Chromium Code Reviews| 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 | |
|
danakj
2016/08/17 18:40:15
git cl format?
gsennton
2016/08/17 19:23:46
Done.
| |
| 47 } // namespace base | |
| 48 #endif // defined(OS_ANDROID | |
|
danakj
2016/08/17 18:40:15
)
gsennton
2016/08/17 19:23:46
Done.
| |
| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 607 // which connects this MessageLoop to the UI thread's CFRunLoop and allows | 617 // which connects this MessageLoop to the UI thread's CFRunLoop and allows |
| 608 // PostTask() to work. | 618 // PostTask() to work. |
| 609 void Attach(); | 619 void Attach(); |
| 610 #endif | 620 #endif |
| 611 | 621 |
| 612 #if defined(OS_ANDROID) | 622 #if defined(OS_ANDROID) |
| 613 // On Android, the UI message loop is handled by Java side. So Run() should | 623 // On Android, the UI message loop is handled by Java side. So Run() should |
| 614 // never be called. Instead use Start(), which will forward all the native UI | 624 // never be called. Instead use Start(), which will forward all the native UI |
| 615 // events to the Java message loop. | 625 // events to the Java message loop. |
| 616 void Start(); | 626 void Start(); |
| 627 void StartForTesting(base::android::JavaMessageHandlerFactory* factory, | |
| 628 WaitableEvent* test_done_event); | |
| 629 // In Android there are cases where we want to abort immediately without | |
| 630 // calling Quit(), in these cases we call Abort(). | |
| 631 void Abort(); | |
| 617 #endif | 632 #endif |
| 618 | 633 |
| 619 #if defined(USE_OZONE) || (defined(USE_X11) && !defined(USE_GLIB)) | 634 #if defined(USE_OZONE) || (defined(USE_X11) && !defined(USE_GLIB)) |
| 620 // Please see MessagePumpLibevent for definition. | 635 // Please see MessagePumpLibevent for definition. |
| 621 bool WatchFileDescriptor( | 636 bool WatchFileDescriptor( |
| 622 int fd, | 637 int fd, |
| 623 bool persistent, | 638 bool persistent, |
| 624 MessagePumpLibevent::Mode mode, | 639 MessagePumpLibevent::Mode mode, |
| 625 MessagePumpLibevent::FileDescriptorWatcher* controller, | 640 MessagePumpLibevent::FileDescriptorWatcher* controller, |
| 626 MessagePumpLibevent::Watcher* delegate); | 641 MessagePumpLibevent::Watcher* delegate); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 708 | 723 |
| 709 // Do not add any member variables to MessageLoopForIO! This is important b/c | 724 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 710 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 725 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 711 // data that you need should be stored on the MessageLoop's pump_ instance. | 726 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 712 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 727 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 713 "MessageLoopForIO should not have extra member variables"); | 728 "MessageLoopForIO should not have extra member variables"); |
| 714 | 729 |
| 715 } // namespace base | 730 } // namespace base |
| 716 | 731 |
| 717 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 732 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| OLD | NEW |