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

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

Issue 421173003: base: Remove now-unused MessagePumpObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 6 years, 4 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
« no previous file with comments | « base/message_loop/message_pump_observer.h ('k') | base/message_loop/message_pump_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PUMP_WIN_H_ 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <list> 10 #include <list>
11 11
12 #include "base/base_export.h" 12 #include "base/base_export.h"
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/message_loop/message_pump.h" 14 #include "base/message_loop/message_pump.h"
15 #include "base/message_loop/message_pump_dispatcher.h" 15 #include "base/message_loop/message_pump_dispatcher.h"
16 #include "base/message_loop/message_pump_observer.h"
17 #include "base/observer_list.h" 16 #include "base/observer_list.h"
18 #include "base/time/time.h" 17 #include "base/time/time.h"
19 #include "base/win/scoped_handle.h" 18 #include "base/win/scoped_handle.h"
20 19
21 namespace base { 20 namespace base {
22 21
23 // MessagePumpWin serves as the base for specialized versions of the MessagePump 22 // MessagePumpWin serves as the base for specialized versions of the MessagePump
24 // for Windows. It provides basic functionality like handling of observers and 23 // for Windows. It provides basic functionality like handling of observers and
25 // controlling the lifetime of the message pump. 24 // controlling the lifetime of the message pump.
26 class BASE_EXPORT MessagePumpWin : public MessagePump { 25 class BASE_EXPORT MessagePumpWin : public MessagePump {
27 public: 26 public:
28 MessagePumpWin() : have_work_(0), state_(NULL) {} 27 MessagePumpWin() : have_work_(0), state_(NULL) {}
29 virtual ~MessagePumpWin() {} 28 virtual ~MessagePumpWin() {}
30 29
31 // Add an Observer, which will start receiving notifications immediately.
32 void AddObserver(MessagePumpObserver* observer);
33
34 // Remove an Observer. It is safe to call this method while an Observer is
35 // receiving a notification callback.
36 void RemoveObserver(MessagePumpObserver* observer);
37
38 // Give a chance to code processing additional messages to notify the
39 // message loop observers that another message has been processed.
40 void WillProcessMessage(const MSG& msg);
41 void DidProcessMessage(const MSG& msg);
42
43 // Like MessagePump::Run, but MSG objects are routed through dispatcher. 30 // Like MessagePump::Run, but MSG objects are routed through dispatcher.
44 void RunWithDispatcher(Delegate* delegate, MessagePumpDispatcher* dispatcher); 31 void RunWithDispatcher(Delegate* delegate, MessagePumpDispatcher* dispatcher);
45 32
46 // MessagePump methods: 33 // MessagePump methods:
47 virtual void Run(Delegate* delegate) { RunWithDispatcher(delegate, NULL); } 34 virtual void Run(Delegate* delegate) { RunWithDispatcher(delegate, NULL); }
48 virtual void Quit(); 35 virtual void Quit();
49 36
50 protected: 37 protected:
51 struct RunState { 38 struct RunState {
52 Delegate* delegate; 39 Delegate* delegate;
53 MessagePumpDispatcher* dispatcher; 40 MessagePumpDispatcher* dispatcher;
54 41
55 // Used to flag that the current Run() invocation should return ASAP. 42 // Used to flag that the current Run() invocation should return ASAP.
56 bool should_quit; 43 bool should_quit;
57 44
58 // Used to count how many Run() invocations are on the stack. 45 // Used to count how many Run() invocations are on the stack.
59 int run_depth; 46 int run_depth;
60 }; 47 };
61 48
62 virtual void DoRunLoop() = 0; 49 virtual void DoRunLoop() = 0;
63 int GetCurrentDelay() const; 50 int GetCurrentDelay() const;
64 51
65 ObserverList<MessagePumpObserver> observers_;
66
67 // The time at which delayed work should run. 52 // The time at which delayed work should run.
68 TimeTicks delayed_work_time_; 53 TimeTicks delayed_work_time_;
69 54
70 // A boolean value used to indicate if there is a kMsgDoWork message pending 55 // A boolean value used to indicate if there is a kMsgDoWork message pending
71 // in the Windows Message queue. There is at most one such message, and it 56 // in the Windows Message queue. There is at most one such message, and it
72 // can drive execution of tasks when a native message pump is running. 57 // can drive execution of tasks when a native message pump is running.
73 LONG have_work_; 58 LONG have_work_;
74 59
75 // State for the current invocation of Run. 60 // State for the current invocation of Run.
76 RunState* state_; 61 RunState* state_;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // This list will be empty almost always. It stores IO completions that have 332 // This list will be empty almost always. It stores IO completions that have
348 // not been delivered yet because somebody was doing cleanup. 333 // not been delivered yet because somebody was doing cleanup.
349 std::list<IOItem> completed_io_; 334 std::list<IOItem> completed_io_;
350 335
351 ObserverList<IOObserver> io_observers_; 336 ObserverList<IOObserver> io_observers_;
352 }; 337 };
353 338
354 } // namespace base 339 } // namespace base
355 340
356 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_ 341 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_WIN_H_
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_observer.h ('k') | base/message_loop/message_pump_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698