summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authoriyengar@google.com <iyengar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-19 02:09:49 +0000
committeriyengar@google.com <iyengar@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-19 02:09:49 +0000
commit84f89cacc8f09a2fbc1fd82b30af13dd35624869 (patch)
tree9e60daee9caffaaaa3da96fd46b0c4ba28318fc8 /chrome/renderer
parent172300b0cd0748cade220e03dcc2b3459ee14b80 (diff)
downloadchromium_src-84f89cacc8f09a2fbc1fd82b30af13dd35624869.zip
chromium_src-84f89cacc8f09a2fbc1fd82b30af13dd35624869.tar.gz
chromium_src-84f89cacc8f09a2fbc1fd82b30af13dd35624869.tar.bz2
This CB fixes the following issue1. http://code.google.com/p/chromium/issues/detail?id=206This is a performance issue while loading PDF documents. The fix is to support PDF fast webview, which is basically support for the NPN_RequestRead API, which allows a plugin to request specific byte ranges in HTTP GET requests. This also needs support for seekable streams. Our support for seekable streams is limited to HTTP servers which allow byte range requests. Firefox also supports a mode in which the the browser caches the file on disk for servers which don't support byte range requests. The plugin_data_stream.cc/.h files are being removed as there is not much value in their existence. The needed functionality is available in the PluginStreamUrl class, which now services manual data streams as well. Testing this is a touch tricky as we need a HTTP server which serves byte range requests. Will add those in a subsequent CB.Also fixed a bug in the multipart parser where we need to ignore leading newline characters while parsing the header.Bug=206
Review URL: http://codereview.chromium.org/2896 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc27
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.h8
2 files changed, 28 insertions, 7 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index 97b0788..225608e 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -44,7 +44,7 @@ class ResourceClientProxy : public WebPluginResourceClient {
}
void Initialize(int resource_id, const std::string &url, bool notify_needed,
- void *notify_data) {
+ void *notify_data, void* existing_stream) {
resource_id_ = resource_id;
url_ = url;
notify_needed_ = notify_needed;
@@ -55,6 +55,7 @@ class ResourceClientProxy : public WebPluginResourceClient {
params.url = url_;
params.notify_needed = notify_needed_;
params.notify_data = notify_data_;
+ params.stream = existing_stream;
channel_->Send(new PluginMsg_HandleURLRequestReply(instance_id_, params));
}
@@ -85,7 +86,7 @@ class ResourceClientProxy : public WebPluginResourceClient {
cancel));
}
- void DidReceiveData(const char* buffer, int length) {
+ void DidReceiveData(const char* buffer, int length, int data_offset) {
DCHECK(channel_ != NULL);
DCHECK(length > 0);
std::vector<char> data;
@@ -95,7 +96,7 @@ class ResourceClientProxy : public WebPluginResourceClient {
// deleted from under us.
scoped_refptr<PluginChannelHost> channel_ref(channel_);
channel_->Send(new PluginMsg_DidReceiveData(instance_id_, resource_id_,
- data));
+ data, data_offset));
}
void DidFinishLoading() {
@@ -112,7 +113,7 @@ class ResourceClientProxy : public WebPluginResourceClient {
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
- private:
+private:
int resource_id_;
int instance_id_;
scoped_refptr<PluginChannelHost> channel_;
@@ -316,6 +317,9 @@ void WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest)
IPC_MESSAGE_HANDLER(PluginHostMsg_GetCPBrowsingContext,
OnGetCPBrowsingContext)
+ IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad)
+ IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest,
+ OnInitiateHTTPRangeRequest)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
}
@@ -655,10 +659,10 @@ void WebPluginDelegateProxy::OnHandleURLRequest(
WebPluginResourceClient* WebPluginDelegateProxy::CreateResourceClient(
int resource_id, const std::string &url, bool notify_needed,
- void *notify_data) {
+ void* notify_data, void* npstream) {
ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_,
instance_id_);
- proxy->Initialize(resource_id, url, notify_needed, notify_data);
+ proxy->Initialize(resource_id, url, notify_needed, notify_data, npstream);
return proxy;
}
@@ -669,3 +673,14 @@ void WebPluginDelegateProxy::URLRequestRouted(const std::string& url,
notify_data));
}
+void WebPluginDelegateProxy::OnCancelDocumentLoad() {
+ plugin_->CancelDocumentLoad();
+}
+
+void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest(
+ const std::string& url, const std::string& range_info,
+ HANDLE existing_stream, bool notify_needed, HANDLE notify_data) {
+ plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(),
+ existing_stream, notify_needed,
+ notify_data);
+}
diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h
index d0f977b..5ce612a 100644
--- a/chrome/renderer/webplugin_delegate_proxy.h
+++ b/chrome/renderer/webplugin_delegate_proxy.h
@@ -82,7 +82,8 @@ class WebPluginDelegateProxy : public WebPluginDelegate,
virtual WebPluginResourceClient* CreateResourceClient(int resource_id,
const std::string &url,
bool notify_needed,
- void *notify_data);
+ void* notify_data,
+ void* existing_stream);
// Notifies the delegate about a Get/Post URL request getting routed
virtual void URLRequestRouted(const std::string&url, bool notify_needed,
@@ -118,6 +119,11 @@ class WebPluginDelegateProxy : public WebPluginDelegate,
std::string* json_retval);
void OnMissingPluginStatus(int status);
void OnGetCPBrowsingContext(uint32* context);
+ void OnCancelDocumentLoad();
+ void OnInitiateHTTPRangeRequest(const std::string& url,
+ const std::string& range_info,
+ HANDLE existing_stream, bool notify_needed,
+ HANDLE notify_data);
// Draw a graphic indicating a crashed plugin.
void PaintSadPlugin(HDC hdc, const gfx::Rect& rect);