| 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/runner/host/native_application_support.h" | 5 #include "mojo/shell/runner/host/native_application_support.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path) { | 45 base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path) { |
| 46 DVLOG(2) << "Loading Mojo app in process from library: " << app_path.value(); | 46 DVLOG(2) << "Loading Mojo app in process from library: " << app_path.value(); |
| 47 | 47 |
| 48 base::NativeLibraryLoadError error; | 48 base::NativeLibraryLoadError error; |
| 49 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); | 49 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); |
| 50 LOG_IF(ERROR, !app_library) | 50 LOG_IF(ERROR, !app_library) |
| 51 << "Failed to load app library (error: " << error.ToString() << ")"; | 51 << "Failed to load app library (error: " << error.ToString() << ")"; |
| 52 return app_library; | 52 return app_library; |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool RunNativeApplication(base::NativeLibrary app_library, | 55 bool RunNativeApplication( |
| 56 InterfaceRequest<Application> application_request) { | 56 base::NativeLibrary app_library, |
| 57 InterfaceRequest<mojom::Application> application_request) { |
| 57 // Tolerate |app_library| being null, to make life easier for callers. | 58 // Tolerate |app_library| being null, to make life easier for callers. |
| 58 if (!app_library) | 59 if (!app_library) |
| 59 return false; | 60 return false; |
| 60 | 61 |
| 61 // Thunks aren't needed/used in component build, since the thunked methods | 62 // Thunks aren't needed/used in component build, since the thunked methods |
| 62 // just live in their own dynamically loaded library. | 63 // just live in their own dynamically loaded library. |
| 63 #if !defined(COMPONENT_BUILD) | 64 #if !defined(COMPONENT_BUILD) |
| 64 if (!SetThunks(&MojoMakeSystemThunks, "MojoSetSystemThunks", app_library)) { | 65 if (!SetThunks(&MojoMakeSystemThunks, "MojoSetSystemThunks", app_library)) { |
| 65 LOG(ERROR) << "MojoSetSystemThunks not found"; | 66 LOG(ERROR) << "MojoSetSystemThunks not found"; |
| 66 return false; | 67 return false; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 MojoHandle handle = application_request.PassMessagePipe().release().value(); | 123 MojoHandle handle = application_request.PassMessagePipe().release().value(); |
| 123 MojoResult result = main_function(handle); | 124 MojoResult result = main_function(handle); |
| 124 if (result != MOJO_RESULT_OK) { | 125 if (result != MOJO_RESULT_OK) { |
| 125 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; | 126 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; |
| 126 } | 127 } |
| 127 return true; | 128 return true; |
| 128 } | 129 } |
| 129 | 130 |
| 130 } // namespace shell | 131 } // namespace shell |
| 131 } // namespace mojo | 132 } // namespace mojo |
| OLD | NEW |