| Index: content/browser/renderer_host/resource_dispatcher_host_impl.cc
|
| diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.cc b/content/browser/renderer_host/resource_dispatcher_host_impl.cc
|
| index 111edc5a9fdabf7eed215daf838f2d97c91f399b..d320956ff66ad1e571f9a874ad46599c67272a50 100644
|
| --- a/content/browser/renderer_host/resource_dispatcher_host_impl.cc
|
| +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.cc
|
| @@ -357,7 +357,8 @@ ResourceDispatcherHostImpl::ResourceDispatcherHostImpl()
|
| kMaxOutstandingRequestsCostPerProcess),
|
| filter_(NULL),
|
| delegate_(NULL),
|
| - allow_cross_origin_auth_prompt_(false) {
|
| + allow_cross_origin_auth_prompt_(false),
|
| + resource_scheduler_(new ResourceScheduler()) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK(!g_resource_dispatcher_host);
|
| g_resource_dispatcher_host = this;
|
| @@ -421,8 +422,8 @@ void ResourceDispatcherHostImpl::CancelRequestsForContext(
|
|
|
| for (LoaderMap::iterator i = pending_loaders_.begin();
|
| i != pending_loaders_.end();) {
|
| - if (i->second->GetRequestInfo()->GetContext() == context) {
|
| - loaders_to_cancel.push_back(i->second);
|
| + if (i->second->loader()->GetRequestInfo()->GetContext() == context) {
|
| + loaders_to_cancel.push_back(i->second->loader());
|
| pending_loaders_.erase(i++);
|
| } else {
|
| ++i;
|
| @@ -476,7 +477,7 @@ void ResourceDispatcherHostImpl::CancelRequestsForContext(
|
| for (LoaderMap::const_iterator i = pending_loaders_.begin();
|
| i != pending_loaders_.end(); ++i) {
|
| // http://crbug.com/90971
|
| - CHECK_NE(i->second->GetRequestInfo()->GetContext(), context);
|
| + CHECK_NE(i->second->loader()->GetRequestInfo()->GetContext(), context);
|
| }
|
|
|
| for (BlockedLoadersMap::const_iterator i = blocked_loaders_map_.begin();
|
| @@ -656,8 +657,9 @@ bool ResourceDispatcherHostImpl::AcceptSSLClientCertificateRequest(
|
| return true;
|
| }
|
|
|
| -bool ResourceDispatcherHostImpl::HandleExternalProtocol(ResourceLoader* loader,
|
| - const GURL& url) {
|
| +bool ResourceDispatcherHostImpl::HandleExternalProtocol(
|
| + ResourceLoader* loader,
|
| + const GURL& url) {
|
| if (!delegate_)
|
| return false;
|
|
|
| @@ -705,7 +707,8 @@ void ResourceDispatcherHostImpl::DidReceiveRedirect(ResourceLoader* loader,
|
| render_process_id, render_view_id, base::Passed(&detail)));
|
| }
|
|
|
| -void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) {
|
| +void ResourceDispatcherHostImpl::DidReceiveResponse(
|
| + ResourceLoader* loader) {
|
| ResourceRequestInfoImpl* info = loader->GetRequestInfo();
|
|
|
| int render_process_id, render_view_id;
|
| @@ -880,8 +883,8 @@ void ResourceDispatcherHostImpl::BeginRequest(
|
| GlobalRequestID(request_data.transferred_request_child_id,
|
| request_data.transferred_request_request_id));
|
| if (it != pending_loaders_.end()) {
|
| - if (it->second->is_transferring()) {
|
| - deferred_loader = it->second;
|
| + if (it->second->loader()->is_transferring()) {
|
| + deferred_loader = it->second->loader();
|
| pending_loaders_.erase(it);
|
| } else {
|
| RecordAction(UserMetricsAction("BadMessageTerminate_RDH"));
|
| @@ -1057,7 +1060,9 @@ void ResourceDispatcherHostImpl::BeginRequest(
|
| }
|
|
|
| if (deferred_loader.get()) {
|
| - pending_loaders_[extra_info->GetGlobalRequestID()] = deferred_loader;
|
| + pending_loaders_[extra_info->GetGlobalRequestID()] = make_linked_ptr(
|
| + resource_scheduler_->ScheduleLoad(child_id, route_id, request_id,
|
| + deferred_loader));
|
| deferred_loader->CompleteTransfer(handler.Pass());
|
| } else {
|
| BeginRequestInternal(new_request.Pass(), handler.Pass());
|
| @@ -1188,7 +1193,7 @@ void ResourceDispatcherHostImpl::HandleSwapOutACK(
|
| // Closes for cross-site transitions are handled such that the cross-site
|
| // transition continues.
|
| ResourceLoader* loader = GetLoader(params.new_render_process_host_id,
|
| - params.new_request_id);
|
| + params.new_request_id);
|
| if (loader) {
|
| // The response we were meant to resume could have already been canceled.
|
| ResourceRequestInfoImpl* info = loader->GetRequestInfo();
|
| @@ -1306,7 +1311,7 @@ void ResourceDispatcherHostImpl::CancelRequestsForRoute(int child_id,
|
| if (i->first.child_id != child_id)
|
| continue;
|
|
|
| - ResourceRequestInfoImpl* info = i->second->GetRequestInfo();
|
| + ResourceRequestInfoImpl* info = i->second->loader()->GetRequestInfo();
|
|
|
| GlobalRequestID id(child_id, i->first.request_id);
|
| DCHECK(id == i->first);
|
| @@ -1373,7 +1378,7 @@ void ResourceDispatcherHostImpl::RemovePendingRequest(int child_id,
|
|
|
| void ResourceDispatcherHostImpl::RemovePendingLoader(
|
| const LoaderMap::iterator& iter) {
|
| - ResourceRequestInfoImpl* info = iter->second->GetRequestInfo();
|
| + ResourceRequestInfoImpl* info = iter->second->loader()->GetRequestInfo();
|
|
|
| // Remove the memory credit that we added when pushing the request onto
|
| // the pending list.
|
| @@ -1502,9 +1507,9 @@ void ResourceDispatcherHostImpl::BeginRequestInternal(
|
| void ResourceDispatcherHostImpl::StartLoading(
|
| ResourceRequestInfoImpl* info,
|
| const linked_ptr<ResourceLoader>& loader) {
|
| - pending_loaders_[info->GetGlobalRequestID()] = loader;
|
| -
|
| - loader->StartRequest();
|
| + pending_loaders_[info->GetGlobalRequestID()] = make_linked_ptr(
|
| + resource_scheduler_->ScheduleLoad(info->GetChildID(), info->GetRouteID(),
|
| + info->GetRequestID(), loader));
|
| }
|
|
|
| void ResourceDispatcherHostImpl::OnUserGesture(WebContentsImpl* contents) {
|
| @@ -1581,8 +1586,8 @@ void ResourceDispatcherHostImpl::UpdateLoadStates() {
|
| // in each View (good chance it's zero).
|
| std::map<std::pair<int, int>, uint64> largest_upload_size;
|
| for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) {
|
| - net::URLRequest* request = i->second->request();
|
| - ResourceRequestInfoImpl* info = i->second->GetRequestInfo();
|
| + net::URLRequest* request = i->second->loader()->request();
|
| + ResourceRequestInfoImpl* info = i->second->loader()->GetRequestInfo();
|
| uint64 upload_size = request->GetUploadProgress().size();
|
| if (request->GetLoadState().state != net::LOAD_STATE_SENDING_REQUEST)
|
| upload_size = 0;
|
| @@ -1592,14 +1597,14 @@ void ResourceDispatcherHostImpl::UpdateLoadStates() {
|
| }
|
|
|
| for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) {
|
| - net::URLRequest* request = i->second->request();
|
| - ResourceRequestInfoImpl* info = i->second->GetRequestInfo();
|
| + net::URLRequest* request = i->second->loader()->request();
|
| + ResourceRequestInfoImpl* info = i->second->loader()->GetRequestInfo();
|
| net::LoadStateWithParam load_state = request->GetLoadState();
|
| net::UploadProgress progress = request->GetUploadProgress();
|
|
|
| // We also poll for upload progress on this timer and send upload
|
| // progress ipc messages to the plugin process.
|
| - i->second->ReportUploadProgress();
|
| + i->second->loader()->ReportUploadProgress();
|
|
|
| std::pair<int, int> key(info->GetChildID(), info->GetRouteID());
|
|
|
| @@ -1718,11 +1723,11 @@ ResourceLoader* ResourceDispatcherHostImpl::GetLoader(
|
| if (i == pending_loaders_.end())
|
| return NULL;
|
|
|
| - return i->second.get();
|
| + return i->second->loader().get();
|
| }
|
|
|
| -ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id,
|
| - int request_id) const {
|
| +ResourceLoader* ResourceDispatcherHostImpl::GetLoader(
|
| + int child_id, int request_id) const {
|
| return GetLoader(GlobalRequestID(child_id, request_id));
|
| }
|
|
|
|
|