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

Unified Diff: mojo/common/message_pump_mojo.h

Issue 663873002: Add the ability to observe MessagePumpMojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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 | « no previous file | mojo/common/message_pump_mojo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/message_pump_mojo.h
diff --git a/mojo/common/message_pump_mojo.h b/mojo/common/message_pump_mojo.h
index 26e28b1067a20639bc5b9fc79f137da54d29b260..4dd715568800bf961a0a60cc9cecbd8cdb331f7f 100644
--- a/mojo/common/message_pump_mojo.h
+++ b/mojo/common/message_pump_mojo.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_pump.h"
+#include "base/observer_list.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "mojo/common/mojo_common_export.h"
@@ -23,6 +24,17 @@ class MessagePumpMojoHandler;
// Mojo implementation of MessagePump.
class MOJO_COMMON_EXPORT MessagePumpMojo : public base::MessagePump {
public:
+ class Observer {
+ public:
+ Observer() {}
+
+ virtual void WillSignalHandler() = 0;
+ virtual void DidSignalHandler() = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
MessagePumpMojo();
virtual ~MessagePumpMojo();
@@ -45,6 +57,9 @@ class MOJO_COMMON_EXPORT MessagePumpMojo : public base::MessagePump {
void RemoveHandler(const Handle& handle);
+ void AddObserver(Observer*);
+ void RemoveObserver(Observer*);
+
// MessagePump:
virtual void Run(Delegate* delegate) override;
virtual void Quit() override;
@@ -88,6 +103,9 @@ class MOJO_COMMON_EXPORT MessagePumpMojo : public base::MessagePump {
// Returns the deadline for the call to MojoWaitMany().
MojoDeadline GetDeadlineForWait(const RunState& run_state) const;
+ void WillSignalHandler();
+ void DidSignalHandler();
+
// If non-NULL we're running (inside Run()). Member is reference to value on
// stack.
RunState* run_state_;
@@ -106,6 +124,8 @@ class MOJO_COMMON_EXPORT MessagePumpMojo : public base::MessagePump {
// notify it.
int next_handler_id_;
+ ObserverList<Observer> observers_;
+
DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo);
};
« no previous file with comments | « no previous file | mojo/common/message_pump_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698