Index: base/message_loop/message_loop.h |
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h |
index 4f3250c3b7f1b164d984dc0e4dcee28866092015..1b8351ba9498675e6e9d2e2120d5dda4cfb02cb0 100644 |
--- a/base/message_loop/message_loop.h |
+++ b/base/message_loop/message_loop.h |
@@ -316,6 +316,15 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
// Runs the specified PendingTask. |
void RunTask(const PendingTask& pending_task); |
+ // Disables running nested loops and Add/RemoveNestingObserver(). |
+ void DisableNesting() { enable_nesting_ = false; } |
+ |
+ // Disables Add/RemoveDestructionObserver(). |
+ void DisableDestructionObservers() { enable_destruction_observers_ = false; } |
+ |
+ // Disables Add/RemoveTaskObserver(). |
+ void DisableTaskObservers() { enable_task_observers_ = false; } |
+ |
//---------------------------------------------------------------------------- |
protected: |
std::unique_ptr<MessagePump> pump_; |
@@ -451,6 +460,15 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
// MessageLoop is bound to its thread and constant forever after. |
PlatformThreadId thread_id_; |
+ // Enable running nested loops and Add/RemoveNestingObserver(). |
+ bool enable_nesting_ = true; |
+ |
+ // Enable Add/RemoveDestructionObserver(). |
+ bool enable_destruction_observers_ = true; |
+ |
+ // Enable Add/RemoveTaskObserver(). |
+ bool enable_task_observers_ = true; |
+ |
DISALLOW_COPY_AND_ASSIGN(MessageLoop); |
}; |