diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-30 17:34:03 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-30 17:34:03 +0000 |
commit | 7b3a1b3f805c07dac94c7eb0482960e99b25fc6b (patch) | |
tree | 4205f392e40058dd301f667f042978b44d1f5df4 /ppapi/native_client | |
parent | 20a8ddeef19d2ed6884cb8d612c6f805fd622ce4 (diff) | |
download | chromium_src-7b3a1b3f805c07dac94c7eb0482960e99b25fc6b.zip chromium_src-7b3a1b3f805c07dac94c7eb0482960e99b25fc6b.tar.gz chromium_src-7b3a1b3f805c07dac94c7eb0482960e99b25fc6b.tar.bz2 |
NaCl: Move sel_ldr_launcher_chrome.cc into the Chromium repo
This will allow the launch_nacl_process() callback to be simplified by
removing unused arguments. But for now, I have left
sel_ldr_launcher_chrome.cc unchanged except to change its use of
namespaces.
BUG=http://code.google.com/p/nativeclient/issues/detail?id=2750
TEST=nacl_integration etc.
Review URL: https://chromiumcodereview.appspot.com/10266003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134552 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
5 files changed, 72 insertions, 3 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.gypi b/ppapi/native_client/src/trusted/plugin/plugin.gypi index c891f28..df9154f 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.gypi +++ b/ppapi/native_client/src/trusted/plugin/plugin.gypi @@ -15,6 +15,7 @@ 'pnacl_coordinator.cc', 'pnacl_resources.cc', 'scriptable_plugin.cc', + 'sel_ldr_launcher_chrome.cc', 'service_runtime.cc', 'srpc_client.cc', 'srpc_params.cc', diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc new file mode 100644 index 0000000..f5b6c9f --- /dev/null +++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc @@ -0,0 +1,44 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" + +#include "native_client/src/trusted/plugin/nacl_entry_points.h" + +#if NACL_WINDOWS +# include <windows.h> +#endif + +LaunchNaClProcessFunc launch_nacl_process = NULL; + +namespace plugin { + +bool SelLdrLauncherChrome::Start(const char* url) { + // send a synchronous message to the browser process + // TODO(mseaborn): Remove the nacl_proc_handle and nacl_proc_id + // arguments. Chromium is being changed not to give the renderer + // the Windows handle of the NaCl process. + nacl::Handle nacl_proc_handle; + int nacl_proc_id; + // TODO(sehr): This is asserted to be one. Remove this parameter. + static const int kNumberOfChannelsToBeCreated = 1; + if (!launch_nacl_process || + !launch_nacl_process(url, + kNumberOfChannelsToBeCreated, + &channel_, + &nacl_proc_handle, + &nacl_proc_id)) { + return false; + } + +#if NACL_WINDOWS + if (nacl_proc_handle != nacl::kInvalidHandle && + nacl_proc_handle != NULL) { + CloseHandle(nacl_proc_handle); + } +#endif + return true; +} + +} // namespace plugin diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h new file mode 100644 index 0000000..2450cf3 --- /dev/null +++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h @@ -0,0 +1,19 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SEL_LDR_LAUNCHER_CHROME_H_ +#define PPAPI_NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SEL_LDR_LAUNCHER_CHROME_H_ + +#include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" + +namespace plugin { + +class SelLdrLauncherChrome : public nacl::SelLdrLauncherBase { + public: + virtual bool Start(const char* url); +}; + +} // namespace plugin + +#endif diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc index 37a836d..8a75b1e 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc @@ -45,6 +45,7 @@ #include "native_client/src/trusted/plugin/plugin.h" #include "native_client/src/trusted/plugin/plugin_error.h" #include "native_client/src/trusted/plugin/pnacl_coordinator.h" +#include "native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" #include "native_client/src/trusted/plugin/srpc_client.h" #include "native_client/src/trusted/plugin/utility.h" @@ -627,8 +628,12 @@ bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, PLUGIN_PRINTF(("ServiceRuntime::Start (nacl_desc=%p)\n", reinterpret_cast<void*>(nacl_desc))); - nacl::scoped_ptr<nacl::SelLdrLauncher> - tmp_subprocess(new nacl::SelLdrLauncher()); + nacl::scoped_ptr<nacl::SelLdrLauncherBase> tmp_subprocess; +#ifdef NACL_STANDALONE + tmp_subprocess.reset(new nacl::SelLdrLauncherStandalone()); +#else + tmp_subprocess.reset(new SelLdrLauncherChrome()); +#endif if (NULL == tmp_subprocess.get()) { PLUGIN_PRINTF(("ServiceRuntime::Start (subprocess create failed)\n")); error_info->SetReport(ERROR_SEL_LDR_CREATE_LAUNCHER, diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h index 7cd04bf..554942a 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.h +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h @@ -247,7 +247,7 @@ class ServiceRuntime { Plugin* plugin_; bool should_report_uma_; nacl::ReverseService* reverse_service_; - nacl::scoped_ptr<nacl::SelLdrLauncher> subprocess_; + nacl::scoped_ptr<nacl::SelLdrLauncherBase> subprocess_; nacl::WeakRefAnchor* anchor_; |