diff options
-rw-r--r-- | ppapi/c/ppb_url_request_info.h | 29 | ||||
-rw-r--r-- | ppapi/cpp/url_request_info.h | 8 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_loader_impl.cc | 32 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_loader_impl.h | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_request_info_impl.cc | 25 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_request_info_impl.h | 12 |
6 files changed, 2 insertions, 106 deletions
diff --git a/ppapi/c/ppb_url_request_info.h b/ppapi/c/ppb_url_request_info.h index a5eca93..260612b 100644 --- a/ppapi/c/ppb_url_request_info.h +++ b/ppapi/c/ppb_url_request_info.h @@ -117,34 +117,7 @@ typedef enum { * custom content transfer encoding; if given to a loader without universal * access, PP_ERROR_BADARGUMENT will result. */ - PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING, - - /** - * This corresponds to an integer (PP_VARTYPE_INT32); default is not defined - * and is set by the browser, possibly depending on system capabilities. - * Set it to an integer to set an upper threshold for the prefetched buffer - * of an asynchronous load. When exceeded, the browser will defer loading - * until PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD is hit, at which - * time it will begin prefetching again. - * When setting this property, - * PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD must also be set. - * Behavior is undefined if the former is <= the latter. - */ - PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD, - - /** - * This corresponds to an integer (PP_VARTYPE_INT32); default is not defined - * and is set by the browser to a value appropriate for the default - * PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD. - * Set it to an integer to set a lower threshold for the prefetched buffer - * of an asynchronous load. When reached, the browser will resume loading if - * If PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD had previously been - * reached. - * When setting this property, - * PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD must also be set. - * Behavior is undefined if the former is >= the latter. - */ - PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD + PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING } PP_URLRequestProperty; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLRequestProperty, 4); /** diff --git a/ppapi/cpp/url_request_info.h b/ppapi/cpp/url_request_info.h index f0922a5..cce4e91 100644 --- a/ppapi/cpp/url_request_info.h +++ b/ppapi/cpp/url_request_info.h @@ -70,14 +70,6 @@ class URLRequestInfo : public Resource { return SetProperty(PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING, content_transfer_encoding); } - bool SetPrefetchBufferUpperThreshold(int32_t size) { - return SetProperty(PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD, - size); - } - bool SetPrefetchBufferLowerThreshold(int32_t size) { - return SetProperty(PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD, - size); - } }; } // namespace pp diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc index 5684d40..27ec617 100644 --- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc @@ -208,8 +208,6 @@ PPB_URLLoader_Impl::PPB_URLLoader_Impl(PluginInstance* instance, user_buffer_(NULL), user_buffer_size_(0), done_status_(PP_OK_COMPLETIONPENDING), - is_streaming_to_file_(false), - is_asynchronous_load_suspended_(false), has_universal_access_(false), status_callback_(NULL) { } @@ -270,7 +268,6 @@ int32_t PPB_URLLoader_Impl::Open(PPB_URLRequestInfo_Impl* request, options.allowCredentials = request->allow_credentials(); } - is_asynchronous_load_suspended_ = false; loader_.reset(frame->createAssociatedURLLoader(options)); if (!loader_.get()) return PP_ERROR_FAILED; @@ -368,12 +365,6 @@ int32_t PPB_URLLoader_Impl::FinishStreamingToFile( if (done_status_ != PP_OK_COMPLETIONPENDING) return done_status_; - is_streaming_to_file_ = true; - if (is_asynchronous_load_suspended_) { - loader_->setDefersLoading(false); - is_asynchronous_load_suspended_ = false; - } - // Wait for didFinishLoading / didFail. RegisterCallback(callback); return PP_OK_COMPLETIONPENDING; @@ -449,20 +440,6 @@ void PPB_URLLoader_Impl::didReceiveData(WebURLLoader* loader, } else { DCHECK(!pending_callback_.get() || pending_callback_->completed()); } - - // To avoid letting the network stack download an entire stream all at once, - // defer loading when we have enough buffer. - // Check the buffer size after potentially moving some to the user buffer. - DCHECK(request_info_->prefetch_buffer_lower_threshold() < - request_info_->prefetch_buffer_upper_threshold()); - if (!is_streaming_to_file_ && - !is_asynchronous_load_suspended_ && - buffer_.size() >= static_cast<size_t>( - request_info_->prefetch_buffer_upper_threshold())) { - DVLOG(1) << "Suspending async load - buffer size: " << buffer_.size(); - loader->setDefersLoading(true); - is_asynchronous_load_suspended_ = true; - } } void PPB_URLLoader_Impl::didFinishLoading(WebURLLoader* loader, @@ -521,15 +498,6 @@ size_t PPB_URLLoader_Impl::FillUserBuffer() { std::copy(buffer_.begin(), buffer_.begin() + bytes_to_copy, user_buffer_); buffer_.erase(buffer_.begin(), buffer_.begin() + bytes_to_copy); - // If the buffer is getting too empty, resume asynchronous loading. - if (is_asynchronous_load_suspended_ && - buffer_.size() <= static_cast<size_t>( - request_info_->prefetch_buffer_lower_threshold())) { - DVLOG(1) << "Resuming async load - buffer size: " << buffer_.size(); - loader_->setDefersLoading(false); - is_asynchronous_load_suspended_ = false; - } - // Reset for next time. user_buffer_ = NULL; user_buffer_size_ = 0; diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.h b/webkit/plugins/ppapi/ppb_url_loader_impl.h index 878ce65..fae3628 100644 --- a/webkit/plugins/ppapi/ppb_url_loader_impl.h +++ b/webkit/plugins/ppapi/ppb_url_loader_impl.h @@ -137,8 +137,6 @@ class PPB_URLLoader_Impl : public Resource, public WebKit::WebURLLoaderClient { char* user_buffer_; size_t user_buffer_size_; int32_t done_status_; - bool is_streaming_to_file_; - bool is_asynchronous_load_suspended_; bool has_universal_access_; diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc index 90a0ec6..7bae8ba 100644 --- a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc @@ -34,9 +34,6 @@ namespace ppapi { namespace { -const int32_t kDefaultPrefetchBufferUpperThreshold = 100 * 1000 * 1000; -const int32_t kDefaultPrefetchBufferLowerThreshold = 50 * 1000 * 1000; - // A header string containing any of the following fields will cause // an error. The list comes from the XMLHttpRequest standard. // http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader-method @@ -116,10 +113,6 @@ PP_Bool SetProperty(PP_Resource request_id, request->SetBooleanProperty(property, PPBoolToBool(var.value.as_bool))); break; - case PP_VARTYPE_INT32: - result = BoolToPPBool( - request->SetIntegerProperty(property, var.value.as_int)); - break; case PP_VARTYPE_STRING: { scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); if (string) @@ -210,9 +203,7 @@ PPB_URLRequestInfo_Impl::PPB_URLRequestInfo_Impl(PluginInstance* instance) has_custom_referrer_url_(false), allow_cross_origin_requests_(false), allow_credentials_(false), - has_custom_content_transfer_encoding_(false), - prefetch_buffer_upper_threshold_(kDefaultPrefetchBufferUpperThreshold), - prefetch_buffer_lower_threshold_(kDefaultPrefetchBufferLowerThreshold) { + has_custom_content_transfer_encoding_(false) { } PPB_URLRequestInfo_Impl::~PPB_URLRequestInfo_Impl() { @@ -269,20 +260,6 @@ bool PPB_URLRequestInfo_Impl::SetBooleanProperty(PP_URLRequestProperty property, } } -bool PPB_URLRequestInfo_Impl::SetIntegerProperty(PP_URLRequestProperty property, - int32_t value) { - switch (property) { - case PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD: - prefetch_buffer_upper_threshold_ = value; - return true; - case PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD: - prefetch_buffer_lower_threshold_ = value; - return true; - default: - return false; - } -} - bool PPB_URLRequestInfo_Impl::SetStringProperty(PP_URLRequestProperty property, const std::string& value) { // TODO(darin): Validate input. Perhaps at a different layer? diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.h b/webkit/plugins/ppapi/ppb_url_request_info_impl.h index 2cdf3e4..9d6c766 100644 --- a/webkit/plugins/ppapi/ppb_url_request_info_impl.h +++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.h @@ -37,7 +37,6 @@ class PPB_URLRequestInfo_Impl : public Resource { // PPB_URLRequestInfo implementation. bool SetUndefinedProperty(PP_URLRequestProperty property); bool SetBooleanProperty(PP_URLRequestProperty property, bool value); - bool SetIntegerProperty(PP_URLRequestProperty property, int32_t value); bool SetStringProperty(PP_URLRequestProperty property, const std::string& value); bool AppendDataToBody(const std::string& data); @@ -61,13 +60,6 @@ class PPB_URLRequestInfo_Impl : public Resource { } bool allow_credentials() const { return allow_credentials_; } - int32_t prefetch_buffer_upper_threshold() const { - return prefetch_buffer_upper_threshold_; - } - int32_t prefetch_buffer_lower_threshold() const { - return prefetch_buffer_lower_threshold_; - } - private: struct BodyItem; typedef std::vector<BodyItem> Body; @@ -97,10 +89,6 @@ class PPB_URLRequestInfo_Impl : public Resource { bool has_custom_content_transfer_encoding_; std::string custom_content_transfer_encoding_; - // Specify permitted range for the size of the buffer unconsumed by plugin. - int32_t prefetch_buffer_upper_threshold_; - int32_t prefetch_buffer_lower_threshold_; - DISALLOW_COPY_AND_ASSIGN(PPB_URLRequestInfo_Impl); }; |