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 <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/message_loop/incoming_task_queue.h" | 17 #include "base/message_loop/incoming_task_queue.h" |
| 18 #include "base/message_loop/message_loop_proxy.h" | 18 #include "base/message_loop/message_loop_proxy.h" |
| 19 #include "base/message_loop/message_loop_proxy_impl.h" | 19 #include "base/message_loop/message_loop_proxy_impl.h" |
| 20 #include "base/message_loop/message_pump.h" | 20 #include "base/message_loop/message_pump.h" |
| 21 #include "base/message_loop/message_pump_dispatcher.h" | |
| 22 #include "base/message_loop/message_pump_observer.h" | |
|
Nico
2013/09/06 21:42:31
Do you need the full includes? Forward declaring s
sadrul
2013/09/07 00:59:35
Yep. Done.
| |
| 21 #include "base/observer_list.h" | 23 #include "base/observer_list.h" |
| 22 #include "base/pending_task.h" | 24 #include "base/pending_task.h" |
| 23 #include "base/sequenced_task_runner_helpers.h" | 25 #include "base/sequenced_task_runner_helpers.h" |
| 24 #include "base/synchronization/lock.h" | 26 #include "base/synchronization/lock.h" |
| 25 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 26 #include "base/tracking_info.h" | 28 #include "base/tracking_info.h" |
| 27 | 29 |
| 28 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 29 // We need this to declare base::MessagePumpWin::Dispatcher, which we should | 31 // We need this to declare base::MessagePumpWin::Dispatcher, which we should |
| 30 // really just eliminate. | 32 // really just eliminate. |
| 31 #include "base/message_loop/message_pump_win.h" | 33 #include "base/message_loop/message_pump_win.h" |
| 32 #elif defined(OS_IOS) | 34 #elif defined(OS_IOS) |
| 33 #include "base/message_loop/message_pump_io_ios.h" | 35 #include "base/message_loop/message_pump_io_ios.h" |
| 34 #elif defined(OS_POSIX) | 36 #elif defined(OS_POSIX) |
| 35 #include "base/message_loop/message_pump_libevent.h" | 37 #include "base/message_loop/message_pump_libevent.h" |
| 36 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 38 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 37 | 39 |
| 38 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL) | 40 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL) |
| 39 #include "base/message_loop/message_pump_aurax11.h" | 41 #include "base/message_loop/message_pump_aurax11.h" |
| 40 #elif defined(USE_OZONE) && !defined(OS_NACL) | 42 #elif defined(USE_OZONE) && !defined(OS_NACL) |
| 41 #include "base/message_loop/message_pump_ozone.h" | 43 #include "base/message_loop/message_pump_ozone.h" |
| 42 #else | 44 #else |
| 45 #define USE_GTK_MESSAGE_PUMP | |
| 43 #include "base/message_loop/message_pump_gtk.h" | 46 #include "base/message_loop/message_pump_gtk.h" |
| 44 #endif | 47 #endif |
| 45 | 48 |
| 46 #endif | 49 #endif |
| 47 #endif | 50 #endif |
| 48 | 51 |
| 49 namespace base { | 52 namespace base { |
| 50 | 53 |
| 51 class HistogramBase; | 54 class HistogramBase; |
| 52 class RunLoop; | 55 class RunLoop; |
| (...skipping 30 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 | 715 |
| 711 // Do not add any member variables to MessageLoopForIO! This is important b/c | 716 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 712 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 717 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 713 // data that you need should be stored on the MessageLoop's pump_ instance. | 718 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 714 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 719 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 715 MessageLoopForIO_should_not_have_extra_member_variables); | 720 MessageLoopForIO_should_not_have_extra_member_variables); |
| 716 | 721 |
| 717 } // namespace base | 722 } // namespace base |
| 718 | 723 |
| 719 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 724 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| OLD | NEW |