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 23 matching lines...) Expand all Loading... |
34 return false; | 34 return false; |
35 } | 35 } |
36 return true; | 36 return true; |
37 } | 37 } |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path) { | 41 base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path) { |
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::NativeLibraryOptions options; |
| 45 options.prefer_own_symbols = true; |
| 46 |
44 base::NativeLibraryLoadError error; | 47 base::NativeLibraryLoadError error; |
45 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); | 48 base::NativeLibrary app_library = base::LoadNativeLibraryWithOptions( |
| 49 app_path, options, &error); |
46 LOG_IF(ERROR, !app_library) | 50 LOG_IF(ERROR, !app_library) |
47 << "Failed to load app library (path: " << app_path.value() | 51 << "Failed to load app library (path: " << app_path.value() |
48 << " reason: " << error.ToString() << ")"; | 52 << " reason: " << error.ToString() << ")"; |
49 return app_library; | 53 return app_library; |
50 } | 54 } |
51 | 55 |
52 bool RunNativeApplication(base::NativeLibrary app_library, | 56 bool RunNativeApplication(base::NativeLibrary app_library, |
53 mojom::ServiceRequest request) { | 57 mojom::ServiceRequest request) { |
54 // Tolerate |app_library| being null, to make life easier for callers. | 58 // Tolerate |app_library| being null, to make life easier for callers. |
55 if (!app_library) | 59 if (!app_library) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // |ServiceMain()| takes ownership of the service handle. | 100 // |ServiceMain()| takes ownership of the service handle. |
97 MojoHandle handle = request.PassMessagePipe().release().value(); | 101 MojoHandle handle = request.PassMessagePipe().release().value(); |
98 MojoResult result = main_function(handle); | 102 MojoResult result = main_function(handle); |
99 if (result != MOJO_RESULT_OK) { | 103 if (result != MOJO_RESULT_OK) { |
100 LOG(ERROR) << "ServiceMain returned error (result: " << result << ")"; | 104 LOG(ERROR) << "ServiceMain returned error (result: " << result << ")"; |
101 } | 105 } |
102 return true; | 106 return true; |
103 } | 107 } |
104 | 108 |
105 } // namespace shell | 109 } // namespace shell |
OLD | NEW |