diff options
-rw-r--r-- | chrome/common/plugin_messages.h | 4 | ||||
-rw-r--r-- | chrome/common/plugin_messages_internal.h | 10 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.cc | 5 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.h | 4 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.h | 2 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 11 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.h | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_instance.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_instance.h | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream_url.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream_url.h | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 4 | ||||
-rw-r--r-- | webkit/glue/webplugin.h | 5 | ||||
-rw-r--r-- | webkit/glue/webplugin_delegate.h | 11 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.cc | 59 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.h | 14 |
18 files changed, 97 insertions, 50 deletions
diff --git a/chrome/common/plugin_messages.h b/chrome/common/plugin_messages.h index 0bfddee..eeea874 100644 --- a/chrome/common/plugin_messages.h +++ b/chrome/common/plugin_messages.h @@ -54,7 +54,7 @@ struct PluginHostMsg_URLRequest_Params { }; struct PluginMsg_URLRequestReply_Params { - int resource_id; + unsigned long resource_id; GURL url; bool notify_needed; intptr_t notify_data; @@ -62,7 +62,7 @@ struct PluginMsg_URLRequestReply_Params { }; struct PluginMsg_DidReceiveResponseParams { - int id; + unsigned long id; std::string mime_type; std::string headers; uint32 expected_length; diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h index 48c3bcf..923a750 100644 --- a/chrome/common/plugin_messages_internal.h +++ b/chrome/common/plugin_messages_internal.h @@ -232,22 +232,22 @@ IPC_BEGIN_MESSAGES(Plugin) WebCursor /* cursor type*/) IPC_SYNC_MESSAGE_ROUTED2_0(PluginMsg_WillSendRequest, - int /* id */, + unsigned long /* id */, GURL /* url */) IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse, PluginMsg_DidReceiveResponseParams) IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData, - int /* id */, + unsigned long /* id */, std::vector<char> /* buffer */, int /* data_offset */) IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, - int /* id */) + unsigned long /* id */) IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, - int /* id */) + unsigned long /* id */) IPC_MESSAGE_ROUTED5(PluginMsg_SendJavaScriptStream, GURL /* url */, @@ -366,7 +366,7 @@ IPC_BEGIN_MESSAGES(PluginHost) intptr_t /* notify_data */) IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading, - int /* resource_id */, + unsigned long /* resource_id */, bool /* defer */) IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException, diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index 9f75444..8142185 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -96,7 +96,7 @@ void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) { } #endif -void WebPluginProxy::CancelResource(int id) { +void WebPluginProxy::CancelResource(unsigned long id) { Send(new PluginHostMsg_CancelResource(route_id_, id)); resource_clients_.erase(id); } @@ -582,7 +582,8 @@ void WebPluginProxy::InitiateHTTPRangeRequest(const char* url, notify_needed, notify_data)); } -void WebPluginProxy::SetDeferResourceLoading(int resource_id, bool defer) { +void WebPluginProxy::SetDeferResourceLoading(unsigned long resource_id, + bool defer) { Send(new PluginHostMsg_DeferResourceLoading(route_id_, resource_id, defer)); } diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h index fabf5d0..2e86bbd 100644 --- a/chrome/plugin/webplugin_proxy.h +++ b/chrome/plugin/webplugin_proxy.h @@ -47,7 +47,7 @@ class WebPluginProxy : public webkit_glue::WebPlugin { void SetWindowlessPumpEvent(HANDLE pump_messages_event); #endif - void CancelResource(int id); + void CancelResource(unsigned long id); void Invalidate(); void InvalidateRect(const gfx::Rect& rect); NPObject* GetWindowScriptNPObject(); @@ -126,7 +126,7 @@ class WebPluginProxy : public webkit_glue::WebPlugin { bool notify_needed, intptr_t notify_data); - void SetDeferResourceLoading(int resource_id, bool defer); + void SetDeferResourceLoading(unsigned long resource_id, bool defer); bool IsOffTheRecord(); diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 1c24bb4..0be5924 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -207,7 +207,7 @@ FilePath WebPluginDelegatePepper::GetPluginPath() { } WebPluginResourceClient* WebPluginDelegatePepper::CreateResourceClient( - int resource_id, const GURL& url, bool notify_needed, + unsigned long resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, intptr_t existing_stream) { // Stream already exists. This typically happens for range requests // initiated via NPN_RequestRead. diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h index 5a7ebf5..afb6630 100644 --- a/chrome/renderer/webplugin_delegate_pepper.h +++ b/chrome/renderer/webplugin_delegate_pepper.h @@ -75,7 +75,7 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { virtual void DidManualLoadFail(); virtual void InstallMissingPlugin(); virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( - int resource_id, + unsigned long resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 823080c..2e24172 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -68,8 +68,9 @@ class ResourceClientProxy : public webkit_glue::WebPluginResourceClient { ~ResourceClientProxy() { } - void Initialize(int resource_id, const GURL& url, bool notify_needed, - intptr_t notify_data, intptr_t existing_stream) { + void Initialize(unsigned long resource_id, const GURL& url, + bool notify_needed, intptr_t notify_data, + intptr_t existing_stream) { resource_id_ = resource_id; url_ = url; notify_needed_ = notify_needed; @@ -147,7 +148,7 @@ class ResourceClientProxy : public webkit_glue::WebPluginResourceClient { private: scoped_refptr<PluginChannelHost> channel_; int instance_id_; - int resource_id_; + unsigned long resource_id_; GURL url_; bool notify_needed_; intptr_t notify_data_; @@ -1125,7 +1126,7 @@ void WebPluginDelegateProxy::OnHandleURLRequest( webkit_glue::WebPluginResourceClient* WebPluginDelegateProxy::CreateResourceClient( - int resource_id, const GURL& url, bool notify_needed, + unsigned long resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, intptr_t npstream) { if (!channel_host_) return NULL; @@ -1148,7 +1149,7 @@ void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( notify_data); } -void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, +void WebPluginDelegateProxy::OnDeferResourceLoading(unsigned long 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 02dd644..f01ae092 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -91,7 +91,7 @@ class WebPluginDelegateProxy virtual void DidManualLoadFail(); virtual void InstallMissingPlugin(); virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( - int resource_id, + unsigned long resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, @@ -136,7 +136,7 @@ class WebPluginDelegateProxy intptr_t existing_stream, bool notify_needed, intptr_t notify_data); - void OnDeferResourceLoading(int resource_id, bool defer); + void OnDeferResourceLoading(unsigned long resource_id, bool defer); #if defined(OS_MACOSX) void OnUpdateGeometry_ACK(int ack_key); diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc index 27526f1..b2919eb 100644 --- a/webkit/glue/plugins/plugin_instance.cc +++ b/webkit/glue/plugins/plugin_instance.cc @@ -60,7 +60,7 @@ PluginInstance::~PluginInstance() { plugin_->CloseInstance(); } -PluginStreamUrl* PluginInstance::CreateStream(int resource_id, +PluginStreamUrl* PluginInstance::CreateStream(unsigned long resource_id, const GURL& url, const std::string& mime_type, bool notify_needed, diff --git a/webkit/glue/plugins/plugin_instance.h b/webkit/glue/plugins/plugin_instance.h index 0c1687a..ec94162 100644 --- a/webkit/glue/plugins/plugin_instance.h +++ b/webkit/glue/plugins/plugin_instance.h @@ -115,7 +115,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { // Set object_url to true if the load is for the object tag's // url, or false if it's for a url that the plugin // fetched through NPN_GetUrl[Notify]. - PluginStreamUrl* CreateStream(int resource_id, + PluginStreamUrl* CreateStream(unsigned long resource_id, const GURL& url, const std::string& mime_type, bool notify_needed, diff --git a/webkit/glue/plugins/plugin_stream_url.cc b/webkit/glue/plugins/plugin_stream_url.cc index 602733d..3362b9e 100644 --- a/webkit/glue/plugins/plugin_stream_url.cc +++ b/webkit/glue/plugins/plugin_stream_url.cc @@ -12,7 +12,7 @@ namespace NPAPI { PluginStreamUrl::PluginStreamUrl( - int resource_id, + unsigned long resource_id, const GURL &url, PluginInstance *instance, bool notify_needed, diff --git a/webkit/glue/plugins/plugin_stream_url.h b/webkit/glue/plugins/plugin_stream_url.h index b4a61c3..7d3f59a 100644 --- a/webkit/glue/plugins/plugin_stream_url.h +++ b/webkit/glue/plugins/plugin_stream_url.h @@ -22,7 +22,7 @@ class PluginStreamUrl : public PluginStream, // a URL. If notifyNeeded is set, then the plugin will be notified // when the stream has been fully sent to the plugin. Initialize // must be called before the object is used. - PluginStreamUrl(int resource_id, + PluginStreamUrl(unsigned long resource_id, const GURL &url, PluginInstance *instance, bool notify_needed, @@ -59,7 +59,7 @@ class PluginStreamUrl : public PluginStream, private: GURL url_; - int id_; + unsigned long id_; DISALLOW_EVIL_CONSTRUCTORS(PluginStreamUrl); }; diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 664ebed..b15fbf1 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -210,7 +210,7 @@ void WebPluginDelegateImpl::WindowedUpdateGeometry( } WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( - int resource_id, const GURL& url, bool notify_needed, + unsigned long resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, intptr_t existing_stream) { // Stream already exists. This typically happens for range requests // initiated via NPN_RequestRead. diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 3f9e447..305d4f7 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -97,7 +97,7 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { virtual void DidManualLoadFail(); virtual void InstallMissingPlugin(); virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( - int resource_id, + unsigned long resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, @@ -332,7 +332,7 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { // we've shut down the plugin, but can't delete ourselves until the last // idle event comes in. bool waiting_to_die_; - + // The most recently seen offset between global and browser-window-local // coordinates. We use this to keep the placeholder Carbon WindowRef's origin // in sync with the actual browser window, without having to pass that diff --git a/webkit/glue/webplugin.h b/webkit/glue/webplugin.h index 194b99d..90ac44a 100644 --- a/webkit/glue/webplugin.h +++ b/webkit/glue/webplugin.h @@ -67,7 +67,7 @@ class WebPlugin { // Cancels a pending request. virtual void SetWindowlessPumpEvent(HANDLE pump_messages_event) = 0; #endif - virtual void CancelResource(int id) = 0; + virtual void CancelResource(unsigned long id) = 0; virtual void Invalidate() = 0; virtual void InvalidateRect(const gfx::Rect& rect) = 0; @@ -125,7 +125,8 @@ class WebPlugin { // Defers the loading of the resource identified by resource_id. This is // controlled by the defer parameter. - virtual void SetDeferResourceLoading(int resource_id, bool defer) = 0; + virtual void SetDeferResourceLoading(unsigned long resource_id, + bool defer) = 0; // Gets the WebPluginDelegate that implements the interface. // This API is only for use with Pepper, and hence only with diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h index 5a724f1..6c38080 100644 --- a/webkit/glue/webplugin_delegate.h +++ b/webkit/glue/webplugin_delegate.h @@ -121,11 +121,12 @@ class WebPluginDelegate { virtual void InstallMissingPlugin() = 0; // Creates a WebPluginResourceClient instance and returns the same. - virtual WebPluginResourceClient* CreateResourceClient(int resource_id, - const GURL& url, - bool notify_needed, - intptr_t notify_data, - intptr_t stream) = 0; + virtual WebPluginResourceClient* CreateResourceClient( + unsigned long resource_id, + const GURL& url, + bool notify_needed, + intptr_t notify_data, + intptr_t stream) = 0; // The following methods are for use in implementing Pepper renderers. // They should not be called outside of that context. diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 3b327b3..a42fd70 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -13,6 +13,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h" #include "third_party/WebKit/WebKit/chromium/public/WebData.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h" @@ -43,6 +44,7 @@ using WebKit::WebCString; using WebKit::WebCursorInfo; using WebKit::WebData; using WebKit::WebDataSource; +using WebKit::WebDevToolsAgent; using WebKit::WebFrame; using WebKit::WebHTTPBody; using WebKit::WebHTTPHeaderVisitor; @@ -425,7 +427,7 @@ GURL WebPluginImpl::CompleteURL(const char* url) { return webframe_->completeURL(WebString::fromUTF8(url)); } -void WebPluginImpl::CancelResource(int id) { +void WebPluginImpl::CancelResource(unsigned long id) { for (size_t i = 0; i < clients_.size(); ++i) { if (clients_[i].id == id) { if (clients_[i].loader.get()) { @@ -698,6 +700,12 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader, response_info.last_modified, request_is_seekable); + if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) { + ClientInfo* client_info = GetClientInfoFromLoader(loader); + if (client_info) + devtools_agent->didReceiveResponse(client_info->id, response); + } + // Bug http://b/issue?id=925559. The flash plugin would not handle the HTTP // error codes in the stream header and as a result, was unaware of the // fate of the HTTP requests issued via NPN_GetURLNotify. Webkit and FF @@ -733,6 +741,12 @@ void WebPluginImpl::didReceiveData(WebURLLoader* loader, loader->setDefersLoading(true); client->DidReceiveData(buffer, length, 0); } + + if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) { + ClientInfo* client_info = GetClientInfoFromLoader(loader); + if (client_info) + devtools_agent->didReceiveData(client_info->id, length); + } } void WebPluginImpl::didFinishLoading(WebURLLoader* loader) { @@ -752,11 +766,14 @@ void WebPluginImpl::didFinishLoading(WebURLLoader* loader) { // It is not safe to access this structure after that. client_info->client = NULL; resource_client->DidFinishLoading(); + + if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) + devtools_agent->didFinishLoading(client_info->id); } } void WebPluginImpl::didFail(WebURLLoader* loader, - const WebURLError&) { + const WebURLError& error) { ClientInfo* client_info = GetClientInfoFromLoader(loader); if (client_info && client_info->client) { loader->setDefersLoading(true); @@ -765,6 +782,9 @@ void WebPluginImpl::didFail(WebURLLoader* loader, // It is not safe to access this structure after that. client_info->client = NULL; resource_client->DidFail(); + + if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) + devtools_agent->didFailLoading(client_info->id, error); } } @@ -829,7 +849,10 @@ void WebPluginImpl::HandleURLRequestInternal( } else { GURL complete_url = CompleteURL(url); - int resource_id = GetNextResourceId(); + unsigned long resource_id = GetNextResourceId(); + if (!resource_id) + return; + WebPluginResourceClient* resource_client = delegate_->CreateResourceClient( resource_id, complete_url, notify, notify_data, NULL); if (!resource_client) @@ -854,12 +877,16 @@ void WebPluginImpl::HandleURLRequestInternal( } } -int WebPluginImpl::GetNextResourceId() { - static int next_id = 0; - return ++next_id; +unsigned long WebPluginImpl::GetNextResourceId() { + if (!webframe_) + return 0; + WebView* view = webframe_->view(); + if (!view) + return 0; + return view->createUniqueIdentifierForRequest(); } -bool WebPluginImpl::InitiateHTTPRequest(int resource_id, +bool WebPluginImpl::InitiateHTTPRequest(unsigned long resource_id, WebPluginResourceClient* client, const char* method, const char* buf, int buf_len, @@ -901,6 +928,11 @@ bool WebPluginImpl::InitiateHTTPRequest(int resource_id, // Sets the routing id to associate the ResourceRequest with the RenderView. webframe_->dispatchWillSendRequest(info.request); + if (WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent()) { + devtools_agent->identifierForInitialRequest(resource_id, webframe_, + info.request); + devtools_agent->willSendRequest(resource_id, info.request); + } info.loader.reset(WebKit::webKitClient()->createURLLoader()); if (!info.loader.get()) @@ -923,7 +955,10 @@ void WebPluginImpl::InitiateHTTPRangeRequest(const char* url, intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { - int resource_id = GetNextResourceId(); + unsigned long resource_id = GetNextResourceId(); + if (!resource_id) + return; + GURL complete_url = CompleteURL(url); WebPluginResourceClient* resource_client = delegate_->CreateResourceClient( @@ -933,7 +968,8 @@ void WebPluginImpl::InitiateHTTPRangeRequest(const char* url, true); } -void WebPluginImpl::SetDeferResourceLoading(int resource_id, bool defer) { +void WebPluginImpl::SetDeferResourceLoading(unsigned long resource_id, + bool defer) { std::vector<ClientInfo>::iterator client_index = clients_.begin(); while (client_index != clients_.end()) { ClientInfo& client_info = *client_index; @@ -953,6 +989,11 @@ void WebPluginImpl::SetDeferResourceLoading(int resource_id, bool defer) { client_info.loader->cancel(); clients_.erase(client_index++); resource_client->DidFail(); + + // Report that resource loading finished. + WebDevToolsAgent* devtools_agent = webframe_->view()->devToolsAgent(); + if (devtools_agent) + devtools_agent->didFinishLoading(resource_id); } break; } diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h index af0d021..07de25f 100644 --- a/webkit/glue/webplugin_impl.h +++ b/webkit/glue/webplugin_impl.h @@ -119,14 +119,16 @@ class WebPluginImpl : public WebPlugin, const char* url); // Cancels a pending request. - void CancelResource(int id); + void CancelResource(unsigned long id); - // Returns the next avaiable resource id. - int GetNextResourceId(); + // Returns the next avaiable resource id. Returns 0 if the operation fails. + // It may fail if the page has already been closed. + unsigned long GetNextResourceId(); // Initiates HTTP GET/POST requests. // Returns true on success. - bool InitiateHTTPRequest(int resource_id, WebPluginResourceClient* client, + bool InitiateHTTPRequest(unsigned long resource_id, + WebPluginResourceClient* client, const char* method, const char* buf, int buf_len, const GURL& url, const char* range_info, bool use_plugin_src_as_referer); @@ -194,7 +196,7 @@ class WebPluginImpl : public WebPlugin, intptr_t existing_stream, bool notify_needed, intptr_t notify_data); - void SetDeferResourceLoading(int resource_id, bool defer); + void SetDeferResourceLoading(unsigned long resource_id, bool defer); // Ignore in-process plugins mode for this flag. bool IsOffTheRecord() { return false; } @@ -219,7 +221,7 @@ class WebPluginImpl : public WebPlugin, void OnDownloadPluginSrcUrl(); struct ClientInfo { - int id; + unsigned long id; WebPluginResourceClient* client; WebKit::WebURLRequest request; bool pending_failure_notification; |