Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1285863003: ResourceScheduler: remove dependency on ResourceRequestInfo and request_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Rename resource_throttle variables back to throttle. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 filter_ = filter; 971 filter_ = filter;
972 bool handled = true; 972 bool handled = true;
973 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcherHostImpl, message) 973 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcherHostImpl, message)
974 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) 974 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource)
975 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) 975 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad)
976 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, 976 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile,
977 OnReleaseDownloadedFile) 977 OnReleaseDownloadedFile)
978 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) 978 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK)
979 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) 979 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK)
980 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) 980 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest)
981 IPC_MESSAGE_HANDLER(ResourceHostMsg_DidChangePriority, OnDidChangePriority)
981 IPC_MESSAGE_UNHANDLED(handled = false) 982 IPC_MESSAGE_UNHANDLED(handled = false)
982 IPC_END_MESSAGE_MAP() 983 IPC_END_MESSAGE_MAP()
983 984
984 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) { 985 if (!handled && IPC_MESSAGE_ID_CLASS(message.type()) == ResourceMsgStart) {
985 base::PickleIterator iter(message); 986 base::PickleIterator iter(message);
986 int request_id = -1; 987 int request_id = -1;
987 bool ok = iter.ReadInt(&request_id); 988 bool ok = iter.ReadInt(&request_id);
988 DCHECK(ok); 989 DCHECK(ok);
989 GlobalRequestID id(filter_->child_id(), request_id); 990 GlobalRequestID id(filter_->child_id(), request_id);
990 DelegateMap::iterator it = delegate_map_.find(id); 991 DelegateMap::iterator it = delegate_map_.find(id);
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 appcache_service, 1429 appcache_service,
1429 resource_type, 1430 resource_type,
1430 &throttles); 1431 &throttles);
1431 } 1432 }
1432 1433
1433 if (request->has_upload()) { 1434 if (request->has_upload()) {
1434 // Block power save while uploading data. 1435 // Block power save while uploading data.
1435 throttles.push_back(new PowerSaveBlockResourceThrottle()); 1436 throttles.push_back(new PowerSaveBlockResourceThrottle());
1436 } 1437 }
1437 1438
1438 throttles.push_back( 1439 // TODO(ricea): Stop looking this up so much.
1439 scheduler_->ScheduleRequest(child_id, route_id, request).release()); 1440 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
1441 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id,
1442 info->IsAsync(), request));
1440 1443
1441 handler.reset( 1444 handler.reset(
1442 new ThrottlingResourceHandler(handler.Pass(), request, throttles.Pass())); 1445 new ThrottlingResourceHandler(handler.Pass(), request, throttles.Pass()));
1443 1446
1444 return handler.Pass(); 1447 return handler.Pass();
1445 } 1448 }
1446 1449
1447 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { 1450 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) {
1448 UnregisterDownloadedTempFile(filter_->child_id(), request_id); 1451 UnregisterDownloadedTempFile(filter_->child_id(), request_id);
1449 } 1452 }
1450 1453
1454 void ResourceDispatcherHostImpl::OnDidChangePriority(
1455 int request_id,
1456 net::RequestPriority new_priority,
1457 int intra_priority_value) {
1458 ResourceLoader* loader = GetLoader(filter_->child_id(), request_id);
1459 // The request may go away before processing this message, so |loader| can
1460 // legitimately be null.
1461 if (!loader)
1462 return;
1463
1464 scheduler_->ReprioritizeRequest(loader->request(), new_priority,
1465 intra_priority_value);
1466 }
1467
1451 void ResourceDispatcherHostImpl::OnDataDownloadedACK(int request_id) { 1468 void ResourceDispatcherHostImpl::OnDataDownloadedACK(int request_id) {
1452 // TODO(michaeln): maybe throttle DataDownloaded messages 1469 // TODO(michaeln): maybe throttle DataDownloaded messages
1453 } 1470 }
1454 1471
1455 void ResourceDispatcherHostImpl::RegisterDownloadedTempFile( 1472 void ResourceDispatcherHostImpl::RegisterDownloadedTempFile(
1456 int child_id, int request_id, const base::FilePath& file_path) { 1473 int child_id, int request_id, const base::FilePath& file_path) {
1457 scoped_refptr<ShareableFileReference> reference = 1474 scoped_refptr<ShareableFileReference> reference =
1458 ShareableFileReference::Get(file_path); 1475 ShareableFileReference::Get(file_path);
1459 DCHECK(reference.get()); 1476 DCHECK(reference.get());
1460 1477
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
2354 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) 2371 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS)
2355 && !policy->CanReadRawCookies(child_id)) { 2372 && !policy->CanReadRawCookies(child_id)) {
2356 VLOG(1) << "Denied unauthorized request for raw headers"; 2373 VLOG(1) << "Denied unauthorized request for raw headers";
2357 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; 2374 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS;
2358 } 2375 }
2359 2376
2360 return load_flags; 2377 return load_flags;
2361 } 2378 }
2362 2379
2363 } // namespace content 2380 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698