| OLD | NEW |
| 1 // Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2012 The Native Client 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 "native_client/src/include/portability.h" | 5 #include "native_client/src/include/portability.h" |
| 6 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" | 6 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" |
| 7 #include "native_client/src/trusted/plugin/nacl_entry_points.h" | 7 #include "native_client/src/trusted/plugin/nacl_entry_points.h" |
| 8 | 8 |
| 9 #if NACL_WINDOWS | 9 #if NACL_WINDOWS |
| 10 # include <windows.h> | 10 # include <windows.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 LaunchNaClProcessFunc launch_nacl_process = NULL; | 13 LaunchNaClProcessFunc launch_nacl_process = NULL; |
| 14 | 14 |
| 15 #if !defined(NACL_STANDALONE) | |
| 16 namespace nacl { | 15 namespace nacl { |
| 17 bool SelLdrLauncher::Start(const char* url) { | 16 bool SelLdrLauncherChrome::Start(const char* url) { |
| 18 // send a synchronous message to the browser process | 17 // send a synchronous message to the browser process |
| 19 // TODO(mseaborn): Remove the nacl_proc_handle and nacl_proc_id | 18 // TODO(mseaborn): Remove the nacl_proc_handle and nacl_proc_id |
| 20 // arguments. Chromium is being changed not to give the renderer | 19 // arguments. Chromium is being changed not to give the renderer |
| 21 // the Windows handle of the NaCl process. | 20 // the Windows handle of the NaCl process. |
| 22 Handle nacl_proc_handle; | 21 Handle nacl_proc_handle; |
| 23 int nacl_proc_id; | 22 int nacl_proc_id; |
| 24 // TODO(sehr): This is asserted to be one. Remove this parameter. | 23 // TODO(sehr): This is asserted to be one. Remove this parameter. |
| 25 static const int kNumberOfChannelsToBeCreated = 1; | 24 static const int kNumberOfChannelsToBeCreated = 1; |
| 26 if (!launch_nacl_process || | 25 if (!launch_nacl_process || |
| 27 !launch_nacl_process(url, | 26 !launch_nacl_process(url, |
| 28 kNumberOfChannelsToBeCreated, | 27 kNumberOfChannelsToBeCreated, |
| 29 &channel_, | 28 &channel_, |
| 30 &nacl_proc_handle, | 29 &nacl_proc_handle, |
| 31 &nacl_proc_id)) { | 30 &nacl_proc_id)) { |
| 32 return false; | 31 return false; |
| 33 } | 32 } |
| 34 | 33 |
| 35 CloseHandlesAfterLaunch(); | |
| 36 #if NACL_WINDOWS | 34 #if NACL_WINDOWS |
| 37 if (nacl_proc_handle != kInvalidHandle && | 35 if (nacl_proc_handle != kInvalidHandle && |
| 38 nacl_proc_handle != NULL) { | 36 nacl_proc_handle != NULL) { |
| 39 CloseHandle(nacl_proc_handle); | 37 CloseHandle(nacl_proc_handle); |
| 40 } | 38 } |
| 41 #endif | 39 #endif |
| 42 return true; | 40 return true; |
| 43 } | 41 } |
| 44 | 42 |
| 45 bool SelLdrLauncher::Start(int socket_count, | |
| 46 Handle* result_sockets, | |
| 47 const char* url) { | |
| 48 UNREFERENCED_PARAMETER(socket_count); | |
| 49 UNREFERENCED_PARAMETER(result_sockets); | |
| 50 return Start(url); | |
| 51 } | |
| 52 } // namespace | 43 } // namespace |
| 53 #endif // !defined(NACL_STANDALONE) | |
| OLD | NEW |