diff options
author | kerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 01:57:10 +0000 |
---|---|---|
committer | kerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 01:57:10 +0000 |
commit | 0913741d59bfcf69585a7bf4574d2bcfc093c260 (patch) | |
tree | 97b9f2da799a15f8459629932516fb4780d265b4 /webkit/plugins | |
parent | ca27645dbac0a03383f052dac8ecc3271668e1d0 (diff) | |
download | chromium_src-0913741d59bfcf69585a7bf4574d2bcfc093c260.zip chromium_src-0913741d59bfcf69585a7bf4574d2bcfc093c260.tar.gz chromium_src-0913741d59bfcf69585a7bf4574d2bcfc093c260.tar.bz2 |
Revert 84096 - Merge 84071 - Defer asynchronous loading when the buffer in PPB_URLLoader_Impl exceeds an optionally-specified threshold and re-enable it when the buffer drops below a lower threshold.
BUG=80684
TEST=Set the thresholds to 4 MB and 2 MB, respectively from a plugin then download a large file (> 200 MB). Observe that the renderer/plugin process memory usage in Task Manager does not exceed ~100MB and that network traffic drops to 0 then picks up again briefly after 10 MB are used.
Review URL: http://codereview.chromium.org/6923002
TBR=ddorwin@chromium.org
Review URL: http://codereview.chromium.org/6928014
TBR=ddorwin@chromium.org
Review URL: http://codereview.chromium.org/6931025
git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@84191 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-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 |
4 files changed, 1 insertions, 70 deletions
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); }; |