| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |