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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 78 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
79 const char** argv = new const char*[cmd_line->argv().size()]; | 79 const char** argv = new const char*[cmd_line->argv().size()]; |
80 for (auto& arg : cmd_line->argv()) | 80 for (auto& arg : cmd_line->argv()) |
81 argv[argc++] = arg.c_str(); | 81 argv[argc++] = arg.c_str(); |
82 init_command_line_args(argc, argv); | 82 init_command_line_args(argc, argv); |
83 } | 83 } |
84 #endif | 84 #endif |
85 | 85 |
86 #endif // !defined(COMPONENT_BUILD) | 86 #endif // !defined(COMPONENT_BUILD) |
87 | 87 |
88 typedef MojoResult (*MojoMainFunction)(MojoHandle); | 88 typedef MojoResult (*ServiceMainFunction)(MojoHandle); |
89 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( | 89 ServiceMainFunction main_function = reinterpret_cast<ServiceMainFunction>( |
90 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); | 90 base::GetFunctionPointerFromNativeLibrary(app_library, "ServiceMain")); |
91 if (!main_function) { | 91 if (!main_function) { |
92 LOG(ERROR) << "MojoMain not found"; | 92 LOG(ERROR) << "ServiceMain not found"; |
93 return false; | 93 return false; |
94 } | 94 } |
95 // |MojoMain()| takes ownership of the service handle. | 95 // |ServiceMain()| 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) << "ServiceMain returned error (result: " << result << ")"; |
100 } | 100 } |
101 return true; | 101 return true; |
102 } | 102 } |
103 | 103 |
104 } // namespace shell | 104 } // namespace shell |
OLD | NEW |