summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.cc17
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.h3
-rw-r--r--chrome/browser/renderer_host/chrome_render_message_filter.cc1
-rw-r--r--chrome/common/nacl_messages.h2
-rw-r--r--chrome/common/nacl_types.cc15
-rw-r--r--chrome/common/nacl_types.h4
-rw-r--r--chrome/common/render_messages.h1
-rw-r--r--chrome/nacl/nacl_listener.cc25
-rw-r--r--chrome/renderer/pepper/ppb_nacl_private_impl.cc4
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl3
-rw-r--r--ppapi/c/private/ppb_nacl_private.h5
-rw-r--r--ppapi/native_client/src/trusted/plugin/nacl_entry_points.h1
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc8
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.h1
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc4
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h1
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc2
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.h1
18 files changed, 73 insertions, 25 deletions
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc
index c8eb47a..ec8b3dd 100644
--- a/chrome/browser/nacl_host/nacl_process_host.cc
+++ b/chrome/browser/nacl_host/nacl_process_host.cc
@@ -149,6 +149,7 @@ bool NaClProcessHost::PluginListener::OnMessageReceived(
NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
int render_view_id,
uint32 permission_bits,
+ bool uses_irt,
bool off_the_record)
: manifest_url_(manifest_url),
permissions_(GetNaClPermissions(permission_bits)),
@@ -165,6 +166,7 @@ NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
enable_exception_handling_(false),
enable_debug_stub_(false),
+ uses_irt_(uses_irt),
off_the_record_(off_the_record),
enable_ipc_proxy_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)),
@@ -706,9 +708,7 @@ bool NaClProcessHost::StartNaClExecution() {
params.enable_debug_stub = enable_debug_stub_ &&
NaClBrowser::GetInstance()->URLMatchesDebugPatterns(manifest_url_);
params.enable_ipc_proxy = enable_ipc_proxy_;
-
- base::PlatformFile irt_file = nacl_browser->IrtFile();
- CHECK_NE(irt_file, base::kInvalidPlatformFileValue);
+ params.uses_irt = uses_irt_;
const ChildProcessData& data = process_->GetData();
if (!ShareHandleToSelLdr(data.handle,
@@ -717,9 +717,14 @@ bool NaClProcessHost::StartNaClExecution() {
return false;
}
- // Send over the IRT file handle. We don't close our own copy!
- if (!ShareHandleToSelLdr(data.handle, irt_file, false, &params.handles))
- return false;
+ if (params.uses_irt) {
+ base::PlatformFile irt_file = nacl_browser->IrtFile();
+ CHECK_NE(irt_file, base::kInvalidPlatformFileValue);
+
+ // Send over the IRT file handle. We don't close our own copy!
+ if (!ShareHandleToSelLdr(data.handle, irt_file, false, &params.handles))
+ return false;
+ }
#if defined(OS_MACOSX)
// For dynamic loading support, NaCl requires a file descriptor that
diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h
index 46337c4..88bc968 100644
--- a/chrome/browser/nacl_host/nacl_process_host.h
+++ b/chrome/browser/nacl_host/nacl_process_host.h
@@ -50,6 +50,7 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
NaClProcessHost(const GURL& manifest_url,
int render_view_id,
uint32 permission_bits,
+ bool uses_irt,
bool off_the_record);
virtual ~NaClProcessHost();
@@ -194,6 +195,8 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
bool enable_exception_handling_;
bool enable_debug_stub_;
+ bool uses_irt_;
+
bool off_the_record_;
bool enable_ipc_proxy_;
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc
index 56dd390..7d14ba7 100644
--- a/chrome/browser/renderer_host/chrome_render_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -180,6 +180,7 @@ void ChromeRenderMessageFilter::OnLaunchNaCl(
GURL(launch_params.manifest_url),
launch_params.render_view_id,
launch_params.permission_bits,
+ launch_params.uses_irt,
off_the_record_);
host->Launch(this, reply_msg, extension_info_map_);
}
diff --git a/chrome/common/nacl_messages.h b/chrome/common/nacl_messages.h
index 7ccba59..d795205 100644
--- a/chrome/common/nacl_messages.h
+++ b/chrome/common/nacl_messages.h
@@ -21,6 +21,7 @@ IPC_STRUCT_TRAITS_BEGIN(nacl::NaClStartParams)
IPC_STRUCT_TRAITS_MEMBER(enable_exception_handling)
IPC_STRUCT_TRAITS_MEMBER(enable_debug_stub)
IPC_STRUCT_TRAITS_MEMBER(enable_ipc_proxy)
+ IPC_STRUCT_TRAITS_MEMBER(uses_irt)
IPC_STRUCT_TRAITS_END()
//-----------------------------------------------------------------------------
@@ -80,4 +81,3 @@ IPC_MESSAGE_CONTROL1(NaClProcessMsg_SetKnownToValidate,
// created successfully.
IPC_MESSAGE_CONTROL1(NaClProcessHostMsg_PpapiChannelCreated,
IPC::ChannelHandle /* channel_handle */)
-
diff --git a/chrome/common/nacl_types.cc b/chrome/common/nacl_types.cc
index 9b48357..1dabb94 100644
--- a/chrome/common/nacl_types.cc
+++ b/chrome/common/nacl_types.cc
@@ -8,7 +8,10 @@ namespace nacl {
NaClStartParams::NaClStartParams()
: validation_cache_enabled(false),
- enable_exception_handling(false) {
+ enable_exception_handling(false),
+ enable_debug_stub(false),
+ enable_ipc_proxy(false),
+ uses_irt(false) {
}
NaClStartParams::~NaClStartParams() {
@@ -16,21 +19,25 @@ NaClStartParams::~NaClStartParams() {
NaClLaunchParams::NaClLaunchParams()
: render_view_id(0),
- permission_bits(0) {
+ permission_bits(0),
+ uses_irt(false) {
}
NaClLaunchParams::NaClLaunchParams(const std::string& manifest_url_,
int render_view_id_,
- uint32 permission_bits_)
+ uint32 permission_bits_,
+ bool uses_irt_)
: manifest_url(manifest_url_),
render_view_id(render_view_id_),
- permission_bits(permission_bits_) {
+ permission_bits(permission_bits_),
+ uses_irt(uses_irt_) {
}
NaClLaunchParams::NaClLaunchParams(const NaClLaunchParams& l) {
manifest_url = l.manifest_url;
render_view_id = l.render_view_id;
permission_bits = l.permission_bits;
+ uses_irt = l.uses_irt;
}
NaClLaunchParams::~NaClLaunchParams() {
diff --git a/chrome/common/nacl_types.h b/chrome/common/nacl_types.h
index 49ff63c..ecb1738 100644
--- a/chrome/common/nacl_types.h
+++ b/chrome/common/nacl_types.h
@@ -57,6 +57,7 @@ struct NaClStartParams {
bool enable_exception_handling;
bool enable_debug_stub;
bool enable_ipc_proxy;
+ bool uses_irt;
};
// Parameters sent to the browser process to have it launch a NaCl process.
@@ -65,13 +66,14 @@ struct NaClStartParams {
// renderer_messages.h.
struct NaClLaunchParams {
NaClLaunchParams();
- NaClLaunchParams(const std::string& u, int r, uint32 p);
+ NaClLaunchParams(const std::string& u, int r, uint32 p, bool uses_irt);
NaClLaunchParams(const NaClLaunchParams& l);
~NaClLaunchParams();
std::string manifest_url;
int render_view_id;
uint32 permission_bits;
+ bool uses_irt;
};
} // namespace nacl
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 85168e4..1b4aafc 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -183,6 +183,7 @@ IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchParams)
IPC_STRUCT_TRAITS_MEMBER(manifest_url)
IPC_STRUCT_TRAITS_MEMBER(render_view_id)
IPC_STRUCT_TRAITS_MEMBER(permission_bits)
+ IPC_STRUCT_TRAITS_MEMBER(uses_irt)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(RendererContentSettingRules)
diff --git a/chrome/nacl/nacl_listener.cc b/chrome/nacl/nacl_listener.cc
index bb8eea5..161efd4 100644
--- a/chrome/nacl/nacl_listener.cc
+++ b/chrome/nacl/nacl_listener.cc
@@ -234,20 +234,25 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
# endif
#endif
- CHECK(handles.size() >= 1);
- NaClHandle irt_handle = nacl::ToNativeHandle(handles[handles.size() - 1]);
- handles.pop_back();
+ if (params.uses_irt) {
+ CHECK(handles.size() >= 1);
+ NaClHandle irt_handle = nacl::ToNativeHandle(handles[handles.size() - 1]);
+ handles.pop_back();
#if defined(OS_WIN)
- args->irt_fd = _open_osfhandle(reinterpret_cast<intptr_t>(irt_handle),
- _O_RDONLY | _O_BINARY);
- if (args->irt_fd < 0) {
- LOG(ERROR) << "_open_osfhandle() failed";
- return;
- }
+ args->irt_fd = _open_osfhandle(reinterpret_cast<intptr_t>(irt_handle),
+ _O_RDONLY | _O_BINARY);
+ if (args->irt_fd < 0) {
+ LOG(ERROR) << "_open_osfhandle() failed";
+ return;
+ }
#else
- args->irt_fd = irt_handle;
+ args->irt_fd = irt_handle;
#endif
+ } else {
+ // Otherwise, the IRT handle is not even sent.
+ args->irt_fd = -1;
+ }
if (params.validation_cache_enabled) {
// SHA256 block size.
diff --git a/chrome/renderer/pepper/ppb_nacl_private_impl.cc b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
index b2c1cba..0a19975 100644
--- a/chrome/renderer/pepper/ppb_nacl_private_impl.cc
+++ b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
@@ -68,6 +68,7 @@ static int GetRoutingID(PP_Instance instance) {
// Launch NaCl's sel_ldr process.
PP_NaClResult LaunchSelLdr(PP_Instance instance,
const char* alleged_url,
+ PP_Bool uses_irt,
PP_Bool uses_ppapi,
PP_Bool enable_ppapi_dev,
void* imc_handle) {
@@ -102,7 +103,8 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
if (!sender->Send(new ChromeViewHostMsg_LaunchNaCl(
nacl::NaClLaunchParams(instance_info.url.spec(),
routing_id,
- perm_bits),
+ perm_bits,
+ PP_ToBool(uses_irt)),
&result_socket,
&instance_info.channel_handle,
&instance_info.plugin_pid,
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index f603d6b..88c88fe 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -44,9 +44,12 @@ interface PPB_NaCl_Private {
* indicates that the nexe run by sel_ldr will use the PPAPI APIs.
* This implies that LaunchSelLdr is run from the main thread. If a nexe
* does not need PPAPI, then it can run off the main thread.
+ * The |uses_irt| flag indicates whether the IRT should be loaded in this
+ * NaCl process. This is true for ABI stable nexes.
*/
PP_NaClResult LaunchSelLdr([in] PP_Instance instance,
[in] str_t alleged_url,
+ [in] PP_Bool uses_irt,
[in] PP_Bool uses_ppapi,
[in] PP_Bool enable_ppapi_dev,
[out] mem_t imc_handle);
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index e89b548..7fbd563 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Mon Jan 7 12:49:31 2013. */
+/* From private/ppb_nacl_private.idl modified Thu Jan 10 16:07:40 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -69,9 +69,12 @@ struct PPB_NaCl_Private_1_0 {
* indicates that the nexe run by sel_ldr will use the PPAPI APIs.
* This implies that LaunchSelLdr is run from the main thread. If a nexe
* does not need PPAPI, then it can run off the main thread.
+ * The |uses_irt| flag indicates whether the IRT should be loaded in this
+ * NaCl process. This is true for ABI stable nexes.
*/
PP_NaClResult (*LaunchSelLdr)(PP_Instance instance,
const char* alleged_url,
+ PP_Bool uses_irt,
PP_Bool uses_ppapi,
PP_Bool enable_ppapi_dev,
void* imc_handle);
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 26507b1..d40e254 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
+++ b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
@@ -18,6 +18,7 @@
typedef PP_NaClResult (*LaunchNaClProcessFunc)(PP_Instance instance,
const char* alleged_url,
+ PP_Bool uses_irt,
PP_Bool uses_ppapi,
PP_Bool enable_ppapi_dev,
nacl::Handle* result_socket);
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 64c27c9..78de2fa 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -544,6 +544,7 @@ bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper,
NaClSubprocess* subprocess,
const Manifest* manifest,
bool should_report_uma,
+ bool uses_irt,
bool uses_ppapi,
ErrorInfo* error_info,
pp::CompletionCallback init_done_cb,
@@ -564,6 +565,7 @@ bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper,
new_service_runtime->Start(wrapper,
error_info,
manifest_base_url(),
+ uses_irt,
uses_ppapi,
enable_dev_interfaces_,
crash_cb);
@@ -586,6 +588,7 @@ bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
ShutDownSubprocesses();
if (!LoadNaClModuleCommon(wrapper, &main_subprocess_, manifest_.get(),
true /* should_report_uma */,
+ true /* uses_irt */,
true /* uses_ppapi */,
error_info, init_done_cb, crash_cb)) {
return false;
@@ -647,8 +650,13 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(nacl::DescWrapper* wrapper,
// Do not report UMA stats for translator-related nexes.
// TODO(sehr): define new UMA stats for translator related nexe events.
+ // NOTE: The PNaCl translator nexes are not built to use the IRT. This is
+ // done to save on address space and swap space. The PNaCl translator
+ // nexes also do not use PPAPI. That allows the nexes to be launched
+ // off of the main thread and not block the UI.
if (!LoadNaClModuleCommon(wrapper, nacl_subprocess.get(), manifest,
false /* should_report_uma */,
+ false /* uses_irt */,
false /* uses_ppapi */,
error_info,
pp::BlockUntilComplete(),
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index 08a436e..5d37595 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -350,6 +350,7 @@ class Plugin : public pp::InstancePrivate {
NaClSubprocess* subprocess,
const Manifest* manifest,
bool should_report_uma,
+ bool uses_irt,
bool uses_ppapi,
ErrorInfo* error_info,
pp::CompletionCallback init_done_cb,
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
index 0222558..b625dcd 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
@@ -11,11 +11,12 @@ LaunchNaClProcessFunc launch_nacl_process = NULL;
namespace plugin {
bool SelLdrLauncherChrome::Start(const char* url) {
- return Start(0, url, true, false);
+ return Start(0, url, true, true, false);
}
bool SelLdrLauncherChrome::Start(PP_Instance instance,
const char* url,
+ bool uses_irt,
bool uses_ppapi,
bool enable_ppapi_dev) {
if (!launch_nacl_process)
@@ -23,6 +24,7 @@ bool SelLdrLauncherChrome::Start(PP_Instance instance,
// send a synchronous message to the browser process
if (launch_nacl_process(instance,
url,
+ PP_FromBool(uses_irt),
PP_FromBool(uses_ppapi),
PP_FromBool(enable_ppapi_dev),
&channel_) != PP_NACL_OK) {
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
index 8f3e3d27..ebcd52f 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
@@ -15,6 +15,7 @@ class SelLdrLauncherChrome : public nacl::SelLdrLauncherBase {
virtual bool Start(const char* url);
virtual bool Start(PP_Instance instance,
const char* url,
+ bool uses_irt,
bool uses_ppapi,
bool enable_ppapi_dev);
};
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 320d989..3c38603 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -711,6 +711,7 @@ bool ServiceRuntime::InitCommunication(nacl::DescWrapper* nacl_desc,
bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc,
ErrorInfo* error_info,
const nacl::string& url,
+ bool uses_irt,
bool uses_ppapi,
bool enable_ppapi_dev,
pp::CompletionCallback crash_cb) {
@@ -727,6 +728,7 @@ bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc,
}
bool started = tmp_subprocess->Start(plugin_->pp_instance(),
url.c_str(),
+ uses_irt,
uses_ppapi,
enable_ppapi_dev);
if (!started) {
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h
index 8ff6e0b..4934d4f 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.h
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h
@@ -238,6 +238,7 @@ class ServiceRuntime {
bool Start(nacl::DescWrapper* nacl_file_desc,
ErrorInfo* error_info,
const nacl::string& url,
+ bool uses_irt,
bool uses_ppapi,
bool enable_ppapi_dev,
pp::CompletionCallback crash_cb);