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 <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // TODO(sky): these includes should not be necessary. Nuke them. | 31 // TODO(sky): these includes should not be necessary. Nuke them. |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
33 #include "base/message_loop/message_pump_win.h" | 33 #include "base/message_loop/message_pump_win.h" |
34 #elif defined(OS_IOS) | 34 #elif defined(OS_IOS) |
35 #include "base/message_loop/message_pump_io_ios.h" | 35 #include "base/message_loop/message_pump_io_ios.h" |
36 #elif defined(OS_POSIX) | 36 #elif defined(OS_POSIX) |
37 #include "base/message_loop/message_pump_libevent.h" | 37 #include "base/message_loop/message_pump_libevent.h" |
38 #endif | 38 #endif |
39 | 39 |
| 40 #if defined(OS_ANDROID) |
| 41 namespace base { |
| 42 namespace android { |
| 43 |
| 44 class JavaMessageHandlerFactory; |
| 45 |
| 46 } // namespace android |
| 47 } // namespace base |
| 48 #endif // defined(OS_ANDROID) |
| 49 |
40 namespace base { | 50 namespace base { |
41 | 51 |
42 class HistogramBase; | 52 class HistogramBase; |
43 class RunLoop; | 53 class RunLoop; |
44 class ThreadTaskRunnerHandle; | 54 class ThreadTaskRunnerHandle; |
45 class WaitableEvent; | 55 class WaitableEvent; |
46 | 56 |
47 // A MessageLoop is used to process events for a particular thread. There is | 57 // A MessageLoop is used to process events for a particular thread. There is |
48 // at most one MessageLoop instance per thread. | 58 // at most one MessageLoop instance per thread. |
49 // | 59 // |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 // which connects this MessageLoop to the UI thread's CFRunLoop and allows | 620 // which connects this MessageLoop to the UI thread's CFRunLoop and allows |
611 // PostTask() to work. | 621 // PostTask() to work. |
612 void Attach(); | 622 void Attach(); |
613 #endif | 623 #endif |
614 | 624 |
615 #if defined(OS_ANDROID) | 625 #if defined(OS_ANDROID) |
616 // On Android, the UI message loop is handled by Java side. So Run() should | 626 // On Android, the UI message loop is handled by Java side. So Run() should |
617 // never be called. Instead use Start(), which will forward all the native UI | 627 // never be called. Instead use Start(), which will forward all the native UI |
618 // events to the Java message loop. | 628 // events to the Java message loop. |
619 void Start(); | 629 void Start(); |
| 630 void StartForTesting(base::android::JavaMessageHandlerFactory* factory, |
| 631 WaitableEvent* test_done_event); |
| 632 // In Android there are cases where we want to abort immediately without |
| 633 // calling Quit(), in these cases we call Abort(). |
| 634 void Abort(); |
620 #endif | 635 #endif |
621 | 636 |
622 #if defined(USE_OZONE) || (defined(USE_X11) && !defined(USE_GLIB)) | 637 #if defined(USE_OZONE) || (defined(USE_X11) && !defined(USE_GLIB)) |
623 // Please see MessagePumpLibevent for definition. | 638 // Please see MessagePumpLibevent for definition. |
624 bool WatchFileDescriptor( | 639 bool WatchFileDescriptor( |
625 int fd, | 640 int fd, |
626 bool persistent, | 641 bool persistent, |
627 MessagePumpLibevent::Mode mode, | 642 MessagePumpLibevent::Mode mode, |
628 MessagePumpLibevent::FileDescriptorWatcher* controller, | 643 MessagePumpLibevent::FileDescriptorWatcher* controller, |
629 MessagePumpLibevent::Watcher* delegate); | 644 MessagePumpLibevent::Watcher* delegate); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 726 |
712 // Do not add any member variables to MessageLoopForIO! This is important b/c | 727 // Do not add any member variables to MessageLoopForIO! This is important b/c |
713 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 728 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
714 // data that you need should be stored on the MessageLoop's pump_ instance. | 729 // data that you need should be stored on the MessageLoop's pump_ instance. |
715 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 730 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
716 "MessageLoopForIO should not have extra member variables"); | 731 "MessageLoopForIO should not have extra member variables"); |
717 | 732 |
718 } // namespace base | 733 } // namespace base |
719 | 734 |
720 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 735 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |