diff options
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/ppb_proxy_impl.cc | 12 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_loader_impl.h | 4 |
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 |