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

Unified Diff: base/message_loop/message_loop.h

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: still need to check MessageLoop::current() in Mojo's RunLoopNestingObserver::GetForThread() Created 3 years, 7 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 a433ae56c88cd621c210906a1e358a3acf1a3422..c180c2df175b075b97220383e589f50c1a93c6ea 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -162,19 +162,6 @@ 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);
-
// Deprecated: use RunLoop instead.
//
// Signals the Run method to return when it becomes idle. It will continue to
@@ -277,9 +264,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
bool old_state_;
};
- // Returns true if we are currently running a nested message loop.
- bool IsNested();
-
// A TaskObserver is an object that receives task notifications from the
// MessageLoop.
//
@@ -303,9 +287,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
void AddTaskObserver(TaskObserver* task_observer);
void RemoveTaskObserver(TaskObserver* task_observer);
- // Can only be called from the thread that owns the MessageLoop.
- bool is_running() const;
-
// Returns true if the message loop has high resolution timers enabled.
// Provided for testing.
bool HasHighResolutionTasks();
@@ -320,12 +301,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// Runs the specified PendingTask.
void RunTask(PendingTask* pending_task);
- bool nesting_allowed() const { return allow_nesting_; }
-
- // Disallow nesting. After this is called, running a nested RunLoop or calling
- // Add/RemoveNestingObserver() on this MessageLoop will crash.
- void DisallowNesting() { allow_nesting_ = false; }
-
// Disallow task observers. After this is called, calling
// Add/RemoveTaskObserver() on this MessageLoop will crash.
void DisallowTaskObservers() { allow_task_observers_ = false; }
@@ -402,9 +377,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// responsible for synchronizing ScheduleWork() calls.
void ScheduleWork();
- // 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;
@@ -439,8 +411,6 @@ 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_;
@@ -475,8 +445,8 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// MessageLoop is bound to its thread and constant forever after.
PlatformThreadId thread_id_;
- // Whether nesting is allowed.
- bool allow_nesting_ = true;
+ // Whether this MessageLoop is currently running in nested RunLoops.
+ bool is_nested_ = false;
// Whether task observers are allowed.
bool allow_task_observers_ = true;
« 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