| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/shell/in_process_dynamic_service_runner.h" | 5 #include "mojo/shell/in_process_dynamic_service_runner.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 InProcessDynamicServiceRunner::~InProcessDynamicServiceRunner() { | 24 InProcessDynamicServiceRunner::~InProcessDynamicServiceRunner() { |
| 25 if (thread_.HasBeenStarted()) { | 25 if (thread_.HasBeenStarted()) { |
| 26 DCHECK(!thread_.HasBeenJoined()); | 26 DCHECK(!thread_.HasBeenJoined()); |
| 27 thread_.Join(); | 27 thread_.Join(); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 void InProcessDynamicServiceRunner::Start( | 31 void InProcessDynamicServiceRunner::Start( |
| 32 const base::FilePath& app_path, | 32 const base::FilePath& app_path, |
| 33 ScopedShellHandle service_handle, | 33 ScopedMessagePipeHandle service_handle, |
| 34 const base::Closure& app_completed_callback) { | 34 const base::Closure& app_completed_callback) { |
| 35 app_path_ = app_path; | 35 app_path_ = app_path; |
| 36 | 36 |
| 37 DCHECK(!service_handle_.is_valid()); | 37 DCHECK(!service_handle_.is_valid()); |
| 38 service_handle_ = service_handle.Pass(); | 38 service_handle_ = service_handle.Pass(); |
| 39 | 39 |
| 40 DCHECK(app_completed_callback_runner_.is_null()); | 40 DCHECK(app_completed_callback_runner_.is_null()); |
| 41 app_completed_callback_runner_ = base::Bind(&base::TaskRunner::PostTask, | 41 app_completed_callback_runner_ = base::Bind(&base::TaskRunner::PostTask, |
| 42 base::MessageLoopProxy::current(), | 42 base::MessageLoopProxy::current(), |
| 43 FROM_HERE, | 43 FROM_HERE, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 LOG(ERROR) << "MojoMain returned an error: " << result; | 92 LOG(ERROR) << "MojoMain returned an error: " << result; |
| 93 } while (false); | 93 } while (false); |
| 94 | 94 |
| 95 bool success = app_completed_callback_runner_.Run(); | 95 bool success = app_completed_callback_runner_.Run(); |
| 96 app_completed_callback_runner_.Reset(); | 96 app_completed_callback_runner_.Reset(); |
| 97 LOG_IF(ERROR, !success) << "Failed post run app_completed_callback"; | 97 LOG_IF(ERROR, !success) << "Failed post run app_completed_callback"; |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace shell | 100 } // namespace shell |
| 101 } // namespace mojo | 101 } // namespace mojo |
| OLD | NEW |