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

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

Issue 10389030: Fixed CHECKs for use of canceled ResourceContexts in ResourceDispatcherHostImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile errors. Created 8 years, 7 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_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 a74a4389b913e68f4470df548a5a18b74d656e3b..a5fe3371108c8e72521d38335002403d7c8feb96 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_impl.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_impl.cc
@@ -371,12 +371,22 @@ void ResourceDispatcherHostImpl::SetAllowCrossOriginAuthPrompt(bool value) {
allow_cross_origin_auth_prompt_ = value;
}
+void ResourceDispatcherHostImpl::AddResourceContext(ResourceContext* context) {
+ active_resource_contexts_.insert(context);
+}
+
+void ResourceDispatcherHostImpl::RemoveResourceContext(
+ ResourceContext* context) {
+ CHECK(ContainsKey(active_resource_contexts_, context));
+ active_resource_contexts_.erase(context);
+}
+
void ResourceDispatcherHostImpl::CancelRequestsForContext(
ResourceContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(context);
- canceled_resource_contexts_.insert(context);
+ CHECK(ContainsKey(active_resource_contexts_, context));
// Note that request cancellation has side effects. Therefore, we gather all
// the requests to cancel first, and then we start cancelling. We assert at
@@ -481,7 +491,7 @@ net::Error ResourceDispatcherHostImpl::BeginDownload(
char url_buf[128];
base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
base::debug::Alias(url_buf);
- CHECK(!ContainsKey(canceled_resource_contexts_, context));
+ CHECK(ContainsKey(active_resource_contexts_, context));
const net::URLRequestContext* request_context = context->GetRequestContext();
request->set_referrer(MaybeStripReferrer(GURL(request->referrer())).spec());
@@ -754,7 +764,7 @@ void ResourceDispatcherHostImpl::BeginRequest(
ResourceContext* resource_context = filter_->resource_context();
// http://crbug.com/90971
- CHECK(!ContainsKey(canceled_resource_contexts_, resource_context));
+ CHECK(ContainsKey(active_resource_contexts_, resource_context));
// Might need to resolve the blob references in the upload data.
if (request_data.upload_data) {
@@ -1160,7 +1170,7 @@ void ResourceDispatcherHostImpl::BeginSaveFile(
char url_buf[128];
base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
base::debug::Alias(url_buf);
- CHECK(!ContainsKey(canceled_resource_contexts_, context));
+ CHECK(ContainsKey(active_resource_contexts_, context));
scoped_refptr<ResourceHandler> handler(
new SaveFileResourceHandler(child_id,
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host_impl.h ('k') | content/browser/resource_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698