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

Side by Side Diff: content/common/mojo/embedded_application_runner.cc

Issue 2140673003: Fix race in EmbeddedApplicationRunner::ShutDown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/mojo/embedded_application_runner.h" 5 #include "content/common/mojo/embedded_application_runner.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 DCHECK(application_task_runner_); 46 DCHECK(application_task_runner_);
47 application_task_runner_->PostTask( 47 application_task_runner_->PostTask(
48 FROM_HERE, 48 FROM_HERE,
49 base::Bind(&Instance::BindServiceRequestOnApplicationThread, this, 49 base::Bind(&Instance::BindServiceRequestOnApplicationThread, this,
50 base::Passed(&request))); 50 base::Passed(&request)));
51 } 51 }
52 52
53 void ShutDown() { 53 void ShutDown() {
54 DCHECK(runner_thread_checker_.CalledOnValidThread()); 54 DCHECK(runner_thread_checker_.CalledOnValidThread());
55 if (thread_) { 55 if (thread_) {
56 thread_.reset();
56 application_task_runner_ = nullptr; 57 application_task_runner_ = nullptr;
57 thread_.reset();
58 } 58 }
59 } 59 }
60 60
61 private: 61 private:
62 void BindServiceRequestOnApplicationThread( 62 void BindServiceRequestOnApplicationThread(
63 shell::mojom::ServiceRequest request) { 63 shell::mojom::ServiceRequest request) {
64 DCHECK(application_task_runner_->BelongsToCurrentThread()); 64 DCHECK(application_task_runner_->BelongsToCurrentThread());
65 65
66 if (!service_) { 66 if (!service_) {
67 service_ = factory_callback_.Run( 67 service_ = factory_callback_.Run(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 const base::Closure& quit_closure) { 157 const base::Closure& quit_closure) {
158 quit_closure_ = quit_closure; 158 quit_closure_ = quit_closure;
159 } 159 }
160 160
161 void EmbeddedApplicationRunner::OnQuit() { 161 void EmbeddedApplicationRunner::OnQuit() {
162 if (!quit_closure_.is_null()) 162 if (!quit_closure_.is_null())
163 quit_closure_.Run(); 163 quit_closure_.Run();
164 } 164 }
165 165
166 } // namespace content 166 } // namespace content
OLDNEW
« 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