Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
| 13 #include "chrome/browser/api/prefs/pref_member.h" | 13 #include "chrome/browser/api/prefs/pref_member.h" |
| 14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
| 16 #include "chrome/browser/io_thread.h" | 16 #include "chrome/browser/io_thread.h" |
| 17 #include "chrome/browser/net/chrome_http_user_agent_settings.h" | |
|
erikwright (departed)
2012/10/24 13:14:33
no longer used, right?
| |
| 17 #include "chrome/browser/net/chrome_net_log.h" | 18 #include "chrome/browser/net/chrome_net_log.h" |
| 18 #include "chrome/browser/net/clear_on_exit_policy.h" | 19 #include "chrome/browser/net/clear_on_exit_policy.h" |
| 19 #include "chrome/browser/net/connect_interceptor.h" | 20 #include "chrome/browser/net/connect_interceptor.h" |
| 20 #include "chrome/browser/net/http_server_properties_manager.h" | 21 #include "chrome/browser/net/http_server_properties_manager.h" |
| 21 #include "chrome/browser/net/predictor.h" | 22 #include "chrome/browser/net/predictor.h" |
| 22 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" | 23 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
| 23 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" | 24 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" |
| 24 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 27 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 44 ProfileImplIOData::Handle::Handle(Profile* profile) | 45 ProfileImplIOData::Handle::Handle(Profile* profile) |
| 45 : io_data_(new ProfileImplIOData), | 46 : io_data_(new ProfileImplIOData), |
| 46 profile_(profile), | 47 profile_(profile), |
| 47 initialized_(false) { | 48 initialized_(false) { |
| 48 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 49 DCHECK(profile); | 50 DCHECK(profile); |
| 50 } | 51 } |
| 51 | 52 |
| 52 ProfileImplIOData::Handle::~Handle() { | 53 ProfileImplIOData::Handle::~Handle() { |
| 53 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 54 if (main_request_context_getter_) | |
| 55 main_request_context_getter_->CleanupOnUIThread(); | |
| 56 if (media_request_context_getter_) | |
| 57 media_request_context_getter_->CleanupOnUIThread(); | |
| 58 if (extensions_request_context_getter_) | |
| 59 extensions_request_context_getter_->CleanupOnUIThread(); | |
| 60 | 55 |
| 61 if (io_data_->predictor_.get() != NULL) { | 56 if (io_data_->predictor_.get() != NULL) { |
| 62 // io_data_->predictor_ might be NULL if Init() was never called | 57 // io_data_->predictor_ might be NULL if Init() was never called |
| 63 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). | 58 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). |
| 64 PrefService* user_prefs = profile_->GetPrefs(); | 59 PrefService* user_prefs = profile_->GetPrefs(); |
| 65 io_data_->predictor_->ShutdownOnUIThread(user_prefs); | 60 io_data_->predictor_->ShutdownOnUIThread(user_prefs); |
| 66 } | 61 } |
| 67 | 62 |
| 68 // Clean up all isolated app request contexts. | |
| 69 for (ChromeURLRequestContextGetterMap::iterator iter = | |
| 70 app_request_context_getter_map_.begin(); | |
| 71 iter != app_request_context_getter_map_.end(); | |
| 72 ++iter) { | |
| 73 iter->second->CleanupOnUIThread(); | |
| 74 } | |
| 75 | |
| 76 // Clean up all isolated media request contexts. | |
| 77 for (ChromeURLRequestContextGetterMap::iterator iter = | |
| 78 isolated_media_request_context_getter_map_.begin(); | |
| 79 iter != isolated_media_request_context_getter_map_.end(); | |
| 80 ++iter) { | |
| 81 iter->second->CleanupOnUIThread(); | |
| 82 } | |
| 83 | |
| 84 if (io_data_->http_server_properties_manager()) | 63 if (io_data_->http_server_properties_manager()) |
| 85 io_data_->http_server_properties_manager()->ShutdownOnUIThread(); | 64 io_data_->http_server_properties_manager()->ShutdownOnUIThread(); |
| 86 io_data_->ShutdownOnUIThread(); | 65 io_data_->ShutdownOnUIThread(); |
| 87 } | 66 } |
| 88 | 67 |
| 89 void ProfileImplIOData::Handle::Init( | 68 void ProfileImplIOData::Handle::Init( |
| 90 const FilePath& cookie_path, | 69 const FilePath& cookie_path, |
| 91 const FilePath& server_bound_cert_path, | 70 const FilePath& server_bound_cert_path, |
| 92 const FilePath& cache_path, | 71 const FilePath& cache_path, |
| 93 int cache_max_size, | 72 int cache_max_size, |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 644 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
| 666 base::Time time) { | 645 base::Time time) { |
| 667 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 646 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 668 LazyInitialize(); | 647 LazyInitialize(); |
| 669 | 648 |
| 670 DCHECK(transport_security_state()); | 649 DCHECK(transport_security_state()); |
| 671 transport_security_state()->DeleteSince(time); | 650 transport_security_state()->DeleteSince(time); |
| 672 DCHECK(http_server_properties_manager()); | 651 DCHECK(http_server_properties_manager()); |
| 673 http_server_properties_manager()->Clear(); | 652 http_server_properties_manager()->Clear(); |
| 674 } | 653 } |
| OLD | NEW |