Index: base/message_loop/message_pump_win.h |
diff --git a/base/message_loop/message_pump_win.h b/base/message_loop/message_pump_win.h |
index 6f4b699cefdfce5a3fac2249d6ebbcc2bf4c5bed..20cfcb813a1f4fcc80a03964140520a47aec9547 100644 |
--- a/base/message_loop/message_pump_win.h |
+++ b/base/message_loop/message_pump_win.h |
@@ -10,6 +10,7 @@ |
#include <list> |
#include "base/base_export.h" |
+#include "base/memory/scoped_ptr.h" |
Lei Zhang
2016/04/07 21:32:26
No new scoped_ptr please. use std::unique_ptr.
stanisc
2016/04/08 01:07:12
Done.
Lei Zhang
2016/04/08 19:10:21
#include <memory> instead.
stanisc
2016/04/11 21:52:59
Done.
|
#include "base/message_loop/message_pump.h" |
#include "base/observer_list.h" |
#include "base/time/time.h" |
@@ -22,7 +23,7 @@ namespace base { |
// controlling the lifetime of the message pump. |
class BASE_EXPORT MessagePumpWin : public MessagePump { |
public: |
- MessagePumpWin() : have_work_(0), state_(NULL) {} |
+ MessagePumpWin() : work_state_(READY), state_(NULL) {} |
// MessagePump methods: |
void Run(Delegate* delegate) override; |
@@ -39,16 +40,23 @@ class BASE_EXPORT MessagePumpWin : public MessagePump { |
int run_depth; |
}; |
+ // State used with work_state_ variable. |
Lei Zhang
2016/04/07 21:32:26
nit: work_state_ variable -> |work_state_|
stanisc
2016/04/08 01:07:12
Done.
|
+ enum WorkState { |
+ READY = 0, // Ready to accept new work. |
+ HAVE_WORK = 1, // New work has been signalled. |
+ WORKING = 2 // Handling the work. |
+ }; |
+ |
virtual void DoRunLoop() = 0; |
int GetCurrentDelay() const; |
// The time at which delayed work should run. |
TimeTicks delayed_work_time_; |
- // A boolean value used to indicate if there is a kMsgDoWork message pending |
+ // A value used to indicate if there is a kMsgDoWork message pending |
// in the Windows Message queue. There is at most one such message, and it |
// can drive execution of tasks when a native message pump is running. |
- LONG have_work_; |
+ LONG work_state_; |
// State for the current invocation of Run. |
RunState* state_; |
@@ -137,6 +145,34 @@ class BASE_EXPORT MessagePumpForUI : public MessagePumpWin { |
}; |
//----------------------------------------------------------------------------- |
+// MessagePumpForGpu is a simplified version of UI message pump that is |
+// optimized for the GPU process. Unlike MessagePumpForUI it doesn't have a |
+// hidden window and doesn't handle a situation where a native message pump |
+// might take over message processing. |
+// |
+class BASE_EXPORT MessagePumpForGpu : public MessagePumpWin { |
+ public: |
+ MessagePumpForGpu(); |
+ ~MessagePumpForGpu() override; |
+ |
+ // Factory methods. |
+ static void InitFactory(); |
+ static scoped_ptr<MessagePump> CreateMessagePumpForGpu(); |
+ |
+ // MessagePump methods: |
+ void ScheduleWork() override; |
+ void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; |
+ |
+ private: |
+ // MessagePump methods: |
Lei Zhang
2016/04/07 21:32:26
MessagePumpWin, actually.
stanisc
2016/04/08 01:07:12
Done.
|
+ void DoRunLoop() override; |
Lei Zhang
2016/04/07 21:32:26
Add a blank line below to separate this from Messa
stanisc
2016/04/08 01:07:12
Done.
|
+ void WaitForWork(); |
+ bool ProcessMessages(); |
+ |
+ DWORD thread_id_; |
Lei Zhang
2016/04/07 21:32:26
const?
stanisc
2016/04/08 01:07:12
Done.
|
+}; |
+ |
+//----------------------------------------------------------------------------- |
// MessagePumpForIO extends MessagePumpWin with methods that are particular to a |
// MessageLoop instantiated with TYPE_IO. This version of MessagePump does not |
// deal with Windows mesagges, and instead has a Run loop based on Completion |