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

Unified Diff: content/browser/renderer_host/resource_queue.cc

Issue 8308003: Revert 105661 - Revert 105659 - Delay network requests on startup if any webRequest or webNavigat... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/resource_queue.cc
===================================================================
--- content/browser/renderer_host/resource_queue.cc (revision 105685)
+++ content/browser/renderer_host/resource_queue.cc (working copy)
@@ -75,19 +75,23 @@
requests_.erase(request_id);
}
-void ResourceQueue::StartDelayedRequest(ResourceQueueDelegate* delegate,
- const GlobalRequestID& request_id) {
+void ResourceQueue::StartDelayedRequests(ResourceQueueDelegate* delegate) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(!shutdown_);
- DCHECK(ContainsKey(interested_delegates_, request_id));
- DCHECK(ContainsKey(interested_delegates_[request_id], delegate));
- interested_delegates_[request_id].erase(delegate);
- if (interested_delegates_[request_id].empty()) {
- interested_delegates_.erase(request_id);
+ for (RequestMap::iterator i = requests_.begin(); i != requests_.end(); ++i) {
+ GlobalRequestID request_id = i->first;
+ // Ignore requests that this delegate never asked to delay.
+ if (!ContainsKey(interested_delegates_, request_id) ||
+ !ContainsKey(interested_delegates_[request_id], delegate)) {
+ continue;
+ }
+ interested_delegates_[request_id].erase(delegate);
- if (ContainsKey(requests_, request_id)) {
- net::URLRequest* request = requests_[request_id];
+ // If no more delegates want a delay, start the request.
+ if (interested_delegates_[request_id].empty()) {
+ interested_delegates_.erase(request_id);
+ net::URLRequest* request = i->second;
// The request shouldn't have started (SUCCESS is the initial state).
DCHECK_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
request->Start();
« no previous file with comments | « content/browser/renderer_host/resource_queue.h ('k') | content/browser/renderer_host/resource_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698