0

Remove the NaCl SRPC proxy from Chrome.

Removes GYP targets for untrusted and trusted parts of the proxy (SRPC proxy
source files will be removed in a follow-on, to keep this patch manageable.)
Removes SRPC proxy startup code from NaCl trusted plugin.
Removes PPAPI PPP* interface adapters from the Plugin class.
Removes a bunch of GYP external dependency declarations that are no longer
needed.

TBR=brettw@chromium.org for OWNERS

BUG=169152
TEST=none


Review URL: https://chromiumcodereview.appspot.com/11783112

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177531 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
bbudge@chromium.org
2013-01-17 23:39:40 +00:00
parent b302556444
commit 7522077b67
19 changed files with 21 additions and 631 deletions

@@ -959,7 +959,6 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kEnableIPCFuzzing, switches::kEnableIPCFuzzing,
switches::kEnableInteractiveAutocomplete, switches::kEnableInteractiveAutocomplete,
switches::kEnableNaCl, switches::kEnableNaCl,
switches::kEnableNaClSRPCProxy,
switches::kEnablePasswordGeneration, switches::kEnablePasswordGeneration,
switches::kEnablePnacl, switches::kEnablePnacl,
switches::kEnableWatchdog, switches::kEnableWatchdog,

@@ -36,12 +36,7 @@ enum ValidationCacheStatus {
}; };
const FilePath::StringType NaClIrtName() { const FilePath::StringType NaClIrtName() {
FilePath::StringType irt_name; FilePath::StringType irt_name(FILE_PATH_LITERAL("nacl_irt_"));
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableNaClSRPCProxy))
irt_name.append(FILE_PATH_LITERAL("nacl_irt_srpc_"));
else
irt_name.append(FILE_PATH_LITERAL("nacl_irt_"));
#if defined(ARCH_CPU_X86_FAMILY) #if defined(ARCH_CPU_X86_FAMILY)
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)

@@ -168,7 +168,6 @@ NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
enable_debug_stub_(false), enable_debug_stub_(false),
uses_irt_(uses_irt), uses_irt_(uses_irt),
off_the_record_(off_the_record), off_the_record_(off_the_record),
enable_ipc_proxy_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)),
render_view_id_(render_view_id) { render_view_id_(render_view_id) {
process_.reset(content::BrowserChildProcessHost::Create( process_.reset(content::BrowserChildProcessHost::Create(
@@ -189,13 +188,6 @@ NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
} }
enable_debug_stub_ = CommandLine::ForCurrentProcess()->HasSwitch( enable_debug_stub_ = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableNaClDebug); switches::kEnableNaClDebug);
enable_ipc_proxy_ = !CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableNaClSRPCProxy);
// If render_view_id == 0 we do not need PPAPI, so we can skip
// PPAPI IPC proxy channel creation, etc.
if (!render_view_id_)
enable_ipc_proxy_ = false;
} }
NaClProcessHost::~NaClProcessHost() { NaClProcessHost::~NaClProcessHost() {
@@ -720,7 +712,8 @@ bool NaClProcessHost::StartNaClExecution() {
params.enable_exception_handling = enable_exception_handling_; params.enable_exception_handling = enable_exception_handling_;
params.enable_debug_stub = enable_debug_stub_ && params.enable_debug_stub = enable_debug_stub_ &&
NaClBrowser::GetInstance()->URLMatchesDebugPatterns(manifest_url_); NaClBrowser::GetInstance()->URLMatchesDebugPatterns(manifest_url_);
params.enable_ipc_proxy = enable_ipc_proxy_; // Enable PPAPI proxy channel creation only for renderer processes.
params.enable_ipc_proxy = enable_ppapi_proxy();
params.uses_irt = uses_irt_; params.uses_irt = uses_irt_;
const ChildProcessData& data = process_->GetData(); const ChildProcessData& data = process_->GetData();
@@ -779,7 +772,7 @@ bool NaClProcessHost::StartNaClExecution() {
} }
bool NaClProcessHost::SendStart() { bool NaClProcessHost::SendStart() {
if (!enable_ipc_proxy_) { if (!enable_ppapi_proxy()) {
if (!ReplyToRenderer(IPC::ChannelHandle())) if (!ReplyToRenderer(IPC::ChannelHandle()))
return false; return false;
} }
@@ -791,7 +784,8 @@ bool NaClProcessHost::SendStart() {
// listener. // listener.
void NaClProcessHost::OnPpapiChannelCreated( void NaClProcessHost::OnPpapiChannelCreated(
const IPC::ChannelHandle& channel_handle) { const IPC::ChannelHandle& channel_handle) {
DCHECK(enable_ipc_proxy_); // Only renderer processes should create a channel.
DCHECK(enable_ppapi_proxy());
// If the proxy channel is null, this must be the initial NaCl-Browser IPC // If the proxy channel is null, this must be the initial NaCl-Browser IPC
// channel. // channel.
if (!ipc_proxy_channel_.get()) { if (!ipc_proxy_channel_.get()) {

@@ -119,6 +119,9 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
void OnResourcesReady(); 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 // Sends the reply message to the renderer who is waiting for the plugin
// to load. Returns true on success. // to load. Returns true on success.
bool ReplyToRenderer(const IPC::ChannelHandle& channel_handle); bool ReplyToRenderer(const IPC::ChannelHandle& channel_handle);
@@ -199,8 +202,6 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
bool off_the_record_; bool off_the_record_;
bool enable_ipc_proxy_;
// Channel proxy to terminate the NaCl-Browser PPAPI channel. // Channel proxy to terminate the NaCl-Browser PPAPI channel.
scoped_ptr<IPC::ChannelProxy> ipc_proxy_channel_; scoped_ptr<IPC::ChannelProxy> ipc_proxy_channel_;
// Plugin listener, to forward browser channel messages to us. // Plugin listener, to forward browser channel messages to us.

@@ -570,10 +570,6 @@ const char kEnableNaClDebug[] = "enable-nacl-debug";
// if manifest URL does not match any pattern. // if manifest URL does not match any pattern.
const char kNaClDebugMask[] = "nacl-debug-mask"; const char kNaClDebugMask[] = "nacl-debug-mask";
// Enables the SRPC Proxy for NaCl. The default is the Chrome IPC based proxy.
// TODO(bbudge) remove this after we switch to IPC and remove SRPC.
const char kEnableNaClSRPCProxy[] = "enable-nacl-srpc-proxy";
// Enables hardware exception handling via debugger process. // Enables hardware exception handling via debugger process.
const char kEnableNaClExceptionHandling[] = "enable-nacl-exception-handling"; const char kEnableNaClExceptionHandling[] = "enable-nacl-exception-handling";

@@ -160,7 +160,6 @@ extern const char kEnableMetricsReportingForTesting[];
extern const char kEnableNaCl[]; extern const char kEnableNaCl[];
extern const char kEnableNaClDebug[]; extern const char kEnableNaClDebug[];
extern const char kEnableNaClExceptionHandling[]; extern const char kEnableNaClExceptionHandling[];
extern const char kEnableNaClSRPCProxy[];
extern const char kEnableNativeMessaging[]; extern const char kEnableNativeMessaging[];
extern const char kEnableNewAutofillHeuristics[]; extern const char kEnableNewAutofillHeuristics[];
extern const char kEnableNewAutofillUi[]; extern const char kEnableNewAutofillUi[];

@@ -26,7 +26,6 @@ void CopyNaClCommandLineArguments(CommandLine* cmd_line) {
switches::kSilentDumpOnDCHECK, switches::kSilentDumpOnDCHECK,
switches::kMemoryProfiling, switches::kMemoryProfiling,
switches::kNoErrorDialogs, switches::kNoErrorDialogs,
switches::kEnableNaClSRPCProxy,
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
switches::kEnableSandboxLogging, switches::kEnableSandboxLogging,
#endif #endif

@@ -81,7 +81,6 @@
['disable_nacl_untrusted==0', { ['disable_nacl_untrusted==0', {
'dependencies': [ 'dependencies': [
'../ppapi/native_client/native_client.gyp:nacl_irt', '../ppapi/native_client/native_client.gyp:nacl_irt',
'../ppapi/native_client/native_client.gyp:nacl_irt_srpc',
'../ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim', '../ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
'../ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp:pnacl_support_extension', '../ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp:pnacl_support_extension',
], ],

@@ -128,10 +128,6 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
} }
PP_NaClResult StartPpapiProxy(PP_Instance instance) { PP_NaClResult StartPpapiProxy(PP_Instance instance) {
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableNaClSRPCProxy))
return PP_NACL_USE_SRPC;
InstanceInfoMap& map = g_instance_info.Get(); InstanceInfoMap& map = g_instance_info.Get();
InstanceInfoMap::iterator it = map.find(instance); InstanceInfoMap::iterator it = map.find(instance);
if (it == map.end()) { if (it == map.end()) {

@@ -21,9 +21,7 @@ enum PP_NaClResult {
/** Error creating the module */ /** Error creating the module */
PP_NACL_ERROR_MODULE = 2, PP_NACL_ERROR_MODULE = 2,
/** Error creating and initializing the instance */ /** Error creating and initializing the instance */
PP_NACL_ERROR_INSTANCE = 3, PP_NACL_ERROR_INSTANCE = 3
/** SRPC proxy should be used instead */
PP_NACL_USE_SRPC = 128
}; };
/** NaCl-specific errors that should be reported to the user */ /** NaCl-specific errors that should be reported to the user */

@@ -3,7 +3,7 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
/* From private/ppb_nacl_private.idl modified Thu Jan 10 16:07:40 2013. */ /* From private/ppb_nacl_private.idl modified Thu Jan 10 15:59:03 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -38,9 +38,7 @@ typedef enum {
/** Error creating the module */ /** Error creating the module */
PP_NACL_ERROR_MODULE = 2, PP_NACL_ERROR_MODULE = 2,
/** Error creating and initializing the instance */ /** Error creating and initializing the instance */
PP_NACL_ERROR_INSTANCE = 3, PP_NACL_ERROR_INSTANCE = 3
/** SRPC proxy should be used instead */
PP_NACL_USE_SRPC = 128
} PP_NaClResult; } PP_NaClResult;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NaClResult, 4); PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NaClResult, 4);

@@ -70,156 +70,6 @@
}, },
], ],
}, },
{
'target_name': 'nacl_irt_srpc',
'type': 'none',
'variables': {
'nexe_target': 'nacl_irt_srpc',
# These out_* fields override the default filenames, which
# include a "_newlib" suffix.
'out_newlib64': '<(PRODUCT_DIR)/nacl_irt_srpc_x86_64.nexe',
'out_newlib32': '<(PRODUCT_DIR)/nacl_irt_srpc_x86_32.nexe',
'out_newlib_arm': '<(PRODUCT_DIR)/nacl_irt_srpc_arm.nexe',
'build_glibc': 0,
'build_newlib': 1,
'include_dirs': [
'lib/gl/include',
'..',
],
'link_flags': [
'-Wl,--start-group',
'-lirt_browser',
'-lppruntime',
'-lsrpc',
'-limc_syscalls',
'-lplatform',
'-lbase_untrusted',
'-lshared_memory_support_untrusted',
'-lgio',
'-Wl,--end-group',
'-lm',
],
# See http://code.google.com/p/nativeclient/issues/detail?id=2691.
# The PNaCl linker (gold) does not implement the "-Ttext-segment"
# option. However, with the linker for x86, the "-Ttext" option
# does not affect the executable's base address.
# TODO(olonho): simplify flags handling and avoid duplication
# with NaCl logic.
'conditions': [
['target_arch!="arm"',
{
'sources': [
],
'link_flags': [
'-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
'-Wl,-Ttext-segment=<(NACL_IRT_TEXT_START)',
]
}, { # target_arch == "arm"
# TODO(mcgrathr): This knowledge really belongs in
# native_client/src/untrusted/irt/irt.gyp instead of here.
# But that builds libirt_browser.a as bitcode, so a native
# object does not fit happily there.
'sources': [
'../../native_client/src/untrusted/irt/aeabi_read_tp.S',
],
'link_flags': [
'-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
'-Wl,-Ttext=<(NACL_IRT_TEXT_START)',
'--pnacl-allow-native',
'-arch', 'arm',
'-Wt,-mtls-use-call',
'-Wl,--pnacl-irt-link',
],
},
],
],
'extra_args': [
'--strip-debug',
],
# TODO(bradchen): get rid of extra_deps64 and extra_deps32
# once native_client/build/untrusted.gypi no longer needs them.
'extra_deps64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppruntime.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgio.a',
],
'extra_deps32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppruntime.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgio.a',
],
'extra_deps_newlib64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppruntime.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgio.a',
],
'extra_deps_newlib32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppruntime.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgio.a',
],
'extra_deps_glibc64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppruntime.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libgio.a',
],
'extra_deps_glibc32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppruntime.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libgio.a',
],
'extra_deps_arm': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppruntime.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libgio.a',
],
},
'dependencies': [
'src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp:ppruntime_lib',
'../../base/base_untrusted.gyp:base_untrusted',
'../../media/media_untrusted.gyp:shared_memory_support_untrusted',
'../../native_client/src/untrusted/irt/irt.gyp:irt_browser_lib',
'../../native_client/src/shared/srpc/srpc.gyp:srpc_lib',
'../../native_client/src/shared/platform/platform.gyp:platform_lib',
'../../native_client/src/untrusted/nacl/nacl.gyp:imc_syscalls_lib',
'../../native_client/src/shared/gio/gio.gyp:gio_lib',
],
},
{ {
'target_name': 'nacl_irt', 'target_name': 'nacl_irt',
'type': 'none', 'type': 'none',

@@ -40,10 +40,6 @@ bool NaClSubprocess::StartSrpcServices() {
return NULL != srpc_client_.get(); return NULL != srpc_client_.get();
} }
bool NaClSubprocess::StartJSObjectProxy(Plugin* plugin, ErrorInfo* error_info) {
return srpc_client_->StartJSObjectProxy(plugin, error_info);
}
bool NaClSubprocess::InvokeSrpcMethod(const nacl::string& method_name, bool NaClSubprocess::InvokeSrpcMethod(const nacl::string& method_name,
const nacl::string& input_signature, const nacl::string& input_signature,
SrpcParams* params, SrpcParams* params,

@@ -56,7 +56,6 @@ class NaClSubprocess {
// Start up interfaces. // Start up interfaces.
bool StartSrpcServices(); bool StartSrpcServices();
bool StartJSObjectProxy(Plugin* plugin, ErrorInfo* error_info);
// Invoke an Srpc Method. |out_params| must be allocated and cleaned up // Invoke an Srpc Method. |out_params| must be allocated and cleaned up
// outside of this function, but it will be initialized by this function, and // outside of this function, but it will be initialized by this function, and

@@ -30,7 +30,6 @@
#include "native_client/src/include/portability_io.h" #include "native_client/src/include/portability_io.h"
#include "native_client/src/include/portability_string.h" #include "native_client/src/include/portability_string.h"
#include "native_client/src/shared/platform/nacl_check.h" #include "native_client/src/shared/platform/nacl_check.h"
#include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
#include "native_client/src/trusted/desc/nacl_desc_wrapper.h" #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/nonnacl_util/sel_ldr_launcher.h"
#include "native_client/src/trusted/plugin/json_manifest.h" #include "native_client/src/trusted/plugin/json_manifest.h"
@@ -67,8 +66,6 @@
#include "ppapi/cpp/mouse_lock.h" #include "ppapi/cpp/mouse_lock.h"
#include "ppapi/cpp/rect.h" #include "ppapi/cpp/rect.h"
using ppapi_proxy::BrowserPpp;
namespace plugin { namespace plugin {
namespace { namespace {
@@ -240,193 +237,6 @@ void HistogramEnumerateManifestIsDataURI(bool is_data_uri) {
HistogramEnumerate("NaCl.Manifest.IsDataURI", is_data_uri, 2, -1); HistogramEnumerate("NaCl.Manifest.IsDataURI", is_data_uri, 2, -1);
} }
// Derive a class from pp::Find_Dev to forward PPP_Find_Dev calls to
// the plugin.
class FindAdapter : public pp::Find_Dev {
public:
explicit FindAdapter(Plugin* plugin)
: pp::Find_Dev(plugin),
plugin_(plugin) {
BrowserPpp* proxy = plugin_->ppapi_proxy();
CHECK(proxy != NULL);
ppp_find_ = static_cast<const PPP_Find_Dev*>(
proxy->GetPluginInterface(PPP_FIND_DEV_INTERFACE));
}
bool StartFind(const std::string& text, bool case_sensitive) {
if (ppp_find_ != NULL) {
PP_Bool pp_success =
ppp_find_->StartFind(plugin_->pp_instance(),
text.c_str(),
PP_FromBool(case_sensitive));
return pp_success == PP_TRUE;
}
return false;
}
void SelectFindResult(bool forward) {
if (ppp_find_ != NULL) {
ppp_find_->SelectFindResult(plugin_->pp_instance(),
PP_FromBool(forward));
}
}
void StopFind() {
if (ppp_find_ != NULL)
ppp_find_->StopFind(plugin_->pp_instance());
}
private:
Plugin* plugin_;
const PPP_Find_Dev* ppp_find_;
NACL_DISALLOW_COPY_AND_ASSIGN(FindAdapter);
};
// Derive a class from pp::MouseLock to forward PPP_MouseLock calls to
// the plugin.
class MouseLockAdapter : public pp::MouseLock {
public:
explicit MouseLockAdapter(Plugin* plugin)
: pp::MouseLock(plugin),
plugin_(plugin) {
BrowserPpp* proxy = plugin_->ppapi_proxy();
CHECK(proxy != NULL);
ppp_mouse_lock_ = static_cast<const PPP_MouseLock*>(
proxy->GetPluginInterface(PPP_MOUSELOCK_INTERFACE));
}
void MouseLockLost() {
if (ppp_mouse_lock_ != NULL)
ppp_mouse_lock_->MouseLockLost(plugin_->pp_instance());
}
private:
Plugin* plugin_;
const PPP_MouseLock* ppp_mouse_lock_;
NACL_DISALLOW_COPY_AND_ASSIGN(MouseLockAdapter);
};
// Derive a class from pp::Printing_Dev to forward PPP_Printing_Dev calls to
// the plugin.
class PrintingAdapter : public pp::Printing_Dev {
public:
explicit PrintingAdapter(Plugin* plugin)
: pp::Printing_Dev(plugin),
plugin_(plugin) {
BrowserPpp* proxy = plugin_->ppapi_proxy();
CHECK(proxy != NULL);
ppp_printing_ = static_cast<const PPP_Printing_Dev*>(
proxy->GetPluginInterface(PPP_PRINTING_DEV_INTERFACE));
}
uint32_t QuerySupportedPrintOutputFormats() {
if (ppp_printing_ != NULL) {
return ppp_printing_->QuerySupportedFormats(plugin_->pp_instance());
}
return 0;
}
int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) {
if (ppp_printing_ != NULL) {
return ppp_printing_->Begin(plugin_->pp_instance(), &print_settings);
}
return 0;
}
pp::Resource PrintPages(const PP_PrintPageNumberRange_Dev* page_ranges,
uint32_t page_range_count) {
if (ppp_printing_ != NULL) {
PP_Resource image_data = ppp_printing_->PrintPages(plugin_->pp_instance(),
page_ranges,
page_range_count);
return pp::ImageData(pp::PASS_REF, image_data);
}
return pp::Resource();
}
void PrintEnd() {
if (ppp_printing_ != NULL)
ppp_printing_->End(plugin_->pp_instance());
}
bool IsPrintScalingDisabled() {
if (ppp_printing_ != NULL) {
PP_Bool result = ppp_printing_->IsScalingDisabled(plugin_->pp_instance());
return result == PP_TRUE;
}
return false;
}
private:
Plugin* plugin_;
const PPP_Printing_Dev* ppp_printing_;
NACL_DISALLOW_COPY_AND_ASSIGN(PrintingAdapter);
};
// Derive a class from pp::Selection_Dev to forward PPP_Selection_Dev calls to
// the plugin.
class SelectionAdapter : public pp::Selection_Dev {
public:
explicit SelectionAdapter(Plugin* plugin)
: pp::Selection_Dev(plugin),
plugin_(plugin) {
BrowserPpp* proxy = plugin_->ppapi_proxy();
CHECK(proxy != NULL);
ppp_selection_ = static_cast<const PPP_Selection_Dev*>(
proxy->GetPluginInterface(PPP_SELECTION_DEV_INTERFACE));
}
pp::Var GetSelectedText(bool html) {
if (ppp_selection_ != NULL) {
PP_Var var = ppp_selection_->GetSelectedText(plugin_->pp_instance(),
PP_FromBool(html));
return pp::Var(pp::PASS_REF, var);
}
return pp::Var();
}
private:
Plugin* plugin_;
const PPP_Selection_Dev* ppp_selection_;
NACL_DISALLOW_COPY_AND_ASSIGN(SelectionAdapter);
};
// Derive a class from pp::Zoom_Dev to forward PPP_Zoom_Dev calls to
// the plugin.
class ZoomAdapter : public pp::Zoom_Dev {
public:
explicit ZoomAdapter(Plugin* plugin)
: pp::Zoom_Dev(plugin),
plugin_(plugin) {
BrowserPpp* proxy = plugin_->ppapi_proxy();
CHECK(proxy != NULL);
ppp_zoom_ = static_cast<const PPP_Zoom_Dev*>(
proxy->GetPluginInterface(PPP_ZOOM_DEV_INTERFACE));
}
void Zoom(double factor, bool text_only) {
if (ppp_zoom_ != NULL) {
ppp_zoom_->Zoom(plugin_->pp_instance(),
factor,
PP_FromBool(text_only));
}
}
private:
Plugin* plugin_;
const PPP_Zoom_Dev* ppp_zoom_;
NACL_DISALLOW_COPY_AND_ASSIGN(ZoomAdapter);
};
} // namespace } // namespace
static int const kAbiHeaderBuffer = 256; // must be at least EI_ABIVERSION + 1 static int const kAbiHeaderBuffer = 256; // must be at least EI_ABIVERSION + 1
@@ -608,7 +418,6 @@ bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) {
"could not initialize module."); "could not initialize module.");
return false; return false;
} }
// Try to start the Chrome IPC-based proxy first.
PP_NaClResult ipc_result = nacl_interface_->StartPpapiProxy(pp_instance()); PP_NaClResult ipc_result = nacl_interface_->StartPpapiProxy(pp_instance());
if (ipc_result == PP_NACL_OK) { if (ipc_result == PP_NACL_OK) {
// Log the amound of time that has passed between the trusted plugin being // Log the amound of time that has passed between the trusted plugin being
@@ -618,11 +427,6 @@ bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) {
"NaCl.Perf.StartupTime.NaClOverhead", "NaCl.Perf.StartupTime.NaClOverhead",
static_cast<float>(NaClGetTimeOfDayMicroseconds() - init_time_) static_cast<float>(NaClGetTimeOfDayMicroseconds() - init_time_)
/ NACL_MICROS_PER_MILLI); / NACL_MICROS_PER_MILLI);
} else if (ipc_result == PP_NACL_USE_SRPC) {
// Start the old SRPC PPAPI proxy.
if (!main_subprocess_.StartJSObjectProxy(this, error_info)) {
return false;
}
} else if (ipc_result == PP_NACL_ERROR_MODULE) { } else if (ipc_result == PP_NACL_ERROR_MODULE) {
error_info->SetReport(ERROR_START_PROXY_MODULE, error_info->SetReport(ERROR_START_PROXY_MODULE,
"could not initialize module."); "could not initialize module.");
@@ -856,7 +660,6 @@ Plugin::Plugin(PP_Instance pp_instance)
nexe_error_reported_(false), nexe_error_reported_(false),
wrapper_factory_(NULL), wrapper_factory_(NULL),
last_error_string_(""), last_error_string_(""),
ppapi_proxy_(NULL),
enable_dev_interfaces_(false), enable_dev_interfaces_(false),
init_time_(0), init_time_(0),
ready_time_(0), ready_time_(0),
@@ -880,9 +683,8 @@ Plugin::~Plugin() {
static_cast<void*>(scriptable_plugin()))); static_cast<void*>(scriptable_plugin())));
// Destroy the coordinator while the rest of the data is still there // Destroy the coordinator while the rest of the data is still there
pnacl_coordinator_.reset(NULL); pnacl_coordinator_.reset(NULL);
// If the proxy has been shutdown before now, it's likely the plugin suffered
// an error while loading. if (!nexe_error_reported()) {
if (ppapi_proxy_ != NULL) {
HistogramTimeLarge( HistogramTimeLarge(
"NaCl.ModuleUptime.Normal", "NaCl.ModuleUptime.Normal",
(shutdown_start - ready_time_) / NACL_MICROS_PER_MILLI); (shutdown_start - ready_time_) / NACL_MICROS_PER_MILLI);
@@ -890,7 +692,6 @@ Plugin::~Plugin() {
url_downloaders_.erase(url_downloaders_.begin(), url_downloaders_.end()); url_downloaders_.erase(url_downloaders_.begin(), url_downloaders_.end());
ShutdownProxy();
ScriptablePlugin* scriptable_plugin_ = scriptable_plugin(); ScriptablePlugin* scriptable_plugin_ = scriptable_plugin();
ScriptablePlugin::Unref(&scriptable_plugin_); ScriptablePlugin::Unref(&scriptable_plugin_);
@@ -933,75 +734,14 @@ Plugin::~Plugin() {
static_cast<void*>(this))); static_cast<void*>(this)));
} }
void Plugin::DidChangeView(const pp::View& view) {
PLUGIN_PRINTF(("Plugin::DidChangeView (this=%p)\n",
static_cast<void*>(this)));
if (!BrowserPpp::is_valid(ppapi_proxy_)) {
// Store this event and replay it when the proxy becomes available.
view_to_replay_ = view;
} else {
ppapi_proxy_->ppp_instance_interface()->DidChangeView(
pp_instance(), view.pp_resource());
}
}
void Plugin::DidChangeFocus(bool has_focus) {
PLUGIN_PRINTF(("Plugin::DidChangeFocus (this=%p)\n",
static_cast<void*>(this)));
if (BrowserPpp::is_valid(ppapi_proxy_)) {
ppapi_proxy_->ppp_instance_interface()->DidChangeFocus(
pp_instance(), PP_FromBool(has_focus));
}
}
bool Plugin::HandleInputEvent(const pp::InputEvent& event) {
PLUGIN_PRINTF(("Plugin::HandleInputEvent (this=%p)\n",
static_cast<void*>(this)));
if (!BrowserPpp::is_valid(ppapi_proxy_) ||
ppapi_proxy_->ppp_input_event_interface() == NULL) {
return false; // event is not handled here.
} else {
bool handled = PP_ToBool(
ppapi_proxy_->ppp_input_event_interface()->HandleInputEvent(
pp_instance(), event.pp_resource()));
PLUGIN_PRINTF(("Plugin::HandleInputEvent (handled=%d)\n", handled));
return handled;
}
}
bool Plugin::HandleDocumentLoad(const pp::URLLoader& url_loader) { bool Plugin::HandleDocumentLoad(const pp::URLLoader& url_loader) {
PLUGIN_PRINTF(("Plugin::HandleDocumentLoad (this=%p)\n", PLUGIN_PRINTF(("Plugin::HandleDocumentLoad (this=%p)\n",
static_cast<void*>(this))); static_cast<void*>(this)));
if (!BrowserPpp::is_valid(ppapi_proxy_)) { // We don't know if the plugin will handle the document load, but return
// Store this event and replay it when the proxy becomes available. // true in order to give it a chance to respond once the proxy is started.
document_load_to_replay_ = url_loader; return true;
// Return true so that the browser keeps servicing this loader so we can
// perform requests on it later.
return true;
} else {
return PP_ToBool(
ppapi_proxy_->ppp_instance_interface()->HandleDocumentLoad(
pp_instance(), url_loader.pp_resource()));
}
} }
void Plugin::HandleMessage(const pp::Var& message) {
PLUGIN_PRINTF(("Plugin::HandleMessage (this=%p)\n",
static_cast<void*>(this)));
if (BrowserPpp::is_valid(ppapi_proxy_) &&
ppapi_proxy_->ppp_messaging_interface() != NULL) {
ppapi_proxy_->ppp_messaging_interface()->HandleMessage(
pp_instance(), message.pp_var());
}
}
pp::Var Plugin::GetInstanceObject() { pp::Var Plugin::GetInstanceObject() {
PLUGIN_PRINTF(("Plugin::GetInstanceObject (this=%p)\n", PLUGIN_PRINTF(("Plugin::GetInstanceObject (this=%p)\n",
static_cast<void*>(this))); static_cast<void*>(this)));
@@ -1171,7 +911,7 @@ void Plugin::NexeDidCrash(int32_t pp_error) {
ErrorInfo error_info; ErrorInfo error_info;
// The error is not quite right. In particular, the crash // The error is not quite right. In particular, the crash
// reported by this path could be due to NaCl application // reported by this path could be due to NaCl application
// crashes that occur after the pepper proxy has started. // crashes that occur after the PPAPI proxy has started.
error_info.SetReport(ERROR_START_PROXY_CRASH, error_info.SetReport(ERROR_START_PROXY_CRASH,
"Nexe crashed during startup"); "Nexe crashed during startup");
ReportLoadError(error_info); ReportLoadError(error_info);
@@ -1230,103 +970,8 @@ void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) {
} }
} }
bool Plugin::StartProxiedExecution(NaClSrpcChannel* srpc_channel,
ErrorInfo* error_info) {
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (srpc_channel=%p)\n",
static_cast<void*>(srpc_channel)));
// Log the amound of time that has passed between the trusted plugin being
// initialized and the untrusted plugin being initialized. This is (roughly)
// the cost of using NaCl, in terms of startup time.
HistogramStartupTimeMedium(
"NaCl.Perf.StartupTime.NaClOverhead",
static_cast<float>(NaClGetTimeOfDayMicroseconds() - init_time_)
/ NACL_MICROS_PER_MILLI);
// Check that the .nexe exports the PPAPI intialization method.
NaClSrpcService* client_service = srpc_channel->client;
if (NaClSrpcServiceMethodIndex(client_service,
"PPP_InitializeModule:ihs:i") ==
kNaClSrpcInvalidMethodIndex) {
error_info->SetReport(
ERROR_START_PROXY_CHECK_PPP,
"could not find PPP_InitializeModule() - toolchain version mismatch?");
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (%s)\n",
error_info->message().c_str()));
return false;
}
nacl::scoped_ptr<BrowserPpp> ppapi_proxy(new BrowserPpp(srpc_channel, this));
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (ppapi_proxy=%p)\n",
static_cast<void*>(ppapi_proxy.get())));
if (ppapi_proxy.get() == NULL) {
error_info->SetReport(ERROR_START_PROXY_ALLOC,
"could not allocate proxy memory.");
return false;
}
pp::Module* module = pp::Module::Get();
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (module=%p)\n",
static_cast<void*>(module)));
CHECK(module != NULL); // We could not have gotten past init stage otherwise.
int32_t pp_error =
ppapi_proxy->InitializeModule(module->pp_module(),
module->get_browser_interface());
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (pp_error=%"
NACL_PRId32")\n", pp_error));
if (pp_error != PP_OK) {
error_info->SetReport(ERROR_START_PROXY_MODULE,
"could not initialize module.");
return false;
}
const PPP_Instance* instance_interface =
ppapi_proxy->ppp_instance_interface();
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (ppp_instance=%p)\n",
static_cast<const void*>(instance_interface)));
CHECK(instance_interface != NULL); // Verified on module initialization.
PP_Bool did_create = instance_interface->DidCreate(
pp_instance(),
argc(),
const_cast<const char**>(argn()),
const_cast<const char**>(argv()));
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (did_create=%d)\n",
did_create));
if (did_create == PP_FALSE) {
error_info->SetReport(ERROR_START_PROXY_INSTANCE,
"could not create instance.");
return false;
}
ppapi_proxy_ = ppapi_proxy.release();
// Create PPP* interface adapters to forward calls to .nexe.
find_adapter_.reset(new FindAdapter(this));
mouse_lock_adapter_.reset(new MouseLockAdapter(this));
printing_adapter_.reset(new PrintingAdapter(this));
selection_adapter_.reset(new SelectionAdapter(this));
zoom_adapter_.reset(new ZoomAdapter(this));
// Replay missed events.
if (!view_to_replay_.is_null()) {
DidChangeView(view_to_replay_);
view_to_replay_ = pp::View();
}
if (!document_load_to_replay_.is_null()) {
HandleDocumentLoad(document_load_to_replay_);
document_load_to_replay_ = pp::URLLoader();
}
bool is_valid_proxy = BrowserPpp::is_valid(ppapi_proxy_);
PLUGIN_PRINTF(("Plugin::StartProxiedExecution (is_valid_proxy=%d)\n",
is_valid_proxy));
if (!is_valid_proxy) {
error_info->SetReport(ERROR_START_PROXY_CRASH,
"instance crashed after creation.");
}
return is_valid_proxy;
}
void Plugin::ReportDeadNexe() { void Plugin::ReportDeadNexe() {
PLUGIN_PRINTF(("Plugin::ReportDeadNexe\n")); PLUGIN_PRINTF(("Plugin::ReportDeadNexe\n"));
if (ppapi_proxy_ != NULL)
ppapi_proxy_->ReportDeadNexe();
if (nacl_ready_state() == DONE && !nexe_error_reported()) { // After loadEnd. if (nacl_ready_state() == DONE && !nexe_error_reported()) { // After loadEnd.
int64_t crash_time = NaClGetTimeOfDayMicroseconds(); int64_t crash_time = NaClGetTimeOfDayMicroseconds();
@@ -1342,30 +987,15 @@ void Plugin::ReportDeadNexe() {
EnqueueProgressEvent(kProgressEventCrash); EnqueueProgressEvent(kProgressEventCrash);
set_nexe_error_reported(true); set_nexe_error_reported(true);
CHECK(ppapi_proxy_ == NULL || !ppapi_proxy_->is_valid());
ShutdownProxy();
} }
// else ReportLoadError() and ReportAbortError() will be used by loading code // else ReportLoadError() and ReportAbortError() will be used by loading code
// to provide error handling and proxy shutdown. // to provide error handling.
// //
// NOTE: not all crashes during load will make it here. // NOTE: not all crashes during load will make it here.
// Those in BrowserPpp::InitializeModule and creation of PPP interfaces // Those in BrowserPpp::InitializeModule and creation of PPP interfaces
// will just get reported back as PP_ERROR_FAILED. // will just get reported back as PP_ERROR_FAILED.
} }
void Plugin::ShutdownProxy() {
PLUGIN_PRINTF(("Plugin::ShutdownProxy (ppapi_proxy=%p)\n",
static_cast<void*>(ppapi_proxy_)));
// We do not call remote PPP_Instance::DidDestroy because the untrusted
// side can no longer take full advantage of mostly asynchronous Pepper
// per-Instance interfaces at this point.
if (ppapi_proxy_ != NULL) {
ppapi_proxy_->ShutdownModule();
delete ppapi_proxy_;
ppapi_proxy_ = NULL;
}
}
void Plugin::NaClManifestBufferReady(int32_t pp_error) { void Plugin::NaClManifestBufferReady(int32_t pp_error) {
PLUGIN_PRINTF(("Plugin::NaClManifestBufferReady (pp_error=%" PLUGIN_PRINTF(("Plugin::NaClManifestBufferReady (pp_error=%"
NACL_PRId32")\n", pp_error)); NACL_PRId32")\n", pp_error));
@@ -1708,7 +1338,6 @@ void Plugin::ReportLoadError(const ErrorInfo& error_info) {
error_info.message(); error_info.message();
set_last_error_string(message); set_last_error_string(message);
AddToConsole(message); AddToConsole(message);
ShutdownProxy();
// Inform JavaScript that loading encountered an error and is complete. // Inform JavaScript that loading encountered an error and is complete.
EnqueueProgressEvent(kProgressEventError); EnqueueProgressEvent(kProgressEventError);
EnqueueProgressEvent(kProgressEventLoadEnd); EnqueueProgressEvent(kProgressEventLoadEnd);
@@ -1727,7 +1356,6 @@ void Plugin::ReportLoadAbort() {
nacl::string error_string("NaCl module load failed: user aborted"); nacl::string error_string("NaCl module load failed: user aborted");
set_last_error_string(error_string); set_last_error_string(error_string);
AddToConsole(error_string); AddToConsole(error_string);
ShutdownProxy();
// Inform JavaScript that loading was aborted and is complete. // Inform JavaScript that loading was aborted and is complete.
EnqueueProgressEvent(kProgressEventAbort); EnqueueProgressEvent(kProgressEventAbort);
EnqueueProgressEvent(kProgressEventLoadEnd); EnqueueProgressEvent(kProgressEventLoadEnd);

@@ -74,7 +74,6 @@
'<(DEPTH)/native_client/src/trusted/simple_service/simple_service.gyp:simple_service', '<(DEPTH)/native_client/src/trusted/simple_service/simple_service.gyp:simple_service',
'<(DEPTH)/native_client/src/trusted/reverse_service/reverse_service.gyp:reverse_service', '<(DEPTH)/native_client/src/trusted/reverse_service/reverse_service.gyp:reverse_service',
'<(DEPTH)/native_client/src/trusted/weak_ref/weak_ref.gyp:weak_ref', '<(DEPTH)/native_client/src/trusted/weak_ref/weak_ref.gyp:weak_ref',
'<(DEPTH)/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy.gyp:nacl_ppapi_browser',
'<(DEPTH)/ppapi/ppapi.gyp:ppapi_cpp', '<(DEPTH)/ppapi/ppapi.gyp:ppapi_cpp',
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp', '<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
], ],

@@ -74,25 +74,13 @@ class Plugin : public pp::InstancePrivate {
// Gets called by the browser right after New(). // Gets called by the browser right after New().
virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]);
// Handles view changes from the browser. // Handles document load, when the plugin is a MIME type handler.
virtual void DidChangeView(const pp::View& view);
// Handles gaining or losing focus.
virtual void DidChangeFocus(bool has_focus);
// Handles input events delivered from the browser to this plugin element.
virtual bool HandleInputEvent(const pp::InputEvent& event);
// Handles gaining or losing focus.
virtual bool HandleDocumentLoad(const pp::URLLoader& url_loader); virtual bool HandleDocumentLoad(const pp::URLLoader& url_loader);
// Returns a scriptable reference to this plugin element. // Returns a scriptable reference to this plugin element.
// Called by JavaScript document.getElementById(plugin_id). // Called by JavaScript document.getElementById(plugin_id).
virtual pp::Var GetInstanceObject(); virtual pp::Var GetInstanceObject();
// Handles postMessage from browser
virtual void HandleMessage(const pp::Var& message);
// ----- Plugin interface support. // ----- Plugin interface support.
// Load support. // Load support.
@@ -103,12 +91,7 @@ class Plugin : public pp::InstancePrivate {
// done. The module will become ready later, asynchronously. Other // done. The module will become ready later, asynchronously. Other
// event handlers should block until the module is ready before // event handlers should block until the module is ready before
// trying to communicate with it, i.e., until nacl_ready_state is // trying to communicate with it, i.e., until nacl_ready_state is
// DONE. Note, however, we already have another mechanism that // DONE.
// prevents event delivery: StartJSObjectProxy plumbs through
// NaClSubprocess to SrpcClient which upcalls
// Plugin::StartProxiedExecution, which sets ppapi_proxy_. And NULL
// == ppapi_proxy_ prevents events from being delivered, even if
// nacl_ready_state is DONE.
// //
// NB: currently we do not time out, so if the untrusted code // NB: currently we do not time out, so if the untrusted code
// does not signal that it is ready, then we will deadlock the main // does not signal that it is ready, then we will deadlock the main
@@ -244,18 +227,6 @@ class Plugin : public pp::InstancePrivate {
// Requests a NaCl manifest download from a |url| relative to the page origin. // Requests a NaCl manifest download from a |url| relative to the page origin.
void RequestNaClManifest(const nacl::string& url); void RequestNaClManifest(const nacl::string& url);
// Start up proxied execution of the browser API.
//
// NB: this is currently invoked from the main thread. If we ever
// move it off the main thread (eliminate the possibility of a
// malicious nexe that isn't linked against / doesn't use our
// ppapi_proxy code that blocks the main thread on the RPCs used
// here), then we will need to take care to ensure that the error
// and crash reporting state machine (see NexeDidCrash comment)
// continues to work.
bool StartProxiedExecution(NaClSrpcChannel* srpc_channel,
ErrorInfo* error_info);
// Support for property getting. // Support for property getting.
typedef void (Plugin::* PropertyGetter)(NaClSrpcArg* prop_value); typedef void (Plugin::* PropertyGetter)(NaClSrpcArg* prop_value);
void AddPropertyGet(const nacl::string& prop_name, PropertyGetter getter); void AddPropertyGet(const nacl::string& prop_name, PropertyGetter getter);
@@ -271,9 +242,6 @@ class Plugin : public pp::InstancePrivate {
// sizes return 0. // sizes return 0.
static const uint64_t kUnknownBytes = 0; static const uint64_t kUnknownBytes = 0;
// Getter for PPAPI proxy interface.
ppapi_proxy::BrowserPpp* ppapi_proxy() const { return ppapi_proxy_; }
// Called back by CallOnMainThread. Dispatches the first enqueued progress // Called back by CallOnMainThread. Dispatches the first enqueued progress
// event. // event.
void DispatchProgressEvent(int32_t result); void DispatchProgressEvent(int32_t result);
@@ -420,9 +388,6 @@ class Plugin : public pp::InstancePrivate {
FileDownloader*& url_downloader, FileDownloader*& url_downloader,
PP_CompletionCallback pp_callback); PP_CompletionCallback pp_callback);
// Shuts down the proxy for PPAPI nexes.
void ShutdownProxy(); // Nexe shutdown + proxy deletion.
// Copy the main service runtime's most recent NaClLog output to the // Copy the main service runtime's most recent NaClLog output to the
// JavaScript console. Valid to use only after a crash, e.g., via a // JavaScript console. Valid to use only after a crash, e.g., via a
// detail level LOG_FATAL NaClLog entry. If the crash was not due // detail level LOG_FATAL NaClLog entry. If the crash was not due
@@ -468,12 +433,6 @@ class Plugin : public pp::InstancePrivate {
// produced by this plugin. // produced by this plugin.
nacl::string last_error_string_; nacl::string last_error_string_;
// A pointer to the browser end of a proxy pattern connecting the
// NaCl plugin to the PPAPI .nexe's PPP interface
// (InitializeModule, Shutdown, and GetInterface).
// TODO(sehr): this should be a scoped_ptr for shutdown.
ppapi_proxy::BrowserPpp* ppapi_proxy_;
// PPAPI Dev interfaces are disabled by default. // PPAPI Dev interfaces are disabled by default.
bool enable_dev_interfaces_; bool enable_dev_interfaces_;
@@ -498,14 +457,6 @@ class Plugin : public pp::InstancePrivate {
// Pending progress events. // Pending progress events.
std::queue<ProgressEvent*> progress_events_; std::queue<ProgressEvent*> progress_events_;
// Adapter class constructors require a reference to 'this', so we can't
// contain them directly.
nacl::scoped_ptr<pp::Find_Dev> find_adapter_;
nacl::scoped_ptr<pp::MouseLock> mouse_lock_adapter_;
nacl::scoped_ptr<pp::Printing_Dev> printing_adapter_;
nacl::scoped_ptr<pp::Selection_Dev> selection_adapter_;
nacl::scoped_ptr<pp::Zoom_Dev> zoom_adapter_;
// Used for NexeFileDidOpenContinuation // Used for NexeFileDidOpenContinuation
int64_t load_start_; int64_t load_start_;

@@ -104,12 +104,6 @@ SrpcClient::~SrpcClient() {
PLUGIN_PRINTF(("SrpcClient::~SrpcClient (return)\n")); PLUGIN_PRINTF(("SrpcClient::~SrpcClient (return)\n"));
} }
bool SrpcClient::StartJSObjectProxy(Plugin* plugin, ErrorInfo *error_info) {
// Start up PPAPI interaction if the plugin determines that the
// requisite methods are exported.
return plugin->StartProxiedExecution(&srpc_channel_, error_info);
}
void SrpcClient::GetMethods() { void SrpcClient::GetMethods() {
PLUGIN_PRINTF(("SrpcClient::GetMethods (this=%p)\n", PLUGIN_PRINTF(("SrpcClient::GetMethods (this=%p)\n",
static_cast<void*>(this))); static_cast<void*>(this)));

@@ -40,7 +40,6 @@ class SrpcClient {
// The destructor closes the connection to sel_ldr. // The destructor closes the connection to sel_ldr.
~SrpcClient(); ~SrpcClient();
bool StartJSObjectProxy(Plugin* plugin, ErrorInfo* error_info);
// Test whether the SRPC service has a given method. // Test whether the SRPC service has a given method.
bool HasMethod(const nacl::string& method_name); bool HasMethod(const nacl::string& method_name);
// Invoke an SRPC method. // Invoke an SRPC method.