| 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/runner/host/in_process_native_runner.h" | 5 #include "mojo/runner/host/in_process_native_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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 void InProcessNativeRunner::Run() { | 59 void InProcessNativeRunner::Run() { |
| 60 DVLOG(2) << "Loading/running Mojo app in process from library: " | 60 DVLOG(2) << "Loading/running Mojo app in process from library: " |
| 61 << app_path_.value() | 61 << app_path_.value() |
| 62 << " thread id=" << base::PlatformThread::CurrentId(); | 62 << " thread id=" << base::PlatformThread::CurrentId(); |
| 63 | 63 |
| 64 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method! | 64 // TODO(vtl): ScopedNativeLibrary doesn't have a .get() method! |
| 65 base::NativeLibrary app_library = LoadNativeApplication(app_path_); | 65 base::NativeLibrary app_library = LoadNativeApplication(app_path_); |
| 66 app_library_.Reset(app_library); | 66 app_library_.Reset(app_library); |
| 67 // This hangs on Windows in the component build, so skip it since it's |
| 68 // unnecessary. |
| 69 #if !(defined(COMPONENT_BUILD) && defined(OS_WIN)) |
| 67 CallLibraryEarlyInitialization(app_library); | 70 CallLibraryEarlyInitialization(app_library); |
| 71 #endif |
| 68 RunNativeApplication(app_library, application_request_.Pass()); | 72 RunNativeApplication(app_library, application_request_.Pass()); |
| 69 app_completed_callback_runner_.Run(); | 73 app_completed_callback_runner_.Run(); |
| 70 app_completed_callback_runner_.Reset(); | 74 app_completed_callback_runner_.Reset(); |
| 71 } | 75 } |
| 72 | 76 |
| 73 scoped_ptr<shell::NativeRunner> InProcessNativeRunnerFactory::Create( | 77 scoped_ptr<shell::NativeRunner> InProcessNativeRunnerFactory::Create( |
| 74 const base::FilePath& app_path) { | 78 const base::FilePath& app_path) { |
| 75 // Non-Mojo apps are always run in a new process. | 79 // Non-Mojo apps are always run in a new process. |
| 76 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { | 80 if (!app_path.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) { |
| 77 return make_scoped_ptr( | 81 return make_scoped_ptr( |
| 78 new OutOfProcessNativeRunner(launch_process_runner_)); | 82 new OutOfProcessNativeRunner(launch_process_runner_)); |
| 79 } | 83 } |
| 80 return make_scoped_ptr(new InProcessNativeRunner); | 84 return make_scoped_ptr(new InProcessNativeRunner); |
| 81 } | 85 } |
| 82 | 86 |
| 83 } // namespace runner | 87 } // namespace runner |
| 84 } // namespace mojo | 88 } // namespace mojo |
| OLD | NEW |