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

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

Issue 10736066: Adding histograms showing fraction of page load times (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 "chrome/browser/net/chrome_url_request_context.h" 5 #include "chrome/browser/net/chrome_url_request_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/io_thread.h" 12 #include "chrome/browser/io_thread.h"
13 #include "chrome/browser/net/cache_stats.h"
13 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_io_data.h" 16 #include "chrome/browser/profiles/profile_io_data.h"
16 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/notification_details.h" 20 #include "content/public/browser/notification_details.h"
20 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
21 #include "content/public/common/content_client.h" 22 #include "content/public/common/content_client.h"
22 #include "net/cookies/cookie_store.h" 23 #include "net/cookies/cookie_store.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 284
284 void ChromeURLRequestContextGetter::OnDefaultCharsetChange( 285 void ChromeURLRequestContextGetter::OnDefaultCharsetChange(
285 const std::string& default_charset) { 286 const std::string& default_charset) {
286 GetIOContext()->OnDefaultCharsetChange(default_charset); 287 GetIOContext()->OnDefaultCharsetChange(default_charset);
287 } 288 }
288 289
289 // ---------------------------------------------------------------------------- 290 // ----------------------------------------------------------------------------
290 // ChromeURLRequestContext 291 // ChromeURLRequestContext
291 // ---------------------------------------------------------------------------- 292 // ----------------------------------------------------------------------------
292 293
293 ChromeURLRequestContext::ChromeURLRequestContext() 294 ChromeURLRequestContext::ChromeURLRequestContext(
295 ContextType type,
296 chrome_browser_net::CacheStats* cache_stats)
294 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 297 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
295 is_incognito_(false) { 298 is_incognito_(false),
299 cache_stats_(cache_stats) {
296 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
301 if (cache_stats_)
302 cache_stats_->RegisterURLRequestContext(this, type);
297 } 303 }
298 304
299 ChromeURLRequestContext::~ChromeURLRequestContext() { 305 ChromeURLRequestContext::~ChromeURLRequestContext() {
300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
307 if (cache_stats_)
308 cache_stats_->UnregisterURLRequestContext(this);
301 } 309 }
302 310
303 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { 311 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) {
304 URLRequestContext::CopyFrom(other); 312 URLRequestContext::CopyFrom(other);
305 313
306 // Copy ChromeURLRequestContext parameters. 314 // Copy ChromeURLRequestContext parameters.
307 // ChromeURLDataManagerBackend is unique per context. 315 // ChromeURLDataManagerBackend is unique per context.
308 set_is_incognito(other->is_incognito()); 316 set_is_incognito(other->is_incognito());
309 } 317 }
310 318
(...skipping 20 matching lines...) Expand all
331 net::HttpUtil::GenerateAcceptLanguageHeader(accept_language)); 339 net::HttpUtil::GenerateAcceptLanguageHeader(accept_language));
332 } 340 }
333 341
334 void ChromeURLRequestContext::OnDefaultCharsetChange( 342 void ChromeURLRequestContext::OnDefaultCharsetChange(
335 const std::string& default_charset) { 343 const std::string& default_charset) {
336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
337 set_referrer_charset(default_charset); 345 set_referrer_charset(default_charset);
338 set_accept_charset( 346 set_accept_charset(
339 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset)); 347 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset));
340 } 348 }
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_url_request_context.h ('k') | chrome/browser/profiles/off_the_record_profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698