| 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_;
|
|
|