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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 1062413002: Remove unnecessary instrumentation for several jank bugs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fixes Created 5 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 unified diff | Download patch
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 <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 427
428 if (media_request_context_) 428 if (media_request_context_)
429 media_request_context_->AssertNoURLRequests(); 429 media_request_context_->AssertNoURLRequests();
430 } 430 }
431 431
432 void ProfileImplIOData::InitializeInternal( 432 void ProfileImplIOData::InitializeInternal(
433 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate, 433 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate,
434 ProfileParams* profile_params, 434 ProfileParams* profile_params,
435 content::ProtocolHandlerMap* protocol_handlers, 435 content::ProtocolHandlerMap* protocol_handlers,
436 content::URLRequestInterceptorScopedVector request_interceptors) const { 436 content::URLRequestInterceptorScopedVector request_interceptors) const {
437 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
438 tracked_objects::ScopedTracker tracking_profile(
439 FROM_HERE_WITH_EXPLICIT_FUNCTION(
440 "436671 ProfileImplIOData::InitializeInternal"));
441
442 // Set up a persistent store for use by the network stack on the IO thread. 437 // Set up a persistent store for use by the network stack on the IO thread.
443 base::FilePath network_json_store_filepath( 438 base::FilePath network_json_store_filepath(
444 profile_path_.Append(chrome::kNetworkPersistentStateFilename)); 439 profile_path_.Append(chrome::kNetworkPersistentStateFilename));
445 network_json_store_ = new JsonPrefStore( 440 network_json_store_ = new JsonPrefStore(
446 network_json_store_filepath, 441 network_json_store_filepath,
447 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath, 442 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath,
448 BrowserThread::GetBlockingPool()), 443 BrowserThread::GetBlockingPool()),
449 scoped_ptr<PrefFilter>()); 444 scoped_ptr<PrefFilter>());
450 network_json_store_->ReadPrefsAsync(nullptr); 445 network_json_store_->ReadPrefsAsync(nullptr);
451 446
452 net::URLRequestContext* main_context = main_request_context(); 447 net::URLRequestContext* main_context = main_request_context();
453 448
454 IOThread* const io_thread = profile_params->io_thread; 449 IOThread* const io_thread = profile_params->io_thread;
455 IOThread::Globals* const io_thread_globals = io_thread->globals(); 450 IOThread::Globals* const io_thread_globals = io_thread->globals();
456 451
457 chrome_network_delegate->set_predictor(predictor_.get()); 452 chrome_network_delegate->set_predictor(predictor_.get());
458 453
459 if (domain_reliability_monitor_) { 454 if (domain_reliability_monitor_) {
460 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
461 tracked_objects::ScopedTracker tracking_profile1(
462 FROM_HERE_WITH_EXPLICIT_FUNCTION(
463 "436671 ProfileImplIOData::InitializeInternal1"));
464
465 domain_reliability::DomainReliabilityMonitor* monitor = 455 domain_reliability::DomainReliabilityMonitor* monitor =
466 domain_reliability_monitor_.get(); 456 domain_reliability_monitor_.get();
467 monitor->InitURLRequestContext(main_context); 457 monitor->InitURLRequestContext(main_context);
468 monitor->AddBakedInConfigs(); 458 monitor->AddBakedInConfigs();
469 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); 459 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread());
470 chrome_network_delegate->set_domain_reliability_monitor(monitor); 460 chrome_network_delegate->set_domain_reliability_monitor(monitor);
471 } 461 }
472 462
473 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
474 tracked_objects::ScopedTracker tracking_profile2(
475 FROM_HERE_WITH_EXPLICIT_FUNCTION(
476 "436671 ProfileImplIOData::InitializeInternal2"));
477
478 ApplyProfileParamsToContext(main_context); 463 ApplyProfileParamsToContext(main_context);
479 464
480 if (http_server_properties_manager_) 465 if (http_server_properties_manager_)
481 http_server_properties_manager_->InitializeOnNetworkThread(); 466 http_server_properties_manager_->InitializeOnNetworkThread();
482 467
483 main_context->set_transport_security_state(transport_security_state()); 468 main_context->set_transport_security_state(transport_security_state());
484 469
485 main_context->set_net_log(io_thread->net_log()); 470 main_context->set_net_log(io_thread->net_log());
486 471
487 network_delegate_ = data_reduction_proxy_io_data()->CreateNetworkDelegate( 472 network_delegate_ = data_reduction_proxy_io_data()->CreateNetworkDelegate(
(...skipping 14 matching lines...) Expand all
502 fraudulent_certificate_reporter()); 487 fraudulent_certificate_reporter());
503 488
504 main_context->set_throttler_manager( 489 main_context->set_throttler_manager(
505 io_thread_globals->throttler_manager.get()); 490 io_thread_globals->throttler_manager.get());
506 491
507 main_context->set_proxy_service(proxy_service()); 492 main_context->set_proxy_service(proxy_service());
508 493
509 scoped_refptr<net::CookieStore> cookie_store = NULL; 494 scoped_refptr<net::CookieStore> cookie_store = NULL;
510 net::ChannelIDService* channel_id_service = NULL; 495 net::ChannelIDService* channel_id_service = NULL;
511 496
512 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 497 // Set up cookie store.
513 tracked_objects::ScopedTracker tracking_profile5(
514 FROM_HERE_WITH_EXPLICIT_FUNCTION(
515 "436671 ProfileImplIOData::InitializeInternal5"));
516
517 // setup cookie store
518 if (!cookie_store.get()) { 498 if (!cookie_store.get()) {
519 DCHECK(!lazy_params_->cookie_path.empty()); 499 DCHECK(!lazy_params_->cookie_path.empty());
520 500
521 content::CookieStoreConfig cookie_config( 501 content::CookieStoreConfig cookie_config(
522 lazy_params_->cookie_path, 502 lazy_params_->cookie_path,
523 lazy_params_->session_cookie_mode, 503 lazy_params_->session_cookie_mode,
524 lazy_params_->special_storage_policy.get(), 504 lazy_params_->special_storage_policy.get(),
525 profile_params->cookie_monster_delegate.get()); 505 profile_params->cookie_monster_delegate.get());
526 cookie_config.crypto_delegate = 506 cookie_config.crypto_delegate =
527 chrome_browser_net::GetCookieCryptoDelegate(); 507 chrome_browser_net::GetCookieCryptoDelegate();
528 cookie_store = content::CreateCookieStore(cookie_config); 508 cookie_store = content::CreateCookieStore(cookie_config);
529 } 509 }
530 510
531 main_context->set_cookie_store(cookie_store.get()); 511 main_context->set_cookie_store(cookie_store.get());
532 512
533 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 513 // Set up server bound cert service.
534 tracked_objects::ScopedTracker tracking_profile6(
535 FROM_HERE_WITH_EXPLICIT_FUNCTION(
536 "436671 ProfileImplIOData::InitializeInternal6"));
537
538 // Setup server bound cert service.
539 if (!channel_id_service) { 514 if (!channel_id_service) {
540 DCHECK(!lazy_params_->channel_id_path.empty()); 515 DCHECK(!lazy_params_->channel_id_path.empty());
541 516
542 scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db = 517 scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db =
543 new QuotaPolicyChannelIDStore( 518 new QuotaPolicyChannelIDStore(
544 lazy_params_->channel_id_path, 519 lazy_params_->channel_id_path,
545 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 520 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
546 BrowserThread::GetBlockingPool()->GetSequenceToken()), 521 BrowserThread::GetBlockingPool()->GetSequenceToken()),
547 lazy_params_->special_storage_policy.get()); 522 lazy_params_->special_storage_policy.get());
548 channel_id_service = new net::ChannelIDService( 523 channel_id_service = new net::ChannelIDService(
549 new net::DefaultChannelIDStore(channel_id_db.get()), 524 new net::DefaultChannelIDStore(channel_id_db.get()),
550 base::WorkerPool::GetTaskRunner(true)); 525 base::WorkerPool::GetTaskRunner(true));
551 } 526 }
552 527
553 set_channel_id_service(channel_id_service); 528 set_channel_id_service(channel_id_service);
554 main_context->set_channel_id_service(channel_id_service); 529 main_context->set_channel_id_service(channel_id_service);
555 530
556 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. 531 scoped_ptr<net::HttpCache> main_cache;
557 tracked_objects::ScopedTracker tracking_profile7( 532 {
558 FROM_HERE_WITH_EXPLICIT_FUNCTION( 533 // TODO(ttuttle): Remove ScopedTracker below once crbug.com/436671 is fixed.
559 "436671 ProfileImplIOData::InitializeInternal7")); 534 tracked_objects::ScopedTracker tracking_profile(
560 535 FROM_HERE_WITH_EXPLICIT_FUNCTION("436671 HttpCache construction"));
561 net::HttpCache::DefaultBackend* main_backend = 536 net::HttpCache::DefaultBackend* main_backend =
562 new net::HttpCache::DefaultBackend( 537 new net::HttpCache::DefaultBackend(
563 net::DISK_CACHE, 538 net::DISK_CACHE,
564 ChooseCacheBackendType(), 539 ChooseCacheBackendType(),
565 lazy_params_->cache_path, 540 lazy_params_->cache_path,
566 lazy_params_->cache_max_size, 541 lazy_params_->cache_max_size,
567 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); 542 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
568 scoped_ptr<net::HttpCache> main_cache = CreateMainHttpFactory( 543 main_cache = CreateMainHttpFactory(profile_params, main_backend);
569 profile_params, main_backend); 544 }
570
571 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
572 tracked_objects::ScopedTracker tracking_profile71(
573 FROM_HERE_WITH_EXPLICIT_FUNCTION(
574 "436671 ProfileImplIOData::InitializeInternal71"));
575 545
576 main_http_factory_.reset(main_cache.release()); 546 main_http_factory_.reset(main_cache.release());
577 main_context->set_http_transaction_factory(main_http_factory_.get()); 547 main_context->set_http_transaction_factory(main_http_factory_.get());
578 548
579 #if !defined(DISABLE_FTP_SUPPORT) 549 #if !defined(DISABLE_FTP_SUPPORT)
580 ftp_factory_.reset( 550 ftp_factory_.reset(
581 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); 551 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get()));
582 #endif // !defined(DISABLE_FTP_SUPPORT) 552 #endif // !defined(DISABLE_FTP_SUPPORT)
583 553
584 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
585 tracked_objects::ScopedTracker tracking_profile8(
586 FROM_HERE_WITH_EXPLICIT_FUNCTION(
587 "436671 ProfileImplIOData::InitializeInternal8"));
588
589 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory( 554 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
590 new net::URLRequestJobFactoryImpl()); 555 new net::URLRequestJobFactoryImpl());
591 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); 556 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
592 557
593 // The data reduction proxy interceptor should be as close to the network 558 // The data reduction proxy interceptor should be as close to the network
594 // as possible. 559 // as possible.
595 request_interceptors.insert( 560 request_interceptors.insert(
596 request_interceptors.begin(), 561 request_interceptors.begin(),
597 data_reduction_proxy_io_data()->CreateInterceptor().release()); 562 data_reduction_proxy_io_data()->CreateInterceptor().release());
598 main_job_factory_ = SetUpJobFactoryDefaults( 563 main_job_factory_ = SetUpJobFactoryDefaults(
599 main_job_factory.Pass(), 564 main_job_factory.Pass(),
600 request_interceptors.Pass(), 565 request_interceptors.Pass(),
601 profile_params->protocol_handler_interceptor.Pass(), 566 profile_params->protocol_handler_interceptor.Pass(),
602 main_context->network_delegate(), 567 main_context->network_delegate(),
603 ftp_factory_.get()); 568 ftp_factory_.get());
604 main_context->set_job_factory(main_job_factory_.get()); 569 main_context->set_job_factory(main_job_factory_.get());
605 570
606 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed.
607 tracked_objects::ScopedTracker tracking_profile9(
608 FROM_HERE_WITH_EXPLICIT_FUNCTION(
609 "436671 ProfileImplIOData::InitializeInternal9"));
610
611 #if defined(ENABLE_EXTENSIONS) 571 #if defined(ENABLE_EXTENSIONS)
612 InitializeExtensionsRequestContext(profile_params); 572 InitializeExtensionsRequestContext(profile_params);
613 #endif 573 #endif
614 574
615 // Setup SDCH for this profile. 575 // Setup SDCH for this profile.
616 sdch_manager_.reset(new net::SdchManager); 576 sdch_manager_.reset(new net::SdchManager);
617 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context)); 577 sdch_policy_.reset(new net::SdchOwner(sdch_manager_.get(), main_context));
618 main_context->set_sdch_manager(sdch_manager_.get()); 578 main_context->set_sdch_manager(sdch_manager_.get());
619 if (ShouldUseSdchPersistence()) { 579 if (ShouldUseSdchPersistence()) {
620 sdch_policy_->EnablePersistentStorage(network_json_store_.get()); 580 sdch_policy_->EnablePersistentStorage(network_json_store_.get());
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 const base::Closure& completion) { 805 const base::Closure& completion) {
846 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 806 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
847 DCHECK(initialized()); 807 DCHECK(initialized());
848 808
849 DCHECK(transport_security_state()); 809 DCHECK(transport_security_state());
850 // Completes synchronously. 810 // Completes synchronously.
851 transport_security_state()->DeleteAllDynamicDataSince(time); 811 transport_security_state()->DeleteAllDynamicDataSince(time);
852 DCHECK(http_server_properties_manager_); 812 DCHECK(http_server_properties_manager_);
853 http_server_properties_manager_->Clear(completion); 813 http_server_properties_manager_->Clear(completion);
854 } 814 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_io_data.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698