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

Side by Side Diff: content/browser/storage_partition_impl_map.cc

Issue 10969017: Create a new URLRequestJobFactory for isolated request contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/storage_partition_impl_map.h" 5 #include "content/browser/storage_partition_impl_map.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }; 137 };
138 138
139 void InitializeURLRequestContext( 139 void InitializeURLRequestContext(
140 net::URLRequestContextGetter* context_getter, 140 net::URLRequestContextGetter* context_getter,
141 AppCacheService* appcache_service, 141 AppCacheService* appcache_service,
142 FileSystemContext* file_system_context, 142 FileSystemContext* file_system_context,
143 ChromeBlobStorageContext* blob_storage_context) { 143 ChromeBlobStorageContext* blob_storage_context) {
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
145 if (!context_getter) 145 if (!context_getter)
146 return; // tests. 146 return; // tests.
147
148 // Currently this just modifies the URLRequestJobFactory on the context
Charlie Reis 2012/09/20 17:47:03 "Currently this just" makes it sound like there's
awong 2012/09/20 22:11:00 Kinda...I'll reword it slightly.
149 // to handle blob: URLs, filesystem: URLs, and to let AppCache intercept
150 // the appropriate requests.
147 net::URLRequestContext* context = context_getter->GetURLRequestContext(); 151 net::URLRequestContext* context = context_getter->GetURLRequestContext();
148 net::URLRequestJobFactory* job_factory = 152 net::URLRequestJobFactory* job_factory =
149 const_cast<net::URLRequestJobFactory*>(context->job_factory()); 153 const_cast<net::URLRequestJobFactory*>(context->job_factory());
154
155 // Note: if this is called twice with 2 request contexts that share one job
156 // factory (as is the case with a media request context and its related
157 // normal request context) then this will early exit.
150 if (job_factory->IsHandledProtocol(chrome::kBlobScheme)) 158 if (job_factory->IsHandledProtocol(chrome::kBlobScheme))
151 return; // Already initialized this RequestContext. 159 return; // Already initialized this JobFactory.
152 160
153 bool set_protocol = job_factory->SetProtocolHandler( 161 bool set_protocol = job_factory->SetProtocolHandler(
154 chrome::kBlobScheme, 162 chrome::kBlobScheme,
155 new BlobProtocolHandler( 163 new BlobProtocolHandler(
156 blob_storage_context->controller(), 164 blob_storage_context->controller(),
157 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); 165 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
158 DCHECK(set_protocol); 166 DCHECK(set_protocol);
159 set_protocol = job_factory->SetProtocolHandler( 167 set_protocol = job_factory->SetProtocolHandler(
160 chrome::kFileSystemScheme, 168 chrome::kFileSystemScheme,
161 CreateFileSystemProtocolHandler(file_system_context)); 169 CreateFileSystemProtocolHandler(file_system_context));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // Add content's URLRequestContext's hooks. 254 // Add content's URLRequestContext's hooks.
247 BrowserThread::PostTask( 255 BrowserThread::PostTask(
248 BrowserThread::IO, FROM_HERE, 256 BrowserThread::IO, FROM_HERE,
249 base::Bind( 257 base::Bind(
250 &InitializeURLRequestContext, 258 &InitializeURLRequestContext,
251 make_scoped_refptr(partition->GetURLRequestContext()), 259 make_scoped_refptr(partition->GetURLRequestContext()),
252 make_scoped_refptr(partition->GetAppCacheService()), 260 make_scoped_refptr(partition->GetAppCacheService()),
253 make_scoped_refptr(partition->GetFileSystemContext()), 261 make_scoped_refptr(partition->GetFileSystemContext()),
254 make_scoped_refptr( 262 make_scoped_refptr(
255 ChromeBlobStorageContext::GetFor(browser_context_)))); 263 ChromeBlobStorageContext::GetFor(browser_context_))));
256 BrowserThread::PostTask(
257 BrowserThread::IO, FROM_HERE,
258 base::Bind(
259 &InitializeURLRequestContext,
260 make_scoped_refptr(partition->GetMediaURLRequestContext()),
Charlie Reis 2012/09/20 17:47:03 Why isn't this needed anymore? The comment you ad
awong 2012/09/20 22:11:00 Done.
261 make_scoped_refptr(partition->GetAppCacheService()),
262 make_scoped_refptr(partition->GetFileSystemContext()),
263 make_scoped_refptr(
264 ChromeBlobStorageContext::GetFor(browser_context_))));
265 } 264 }
266 } 265 }
267 266
268 } // namespace content 267 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698