Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: base/message_loop/message_loop.h

Issue 135563004: Nukes MessageLoop::Dispatcher (2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/observer_list.h" 21 #include "base/observer_list.h"
22 #include "base/pending_task.h" 22 #include "base/pending_task.h"
23 #include "base/sequenced_task_runner_helpers.h" 23 #include "base/sequenced_task_runner_helpers.h"
24 #include "base/synchronization/lock.h" 24 #include "base/synchronization/lock.h"
25 #include "base/time/time.h" 25 #include "base/time/time.h"
26 #include "base/tracking_info.h" 26 #include "base/tracking_info.h"
27 27
28 // TODO(sky): these includes should not be necessary. Nuke them.
28 #if defined(OS_WIN) 29 #if defined(OS_WIN)
29 // We need this to declare base::MessagePumpWin::Dispatcher, which we should
30 // really just eliminate.
31 #include "base/message_loop/message_pump_win.h" 30 #include "base/message_loop/message_pump_win.h"
32 #elif defined(OS_IOS) 31 #elif defined(OS_IOS)
33 #include "base/message_loop/message_pump_io_ios.h" 32 #include "base/message_loop/message_pump_io_ios.h"
34 #elif defined(OS_POSIX) 33 #elif defined(OS_POSIX)
35 #include "base/message_loop/message_pump_libevent.h" 34 #include "base/message_loop/message_pump_libevent.h"
36 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 35 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
37 36
38 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL) 37 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL)
39 #include "base/message_loop/message_pump_x11.h" 38 #include "base/message_loop/message_pump_x11.h"
40 #elif defined(USE_OZONE) && !defined(OS_NACL) 39 #elif defined(USE_OZONE) && !defined(OS_NACL)
41 #include "base/message_loop/message_pump_ozone.h" 40 #include "base/message_loop/message_pump_ozone.h"
42 #else 41 #else
43 #define USE_GTK_MESSAGE_PUMP 42 #define USE_GTK_MESSAGE_PUMP
44 #include "base/message_loop/message_pump_gtk.h" 43 #include "base/message_loop/message_pump_gtk.h"
45 #if defined(TOOLKIT_GTK) 44 #if defined(TOOLKIT_GTK)
46 #include "base/message_loop/message_pump_x11.h" 45 #include "base/message_loop/message_pump_x11.h"
47 #endif 46 #endif
48 #endif 47 #endif
49 48
50 #endif 49 #endif
51 #endif 50 #endif
52 51
53 namespace base { 52 namespace base {
54 53
55 class HistogramBase; 54 class HistogramBase;
56 class MessagePumpDispatcher;
57 class MessagePumpObserver; 55 class MessagePumpObserver;
58 class RunLoop; 56 class RunLoop;
59 class ThreadTaskRunnerHandle; 57 class ThreadTaskRunnerHandle;
60 #if defined(OS_ANDROID) 58 #if defined(OS_ANDROID)
61 class MessagePumpForUI; 59 class MessagePumpForUI;
62 #endif 60 #endif
63 class WaitableEvent; 61 class WaitableEvent;
64 62
65 // A MessageLoop is used to process events for a particular thread. There is 63 // A MessageLoop is used to process events for a particular thread. There is
66 // at most one MessageLoop instance per thread. 64 // at most one MessageLoop instance per thread.
(...skipping 23 matching lines...) Expand all
90 // } 88 // }
91 // // Process |hr| (the result returned by DoDragDrop()). 89 // // Process |hr| (the result returned by DoDragDrop()).
92 // 90 //
93 // Please be SURE your task is reentrant (nestable) and all global variables 91 // Please be SURE your task is reentrant (nestable) and all global variables
94 // are stable and accessible before calling SetNestableTasksAllowed(true). 92 // are stable and accessible before calling SetNestableTasksAllowed(true).
95 // 93 //
96 class BASE_EXPORT MessageLoop : public MessagePump::Delegate { 94 class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
97 public: 95 public:
98 96
99 #if defined(USE_AURA) 97 #if defined(USE_AURA)
100 typedef MessagePumpDispatcher Dispatcher;
101 typedef MessagePumpObserver Observer; 98 typedef MessagePumpObserver Observer;
102 #elif defined(USE_GTK_MESSAGE_PUMP) 99 #elif defined(USE_GTK_MESSAGE_PUMP)
103 typedef MessagePumpGdkObserver Observer; 100 typedef MessagePumpGdkObserver Observer;
104 #endif 101 #endif
105 102
106 // A MessageLoop has a particular type, which indicates the set of 103 // A MessageLoop has a particular type, which indicates the set of
107 // asynchronous events it may process in addition to tasks and timers. 104 // asynchronous events it may process in addition to tasks and timers.
108 // 105 //
109 // TYPE_DEFAULT 106 // TYPE_DEFAULT
110 // This type of ML only supports tasks and timers. 107 // This type of ML only supports tasks and timers.
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 714
718 // Do not add any member variables to MessageLoopForIO! This is important b/c 715 // Do not add any member variables to MessageLoopForIO! This is important b/c
719 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 716 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
720 // data that you need should be stored on the MessageLoop's pump_ instance. 717 // data that you need should be stored on the MessageLoop's pump_ instance.
721 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 718 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
722 MessageLoopForIO_should_not_have_extra_member_variables); 719 MessageLoopForIO_should_not_have_extra_member_variables);
723 720
724 } // namespace base 721 } // namespace base
725 722
726 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 723 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698