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 20 matching lines...) Expand all Loading... |
31 #include "base/message_loop/message_pump_win.h" | 31 #include "base/message_loop/message_pump_win.h" |
32 #elif defined(OS_IOS) | 32 #elif defined(OS_IOS) |
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 #endif | 36 #endif |
37 | 37 |
38 namespace base { | 38 namespace base { |
39 | 39 |
40 class HistogramBase; | 40 class HistogramBase; |
41 class MessagePumpObserver; | |
42 class RunLoop; | 41 class RunLoop; |
43 class ThreadTaskRunnerHandle; | 42 class ThreadTaskRunnerHandle; |
44 class WaitableEvent; | 43 class WaitableEvent; |
45 | 44 |
46 // A MessageLoop is used to process events for a particular thread. There is | 45 // A MessageLoop is used to process events for a particular thread. There is |
47 // at most one MessageLoop instance per thread. | 46 // at most one MessageLoop instance per thread. |
48 // | 47 // |
49 // Events include at a minimum Task instances submitted to PostTask and its | 48 // Events include at a minimum Task instances submitted to PostTask and its |
50 // variants. Depending on the type of message pump used by the MessageLoop | 49 // variants. Depending on the type of message pump used by the MessageLoop |
51 // other events such as UI messages may be processed. On Windows APC calls (as | 50 // other events such as UI messages may be processed. On Windows APC calls (as |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 void Attach(); | 543 void Attach(); |
545 #endif | 544 #endif |
546 | 545 |
547 #if defined(OS_ANDROID) | 546 #if defined(OS_ANDROID) |
548 // On Android, the UI message loop is handled by Java side. So Run() should | 547 // On Android, the UI message loop is handled by Java side. So Run() should |
549 // never be called. Instead use Start(), which will forward all the native UI | 548 // never be called. Instead use Start(), which will forward all the native UI |
550 // events to the Java message loop. | 549 // events to the Java message loop. |
551 void Start(); | 550 void Start(); |
552 #endif | 551 #endif |
553 | 552 |
554 #if defined(OS_WIN) | |
555 typedef MessagePumpObserver Observer; | |
556 | |
557 // Please see message_pump_win for definitions of these methods. | |
558 void AddObserver(Observer* observer); | |
559 void RemoveObserver(Observer* observer); | |
560 #endif | |
561 | |
562 #if defined(USE_OZONE) || (defined(USE_X11) && !defined(USE_GLIB)) | 553 #if defined(USE_OZONE) || (defined(USE_X11) && !defined(USE_GLIB)) |
563 // Please see MessagePumpLibevent for definition. | 554 // Please see MessagePumpLibevent for definition. |
564 bool WatchFileDescriptor( | 555 bool WatchFileDescriptor( |
565 int fd, | 556 int fd, |
566 bool persistent, | 557 bool persistent, |
567 MessagePumpLibevent::Mode mode, | 558 MessagePumpLibevent::Mode mode, |
568 MessagePumpLibevent::FileDescriptorWatcher* controller, | 559 MessagePumpLibevent::FileDescriptorWatcher* controller, |
569 MessagePumpLibevent::Watcher* delegate); | 560 MessagePumpLibevent::Watcher* delegate); |
570 #endif | 561 #endif |
571 }; | 562 }; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 644 |
654 // Do not add any member variables to MessageLoopForIO! This is important b/c | 645 // Do not add any member variables to MessageLoopForIO! This is important b/c |
655 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 646 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
656 // data that you need should be stored on the MessageLoop's pump_ instance. | 647 // data that you need should be stored on the MessageLoop's pump_ instance. |
657 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 648 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
658 MessageLoopForIO_should_not_have_extra_member_variables); | 649 MessageLoopForIO_should_not_have_extra_member_variables); |
659 | 650 |
660 } // namespace base | 651 } // namespace base |
661 | 652 |
662 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 653 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |