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/runner/native_application_support.h" | 5 #include "mojo/runner/native_application_support.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "mojo/platform_handle/platform_handle_private_thunks.h" | |
12 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h
" | 11 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h
" |
13 #include "mojo/public/platform/native/gles2_impl_chromium_sub_image_thunks.h" | 12 #include "mojo/public/platform/native/gles2_impl_chromium_sub_image_thunks.h" |
14 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" | 13 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" |
15 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks
.h" | 14 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks
.h" |
16 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" | 15 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" |
17 #include "mojo/public/platform/native/gles2_impl_thunks.h" | 16 #include "mojo/public/platform/native/gles2_impl_thunks.h" |
18 #include "mojo/public/platform/native/gles2_thunks.h" | 17 #include "mojo/public/platform/native/gles2_thunks.h" |
19 #include "mojo/public/platform/native/system_thunks.h" | 18 #include "mojo/public/platform/native/system_thunks.h" |
20 | 19 |
21 namespace mojo { | 20 namespace mojo { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 if (init_command_line_args) { | 119 if (init_command_line_args) { |
121 int argc = 0; | 120 int argc = 0; |
122 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 121 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
123 const char** argv = new const char* [cmd_line->argv().size()]; | 122 const char** argv = new const char* [cmd_line->argv().size()]; |
124 for (auto& arg : cmd_line->argv()) | 123 for (auto& arg : cmd_line->argv()) |
125 argv[argc++] = arg.c_str(); | 124 argv[argc++] = arg.c_str(); |
126 init_command_line_args(argc, argv); | 125 init_command_line_args(argc, argv); |
127 } | 126 } |
128 #endif | 127 #endif |
129 | 128 |
130 // Apps need not include platform handle thunks. | |
131 SetThunks(&MojoMakePlatformHandlePrivateThunks, | |
132 "MojoSetPlatformHandlePrivateThunks", app_library); | |
133 | |
134 typedef MojoResult (*MojoMainFunction)(MojoHandle); | 129 typedef MojoResult (*MojoMainFunction)(MojoHandle); |
135 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( | 130 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( |
136 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); | 131 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); |
137 if (!main_function) { | 132 if (!main_function) { |
138 LOG(ERROR) << "MojoMain not found"; | 133 LOG(ERROR) << "MojoMain not found"; |
139 return false; | 134 return false; |
140 } | 135 } |
141 // |MojoMain()| takes ownership of the service handle. | 136 // |MojoMain()| takes ownership of the service handle. |
142 MojoHandle handle = application_request.PassMessagePipe().release().value(); | 137 MojoHandle handle = application_request.PassMessagePipe().release().value(); |
143 MojoResult result = main_function(handle); | 138 MojoResult result = main_function(handle); |
144 if (result != MOJO_RESULT_OK) { | 139 if (result != MOJO_RESULT_OK) { |
145 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; | 140 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; |
146 } | 141 } |
147 return true; | 142 return true; |
148 } | 143 } |
149 | 144 |
150 } // namespace runner | 145 } // namespace runner |
151 } // namespace mojo | 146 } // namespace mojo |
OLD | NEW |