summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-15 23:26:57 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-15 23:26:57 +0000
commit97e521cba140ce053f33dd3e852e847c76781689 (patch)
tree4ec754e5643e0283be4eea86e2be1a1d21ceacb4 /webkit/plugins
parent08ae727a958a96ff482ff524545c5c9e0048ae91 (diff)
downloadchromium_src-97e521cba140ce053f33dd3e852e847c76781689.zip
chromium_src-97e521cba140ce053f33dd3e852e847c76781689.tar.gz
chromium_src-97e521cba140ce053f33dd3e852e847c76781689.tar.bz2
Pre-buffer data from the host to the plugin in the PPAPI proxy to reduce the
impact of IPC latency on streaming data. This allows most resource requests to be returned synchronously from the URLLoader in the plugin. TEST=manual BUG=none Review URL: http://codereview.chromium.org/6870018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/ppb_proxy_impl.cc12
-rw-r--r--webkit/plugins/ppapi/ppb_url_loader_impl.h4
2 files changed, 15 insertions, 1 deletions
diff --git a/webkit/plugins/ppapi/ppb_proxy_impl.cc b/webkit/plugins/ppapi/ppb_proxy_impl.cc
index f82ec46..9c69891 100644
--- a/webkit/plugins/ppapi/ppb_proxy_impl.cc
+++ b/webkit/plugins/ppapi/ppb_proxy_impl.cc
@@ -7,6 +7,7 @@
#include "ppapi/c/private/ppb_proxy_private.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+#include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
#include "webkit/plugins/ppapi/resource.h"
#include "webkit/plugins/ppapi/resource_tracker.h"
@@ -35,10 +36,19 @@ void SetReserveInstanceIDCallback(PP_Module module,
plugin_module->SetReserveInstanceIDCallback(reserve);
}
+int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) {
+ scoped_refptr<PPB_URLLoader_Impl> loader(
+ Resource::GetAs<PPB_URLLoader_Impl>(url_loader));
+ if (!loader)
+ return 0;
+ return loader->buffer_size();
+}
+
const PPB_Proxy_Private ppb_proxy = {
&PluginCrashed,
&GetInstanceForResource,
- &SetReserveInstanceIDCallback
+ &SetReserveInstanceIDCallback,
+ &GetURLLoaderBufferedBytes
};
} // namespace
diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.h b/webkit/plugins/ppapi/ppb_url_loader_impl.h
index c46bbb6..fae3628 100644
--- a/webkit/plugins/ppapi/ppb_url_loader_impl.h
+++ b/webkit/plugins/ppapi/ppb_url_loader_impl.h
@@ -88,6 +88,10 @@ class PPB_URLLoader_Impl : public Resource, public WebKit::WebURLLoaderClient {
PPB_URLResponseInfo_Impl* response_info() const { return response_info_; }
+ // Returns the number of bytes currently available for synchronous reading
+ // in the loader.
+ int32_t buffer_size() const { return buffer_.size(); }
+
private:
// Check that |callback| is valid (only non-blocking operation is supported)
// and that no callback is already pending. Returns |PP_OK| if okay, else