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

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

Issue 1542743002: [RDHI] Refactored blocked_loaders_map_ to key by render frame route id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just comments / minor restructuring (trybots previous) Created 5 years 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/loader/cross_site_resource_handler_browsertest.cc
diff --git a/content/browser/loader/cross_site_resource_handler_browsertest.cc b/content/browser/loader/cross_site_resource_handler_browsertest.cc
index 55d7bc010560e992f7f6a41b69b1b58057a09849..b4ab136201104a169f01ea6183246ab13869a413 100644
--- a/content/browser/loader/cross_site_resource_handler_browsertest.cc
+++ b/content/browser/loader/cross_site_resource_handler_browsertest.cc
@@ -96,7 +96,8 @@ class TestResourceDispatcherHostDelegate
CallbackRunningResourceThrottle(net::URLRequest* request,
TestResourceDispatcherHostDelegate* tracker,
const RequestDeferredHook& run_on_start)
- : request_(request),
+ : resumed_(false),
+ request_(request),
tracker_(tracker),
run_on_start_(run_on_start),
weak_factory_(this) {}
@@ -115,9 +116,12 @@ class TestResourceDispatcherHostDelegate
~CallbackRunningResourceThrottle() override {
// If the request is deleted without being cancelled, its status will
// indicate it succeeded, so have to check if the request is still pending
- // as well.
+ // as well. If the request never even started, the throttle will never
+ // resume it. Check this condition as well to allow for early
+ // cancellation.
tracker_->OnTrackedRequestDestroyed(!request_->is_pending() &&
- request_->status().is_success());
+ request_->status().is_success() &&
+ resumed_);
}
// ResourceThrottle implementation:
@@ -126,7 +130,12 @@ class TestResourceDispatcherHostDelegate
}
private:
- void Resume() { controller()->Resume(); }
+ void Resume() {
+ resumed_ = true;
+ controller()->Resume();
+ }
+
+ bool resumed_;
net::URLRequest* request_;
TestResourceDispatcherHostDelegate* tracker_;
RequestDeferredHook run_on_start_;

Powered by Google App Engine
This is Rietveld 408576698