| Index: content/child/resource_dispatcher.cc
|
| diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
|
| index 6e4f438b961eeb5fdfac3dd1115dfbf535caefbe..748b86a2869a6c9e56b2d87bcfb42fe53129a213 100644
|
| --- a/content/child/resource_dispatcher.cc
|
| +++ b/content/child/resource_dispatcher.cc
|
| @@ -17,6 +17,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "content/child/request_extra_data.h"
|
| #include "content/child/site_isolation_policy.h"
|
| +#include "content/child/webthreadedresourceprovider_impl.h"
|
| #include "content/common/inter_process_time_ticks_converter.h"
|
| #include "content/common/resource_messages.h"
|
| #include "content/public/child/resource_dispatcher_delegate.h"
|
| @@ -78,6 +79,8 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge {
|
| virtual void Cancel() OVERRIDE;
|
| virtual void SetDefersLoading(bool value) OVERRIDE;
|
| virtual void DidChangePriority(net::RequestPriority new_priority) OVERRIDE;
|
| + virtual blink::WebThreadedResourceProvider*
|
| + CreateThreadedResourceProvider() OVERRIDE;
|
| virtual void SyncLoad(SyncLoadResponse* response) OVERRIDE;
|
|
|
| private:
|
| @@ -233,6 +236,16 @@ void IPCResourceLoaderBridge::DidChangePriority(
|
| dispatcher_->DidChangePriority(routing_id_, request_id_, new_priority);
|
| }
|
|
|
| +blink::WebThreadedResourceProvider*
|
| +IPCResourceLoaderBridge::CreateThreadedResourceProvider() {
|
| + if (request_id_ < 0) {
|
| + NOTREACHED() << "Trying to set parser-resource bridge on unstarted request";
|
| + return NULL;
|
| + }
|
| +
|
| + return dispatcher_->CreateThreadedResourceProvider(request_id_);
|
| +}
|
| +
|
| void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) {
|
| if (request_id_ != -1) {
|
| NOTREACHED() << "Starting a request twice";
|
| @@ -276,6 +289,7 @@ ResourceDispatcher::ResourceDispatcher(IPC::Sender* sender)
|
| }
|
|
|
| ResourceDispatcher::~ResourceDispatcher() {
|
| + WebThreadedResourceProviderImpl::Cleanup();
|
| }
|
|
|
| // ResourceDispatcher implementation ------------------------------------------
|
| @@ -457,7 +471,8 @@ void ResourceDispatcher::OnReceivedData(int request_id,
|
| }
|
|
|
| // Acknowledge the reception of this data.
|
| - message_sender()->Send(new ResourceHostMsg_DataReceived_ACK(request_id));
|
| + if (!request_info || request_info->send_data_acks)
|
| + SendDataACK(request_id);
|
| }
|
|
|
| void ResourceDispatcher::OnDownloadedData(int request_id,
|
| @@ -592,6 +607,16 @@ void ResourceDispatcher::CancelPendingRequest(int request_id) {
|
| message_sender()->Send(new ResourceHostMsg_CancelRequest(request_id));
|
| }
|
|
|
| +void ResourceDispatcher::StopSendingDataACKs(int request_id) {
|
| + PendingRequestList::iterator it = pending_requests_.find(request_id);
|
| + if (it != pending_requests_.end())
|
| + it->second.send_data_acks = false;
|
| +}
|
| +
|
| +void ResourceDispatcher::SendDataACK(int request_id) {
|
| + message_sender()->Send(new ResourceHostMsg_DataReceived_ACK(request_id));
|
| +}
|
| +
|
| void ResourceDispatcher::SetDefersLoading(int request_id, bool value) {
|
| PendingRequestList::iterator it = pending_requests_.find(request_id);
|
| if (it == pending_requests_.end()) {
|
| @@ -621,11 +646,22 @@ void ResourceDispatcher::DidChangePriority(
|
| request_id, new_priority));
|
| }
|
|
|
| +blink::WebThreadedResourceProvider*
|
| +ResourceDispatcher::CreateThreadedResourceProvider(int request_id) {
|
| + PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
|
| +
|
| + return new WebThreadedResourceProviderImpl(request_id,
|
| + weak_factory_.GetWeakPtr(),
|
| + request_info->buffer,
|
| + request_info->buffer_size);
|
| +}
|
| +
|
| ResourceDispatcher::PendingRequestInfo::PendingRequestInfo()
|
| : peer(NULL),
|
| resource_type(ResourceType::SUB_RESOURCE),
|
| is_deferred(false),
|
| - buffer_size(0) {
|
| + buffer_size(0),
|
| + send_data_acks(true) {
|
| }
|
|
|
| ResourceDispatcher::PendingRequestInfo::PendingRequestInfo(
|
| @@ -641,7 +677,8 @@ ResourceDispatcher::PendingRequestInfo::PendingRequestInfo(
|
| url(request_url),
|
| frame_origin(frame_origin),
|
| response_url(request_url),
|
| - request_start(base::TimeTicks::Now()) {
|
| + request_start(base::TimeTicks::Now()),
|
| + send_data_acks(true) {
|
| }
|
|
|
| ResourceDispatcher::PendingRequestInfo::~PendingRequestInfo() {}
|
|
|