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

Unified Diff: base/message_loop/message_loop.cc

Issue 2395763004: Disable MessageLoop features on some BrowserThreads. (Closed)
Patch Set: rebase Created 4 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 | « base/message_loop/message_loop.h ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop.cc
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index ef7747ef06998475ede2369c110c8efcb2ba712a..23fd0751c68bf2c43ea435050e2a6f94d57fed9a 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -124,8 +124,10 @@ MessageLoop::~MessageLoop() {
DCHECK(!did_work);
// Let interested parties have one last shot at accessing this.
- FOR_EACH_OBSERVER(DestructionObserver, destruction_observers_,
- WillDestroyCurrentMessageLoop());
+ if (enable_destruction_observers_) {
+ FOR_EACH_OBSERVER(DestructionObserver, destruction_observers_,
+ WillDestroyCurrentMessageLoop());
+ }
thread_task_runner_handle_.reset();
@@ -205,22 +207,26 @@ std::unique_ptr<MessagePump> MessageLoop::CreateMessagePumpForType(Type type) {
void MessageLoop::AddDestructionObserver(
DestructionObserver* destruction_observer) {
DCHECK_EQ(this, current());
+ //DCHECK(enable_destruction_observers_);
destruction_observers_.AddObserver(destruction_observer);
}
void MessageLoop::RemoveDestructionObserver(
DestructionObserver* destruction_observer) {
DCHECK_EQ(this, current());
+ //DCHECK(enable_destruction_observers_);
destruction_observers_.RemoveObserver(destruction_observer);
}
void MessageLoop::AddNestingObserver(NestingObserver* observer) {
DCHECK_EQ(this, current());
+ DCHECK(enable_nesting_);
nesting_observers_.AddObserver(observer);
}
void MessageLoop::RemoveNestingObserver(NestingObserver* observer) {
DCHECK_EQ(this, current());
+ DCHECK(enable_nesting_);
nesting_observers_.RemoveObserver(observer);
}
@@ -274,11 +280,13 @@ bool MessageLoop::IsNested() {
void MessageLoop::AddTaskObserver(TaskObserver* task_observer) {
DCHECK_EQ(this, current());
+ DCHECK(enable_task_observers_);
task_observers_.AddObserver(task_observer);
}
void MessageLoop::RemoveTaskObserver(TaskObserver* task_observer) {
DCHECK_EQ(this, current());
+ DCHECK(enable_task_observers_);
task_observers_.RemoveObserver(task_observer);
}
@@ -367,6 +375,7 @@ void MessageLoop::SetThreadTaskRunnerHandle() {
void MessageLoop::RunHandler() {
DCHECK_EQ(this, current());
+ DCHECK(enable_nesting_ || run_loop_->run_depth_ == 1);
pump_->Run(this);
}
« no previous file with comments | « base/message_loop/message_loop.h ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698