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/native_application_support.h" | 5 #include "services/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 DVLOG(2) << "Loading Mojo app in process from library: " << app_path.value(); | 42 DVLOG(2) << "Loading Mojo app in process from library: " << app_path.value(); |
43 | 43 |
44 base::NativeLibraryLoadError error; | 44 base::NativeLibraryLoadError error; |
45 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); | 45 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); |
46 LOG_IF(ERROR, !app_library) | 46 LOG_IF(ERROR, !app_library) |
47 << "Failed to load app library (path: " << app_path.value() << ")"; | 47 << "Failed to load app library (path: " << app_path.value() << ")"; |
48 return app_library; | 48 return app_library; |
49 } | 49 } |
50 | 50 |
51 bool RunNativeApplication(base::NativeLibrary app_library, | 51 bool RunNativeApplication(base::NativeLibrary app_library, |
52 mojom::ShellClientRequest request) { | 52 mojom::ServiceRequest request) { |
53 // Tolerate |app_library| being null, to make life easier for callers. | 53 // Tolerate |app_library| being null, to make life easier for callers. |
54 if (!app_library) | 54 if (!app_library) |
55 return false; | 55 return false; |
56 | 56 |
57 // Thunks aren't needed/used in component build, since the thunked methods | 57 // Thunks aren't needed/used in component build, since the thunked methods |
58 // just live in their own dynamically loaded library. | 58 // just live in their own dynamically loaded library. |
59 #if !defined(COMPONENT_BUILD) | 59 #if !defined(COMPONENT_BUILD) |
60 if (!SetThunks(&mojo::edk::MakeSystemThunks, "MojoSetSystemThunks", | 60 if (!SetThunks(&mojo::edk::MakeSystemThunks, "MojoSetSystemThunks", |
61 app_library)) { | 61 app_library)) { |
62 LOG(ERROR) << "MojoSetSystemThunks not found"; | 62 LOG(ERROR) << "MojoSetSystemThunks not found"; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // |MojoMain()| takes ownership of the service handle. | 95 // |MojoMain()| takes ownership of the service handle. |
96 MojoHandle handle = request.PassMessagePipe().release().value(); | 96 MojoHandle handle = request.PassMessagePipe().release().value(); |
97 MojoResult result = main_function(handle); | 97 MojoResult result = main_function(handle); |
98 if (result != MOJO_RESULT_OK) { | 98 if (result != MOJO_RESULT_OK) { |
99 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; | 99 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; |
100 } | 100 } |
101 return true; | 101 return true; |
102 } | 102 } |
103 | 103 |
104 } // namespace shell | 104 } // namespace shell |
OLD | NEW |