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

Unified Diff: base/message_pump_win.h

Issue 3094: As an intermediary step towards having a message pump handling IO through com... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_win.h
===================================================================
--- base/message_pump_win.h (revision 2577)
+++ base/message_pump_win.h (working copy)
@@ -62,15 +62,6 @@
//
class MessagePumpWin : public MessagePump {
public:
- // Used with WatchObject to asynchronously monitor the signaled state of a
- // HANDLE object.
- class Watcher {
- public:
- virtual ~Watcher() {}
- // Called from MessageLoop::Run when a signalled object is detected.
- virtual void OnObjectSignaled(HANDLE object) = 0;
- };
-
// An Observer is an object that receives global notifications from the
// MessageLoop.
//
@@ -106,12 +97,8 @@
};
MessagePumpWin();
- ~MessagePumpWin();
+ virtual ~MessagePumpWin();
- // Have the current thread's message loop watch for a signaled object.
- // Pass a null watcher to stop watching the object.
- void WatchObject(HANDLE, Watcher*);
-
// Add an Observer, which will start receiving notifications immediately.
void AddObserver(Observer* observer);
@@ -138,7 +125,7 @@
virtual void ScheduleWork();
virtual void ScheduleDelayedWork(const Time& delayed_work_time);
- private:
+ protected:
struct RunState {
Delegate* delegate;
Dispatcher* dispatcher;
@@ -152,26 +139,18 @@
static LRESULT CALLBACK WndProcThunk(
HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+ virtual void DoRunLoop() = 0;
void InitMessageWnd();
void HandleWorkMessage();
void HandleTimerMessage();
- void DoRunLoop();
- void WaitForWork();
bool ProcessNextWindowsMessage();
bool ProcessMessageHelper(const MSG& msg);
bool ProcessPumpReplacementMessage();
- bool ProcessNextObject();
- bool SignalWatcher(size_t object_index);
int GetCurrentDelay() const;
// A hidden message-only window.
HWND message_hwnd_;
- // A vector of objects (and corresponding watchers) that are routinely
- // serviced by this message pump.
- std::vector<HANDLE> objects_;
- std::vector<Watcher*> watchers_;
-
ObserverList<Observer> observers_;
// The time at which delayed work should run.
@@ -186,6 +165,53 @@
RunState* state_;
};
+//-----------------------------------------------------------------------------
+// MessagePumpForUI extends MessagePumpWin with methods that are particular to a
+// MessageLoop instantiated with TYPE_UI.
+//
+class MessagePumpForUI : public MessagePumpWin {
+ public:
+ MessagePumpForUI() {}
+ virtual ~MessagePumpForUI() {}
+ private:
+ virtual void DoRunLoop();
+ void WaitForWork();
+};
+
+//-----------------------------------------------------------------------------
+// MessagePumpForIO extends MessagePumpWin with methods that are particular to a
+// MessageLoop instantiated with TYPE_IO.
+//
+class MessagePumpForIO : public MessagePumpWin {
+ public:
+ // Used with WatchObject to asynchronously monitor the signaled state of a
+ // HANDLE object.
+ class Watcher {
+ public:
+ virtual ~Watcher() {}
+ // Called from MessageLoop::Run when a signalled object is detected.
+ virtual void OnObjectSignaled(HANDLE object) = 0;
+ };
+
+ MessagePumpForIO() {}
+ virtual ~MessagePumpForIO() {}
+
+ // Have the current thread's message loop watch for a signaled object.
+ // Pass a null watcher to stop watching the object.
+ void WatchObject(HANDLE, Watcher*);
+
+ private:
+ virtual void DoRunLoop();
+ void WaitForWork();
+ bool ProcessNextObject();
+ bool SignalWatcher(size_t object_index);
+
+ // A vector of objects (and corresponding watchers) that are routinely
+ // serviced by this message pump.
+ std::vector<HANDLE> objects_;
+ std::vector<Watcher*> watchers_;
+};
+
} // namespace base
#endif // BASE_MESSAGE_PUMP_WIN_H_
« no previous file with comments | « base/message_loop.cc ('k') | base/message_pump_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698