OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "base/message_loop/message_pump_io_ios.h" | 33 #include "base/message_loop/message_pump_io_ios.h" |
34 #elif defined(OS_POSIX) | 34 #elif defined(OS_POSIX) |
35 #include "base/message_loop/message_pump_libevent.h" | 35 #include "base/message_loop/message_pump_libevent.h" |
36 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 36 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
37 | 37 |
38 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL) | 38 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL) |
39 #include "base/message_loop/message_pump_aurax11.h" | 39 #include "base/message_loop/message_pump_aurax11.h" |
40 #elif defined(USE_OZONE) && !defined(OS_NACL) | 40 #elif defined(USE_OZONE) && !defined(OS_NACL) |
41 #include "base/message_loop/message_pump_ozone.h" | 41 #include "base/message_loop/message_pump_ozone.h" |
42 #else | 42 #else |
| 43 #define USE_GTK_MESSAGE_PUMP |
43 #include "base/message_loop/message_pump_gtk.h" | 44 #include "base/message_loop/message_pump_gtk.h" |
44 #endif | 45 #endif |
45 | 46 |
46 #endif | 47 #endif |
47 #endif | 48 #endif |
48 | 49 |
49 namespace base { | 50 namespace base { |
50 | 51 |
51 class HistogramBase; | 52 class HistogramBase; |
| 53 class MessagePumpDispatcher; |
| 54 class MessagePumpObserver; |
52 class RunLoop; | 55 class RunLoop; |
53 class ThreadTaskRunnerHandle; | 56 class ThreadTaskRunnerHandle; |
54 #if defined(OS_ANDROID) | 57 #if defined(OS_ANDROID) |
55 class MessagePumpForUI; | 58 class MessagePumpForUI; |
56 #endif | 59 #endif |
57 class WaitableEvent; | 60 class WaitableEvent; |
58 | 61 |
59 // A MessageLoop is used to process events for a particular thread. There is | 62 // A MessageLoop is used to process events for a particular thread. There is |
60 // at most one MessageLoop instance per thread. | 63 // at most one MessageLoop instance per thread. |
61 // | 64 // |
(...skipping 21 matching lines...) Expand all Loading... |
83 // hr = DoDragDrop(...); // Implicitly runs a modal message loop. | 86 // hr = DoDragDrop(...); // Implicitly runs a modal message loop. |
84 // } | 87 // } |
85 // // Process |hr| (the result returned by DoDragDrop()). | 88 // // Process |hr| (the result returned by DoDragDrop()). |
86 // | 89 // |
87 // Please be SURE your task is reentrant (nestable) and all global variables | 90 // Please be SURE your task is reentrant (nestable) and all global variables |
88 // are stable and accessible before calling SetNestableTasksAllowed(true). | 91 // are stable and accessible before calling SetNestableTasksAllowed(true). |
89 // | 92 // |
90 class BASE_EXPORT MessageLoop : public MessagePump::Delegate { | 93 class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
91 public: | 94 public: |
92 | 95 |
93 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 96 #if defined(USE_GTK_MESSAGE_PUMP) |
| 97 typedef MessagePumpGdkObserver Observer; |
| 98 #elif !defined(OS_MACOSX) && !defined(OS_ANDROID) |
94 typedef MessagePumpDispatcher Dispatcher; | 99 typedef MessagePumpDispatcher Dispatcher; |
95 typedef MessagePumpObserver Observer; | 100 typedef MessagePumpObserver Observer; |
96 #endif | 101 #endif |
97 | 102 |
98 // A MessageLoop has a particular type, which indicates the set of | 103 // A MessageLoop has a particular type, which indicates the set of |
99 // asynchronous events it may process in addition to tasks and timers. | 104 // asynchronous events it may process in addition to tasks and timers. |
100 // | 105 // |
101 // TYPE_DEFAULT | 106 // TYPE_DEFAULT |
102 // This type of ML only supports tasks and timers. | 107 // This type of ML only supports tasks and timers. |
103 // | 108 // |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 717 |
713 // Do not add any member variables to MessageLoopForIO! This is important b/c | 718 // Do not add any member variables to MessageLoopForIO! This is important b/c |
714 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 719 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
715 // data that you need should be stored on the MessageLoop's pump_ instance. | 720 // data that you need should be stored on the MessageLoop's pump_ instance. |
716 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 721 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
717 MessageLoopForIO_should_not_have_extra_member_variables); | 722 MessageLoopForIO_should_not_have_extra_member_variables); |
718 | 723 |
719 } // namespace base | 724 } // namespace base |
720 | 725 |
721 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 726 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |