xref: /aosp_15_r20/external/cronet/base/message_loop/message_pump_type.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2019 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_MESSAGE_LOOP_MESSAGE_PUMP_TYPE_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_TYPE_H_
7 
8 #include "build/build_config.h"
9 
10 namespace base {
11 
12 // A MessagePump has a particular type, which indicates the set of
13 // asynchronous events it may process in addition to tasks and timers.
14 
15 enum class MessagePumpType {
16   // This type of pump only supports tasks and timers.
17   DEFAULT,
18 
19   // This type of pump also supports native UI events (e.g., Windows
20   // messages).
21   UI,
22 
23   // User provided implementation of MessagePump interface
24   CUSTOM,
25 
26   // This type of pump also supports asynchronous IO.
27   IO,
28 
29 #if BUILDFLAG(IS_ANDROID)
30   // This type of pump is backed by a Java message handler which is
31   // responsible for running the tasks added to the ML. This is only for use
32   // on Android. TYPE_JAVA behaves in essence like TYPE_UI, except during
33   // construction where it does not use the main thread specific pump factory.
34   JAVA,
35 #endif  // BUILDFLAG(IS_ANDROID)
36 
37 #if BUILDFLAG(IS_APPLE)
38   // This type of pump is backed by a NSRunLoop. This is only for use on
39   // OSX and IOS.
40   NS_RUNLOOP,
41 #endif  // BUILDFLAG(IS_APPLE)
42 };
43 
44 }  // namespace base
45 
46 #endif  // BASE_MESSAGE_LOOP_MESSAGE_PUMP_TYPE_H_
47