From 336374152866bf926d83c7749ff5dc0dd26d3cda Mon Sep 17 00:00:00 2001 From: "ddorwin@chromium.org" Date: Thu, 5 May 2011 03:55:15 +0000 Subject: Merge 84204 - Fix renderer crash and resulting test hang in PDFBrowserTests. I had assumed that didReceiveData() would only be called after Open(), but WebPluginImpl::didReceiveResponse() creates a PPB_URLLoader_Impl and immediately calls didReceiveData(). This correctly handles this case. BUG=80684 TEST=PDFBrowserTest TBR=brettw@chromium.org TBR=ddorwin@chromium.org Review URL: http://codereview.chromium.org/6931027 git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@84210 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/plugins/ppapi/ppb_url_loader_impl.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'webkit/plugins') diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc index 5684d40..d0d4f06 100644 --- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc @@ -453,12 +453,14 @@ void PPB_URLLoader_Impl::didReceiveData(WebURLLoader* loader, // 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()); + DCHECK(!request_info_ || + (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( - request_info_->prefetch_buffer_upper_threshold())) { + request_info_ && + (buffer_.size() >= static_cast( + request_info_->prefetch_buffer_upper_threshold()))) { DVLOG(1) << "Suspending async load - buffer size: " << buffer_.size(); loader->setDefersLoading(true); is_asynchronous_load_suspended_ = true; @@ -522,6 +524,7 @@ size_t PPB_URLLoader_Impl::FillUserBuffer() { buffer_.erase(buffer_.begin(), buffer_.begin() + bytes_to_copy); // If the buffer is getting too empty, resume asynchronous loading. + DCHECK(!is_asynchronous_load_suspended_ || request_info_); if (is_asynchronous_load_suspended_ && buffer_.size() <= static_cast( request_info_->prefetch_buffer_lower_threshold())) { -- cgit v1.1