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

Side by Side Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 267132: Http Cache: Enable byte-range support by default.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/net/chrome_url_request_context.h" 5 #include "chrome/browser/net/chrome_url_request_context.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/privacy_blacklist/blacklist.h" 10 #include "chrome/browser/privacy_blacklist/blacklist.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 126 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
127 127
128 context->proxy_service_ = CreateProxyService(context, command_line); 128 context->proxy_service_ = CreateProxyService(context, command_line);
129 129
130 net::HttpCache* cache = 130 net::HttpCache* cache =
131 new net::HttpCache(context->host_resolver_, 131 new net::HttpCache(context->host_resolver_,
132 context->proxy_service_, 132 context->proxy_service_,
133 context->ssl_config_service_, 133 context->ssl_config_service_,
134 disk_cache_path.ToWStringHack(), cache_size); 134 disk_cache_path.ToWStringHack(), cache_size);
135 135
136 if (command_line.HasSwitch(switches::kEnableByteRangeSupport)) 136 if (command_line.HasSwitch(switches::kDisableByteRangeSupport))
137 cache->set_enable_range_support(true); 137 cache->set_enable_range_support(false);
138 138
139 bool record_mode = chrome::kRecordModeEnabled && 139 bool record_mode = chrome::kRecordModeEnabled &&
140 command_line.HasSwitch(switches::kRecordMode); 140 command_line.HasSwitch(switches::kRecordMode);
141 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); 141 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode);
142 142
143 if (record_mode || playback_mode) { 143 if (record_mode || playback_mode) {
144 // Don't use existing cookies and use an in-memory store. 144 // Don't use existing cookies and use an in-memory store.
145 context->cookie_store_ = new net::CookieMonster(); 145 context->cookie_store_ = new net::CookieMonster();
146 cache->set_mode( 146 cache->set_mode(
147 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); 147 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 context->proxy_service_ = 228 context->proxy_service_ =
229 profile->GetOriginalProfile()->GetRequestContext()->proxy_service(); 229 profile->GetOriginalProfile()->GetRequestContext()->proxy_service();
230 230
231 net::HttpCache* cache = 231 net::HttpCache* cache =
232 new net::HttpCache(context->host_resolver_, context->proxy_service_, 232 new net::HttpCache(context->host_resolver_, context->proxy_service_,
233 context->ssl_config_service_, 0); 233 context->ssl_config_service_, 0);
234 context->cookie_store_ = new net::CookieMonster; 234 context->cookie_store_ = new net::CookieMonster;
235 context->http_transaction_factory_ = cache; 235 context->http_transaction_factory_ = cache;
236 236
237 if (CommandLine::ForCurrentProcess()->HasSwitch( 237 if (CommandLine::ForCurrentProcess()->HasSwitch(
238 switches::kEnableByteRangeSupport)) 238 switches::kDisableByteRangeSupport))
239 cache->set_enable_range_support(true); 239 cache->set_enable_range_support(false);
240 240
241 // The kWininetFtp switch is Windows specific because we have two FTP 241 // The kWininetFtp switch is Windows specific because we have two FTP
242 // implementations on Windows. 242 // implementations on Windows.
243 #if defined(OS_WIN) 243 #if defined(OS_WIN)
244 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kWininetFtp)) 244 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kWininetFtp))
245 context->ftp_transaction_factory_ = 245 context->ftp_transaction_factory_ =
246 new net::FtpNetworkLayer(context->host_resolver_); 246 new net::FtpNetworkLayer(context->host_resolver_);
247 #else 247 #else
248 context->ftp_transaction_factory_ = 248 context->ftp_transaction_factory_ =
249 new net::FtpNetworkLayer(context->host_resolver_); 249 new net::FtpNetworkLayer(context->host_resolver_);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } else { 301 } else {
302 // If original HttpCache doesn't exist, simply construct one with a whole 302 // If original HttpCache doesn't exist, simply construct one with a whole
303 // new set of network stack. 303 // new set of network stack.
304 cache = new net::HttpCache(original_context->host_resolver(), 304 cache = new net::HttpCache(original_context->host_resolver(),
305 original_context->proxy_service(), 305 original_context->proxy_service(),
306 original_context->ssl_config_service(), 306 original_context->ssl_config_service(),
307 disk_cache_path.ToWStringHack(), cache_size); 307 disk_cache_path.ToWStringHack(), cache_size);
308 } 308 }
309 309
310 if (CommandLine::ForCurrentProcess()->HasSwitch( 310 if (CommandLine::ForCurrentProcess()->HasSwitch(
311 switches::kEnableByteRangeSupport)) 311 switches::kDisableByteRangeSupport))
312 cache->set_enable_range_support(true); 312 cache->set_enable_range_support(false);
313 313
314 cache->set_type(net::MEDIA_CACHE); 314 cache->set_type(net::MEDIA_CACHE);
315 context->http_transaction_factory_ = cache; 315 context->http_transaction_factory_ = cache;
316 return context; 316 return context;
317 } 317 }
318 318
319 ChromeURLRequestContext::ChromeURLRequestContext( 319 ChromeURLRequestContext::ChromeURLRequestContext(
320 Profile* profile, ChromeAppCacheService* appcache_service) 320 Profile* profile, ChromeAppCacheService* appcache_service)
321 : appcache_service_(appcache_service), 321 : appcache_service_(appcache_service),
322 prefs_(profile->GetPrefs()), 322 prefs_(profile->GetPrefs()),
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 appcache_service_->set_request_context(NULL); 539 appcache_service_->set_request_context(NULL);
540 540
541 NotificationService::current()->Notify( 541 NotificationService::current()->Notify(
542 NotificationType::URL_REQUEST_CONTEXT_RELEASED, 542 NotificationType::URL_REQUEST_CONTEXT_RELEASED,
543 Source<URLRequestContext>(this), 543 Source<URLRequestContext>(this),
544 NotificationService::NoDetails()); 544 NotificationService::NoDetails());
545 545
546 delete ftp_transaction_factory_; 546 delete ftp_transaction_factory_;
547 delete http_transaction_factory_; 547 delete http_transaction_factory_;
548 } 548 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698