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

Unified Diff: base/message_loop/message_loop.cc

Issue 2407313002: Disallow nesting on some BrowserThreads. (Closed)
Patch Set: self-review 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..9bdcf406589aaabfd9a9ade97d25f828a6a7ac9e 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -216,11 +216,13 @@ void MessageLoop::RemoveDestructionObserver(
void MessageLoop::AddNestingObserver(NestingObserver* observer) {
DCHECK_EQ(this, current());
+ CHECK(allow_nesting_);
nesting_observers_.AddObserver(observer);
}
void MessageLoop::RemoveNestingObserver(NestingObserver* observer) {
DCHECK_EQ(this, current());
+ CHECK(allow_nesting_);
nesting_observers_.RemoveObserver(observer);
}
@@ -257,6 +259,8 @@ Closure MessageLoop::QuitWhenIdleClosure() {
void MessageLoop::SetNestableTasksAllowed(bool allowed) {
if (allowed) {
+ CHECK(allow_nesting_);
+
// Kick the native pump just in case we enter a OS-driven nested message
// loop.
pump_->ScheduleWork();
@@ -367,6 +371,8 @@ void MessageLoop::SetThreadTaskRunnerHandle() {
void MessageLoop::RunHandler() {
DCHECK_EQ(this, current());
+ DCHECK(run_loop_);
+ CHECK(allow_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