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

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

Issue 1057603003: Simplify mojo_shell since it's now only used for Mandoline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update scripts Created 5 years, 8 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/shell/desktop/launcher_process.cc ('k') | mojo/shell/shell_apptest.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/shell/native_application_support.h" 5 #include "mojo/shell/native_application_support.h"
6 6
7 #include "base/command_line.h"
7 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h " 11 #include "mojo/public/platform/native/gles2_impl_chromium_miscellaneous_thunks.h "
11 #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"
12 #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"
13 #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"
14 #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"
15 #include "mojo/public/platform/native/gles2_impl_thunks.h" 16 #include "mojo/public/platform/native/gles2_impl_thunks.h"
16 #include "mojo/public/platform/native/gles2_thunks.h" 17 #include "mojo/public/platform/native/gles2_thunks.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Go shared library support requires us to initialize the runtime before we 98 // Go shared library support requires us to initialize the runtime before we
98 // start running any go code. This is a temporary patch. 99 // start running any go code. This is a temporary patch.
99 typedef void (*InitGoRuntimeFn)(); 100 typedef void (*InitGoRuntimeFn)();
100 InitGoRuntimeFn init_go_runtime = reinterpret_cast<InitGoRuntimeFn>( 101 InitGoRuntimeFn init_go_runtime = reinterpret_cast<InitGoRuntimeFn>(
101 base::GetFunctionPointerFromNativeLibrary(app_library, "InitGoRuntime")); 102 base::GetFunctionPointerFromNativeLibrary(app_library, "InitGoRuntime"));
102 if (init_go_runtime) { 103 if (init_go_runtime) {
103 DVLOG(2) << "InitGoRuntime: Initializing Go Runtime found in app"; 104 DVLOG(2) << "InitGoRuntime: Initializing Go Runtime found in app";
104 init_go_runtime(); 105 init_go_runtime();
105 } 106 }
106 107
108 #if !defined(OS_WIN)
109 // On Windows, initializing base::CommandLine with null parameters gets the
110 // process's command line from the OS. Other platforms need it to be passed
111 // in. This needs to be passed in before the app initializes the command line,
112 // which is done as soon as it loads.
113 typedef void (*InitCommandLineArgs)(int, const char* const*);
114 InitCommandLineArgs init_command_line_args =
115 reinterpret_cast<InitCommandLineArgs>(
116 base::GetFunctionPointerFromNativeLibrary(app_library,
117 "InitCommandLineArgs"));
118 if (init_command_line_args) {
119 int argc = 0;
120 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
121 const char** argv = new const char* [cmd_line->argv().size()];
122 for (auto& arg : cmd_line->argv())
123 argv[argc++] = arg.c_str();
124 init_command_line_args(argc, argv);
125 }
126 #endif
127
107 typedef MojoResult (*MojoMainFunction)(MojoHandle); 128 typedef MojoResult (*MojoMainFunction)(MojoHandle);
108 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>( 129 MojoMainFunction main_function = reinterpret_cast<MojoMainFunction>(
109 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain")); 130 base::GetFunctionPointerFromNativeLibrary(app_library, "MojoMain"));
110 if (!main_function) { 131 if (!main_function) {
111 LOG(ERROR) << "MojoMain not found"; 132 LOG(ERROR) << "MojoMain not found";
112 return false; 133 return false;
113 } 134 }
114 // |MojoMain()| takes ownership of the service handle. 135 // |MojoMain()| takes ownership of the service handle.
115 MojoHandle handle = application_request.PassMessagePipe().release().value(); 136 MojoHandle handle = application_request.PassMessagePipe().release().value();
116 MojoResult result = main_function(handle); 137 MojoResult result = main_function(handle);
117 if (result < MOJO_RESULT_OK) { 138 if (result < MOJO_RESULT_OK) {
118 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; 139 LOG(ERROR) << "MojoMain returned error (result: " << result << ")";
119 } 140 }
120 return true; 141 return true;
121 } 142 }
122 143
123 } // namespace shell 144 } // namespace shell
124 } // namespace mojo 145 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/desktop/launcher_process.cc ('k') | mojo/shell/shell_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698