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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 648803002: Fix outstanding request stats for multiple transfer navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bug and add test Created 6 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
« no previous file with comments | « no previous file | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index a1cb1f1c15e8c7a0499e157d2e19c6ae16234193..64f71f01b290098983c62aabd7d1a76251ef6eeb 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1004,10 +1004,12 @@ void ResourceDispatcherHostImpl::UpdateRequestForTransfer(
GlobalRequestID new_request_id(child_id, request_id);
// Clear out data that depends on |info| before updating it.
- IncrementOutstandingRequestsMemory(-1, *info);
- OustandingRequestsStats empty_stats = { 0, 0 };
- OustandingRequestsStats old_stats = GetOutstandingRequestsStats(*info);
- UpdateOutstandingRequestsStats(*info, empty_stats);
+ // We always need to move the memory stats to the new process. In contrast,
+ // stats.num_requests is only sometimes tracked.
+ OustandingRequestsStats stats = IncrementOutstandingRequestsMemory(-1, *info);
+ bool should_update_count = stats.num_requests > 0;
davidben 2014/10/13 17:40:04 Hrm. Is this the right criteria? OutstandingReques
Charlie Reis 2014/10/14 23:54:12 Oops-- you're totally right. Awkward that we don'
+ if (should_update_count)
+ IncrementOutstandingRequestsCount(-1, *info);
pending_loaders_.erase(old_request_id);
// ResourceHandlers should always get state related to the request from the
@@ -1020,8 +1022,9 @@ void ResourceDispatcherHostImpl::UpdateRequestForTransfer(
// Update maps that used the old IDs, if necessary. Some transfers in tests
// do not actually use a different ID, so not all maps need to be updated.
pending_loaders_[new_request_id] = loader;
- UpdateOutstandingRequestsStats(*info, old_stats);
IncrementOutstandingRequestsMemory(1, *info);
+ if (should_update_count)
+ IncrementOutstandingRequestsCount(1, *info);
if (old_routing_id != new_routing_id) {
if (blocked_loaders_map_.find(old_routing_id) !=
blocked_loaders_map_.end()) {
« no previous file with comments | « no previous file | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698