| 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" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 // If the application is using GLES2 extension points, register those | 75 // If the application is using GLES2 extension points, register those |
| 76 // thunks. Applications may use or not use any of these, so don't warn if | 76 // thunks. Applications may use or not use any of these, so don't warn if |
| 77 // they are missing. | 77 // they are missing. |
| 78 SetThunks(MojoMakeGLES2ImplChromiumExtensionThunks, | 78 SetThunks(MojoMakeGLES2ImplChromiumExtensionThunks, |
| 79 "MojoSetGLES2ImplChromiumExtensionThunks", app_library); | 79 "MojoSetGLES2ImplChromiumExtensionThunks", app_library); |
| 80 } | 80 } |
| 81 // Unlike system thunks, we don't warn on a lack of GLES2 thunks because | 81 // Unlike system thunks, we don't warn on a lack of GLES2 thunks because |
| 82 // not everything is a visual app. | 82 // not everything is a visual app. |
| 83 | 83 |
| 84 // Go shared library support requires us to initialize the runtime before we | |
| 85 // start running any go code. This is a temporary patch. | |
| 86 typedef void (*InitGoRuntimeFn)(); | |
| 87 InitGoRuntimeFn init_go_runtime = reinterpret_cast<InitGoRuntimeFn>( | |
| 88 base::GetFunctionPointerFromNativeLibrary(app_library, "InitGoRuntime")); | |
| 89 if (init_go_runtime) { | |
| 90 DVLOG(2) << "InitGoRuntime: Initializing Go Runtime found in app"; | |
| 91 init_go_runtime(); | |
| 92 } | |
| 93 | |
| 94 #if !defined(OS_WIN) | 84 #if !defined(OS_WIN) |
| 95 // On Windows, initializing base::CommandLine with null parameters gets the | 85 // On Windows, initializing base::CommandLine with null parameters gets the |
| 96 // process's command line from the OS. Other platforms need it to be passed | 86 // process's command line from the OS. Other platforms need it to be passed |
| 97 // in. This needs to be passed in before the app initializes the command line, | 87 // in. This needs to be passed in before the app initializes the command line, |
| 98 // which is done as soon as it loads. | 88 // which is done as soon as it loads. |
| 99 typedef void (*InitCommandLineArgs)(int, const char* const*); | 89 typedef void (*InitCommandLineArgs)(int, const char* const*); |
| 100 InitCommandLineArgs init_command_line_args = | 90 InitCommandLineArgs init_command_line_args = |
| 101 reinterpret_cast<InitCommandLineArgs>( | 91 reinterpret_cast<InitCommandLineArgs>( |
| 102 base::GetFunctionPointerFromNativeLibrary(app_library, | 92 base::GetFunctionPointerFromNativeLibrary(app_library, |
| 103 "InitCommandLineArgs")); | 93 "InitCommandLineArgs")); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 126 MojoHandle handle = application_request.PassMessagePipe().release().value(); | 116 MojoHandle handle = application_request.PassMessagePipe().release().value(); |
| 127 MojoResult result = main_function(handle); | 117 MojoResult result = main_function(handle); |
| 128 if (result != MOJO_RESULT_OK) { | 118 if (result != MOJO_RESULT_OK) { |
| 129 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; | 119 LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; |
| 130 } | 120 } |
| 131 return true; | 121 return true; |
| 132 } | 122 } |
| 133 | 123 |
| 134 } // namespace runner | 124 } // namespace runner |
| 135 } // namespace mojo | 125 } // namespace mojo |
| OLD | NEW |