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/service_manager/runner/host/native_library_runner.h" | 5 #include "services/service_manager/runner/host/native_library_runner.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" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "mojo/edk/embedder/entrypoints.h" | 13 #include "mojo/edk/embedder/entrypoints.h" |
14 #include "mojo/public/c/system/thunks.h" | 14 #include "mojo/public/c/system/thunks.h" |
15 | 15 |
16 namespace shell { | 16 namespace service_manager { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 template <typename Thunks> | 20 template <typename Thunks> |
21 bool SetThunks(Thunks (*make_thunks)(), | 21 bool SetThunks(Thunks (*make_thunks)(), |
22 const char* function_name, | 22 const char* function_name, |
23 base::NativeLibrary library) { | 23 base::NativeLibrary library) { |
24 typedef size_t (*SetThunksFn)(const Thunks* thunks); | 24 typedef size_t (*SetThunksFn)(const Thunks* thunks); |
25 SetThunksFn set_thunks = reinterpret_cast<SetThunksFn>( | 25 SetThunksFn set_thunks = reinterpret_cast<SetThunksFn>( |
26 base::GetFunctionPointerFromNativeLibrary(library, function_name)); | 26 base::GetFunctionPointerFromNativeLibrary(library, function_name)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 // |ServiceMain()| takes ownership of the service handle. | 96 // |ServiceMain()| takes ownership of the service handle. |
97 MojoHandle handle = request.PassMessagePipe().release().value(); | 97 MojoHandle handle = request.PassMessagePipe().release().value(); |
98 MojoResult result = main_function(handle); | 98 MojoResult result = main_function(handle); |
99 if (result != MOJO_RESULT_OK) { | 99 if (result != MOJO_RESULT_OK) { |
100 LOG(ERROR) << "ServiceMain returned error (result: " << result << ")"; | 100 LOG(ERROR) << "ServiceMain returned error (result: " << result << ")"; |
101 } | 101 } |
102 return true; | 102 return true; |
103 } | 103 } |
104 | 104 |
105 } // namespace shell | 105 } // namespace service_manager |
OLD | NEW |