diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-04 07:06:39 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-04 07:06:39 +0000 |
commit | e15e9c49957bb309877d90442353328e1b53a0a6 (patch) | |
tree | 97701d9822f030b5939c1738441eb5e9683262c8 /chrome | |
parent | d2817019145d7806d400ae70bf9fb4b5681905c8 (diff) | |
download | chromium_src-e15e9c49957bb309877d90442353328e1b53a0a6.zip chromium_src-e15e9c49957bb309877d90442353328e1b53a0a6.tar.gz chromium_src-e15e9c49957bb309877d90442353328e1b53a0a6.tar.bz2 |
Another attempt at landing this patch.
The reliability tests regressions caused by this patch have been addressed by the upstream bug fix https://bugs.webkit.org/show_bug.cgi?id=27769
The IPCs for carrying data requested by plugins have been changed from synchronous IPCs to asynchronous IPCs.
This fixes bug http://code.google.com/p/chromium/issues/detail?id=14323,
where the Flash plugin would not render content on the page if these IPCs were processed while the plugin waited for sync calls like NPN_Evaluate to return.
This CL also fixes the following bugs, which were crashes in reliability test runs when this patch was landed last time.
http://code.google.com/p/chromium/issues/detail?id=18058
http://code.google.com/p/chromium/issues/detail?id=18059
The crash happens because of NPP_Write calls issued to the plugin while it is waiting for an NPN_Invoke call to return in the context of NPP_NewStream. Inspecting the safari plugin implementation revealed that they defer the resource load before calling the plugin and restore it on return.
We emulate this behavior via an IPC sent from the plugin which serves as an acknowledgement.
Test=covered by UI tests.
Bug=14323,18058,18059
Review URL: http://codereview.chromium.org/159746
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/common/plugin_messages_internal.h | 25 | ||||
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.cc | 6 | ||||
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.h | 3 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.cc | 8 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.h | 2 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 13 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.h | 1 |
7 files changed, 36 insertions, 22 deletions
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h index 18152d9..ce934a2 100644 --- a/chrome/common/plugin_messages_internal.h +++ b/chrome/common/plugin_messages_internal.h @@ -183,20 +183,19 @@ IPC_BEGIN_MESSAGES(Plugin) int /* id */, GURL /* url */) - IPC_SYNC_MESSAGE_ROUTED1_1(PluginMsg_DidReceiveResponse, - PluginMsg_DidReceiveResponseParams, - bool /* cancel */) + IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse, + PluginMsg_DidReceiveResponseParams) - IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_DidReceiveData, - int /* id */, - std::vector<char> /* buffer */, - int /* data_offset */) + IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData, + int /* id */, + std::vector<char> /* buffer */, + int /* data_offset */) - IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_DidFinishLoading, - int /* id */) + IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, + int /* id */) - IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_DidFail, - int /* id */) + IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, + int /* id */) IPC_MESSAGE_ROUTED5(PluginMsg_SendJavaScriptStream, std::string /* url */, @@ -322,6 +321,10 @@ IPC_BEGIN_MESSAGES(PluginHost) bool /* notify_needed */, intptr_t /* notify_data */) + IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading, + int /* resource_id */, + bool /* defer */) + IPC_END_MESSAGES(PluginHost) //----------------------------------------------------------------------------- diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 277ff91..c42815a 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -175,8 +175,7 @@ void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url) { } void WebPluginDelegateStub::OnDidReceiveResponse( - const PluginMsg_DidReceiveResponseParams& params, bool* cancel) { - *cancel = false; + const PluginMsg_DidReceiveResponseParams& params) { WebPluginResourceClient* client = webplugin_->GetResourceClient(params.id); if (!client) return; @@ -185,8 +184,7 @@ void WebPluginDelegateStub::OnDidReceiveResponse( params.headers, params.expected_length, params.last_modified, - params.request_is_seekable, - cancel); + params.request_is_seekable); } void WebPluginDelegateStub::OnDidReceiveData(int id, diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h index 2def46c..519a648 100644 --- a/chrome/plugin/webplugin_delegate_stub.h +++ b/chrome/plugin/webplugin_delegate_stub.h @@ -52,8 +52,7 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, void OnInit(const PluginMsg_Init_Params& params, bool* result); void OnWillSendRequest(int id, const GURL& url); - void OnDidReceiveResponse(const PluginMsg_DidReceiveResponseParams& params, - bool* cancel); + void OnDidReceiveResponse(const PluginMsg_DidReceiveResponseParams& params); void OnDidReceiveData(int id, const std::vector<char>& buffer, int data_offset); void OnDidFinishLoading(int id); diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index fc061ce..6aee645 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -287,8 +287,10 @@ WebPluginProxy* WebPluginProxy::FromCPBrowsingContext( WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) { ResourceClientMap::iterator iterator = resource_clients_.find(id); + // The IPC messages which deal with streams are now asynchronous. It is + // now possible to receive stream messages from the renderer for streams + // which may have been cancelled by the plugin. if (iterator == resource_clients_.end()) { - NOTREACHED(); return NULL; } @@ -653,6 +655,10 @@ void WebPluginProxy::InitiateHTTPRangeRequest(const char* url, notify_needed, notify_data)); } +void WebPluginProxy::SetDeferResourceLoading(int resource_id, bool defer) { + Send(new PluginHostMsg_DeferResourceLoading(route_id_, resource_id, defer)); +} + void WebPluginProxy::OnPaint(const gfx::Rect& damaged_rect) { child_process_logging::ScopedActiveURLSetter url_setter(page_url_); diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h index 38a3879..2b11e55 100644 --- a/chrome/plugin/webplugin_proxy.h +++ b/chrome/plugin/webplugin_proxy.h @@ -121,6 +121,8 @@ class WebPluginProxy : public WebPlugin { bool notify_needed, intptr_t notify_data); + void SetDeferResourceLoading(int resource_id, bool defer); + bool IsOffTheRecord(); void ResourceClientDeleted(WebPluginResourceClient* resource_client); diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index f4eddc4..53d50be 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -100,8 +100,7 @@ class ResourceClientProxy : public WebPluginResourceClient { const std::string& headers, uint32 expected_length, uint32 last_modified, - bool request_is_seekable, - bool* cancel) { + bool request_is_seekable) { DCHECK(channel_ != NULL); PluginMsg_DidReceiveResponseParams params; params.id = resource_id_; @@ -113,8 +112,7 @@ class ResourceClientProxy : public WebPluginResourceClient { // Grab a reference on the underlying channel so it does not get // deleted from under us. scoped_refptr<PluginChannelHost> channel_ref(channel_); - channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params, - cancel)); + channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params)); } void DidReceiveData(const char* buffer, int length, int data_offset) { @@ -381,6 +379,8 @@ void WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad) IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest, OnInitiateHTTPRangeRequest) + IPC_MESSAGE_HANDLER(PluginHostMsg_DeferResourceLoading, + OnDeferResourceLoading) IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP() } @@ -985,3 +985,8 @@ void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( existing_stream, notify_needed, notify_data); } + +void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, + bool defer) { + plugin_->SetDeferResourceLoading(resource_id, defer); +} diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h index 17ce1d1..aefac28 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -143,6 +143,7 @@ class WebPluginDelegateProxy : public WebPluginDelegate, intptr_t existing_stream, bool notify_needed, intptr_t notify_data); + void OnDeferResourceLoading(int resource_id, bool defer); // Draw a graphic indicating a crashed plugin. void PaintSadPlugin(gfx::NativeDrawingContext context, const gfx::Rect& rect); |