Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: mojo/runner/native_application_support.cc

Issue 1113393002: Adds thunks for getting platform handles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix windows Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/runner/BUILD.gn ('k') | mojo/runner/platform_handle_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h " 12 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h "
12 #include "mojo/public/platform/native/gles2_impl_chromium_sub_image_thunks.h" 13 #include "mojo/public/platform/native/gles2_impl_chromium_sub_image_thunks.h"
13 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" 14 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h"
14 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks .h" 15 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks .h"
15 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h" 16 #include "mojo/public/platform/native/gles2_impl_occlusion_query_ext_thunks.h"
16 #include "mojo/public/platform/native/gles2_impl_thunks.h" 17 #include "mojo/public/platform/native/gles2_impl_thunks.h"
17 #include "mojo/public/platform/native/gles2_thunks.h" 18 #include "mojo/public/platform/native/gles2_thunks.h"
18 #include "mojo/public/platform/native/system_thunks.h" 19 #include "mojo/public/platform/native/system_thunks.h"
19 20
20 namespace mojo { 21 namespace mojo {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (init_command_line_args) { 120 if (init_command_line_args) {
120 int argc = 0; 121 int argc = 0;
121 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 122 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
122 const char** argv = new const char* [cmd_line->argv().size()]; 123 const char** argv = new const char* [cmd_line->argv().size()];
123 for (auto& arg : cmd_line->argv()) 124 for (auto& arg : cmd_line->argv())
124 argv[argc++] = arg.c_str(); 125 argv[argc++] = arg.c_str();
125 init_command_line_args(argc, argv); 126 init_command_line_args(argc, argv);
126 } 127 }
127 #endif 128 #endif
128 129
130 // Apps need not include platform handle thunks.
131 SetThunks(&MojoMakePlatformHandlePrivateThunks,
132 "MojoSetPlatformHandlePrivateThunks", app_library);
133
129 typedef MojoResult (*MojoMainFunction)(MojoHandle); 134 typedef MojoResult (*MojoMainFunction)(MojoHandle);
130 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( 135 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>(
131 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); 136 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain"));
132 if (!main_function) { 137 if (!main_function) {
133 LOG(ERROR) << "MojoMain not found"; 138 LOG(ERROR) << "MojoMain not found";
134 return false; 139 return false;
135 } 140 }
136 // |MojoMain()| takes ownership of the service handle. 141 // |MojoMain()| takes ownership of the service handle.
137 MojoHandle handle = application_request.PassMessagePipe().release().value(); 142 MojoHandle handle = application_request.PassMessagePipe().release().value();
138 MojoResult result = main_function(handle); 143 MojoResult result = main_function(handle);
139 if (result != MOJO_RESULT_OK) { 144 if (result != MOJO_RESULT_OK) {
140 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; 145 LOG(ERROR) << "MojoMain returned error (result: " << result << ")";
141 } 146 }
142 return true; 147 return true;
143 } 148 }
144 149
145 } // namespace runner 150 } // namespace runner
146 } // namespace mojo 151 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/BUILD.gn ('k') | mojo/runner/platform_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698