summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-22 21:09:09 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-22 21:09:09 +0000
commit17b5a817290e1b495a577fcc783d15fb8bc89137 (patch)
tree468b06ffeceecd892c08d6d2dc7879597b47b189 /ppapi/native_client
parent1639cb3af1931b16d7eda95732fa69d94dc57c81 (diff)
downloadchromium_src-17b5a817290e1b495a577fcc783d15fb8bc89137.zip
chromium_src-17b5a817290e1b495a577fcc783d15fb8bc89137.tar.gz
chromium_src-17b5a817290e1b495a577fcc783d15fb8bc89137.tar.bz2
Add an IPC channel between the NaCl loader process and the renderer.
BUG=116317 TEST=ppapi, nacl tests, manual testing for experimental IPC proxy. TBR=brettw@chromium.org Review URL: https://chromiumcodereview.appspot.com/10661002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r--ppapi/native_client/src/trusted/plugin/nacl_entry_points.h3
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc32
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.h3
3 files changed, 33 insertions, 5 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
index 3723394..a1875e8 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
+++ b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
@@ -21,10 +21,7 @@ typedef bool (*LaunchNaClProcessFunc)(PP_Instance instance,
int socket_count,
nacl::Handle* result_sockets);
-typedef bool (*StartPpapiProxyFunc)(PP_Instance instance);
-
extern LaunchNaClProcessFunc launch_nacl_process;
-extern StartPpapiProxyFunc start_ppapi_proxy;
#endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_NACL_ENTRY_POINTS_H_
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 891df69..856b31d 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -34,6 +34,7 @@
#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
#include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
#include "native_client/src/trusted/plugin/json_manifest.h"
+#include "native_client/src/trusted/plugin/nacl_entry_points.h"
#include "native_client/src/trusted/plugin/nacl_subprocess.h"
#include "native_client/src/trusted/plugin/nexe_arch.h"
#include "native_client/src/trusted/plugin/plugin_error.h"
@@ -54,6 +55,7 @@
#include "ppapi/c/ppp_input_event.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/ppp_mouse_lock.h"
+#include "ppapi/c/private/ppb_nacl_private.h"
#include "ppapi/c/private/ppb_uma_private.h"
#include "ppapi/cpp/dev/find_dev.h"
#include "ppapi/cpp/dev/printing_dev.h"
@@ -120,6 +122,13 @@ const int64_t kSizeKBMin = 1;
const int64_t kSizeKBMax = 512*1024; // very large .nexe
const uint32_t kSizeKBBuckets = 100;
+const PPB_NaCl_Private* GetNaclInterface() {
+ pp::Module *module = pp::Module::Get();
+ CHECK(module);
+ return static_cast<const PPB_NaCl_Private*>(
+ module->GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE));
+}
+
const PPB_UMA_Private* GetUMAInterface() {
pp::Module *module = pp::Module::Get();
CHECK(module);
@@ -603,12 +612,25 @@ bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper,
}
bool service_runtime_started =
- new_service_runtime->Start(wrapper, error_info, manifest_base_url());
+ new_service_runtime->Start(wrapper,
+ error_info,
+ manifest_base_url());
PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n",
service_runtime_started));
if (!service_runtime_started) {
return false;
}
+
+ // Try to start the Chrome IPC-based proxy.
+ const PPB_NaCl_Private* ppb_nacl = GetNaclInterface();
+ if (ppb_nacl->StartPpapiProxy(pp_instance())) {
+ using_ipc_proxy_ = true;
+ // We need to explicitly schedule this here. It is normally called in
+ // response to starting the SRPC proxy.
+ CHECK(init_done_cb.pp_completion_callback().func != NULL);
+ PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon, started ipc proxy.\n"));
+ pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb, PP_OK);
+ }
return true;
}
@@ -631,6 +653,11 @@ bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
}
bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) {
+ // If we are using the IPC proxy, StartSrpcServices and StartJSObjectProxy
+ // don't makes sense. Return 'true' so that the plugin continues loading.
+ if (using_ipc_proxy_)
+ return true;
+
if (!main_subprocess_.StartSrpcServices()) {
error_info->SetReport(ERROR_SRPC_CONNECTION_FAIL,
"SRPC connection failure for " +
@@ -862,7 +889,8 @@ Plugin::Plugin(PP_Instance pp_instance)
init_time_(0),
ready_time_(0),
nexe_size_(0),
- time_of_last_progress_event_(0) {
+ time_of_last_progress_event_(0),
+ using_ipc_proxy_(false) {
PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%"
NACL_PRId32")\n", static_cast<void*>(this), pp_instance));
callback_factory_.Initialize(this);
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index cd79517..1a709d8 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -517,6 +517,9 @@ class Plugin : public pp::InstancePrivate {
const FileDownloader* FindFileDownloader(PP_Resource url_loader) const;
int64_t time_of_last_progress_event_;
+
+ // Whether we are using IPC-based PPAPI proxy.
+ bool using_ipc_proxy_;
};
} // namespace plugin