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

Unified Diff: base/message_loop/message_loop.h

Issue 1891233006: mus: Fix handled status in UI event ack, add MessageLoop::NestingObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eventresult
Patch Set: review comments 3 Created 4 years, 8 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 | base/message_loop/message_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop.h
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 802fae0dd191e64034c1779c81263a83d1fe6492..24d5b46aacac7bb5ea54b6dff894bddb9cb9058f 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -133,6 +133,7 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// Creates the default MessagePump based on |type|. Caller owns return
// value.
static std::unique_ptr<MessagePump> CreateMessagePumpForType(Type type);
+
// A DestructionObserver is notified when the current MessageLoop is being
// destroyed. These observers are notified prior to MessageLoop::current()
// being changed to return NULL. This gives interested parties the chance to
@@ -157,6 +158,19 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// DestructionObserver is receiving a notification callback.
void RemoveDestructionObserver(DestructionObserver* destruction_observer);
+ // A NestingObserver is notified when a nested message loop begins. The
+ // observers are notified before the first task is processed.
+ class BASE_EXPORT NestingObserver {
+ public:
+ virtual void OnBeginNestedMessageLoop() = 0;
+
+ protected:
+ virtual ~NestingObserver();
+ };
+
+ void AddNestingObserver(NestingObserver* observer);
+ void RemoveNestingObserver(NestingObserver* observer);
+
// NOTE: Deprecated; prefer task_runner() and the TaskRunner interfaces.
// TODO(skyostil): Remove these functions (crbug.com/465354).
//
@@ -473,6 +487,9 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// If message_histogram_ is NULL, this is a no-op.
void HistogramEvent(int event);
+ // Notify observers that a nested message loop is starting.
+ void NotifyBeginNestedLoop();
+
// MessagePump::Delegate methods:
bool DoWork() override;
bool DoDelayedWork(TimeTicks* next_delayed_work_time) override;
@@ -507,6 +524,8 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
ObserverList<DestructionObserver> destruction_observers_;
+ ObserverList<NestingObserver> nesting_observers_;
+
// A recursion block that prevents accidentally running additional tasks when
// insider a (accidentally induced?) nested message pump.
bool nestable_tasks_allowed_;
« no previous file with comments | « no previous file | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698