| 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 "services/shell/runner/host/child_process.h" | 5 #include "services/shell/runner/host/child_process.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "base/threading/thread_checker.h" | 26 #include "base/threading/thread_checker.h" |
| 27 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
| 28 #include "mojo/edk/embedder/embedder.h" | 28 #include "mojo/edk/embedder/embedder.h" |
| 29 #include "mojo/edk/embedder/platform_channel_pair.h" | 29 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 30 #include "mojo/edk/embedder/process_delegate.h" | 30 #include "mojo/edk/embedder/process_delegate.h" |
| 31 #include "mojo/edk/embedder/scoped_platform_handle.h" | 31 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 32 #include "mojo/public/cpp/bindings/binding.h" | 32 #include "mojo/public/cpp/bindings/binding.h" |
| 33 #include "mojo/public/cpp/system/core.h" | 33 #include "mojo/public/cpp/system/core.h" |
| 34 #include "services/shell/runner/common/switches.h" | 34 #include "services/shell/runner/common/switches.h" |
| 35 #include "services/shell/runner/host/child_process_base.h" | 35 #include "services/shell/runner/host/child_process_base.h" |
| 36 #include "services/shell/runner/host/native_application_support.h" | 36 #include "services/shell/runner/host/native_library_runner.h" |
| 37 #include "services/shell/runner/init.h" | 37 #include "services/shell/runner/init.h" |
| 38 | 38 |
| 39 namespace shell { | 39 namespace shell { |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 void RunNativeLibrary(base::NativeLibrary app_library, | 43 void RunNativeLibrary(base::NativeLibrary library, |
| 44 mojom::ServiceRequest service_request) { | 44 mojom::ServiceRequest service_request) { |
| 45 if (!RunNativeApplication(app_library, std::move(service_request))) { | 45 if (!RunServiceInNativeLibrary(library, std::move(service_request))) { |
| 46 LOG(ERROR) << "Failure to RunNativeApplication()"; | 46 LOG(ERROR) << "Failure to RunServiceInNativeLibrary()"; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 int ChildProcessMain() { | 52 int ChildProcessMain() { |
| 53 DVLOG(2) << "ChildProcessMain()"; | 53 DVLOG(2) << "ChildProcessMain()"; |
| 54 const base::CommandLine& command_line = | 54 const base::CommandLine& command_line = |
| 55 *base::CommandLine::ForCurrentProcess(); | 55 *base::CommandLine::ForCurrentProcess(); |
| 56 | 56 |
| 57 base::NativeLibrary app_library = 0; | 57 base::NativeLibrary library = 0; |
| 58 // Load the application library before we engage the sandbox. | 58 // Load the application library before we engage the sandbox. |
| 59 base::FilePath app_library_path = | 59 base::FilePath library_path = |
| 60 command_line.GetSwitchValuePath(switches::kChildProcess); | 60 command_line.GetSwitchValuePath(switches::kChildProcess); |
| 61 if (!app_library_path.empty()) | 61 if (!library_path.empty()) |
| 62 app_library = LoadNativeApplication(app_library_path); | 62 library = LoadNativeLibrary(library_path); |
| 63 base::i18n::InitializeICU(); | 63 base::i18n::InitializeICU(); |
| 64 if (app_library) | 64 if (library) |
| 65 CallLibraryEarlyInitialization(app_library); | 65 CallLibraryEarlyInitialization(library); |
| 66 | 66 |
| 67 ChildProcessMainWithCallback(base::Bind(&RunNativeLibrary, app_library)); | 67 ChildProcessMainWithCallback(base::Bind(&RunNativeLibrary, library)); |
| 68 | 68 |
| 69 return 0; | 69 return 0; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace shell | 72 } // namespace shell |
| OLD | NEW |