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

Unified Diff: content/common/mojo/embedded_application_runner.cc

Issue 2188503003: Prevent DCHECK on shutdown of EmbeddedApplicationRunner (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/mojo/embedded_application_runner.cc
diff --git a/content/common/mojo/embedded_application_runner.cc b/content/common/mojo/embedded_application_runner.cc
index 5d7abed900d54549082faca86bd848afaba85048..e28fbfc94b28d54db1b492ca46ed957d621f40a5 100644
--- a/content/common/mojo/embedded_application_runner.cc
+++ b/content/common/mojo/embedded_application_runner.cc
@@ -52,6 +52,11 @@ class EmbeddedApplicationRunner::Instance
void ShutDown() {
DCHECK(runner_thread_checker_.CalledOnValidThread());
+ // Any extant ServiceContexts must be destroyed on the correct thread.
Ken Rockot(use gerrit already) 2016/07/27 18:23:05 If application_task_runner_ is null, the app has a
kmackay 2016/07/27 18:51:59 Done.
+ if (application_task_runner_) {
+ application_task_runner_->PostTask(FROM_HERE,
+ base::Bind(&Instance::Quit, this));
+ }
if (thread_) {
Ken Rockot(use gerrit already) 2016/07/27 18:23:05 And you can just delete this block now
kmackay 2016/07/27 18:51:59 I wasn't sure if we wanted to make sure that the a
thread_.reset();
application_task_runner_ = nullptr;
@@ -108,7 +113,10 @@ class EmbeddedApplicationRunner::Instance
void QuitOnRunnerThread() {
DCHECK(runner_thread_checker_.CalledOnValidThread());
- ShutDown();
+ if (thread_) {
+ thread_.reset();
+ application_task_runner_ = nullptr;
+ }
quit_closure_.Run();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698