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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.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/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 DestroyResourceContext(); 260 DestroyResourceContext();
261 261
262 if (media_request_context_.get()) 262 if (media_request_context_.get())
263 media_request_context_->AssertNoURLRequests(); 263 media_request_context_->AssertNoURLRequests();
264 } 264 }
265 265
266 void ProfileImplIOData::LazyInitializeInternal( 266 void ProfileImplIOData::LazyInitializeInternal(
267 ProfileParams* profile_params) const { 267 ProfileParams* profile_params) const {
268 ChromeURLRequestContext* main_context = main_request_context(); 268 ChromeURLRequestContext* main_context = main_request_context();
269 ChromeURLRequestContext* extensions_context = extensions_request_context(); 269 ChromeURLRequestContext* extensions_context = extensions_request_context();
270 media_request_context_.reset(new ChromeURLRequestContext); 270 media_request_context_.reset(new ChromeURLRequestContext(
271 ChromeURLRequestContext::CONTEXT_TYPE_MEDIA, cache_stats()));
271 272
272 IOThread* const io_thread = profile_params->io_thread; 273 IOThread* const io_thread = profile_params->io_thread;
273 IOThread::Globals* const io_thread_globals = io_thread->globals(); 274 IOThread::Globals* const io_thread_globals = io_thread->globals();
274 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 275 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
275 // Only allow Record Mode if we are in a Debug build or where we are running 276 // Only allow Record Mode if we are in a Debug build or where we are running
276 // a cycle, and the user has limited control. 277 // a cycle, and the user has limited control.
277 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && 278 bool record_mode = command_line.HasSwitch(switches::kRecordMode) &&
278 (chrome::kRecordModeEnabled || 279 (chrome::kRecordModeEnabled ||
279 command_line.HasSwitch(switches::kVisitURLs)); 280 command_line.HasSwitch(switches::kVisitURLs));
280 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); 281 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 media_request_context_->set_job_factory(media_request_job_factory_.get()); 471 media_request_context_->set_job_factory(media_request_job_factory_.get());
471 extensions_context->set_job_factory(extensions_job_factory_.get()); 472 extensions_context->set_job_factory(extensions_job_factory_.get());
472 473
473 lazy_params_.reset(); 474 lazy_params_.reset();
474 } 475 }
475 476
476 ChromeURLRequestContext* 477 ChromeURLRequestContext*
477 ProfileImplIOData::InitializeAppRequestContext( 478 ProfileImplIOData::InitializeAppRequestContext(
478 ChromeURLRequestContext* main_context, 479 ChromeURLRequestContext* main_context,
479 const std::string& app_id) const { 480 const std::string& app_id) const {
480 AppRequestContext* context = new AppRequestContext; 481 AppRequestContext* context = new AppRequestContext(cache_stats());
481 482
482 // If this is for a guest process, we should not persist cookies and http 483 // If this is for a guest process, we should not persist cookies and http
483 // cache. 484 // cache.
484 bool guest_process = (app_id.find("guest-") != std::string::npos); 485 bool guest_process = (app_id.find("guest-") != std::string::npos);
485 486
486 // Copy most state from the main context. 487 // Copy most state from the main context.
487 context->CopyFrom(main_context); 488 context->CopyFrom(main_context);
488 489
489 FilePath app_path = app_path_.AppendASCII(app_id); 490 FilePath app_path = app_path_.AppendASCII(app_id);
490 FilePath cookie_path = app_path.Append(chrome::kCookieFilename); 491 FilePath cookie_path = app_path.Append(chrome::kCookieFilename);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 ProfileImplIOData::AcquireIsolatedAppRequestContext( 558 ProfileImplIOData::AcquireIsolatedAppRequestContext(
558 ChromeURLRequestContext* main_context, 559 ChromeURLRequestContext* main_context,
559 const std::string& app_id) const { 560 const std::string& app_id) const {
560 // We create per-app contexts on demand, unlike the others above. 561 // We create per-app contexts on demand, unlike the others above.
561 ChromeURLRequestContext* app_request_context = 562 ChromeURLRequestContext* app_request_context =
562 InitializeAppRequestContext(main_context, app_id); 563 InitializeAppRequestContext(main_context, app_id);
563 DCHECK(app_request_context); 564 DCHECK(app_request_context);
564 return app_request_context; 565 return app_request_context;
565 } 566 }
566 567
568 chrome_browser_net::CacheStats* ProfileImplIOData::GetCacheStats(
569 IOThread::Globals* io_thread_globals) const {
570 return io_thread_globals->cache_stats.get();
571 }
572
567 void ProfileImplIOData::CreateFtpProtocolHandler( 573 void ProfileImplIOData::CreateFtpProtocolHandler(
568 net::URLRequestJobFactory* job_factory, 574 net::URLRequestJobFactory* job_factory,
569 net::FtpAuthCache* ftp_auth_cache) const { 575 net::FtpAuthCache* ftp_auth_cache) const {
570 job_factory->SetProtocolHandler( 576 job_factory->SetProtocolHandler(
571 chrome::kFtpScheme, 577 chrome::kFtpScheme,
572 new net::FtpProtocolHandler(network_delegate(), 578 new net::FtpProtocolHandler(network_delegate(),
573 ftp_factory_.get(), 579 ftp_factory_.get(),
574 ftp_auth_cache)); 580 ftp_auth_cache));
575 } 581 }
576 582
577 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 583 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
578 base::Time time) { 584 base::Time time) {
579 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 585 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
580 LazyInitialize(); 586 LazyInitialize();
581 587
582 DCHECK(transport_security_state()); 588 DCHECK(transport_security_state());
583 transport_security_state()->DeleteSince(time); 589 transport_security_state()->DeleteSince(time);
584 DCHECK(http_server_properties_manager()); 590 DCHECK(http_server_properties_manager());
585 http_server_properties_manager()->Clear(); 591 http_server_properties_manager()->Clear();
586 } 592 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698