diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-14 00:57:39 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-14 00:57:39 +0000 |
commit | 6254de6cd41eb3b61d7f4a013ccbc3e6f091e8bb (patch) | |
tree | e0ad1a6cbcd3ebc89766a45776fa148d3f0ba323 /webkit/plugins/ppapi | |
parent | daede9b9ac8afb19cabb530028b154d7561e0b85 (diff) | |
download | chromium_src-6254de6cd41eb3b61d7f4a013ccbc3e6f091e8bb.zip chromium_src-6254de6cd41eb3b61d7f4a013ccbc3e6f091e8bb.tar.gz chromium_src-6254de6cd41eb3b61d7f4a013ccbc3e6f091e8bb.tar.bz2 |
Improve NaCl startup error reporting in plugin and IPC proxy.
BUG=116317
TEST=nacl_integration
Review URL: https://chromiumcodereview.appspot.com/11415142
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi')
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.cc | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.h | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 14 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.h | 3 |
4 files changed, 18 insertions, 11 deletions
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index a14b766..046140d 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -505,17 +505,17 @@ scoped_refptr<PluginModule> PluginModule::CreateModuleForNaClInstance() { return nacl_module; } -bool PluginModule::InitAsProxiedNaCl(PluginInstance* plugin_instance) { +PP_NaClResult PluginModule::InitAsProxiedNaCl(PluginInstance* instance) { DCHECK(out_of_process_proxy_.get()); // InitAsProxied (for the trusted/out-of-process case) initializes only the // module, and one or more instances are added later. In this case, the // PluginInstance was already created as in-process, so we missed the proxy // AddInstance step and must do it now. - out_of_process_proxy_->AddInstance(plugin_instance->pp_instance()); + out_of_process_proxy_->AddInstance(instance->pp_instance()); // In NaCl, we need to tell the instance to reset itself as proxied. This will // clear cached interface pointers and send DidCreate (etc) to the plugin // side of the proxy. - return plugin_instance->ResetAsProxied(this); + return instance->ResetAsProxied(this); } bool PluginModule::IsProxied() const { diff --git a/webkit/plugins/ppapi/plugin_module.h b/webkit/plugins/ppapi/plugin_module.h index 5af4fde..bf417d6 100644 --- a/webkit/plugins/ppapi/plugin_module.h +++ b/webkit/plugins/ppapi/plugin_module.h @@ -21,6 +21,7 @@ #include "ppapi/c/pp_module.h" #include "ppapi/c/ppb.h" #include "ppapi/c/ppb_core.h" +#include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/shared_impl/ppapi_permissions.h" #include "webkit/plugins/ppapi/plugin_delegate.h" #include "webkit/plugins/webkit_plugins_export.h" @@ -115,8 +116,9 @@ class WEBKIT_PLUGINS_EXPORT PluginModule : scoped_refptr<PluginModule> CreateModuleForNaClInstance(); // Initializes the NaCl module for the out of process proxy. InitAsProxied - // must be called before calling InitAsProxiedNaCl. Returns true on success. - bool InitAsProxiedNaCl(PluginInstance* instance); + // must be called before calling InitAsProxiedNaCl. Returns a NaCl result code + // indicating whether the proxy started successfully or there was an error. + PP_NaClResult InitAsProxiedNaCl(PluginInstance* instance); bool IsProxied() const; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index f7d52ae..71099a6 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -2386,7 +2386,8 @@ PP_Var PluginInstance::GetPluginInstanceURL( components); } -bool PluginInstance::ResetAsProxied(scoped_refptr<PluginModule> module) { +PP_NaClResult PluginInstance::ResetAsProxied( + scoped_refptr<PluginModule> module) { // Save the original module and switch over to the new one now that this // plugin is using the IPC-based proxy. original_module_ = module_; @@ -2405,9 +2406,12 @@ bool PluginInstance::ResetAsProxied(scoped_refptr<PluginModule> module) { PPP_Instance_Combined::Create(get_plugin_interface_func); if (!ppp_instance_combined) { // The proxy must support at least one usable PPP_Instance interface. - // Don't assert; some tests exercise this path. - return false; + // While this could be a failure to implement the interface in the NaCl + // module, it is more likely that the NaCl process has crashed. Either + // way, report that module initialization failed. + return PP_NACL_ERROR_MODULE; } + instance_interface_.reset(ppp_instance_combined); // Clear all PPP interfaces we may have cached. plugin_find_interface_ = NULL; @@ -2428,7 +2432,7 @@ bool PluginInstance::ResetAsProxied(scoped_refptr<PluginModule> module) { scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); if (!instance_interface_->DidCreate(pp_instance(), argn_.size(), argn_array.get(), argv_array.get())) - return false; + return PP_NACL_ERROR_INSTANCE; message_channel_->StopQueueingJavaScriptMessages(); // Clear sent_initial_did_change_view_ and cancel any pending DidChangeView @@ -2441,7 +2445,7 @@ bool PluginInstance::ResetAsProxied(scoped_refptr<PluginModule> module) { // If we received HandleDocumentLoad, re-send it now via the proxy. if (document_loader_) HandleDocumentLoad(document_loader_.get()); - return true; + return PP_NACL_OK; } void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index 79dea73..3abb4b1 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -35,6 +35,7 @@ #include "ppapi/c/ppp_messaging.h" #include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/ppb_content_decryptor_private.h" +#include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/c/private/ppp_instance_private.h" #include "ppapi/shared_impl/ppb_instance_shared.h" #include "ppapi/shared_impl/ppb_view_shared.h" @@ -455,7 +456,7 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if // necessary). // This is for use with the NaCl proxy. - bool ResetAsProxied(scoped_refptr<PluginModule> module); + PP_NaClResult ResetAsProxied(scoped_refptr<PluginModule> module); private: friend class PpapiUnittest; |