diff options
author | mseaborn <mseaborn@chromium.org> | 2015-12-14 12:37:25 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-14 20:38:57 +0000 |
commit | 3bfa470fe7a8d7de73dde508d0446b790fe8284a (patch) | |
tree | 682ea0d95c45013238c00c2bd575e66d6b802fee | |
parent | bf32c2a4380e5dc0a17ee24255723f2f11754f04 (diff) | |
download | chromium_src-3bfa470fe7a8d7de73dde508d0446b790fe8284a.zip chromium_src-3bfa470fe7a8d7de73dde508d0446b790fe8284a.tar.gz chromium_src-3bfa470fe7a8d7de73dde508d0446b790fe8284a.tar.bz2 |
NaCl: Remove enable_ipc_proxy and enable_ppapi_proxy, which are always true
enable_ppapi_proxy() always returns true, because render_view_id_ is
always non-zero. As a result, we can simplify some code by removing
some misleading conditionals.
Some background: The "enable_ipc_proxy" flag was originally introduced
when NaCl was switching from the SRPC-based PPAPI proxy to the
Chrome-IPC-based PPAPI proxy.
The SRPC-based proxy is long since gone. I think the
"enable_ipc_proxy" flag stuck around because there was some intent
that the PPAPI proxy (and its IPC channels) should not be enabled for
PNaCl translator processes. However, StartPPAPIProxy() *is* being run
for PNaCl translator processes, so this intent is not realised. This
might not be ideal, but it seems to work OK.
BUG=302078
TEST=e.g. NaClBrowserTestPnacl.PPAPICore
Review URL: https://codereview.chromium.org/1515523006
Cr-Commit-Position: refs/heads/master@{#365091}
-rw-r--r-- | components/nacl/browser/nacl_process_host.cc | 27 | ||||
-rw-r--r-- | components/nacl/browser/nacl_process_host.h | 3 | ||||
-rw-r--r-- | components/nacl/common/nacl_messages.h | 1 | ||||
-rw-r--r-- | components/nacl/common/nacl_types.cc | 1 | ||||
-rw-r--r-- | components/nacl/common/nacl_types.h | 1 | ||||
-rw-r--r-- | components/nacl/loader/nacl_listener.cc | 49 | ||||
-rw-r--r-- | components/nacl/loader/nonsfi/nonsfi_listener.cc | 3 |
7 files changed, 26 insertions, 59 deletions
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc index 5b6cb44..06c3c78 100644 --- a/components/nacl/browser/nacl_process_host.cc +++ b/components/nacl/browser/nacl_process_host.cc @@ -493,13 +493,6 @@ void NaClProcessHost::Launch( delete this; return; } - - if (!enable_ppapi_proxy()) { - SendErrorToRenderer( - "PPAPI proxy must be enabled on NaCl in Non-SFI mode."); - delete this; - return; - } } else { // Rather than creating a socket pair in the renderer, and passing // one side through the browser to sel_ldr, socket pairs are created @@ -900,8 +893,6 @@ bool NaClProcessHost::StartNaClExecution() { NaClStartParams params; - // Enable PPAPI proxy channel creation only for renderer processes. - params.enable_ipc_proxy = enable_ppapi_proxy(); params.process_type = process_type_; bool enable_nacl_debug = enable_debug_stub_ && NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_); @@ -1061,9 +1052,6 @@ void NaClProcessHost::StartNaClFileResolved( // process will exit properly. bool has_error = false; - // Note: this check is redundant. We check this earlier. - DCHECK(params.enable_ipc_proxy); - ScopedChannelHandle ppapi_browser_server_channel_handle; ScopedChannelHandle ppapi_browser_client_channel_handle; ScopedChannelHandle ppapi_renderer_server_channel_handle; @@ -1207,18 +1195,9 @@ void NaClProcessHost::OnPpapiChannelsCreated( ScopedChannelHandle manifest_service_channel_handle( raw_manifest_service_channel_handle); - if (enable_ppapi_proxy()) { - if (!StartPPAPIProxy(ppapi_browser_channel_handle.Pass())) { - SendErrorToRenderer("Browser PPAPI proxy could not start."); - return; - } - } else { - // If PPAPI proxy is disabled, channel handles should be invalid. - DCHECK(ppapi_browser_channel_handle.get().name.empty()); - DCHECK(ppapi_renderer_channel_handle.get().name.empty()); - // Invalidate, just in case. - ppapi_browser_channel_handle.reset(); - ppapi_renderer_channel_handle.reset(); + if (!StartPPAPIProxy(ppapi_browser_channel_handle.Pass())) { + SendErrorToRenderer("Browser PPAPI proxy could not start."); + return; } // Let the renderer know that the IPC channels are established. diff --git a/components/nacl/browser/nacl_process_host.h b/components/nacl/browser/nacl_process_host.h index 80e2a0a..7580f21 100644 --- a/components/nacl/browser/nacl_process_host.h +++ b/components/nacl/browser/nacl_process_host.h @@ -139,9 +139,6 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate { void OnResourcesReady(); - // Enable the PPAPI proxy only for NaCl processes corresponding to a renderer. - bool enable_ppapi_proxy() { return render_view_id_ != 0; } - // Sends the reply message to the renderer who is waiting for the plugin // to load. Returns true on success. void ReplyToRenderer( diff --git a/components/nacl/common/nacl_messages.h b/components/nacl/common/nacl_messages.h index aed918d..2e3ce62 100644 --- a/components/nacl/common/nacl_messages.h +++ b/components/nacl/common/nacl_messages.h @@ -35,7 +35,6 @@ IPC_STRUCT_TRAITS_BEGIN(nacl::NaClStartParams) IPC_STRUCT_TRAITS_MEMBER(validation_cache_key) IPC_STRUCT_TRAITS_MEMBER(version) IPC_STRUCT_TRAITS_MEMBER(enable_debug_stub) - IPC_STRUCT_TRAITS_MEMBER(enable_ipc_proxy) IPC_STRUCT_TRAITS_MEMBER(process_type) IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle) IPC_STRUCT_TRAITS_END() diff --git a/components/nacl/common/nacl_types.cc b/components/nacl/common/nacl_types.cc index 1273ec6..9667af6 100644 --- a/components/nacl/common/nacl_types.cc +++ b/components/nacl/common/nacl_types.cc @@ -19,7 +19,6 @@ NaClStartParams::NaClStartParams() #endif validation_cache_enabled(false), enable_debug_stub(false), - enable_ipc_proxy(false), process_type(kUnknownNaClProcessType), crash_info_shmem_handle(base::SharedMemory::NULLHandle()) { } diff --git a/components/nacl/common/nacl_types.h b/components/nacl/common/nacl_types.h index 32d4c0c..8e4fe87 100644 --- a/components/nacl/common/nacl_types.h +++ b/components/nacl/common/nacl_types.h @@ -101,7 +101,6 @@ struct NaClStartParams { std::string version; bool enable_debug_stub; - bool enable_ipc_proxy; NaClAppProcessType process_type; diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc index d6f8849..329dc9c 100644 --- a/components/nacl/loader/nacl_listener.cc +++ b/components/nacl/loader/nacl_listener.cc @@ -350,32 +350,29 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { LOG(FATAL) << "NaClAppCreate() failed"; } - IPC::ChannelHandle browser_handle; - IPC::ChannelHandle ppapi_renderer_handle; - IPC::ChannelHandle manifest_service_handle; - - if (params.enable_ipc_proxy) { - browser_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); - ppapi_renderer_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); - manifest_service_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); - - // Create the PPAPI IPC channels between the NaCl IRT and the host - // (browser/renderer) processes. The IRT uses these channels to - // communicate with the host and to initialize the IPC dispatchers. - SetUpIPCAdapter(&browser_handle, io_thread_.task_runner(), nap, - NACL_CHROME_DESC_BASE, - NaClIPCAdapter::ResolveFileTokenCallback(), - NaClIPCAdapter::OpenResourceCallback()); - SetUpIPCAdapter(&ppapi_renderer_handle, io_thread_.task_runner(), nap, - NACL_CHROME_DESC_BASE + 1, - NaClIPCAdapter::ResolveFileTokenCallback(), - NaClIPCAdapter::OpenResourceCallback()); - SetUpIPCAdapter( - &manifest_service_handle, io_thread_.task_runner(), nap, - NACL_CHROME_DESC_BASE + 2, - base::Bind(&NaClListener::ResolveFileToken, base::Unretained(this)), - base::Bind(&NaClListener::OnOpenResource, base::Unretained(this))); - } + IPC::ChannelHandle browser_handle = + IPC::Channel::GenerateVerifiedChannelID("nacl"); + IPC::ChannelHandle ppapi_renderer_handle = + IPC::Channel::GenerateVerifiedChannelID("nacl"); + IPC::ChannelHandle manifest_service_handle = + IPC::Channel::GenerateVerifiedChannelID("nacl"); + + // Create the PPAPI IPC channels between the NaCl IRT and the host + // (browser/renderer) processes. The IRT uses these channels to + // communicate with the host and to initialize the IPC dispatchers. + SetUpIPCAdapter(&browser_handle, io_thread_.task_runner(), nap, + NACL_CHROME_DESC_BASE, + NaClIPCAdapter::ResolveFileTokenCallback(), + NaClIPCAdapter::OpenResourceCallback()); + SetUpIPCAdapter(&ppapi_renderer_handle, io_thread_.task_runner(), nap, + NACL_CHROME_DESC_BASE + 1, + NaClIPCAdapter::ResolveFileTokenCallback(), + NaClIPCAdapter::OpenResourceCallback()); + SetUpIPCAdapter( + &manifest_service_handle, io_thread_.task_runner(), nap, + NACL_CHROME_DESC_BASE + 2, + base::Bind(&NaClListener::ResolveFileToken, base::Unretained(this)), + base::Bind(&NaClListener::OnOpenResource, base::Unretained(this))); trusted_listener_ = new NaClTrustedListener(IPC::Channel::GenerateVerifiedChannelID("nacl"), diff --git a/components/nacl/loader/nonsfi/nonsfi_listener.cc b/components/nacl/loader/nonsfi/nonsfi_listener.cc index 5d2ed0c..feb84a9 100644 --- a/components/nacl/loader/nonsfi/nonsfi_listener.cc +++ b/components/nacl/loader/nonsfi/nonsfi_listener.cc @@ -77,9 +77,6 @@ void NonSfiListener::OnStart(const nacl::NaClStartParams& params) { // Random number source initialization. nonsfi_set_urandom_fd(base::GetUrandomFD()); - // In Non-SFI mode, PPAPI proxy must be enabled. - CHECK(params.enable_ipc_proxy); - // In Non-SFI mode, we neither intercept nor rewrite the message using // NaClIPCAdapter, and the channels are connected between the plugin and // the hosts directly. So, the IPC::Channel instances will be created in |