| 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 "shell/dynamic_service_runner.h" | 5 #include "shell/dynamic_service_runner.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" | 10 #include "mojo/public/platform/native/gles2_impl_chromium_sync_point_thunks.h" |
| 10 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks
.h" | 11 #include "mojo/public/platform/native/gles2_impl_chromium_texture_mailbox_thunks
.h" |
| 11 #include "mojo/public/platform/native/gles2_impl_thunks.h" | 12 #include "mojo/public/platform/native/gles2_impl_thunks.h" |
| 12 #include "mojo/public/platform/native/gles2_thunks.h" | 13 #include "mojo/public/platform/native/gles2_thunks.h" |
| 13 #include "mojo/public/platform/native/system_thunks.h" | 14 #include "mojo/public/platform/native/system_thunks.h" |
| 14 | 15 |
| 15 namespace mojo { | 16 namespace mojo { |
| 16 namespace shell { | 17 namespace shell { |
| 17 | 18 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 33 << " to return thunks of size: " << expected_size; | 34 << " to return thunks of size: " << expected_size; |
| 34 return false; | 35 return false; |
| 35 } | 36 } |
| 36 return true; | 37 return true; |
| 37 } | 38 } |
| 38 | 39 |
| 39 } // namespace | 40 } // namespace |
| 40 | 41 |
| 41 base::NativeLibrary DynamicServiceRunner::LoadAndRunService( | 42 base::NativeLibrary DynamicServiceRunner::LoadAndRunService( |
| 42 const base::FilePath& app_path, | 43 const base::FilePath& app_path, |
| 44 bool clean_app_path, |
| 43 ScopedMessagePipeHandle service_handle) { | 45 ScopedMessagePipeHandle service_handle) { |
| 44 DVLOG(2) << "Loading/running Mojo app in process from library: " | 46 DVLOG(2) << "Loading/running Mojo app in process from library: " |
| 45 << app_path.value(); | 47 << app_path.value(); |
| 46 base::NativeLibraryLoadError error; | 48 base::NativeLibraryLoadError error; |
| 47 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); | 49 base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); |
| 50 if (clean_app_path) |
| 51 DeleteFile(app_path, false); |
| 48 do { | 52 do { |
| 49 if (!app_library) { | 53 if (!app_library) { |
| 50 LOG(ERROR) << "Failed to load app library (error: " << error.ToString() | 54 LOG(ERROR) << "Failed to load app library (error: " << error.ToString() |
| 51 << ")"; | 55 << ")"; |
| 52 break; | 56 break; |
| 53 } | 57 } |
| 54 // Go shared library support requires us to initialize the runtime before we | 58 // Go shared library support requires us to initialize the runtime before we |
| 55 // start running any go code. This is a temporary patch. | 59 // start running any go code. This is a temporary patch. |
| 56 typedef void (*InitGoRuntimeFn)(); | 60 typedef void (*InitGoRuntimeFn)(); |
| 57 InitGoRuntimeFn init_go_runtime = reinterpret_cast<InitGoRuntimeFn>( | 61 InitGoRuntimeFn init_go_runtime = reinterpret_cast<InitGoRuntimeFn>( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 LOG(ERROR) << app_path.value() << " MojoMain returned error(" << result | 107 LOG(ERROR) << app_path.value() << " MojoMain returned error(" << result |
| 104 << ")"; | 108 << ")"; |
| 105 } | 109 } |
| 106 } while (false); | 110 } while (false); |
| 107 | 111 |
| 108 return app_library; | 112 return app_library; |
| 109 } | 113 } |
| 110 | 114 |
| 111 } // namespace shell | 115 } // namespace shell |
| 112 } // namespace mojo | 116 } // namespace mojo |
| OLD | NEW |