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

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

Issue 2536723009: Make net::URLRequestContext a MemoryDumpProvider (Closed)
Patch Set: fix compile Created 4 years 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 <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 sdch_policy_.reset(new net::SdchOwner(sdch_manager.get(), main_context)); 567 sdch_policy_.reset(new net::SdchOwner(sdch_manager.get(), main_context));
568 sdch_policy_->EnablePersistentStorage( 568 sdch_policy_->EnablePersistentStorage(
569 std::unique_ptr<net::SdchOwner::PrefStorage>( 569 std::unique_ptr<net::SdchOwner::PrefStorage>(
570 new chrome_browser_net::SdchOwnerPrefStorage( 570 new chrome_browser_net::SdchOwnerPrefStorage(
571 network_json_store_.get()))); 571 network_json_store_.get())));
572 main_context_storage->set_sdch_manager(std::move(sdch_manager)); 572 main_context_storage->set_sdch_manager(std::move(sdch_manager));
573 573
574 // Create a media request context based on the main context, but using a 574 // Create a media request context based on the main context, but using a
575 // media cache. It shares the same job factory as the main context. 575 // media cache. It shares the same job factory as the main context.
576 StoragePartitionDescriptor details(profile_path_, false); 576 StoragePartitionDescriptor details(profile_path_, false);
577 media_request_context_.reset(InitializeMediaRequestContext(main_context, 577 media_request_context_.reset(
578 details)); 578 InitializeMediaRequestContext(main_context, details, "main_media"));
579
580 lazy_params_.reset(); 579 lazy_params_.reset();
581 } 580 }
582 581
583 void ProfileImplIOData:: 582 void ProfileImplIOData::
584 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { 583 InitializeExtensionsRequestContext(ProfileParams* profile_params) const {
585 net::URLRequestContext* extensions_context = extensions_request_context(); 584 net::URLRequestContext* extensions_context = extensions_request_context();
586 IOThread* const io_thread = profile_params->io_thread; 585 IOThread* const io_thread = profile_params->io_thread;
587 IOThread::Globals* const io_thread_globals = io_thread->globals(); 586 IOThread::Globals* const io_thread_globals = io_thread->globals();
588 ApplyProfileParamsToContext(extensions_context); 587 ApplyProfileParamsToContext(extensions_context);
589 588
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 std::unique_ptr<net::URLRequestJobFactory> top_job_factory( 708 std::unique_ptr<net::URLRequestJobFactory> top_job_factory(
710 SetUpJobFactoryDefaults( 709 SetUpJobFactoryDefaults(
711 std::move(job_factory), std::move(request_interceptors), 710 std::move(job_factory), std::move(request_interceptors),
712 std::move(protocol_handler_interceptor), context->network_delegate(), 711 std::move(protocol_handler_interceptor), context->network_delegate(),
713 context->host_resolver())); 712 context->host_resolver()));
714 context->SetJobFactory(std::move(top_job_factory)); 713 context->SetJobFactory(std::move(top_job_factory));
715 714
716 return context; 715 return context;
717 } 716 }
718 717
719 net::URLRequestContext* 718 net::URLRequestContext* ProfileImplIOData::InitializeMediaRequestContext(
720 ProfileImplIOData::InitializeMediaRequestContext(
721 net::URLRequestContext* original_context, 719 net::URLRequestContext* original_context,
722 const StoragePartitionDescriptor& partition_descriptor) const { 720 const StoragePartitionDescriptor& partition_descriptor,
721 const std::string& name) const {
723 // Copy most state from the original context. 722 // Copy most state from the original context.
724 MediaRequestContext* context = new MediaRequestContext(); 723 MediaRequestContext* context = new MediaRequestContext(name);
725 context->CopyFrom(original_context); 724 context->CopyFrom(original_context);
726 725
727 // For in-memory context, return immediately after creating the new 726 // For in-memory context, return immediately after creating the new
728 // context before attaching a separate cache. It is important to return 727 // context before attaching a separate cache. It is important to return
729 // a new context rather than just reusing |original_context| because 728 // a new context rather than just reusing |original_context| because
730 // the caller expects to take ownership of the pointer. 729 // the caller expects to take ownership of the pointer.
731 if (partition_descriptor.in_memory) 730 if (partition_descriptor.in_memory)
732 return context; 731 return context;
733 732
734 using content::StoragePartition; 733 using content::StoragePartition;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 std::move(request_interceptors)); 783 std::move(request_interceptors));
785 DCHECK(app_request_context); 784 DCHECK(app_request_context);
786 return app_request_context; 785 return app_request_context;
787 } 786 }
788 787
789 net::URLRequestContext* 788 net::URLRequestContext*
790 ProfileImplIOData::AcquireIsolatedMediaRequestContext( 789 ProfileImplIOData::AcquireIsolatedMediaRequestContext(
791 net::URLRequestContext* app_context, 790 net::URLRequestContext* app_context,
792 const StoragePartitionDescriptor& partition_descriptor) const { 791 const StoragePartitionDescriptor& partition_descriptor) const {
793 // We create per-app media contexts on demand, unlike the others above. 792 // We create per-app media contexts on demand, unlike the others above.
794 net::URLRequestContext* media_request_context = 793 net::URLRequestContext* media_request_context = InitializeMediaRequestContext(
795 InitializeMediaRequestContext(app_context, partition_descriptor); 794 app_context, partition_descriptor, "isolated_media");
796 DCHECK(media_request_context); 795 DCHECK(media_request_context);
797 return media_request_context; 796 return media_request_context;
798 } 797 }
799 798
800 chrome_browser_net::Predictor* ProfileImplIOData::GetPredictor() { 799 chrome_browser_net::Predictor* ProfileImplIOData::GetPredictor() {
801 return predictor_.get(); 800 return predictor_.get();
802 } 801 }
803 802
804 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 803 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
805 base::Time time, 804 base::Time time,
806 const base::Closure& completion) { 805 const base::Closure& completion) {
807 DCHECK_CURRENTLY_ON(BrowserThread::IO); 806 DCHECK_CURRENTLY_ON(BrowserThread::IO);
808 DCHECK(initialized()); 807 DCHECK(initialized());
809 808
810 DCHECK(transport_security_state()); 809 DCHECK(transport_security_state());
811 // Completes synchronously. 810 // Completes synchronously.
812 transport_security_state()->DeleteAllDynamicDataSince(time); 811 transport_security_state()->DeleteAllDynamicDataSince(time);
813 DCHECK(http_server_properties_manager_); 812 DCHECK(http_server_properties_manager_);
814 http_server_properties_manager_->Clear(completion); 813 http_server_properties_manager_->Clear(completion);
815 } 814 }
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