xref: /aosp_15_r20/external/cronet/base/win/resource_exhaustion.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_WIN_RESOURCE_EXHAUSTION_H_
6 #define BASE_WIN_RESOURCE_EXHAUSTION_H_
7 
8 #include "base/base_export.h"
9 
10 namespace base::win {
11 
12 using OnResourceExhaustedFunction = void (*)();
13 
14 // Sets a callback to be run in the event that a system resource is exhausted
15 // such that a system restart is the only recovery. Typically, there is no
16 // point in letting the process continue execution when this happens.
17 BASE_EXPORT void SetOnResourceExhaustedFunction(
18     OnResourceExhaustedFunction on_resource_exhausted);
19 
20 // Reports that some system resource has been exhausted. A callback, if provided
21 // will be run to allow for application-specific handling.
22 BASE_EXPORT void OnResourceExhausted();
23 
24 }  // namespace base::win
25 
26 #endif  // BASE_WIN_RESOURCE_EXHAUSTION_H_
27