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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // TODO(sky): these includes should not be necessary. Nuke them. | 28 // TODO(sky): these includes should not be necessary. Nuke them. |
29 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
30 #include "base/message_loop/message_pump_win.h" | 30 #include "base/message_loop/message_pump_win.h" |
31 #elif defined(OS_IOS) | 31 #elif defined(OS_IOS) |
32 #include "base/message_loop/message_pump_io_ios.h" | 32 #include "base/message_loop/message_pump_io_ios.h" |
33 #elif defined(OS_POSIX) | 33 #elif defined(OS_POSIX) |
34 #include "base/message_loop/message_pump_libevent.h" | 34 #include "base/message_loop/message_pump_libevent.h" |
35 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 35 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
36 | 36 |
37 #if defined(USE_GLIB) && !defined(OS_NACL) | 37 #if defined(OS_CHROMEOS) && !defined(OS_NACL) && !defined(USE_GLIB) |
| 38 #include "base/message_loop/message_pump_libevent.h" |
| 39 #elif defined(USE_GLIB) && !defined(OS_NACL) |
38 #include "base/message_loop/message_pump_glib.h" | 40 #include "base/message_loop/message_pump_glib.h" |
39 #elif !defined(OS_ANDROID_HOST) | 41 #elif !defined(OS_ANDROID_HOST) |
40 #include "base/message_loop/message_pump_glib.h" | 42 #include "base/message_loop/message_pump_glib.h" |
41 #endif | 43 #endif |
42 | 44 |
43 #endif | 45 #endif |
44 #endif | 46 #endif |
45 | 47 |
46 namespace base { | 48 namespace base { |
47 | 49 |
48 class HistogramBase; | 50 class HistogramBase; |
49 class MessagePumpObserver; | 51 class MessagePumpObserver; |
50 class RunLoop; | 52 class RunLoop; |
51 class ThreadTaskRunnerHandle; | 53 class ThreadTaskRunnerHandle; |
52 #if defined(OS_ANDROID) | 54 #if defined(OS_ANDROID) |
53 class MessagePumpForUI; | 55 class MessagePumpForUI; |
54 #elif defined(OS_ANDROID_HOST) | 56 #elif defined(OS_ANDROID_HOST) || (defined(OS_CHROMEOS) && !defined(USE_GLIB)) |
55 typedef MessagePumpLibevent MessagePumpForUI; | 57 typedef MessagePumpLibevent MessagePumpForUI; |
56 #endif | 58 #endif |
57 class WaitableEvent; | 59 class WaitableEvent; |
58 | 60 |
59 // A MessageLoop is used to process events for a particular thread. There is | 61 // A MessageLoop is used to process events for a particular thread. There is |
60 // at most one MessageLoop instance per thread. | 62 // at most one MessageLoop instance per thread. |
61 // | 63 // |
62 // Events include at a minimum Task instances submitted to PostTask and its | 64 // Events include at a minimum Task instances submitted to PostTask and its |
63 // variants. Depending on the type of message pump used by the MessageLoop | 65 // variants. Depending on the type of message pump used by the MessageLoop |
64 // other events such as UI messages may be processed. On Windows APC calls (as | 66 // other events such as UI messages may be processed. On Windows APC calls (as |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 // events to the Java message loop. | 556 // events to the Java message loop. |
555 void Start(); | 557 void Start(); |
556 #endif | 558 #endif |
557 | 559 |
558 #if !defined(OS_NACL) && defined(OS_WIN) | 560 #if !defined(OS_NACL) && defined(OS_WIN) |
559 // Please see message_pump_win for definitions of these methods. | 561 // Please see message_pump_win for definitions of these methods. |
560 void AddObserver(Observer* observer); | 562 void AddObserver(Observer* observer); |
561 void RemoveObserver(Observer* observer); | 563 void RemoveObserver(Observer* observer); |
562 #endif | 564 #endif |
563 | 565 |
564 #if defined(USE_OZONE) && !defined(OS_NACL) | 566 #if !defined(OS_NACL) && \ |
| 567 (defined(USE_OZONE) || (defined(OS_CHROMEOS) && !defined(USE_GLIB))) |
565 // Please see MessagePumpLibevent for definition. | 568 // Please see MessagePumpLibevent for definition. |
566 bool WatchFileDescriptor( | 569 bool WatchFileDescriptor( |
567 int fd, | 570 int fd, |
568 bool persistent, | 571 bool persistent, |
569 MessagePumpLibevent::Mode mode, | 572 MessagePumpLibevent::Mode mode, |
570 MessagePumpLibevent::FileDescriptorWatcher* controller, | 573 MessagePumpLibevent::FileDescriptorWatcher* controller, |
571 MessagePumpLibevent::Watcher* delegate); | 574 MessagePumpLibevent::Watcher* delegate); |
572 #endif | 575 #endif |
573 | 576 |
574 protected: | 577 protected: |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 692 |
690 // Do not add any member variables to MessageLoopForIO! This is important b/c | 693 // Do not add any member variables to MessageLoopForIO! This is important b/c |
691 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 694 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
692 // data that you need should be stored on the MessageLoop's pump_ instance. | 695 // data that you need should be stored on the MessageLoop's pump_ instance. |
693 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 696 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
694 MessageLoopForIO_should_not_have_extra_member_variables); | 697 MessageLoopForIO_should_not_have_extra_member_variables); |
695 | 698 |
696 } // namespace base | 699 } // namespace base |
697 | 700 |
698 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 701 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |