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

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

Issue 6825038: Create a content::ResourceContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oops, inverted the assertions. Created 9 years, 8 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_message_filter.cc
diff --git a/content/browser/renderer_host/resource_message_filter.cc b/content/browser/renderer_host/resource_message_filter.cc
index fe490f81bf56f8aa69f76c9692e0d5dec7a6daeb..d038ef463dafe225c0c523e2ec8899c1f15845fe 100644
--- a/content/browser/renderer_host/resource_message_filter.cc
+++ b/content/browser/renderer_host/resource_message_filter.cc
@@ -7,15 +7,20 @@
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/render_messages.h"
+#include "content/browser/browser_thread.h"
+#include "content/browser/resource_context.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
ResourceMessageFilter::ResourceMessageFilter(
int child_id,
ChildProcessInfo::ProcessType process_type,
+ content::ResourceContextGetter* resource_context_getter,
ResourceDispatcherHost* resource_dispatcher_host)
: child_id_(child_id),
process_type_(process_type),
- resource_dispatcher_host_(resource_dispatcher_host) {
+ resource_dispatcher_host_(resource_dispatcher_host),
+ resource_context_getter_(resource_context_getter),
+ resource_context_(NULL) {
}
ResourceMessageFilter::~ResourceMessageFilter() {
@@ -50,3 +55,14 @@ ChromeURLRequestContext* ResourceMessageFilter::GetURLRequestContext(
return static_cast<ChromeURLRequestContext*>(rv);
}
+
+const content::ResourceContext& ResourceMessageFilter::resource_context() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (resource_context_getter_.get()) {
+ DCHECK(!resource_context_);
+ resource_context_ = &resource_context_getter_->Get();
+ resource_context_getter_.reset();
+ }
+ DCHECK(resource_context_);
+ return *resource_context_;
+}

Powered by Google App Engine
This is Rietveld 408576698