diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 19:49:35 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 19:49:35 +0000 |
commit | 91240c947358b33cc19c0923a06d116ab36737dd (patch) | |
tree | 7897c99ad9b41d7735c7a42e0ea75fe6f76760b3 /o3d/plugin/npapi_host_control | |
parent | 2e25a9f4152a90a179ad37206bff79e1198379d7 (diff) | |
download | chromium_src-91240c947358b33cc19c0923a06d116ab36737dd.zip chromium_src-91240c947358b33cc19c0923a06d116ab36737dd.tar.gz chromium_src-91240c947358b33cc19c0923a06d116ab36737dd.tar.bz2 |
Asynchronous tick now uses NPN_PluginAsyncCall.URL streaming callbacks are now also asynchronous.Implemented NPN_PluginAsyncCall for IE.Allowed WM_PAINT handler to be reentered because it no longer calls into the browser (except to schedule an asynchronous tick if none is pending).Fixed a bug where the EventManager would crash if an event callback called cleanUp on the client.Cleanup destroys all the packs. Doing this in NPP_Destroy seems to make Chrome timeout and fail to load the next page.Tar and GZ decoding happens on a new thread.
Review URL: http://codereview.chromium.org/155733
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin/npapi_host_control')
4 files changed, 38 insertions, 1 deletions
diff --git a/o3d/plugin/npapi_host_control/win/host_control.cc b/o3d/plugin/npapi_host_control/win/host_control.cc index 117245c..957f465 100644 --- a/o3d/plugin/npapi_host_control/win/host_control.cc +++ b/o3d/plugin/npapi_host_control/win/host_control.cc @@ -260,6 +260,17 @@ LRESULT CHostControl::OnDestroy(UINT uMsg, return 0; } +LRESULT CHostControl::OnPluginAsyncCall(UINT message, + WPARAM w_param, + LPARAM l_param, + BOOL& handled) { + typedef void (*Function)(void*); + Function function = reinterpret_cast<Function>(w_param); + void* data = reinterpret_cast<void*>(l_param); + function(data); + handled = TRUE; + return 0; +} HRESULT CHostControl::FinalConstruct() { return ConstructPluginProxy(); diff --git a/o3d/plugin/npapi_host_control/win/host_control.h b/o3d/plugin/npapi_host_control/win/host_control.h index 5cf50ad..ae37487 100644 --- a/o3d/plugin/npapi_host_control/win/host_control.h +++ b/o3d/plugin/npapi_host_control/win/host_control.h @@ -58,6 +58,8 @@ class NPPluginProxy; +const UINT WM_PLUGINASYNCCALL = WM_USER + 100; + // Class implementing an ActiveX control for containing NPAPI plugin-objects. // This needs to be CComMultiThreadModel because these objects are concurrently // AddRefed and Released from StreamOperation threads. @@ -110,6 +112,7 @@ DECLARE_REGISTRY_RESOURCEID(IDR_HOSTCONTROL) BEGIN_MSG_MAP(CHostControl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(WM_PLUGINASYNCCALL, OnPluginAsyncCall) END_MSG_MAP() BEGIN_CONNECTION_POINT_MAP(CHostControl) @@ -176,6 +179,8 @@ END_PROP_MAP() LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnPluginAsyncCall(UINT message, WPARAM w_param, LPARAM l_param, + BOOL& handled); // Initiates a data transfer, calling back into the hosted plug-in instance // on status updates. Does not block on the transfer. diff --git a/o3d/plugin/npapi_host_control/win/np_browser_proxy.cc b/o3d/plugin/npapi_host_control/win/np_browser_proxy.cc index 968e71e..bba80d1 100644 --- a/o3d/plugin/npapi_host_control/win/np_browser_proxy.cc +++ b/o3d/plugin/npapi_host_control/win/np_browser_proxy.cc @@ -63,7 +63,7 @@ NPError OpenURL(NPBrowserProxy* browser_proxy, NPNetscapeFuncs NPBrowserProxy::kNetscapeFunctions = { sizeof(kNetscapeFunctions), - NPVERS_HAS_NPOBJECT_ENUM, + NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL, NPN_GetURL, NPN_PostURL, NPN_RequestRead, @@ -107,6 +107,7 @@ NPNetscapeFuncs NPBrowserProxy::kNetscapeFunctions = { NULL, NULL, NPN_Enumerate, + NPN_PluginThreadAsyncCall, }; NPBrowserProxy::NPBrowserProxy(CHostControl* host, IDispatchEx* window_dispatch) @@ -790,6 +791,22 @@ bool NPBrowserProxy::NPN_Evaluate(NPP npp, return success; } +void NPBrowserProxy::NPN_PluginThreadAsyncCall(NPP npp, + void (*function)(void *), + void *data) { + if (!npp || !function) { + return; + } + + NPBrowserProxy *browser_proxy = static_cast<NPBrowserProxy*>(npp->ndata); + CHostControl *host_control = browser_proxy->GetHostingControl(); + ATLASSERT(host_control); + + host_control->PostMessage(WM_PLUGINASYNCCALL, + reinterpret_cast<WPARAM>(function), + reinterpret_cast<LPARAM>(data)); +} + void NPBrowserProxy::NPN_SetException(NPObject *obj, const NPUTF8 *message) { ATLASSERT(false && "NPN_SetException not implemented"); diff --git a/o3d/plugin/npapi_host_control/win/np_browser_proxy.h b/o3d/plugin/npapi_host_control/win/np_browser_proxy.h index e245c84..4c28cea 100644 --- a/o3d/plugin/npapi_host_control/win/np_browser_proxy.h +++ b/o3d/plugin/npapi_host_control/win/np_browser_proxy.h @@ -266,6 +266,10 @@ class NPBrowserProxy { NPString *script, NPVariant *result); + static void NPN_PluginThreadAsyncCall(NPP npp, + void (*function)(void *), + void *data); + static void NPN_SetException(NPObject *obj, const NPUTF8 *message); // Static table of function pointers to the member function entry points |