| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 appcache_service_.get(), | 673 appcache_service_.get(), |
| 674 &appcache::AppCacheService::set_clear_local_state_on_exit, | 674 &appcache::AppCacheService::set_clear_local_state_on_exit, |
| 675 true)); | 675 true)); |
| 676 } | 676 } |
| 677 | 677 |
| 678 StopCreateSessionServiceTimer(); | 678 StopCreateSessionServiceTimer(); |
| 679 | 679 |
| 680 // Remove pref observers | 680 // Remove pref observers |
| 681 pref_change_registrar_.RemoveAll(); | 681 pref_change_registrar_.RemoveAll(); |
| 682 | 682 |
| 683 // The sync service needs to be deleted before the services it calls. |
| 684 sync_service_.reset(); |
| 685 |
| 683 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 686 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 684 | 687 |
| 685 if (db_tracker_) { | 688 if (db_tracker_) { |
| 686 BrowserThread::PostTask( | 689 BrowserThread::PostTask( |
| 687 BrowserThread::FILE, FROM_HERE, | 690 BrowserThread::FILE, FROM_HERE, |
| 688 NewRunnableMethod( | 691 NewRunnableMethod( |
| 689 db_tracker_.get(), | 692 db_tracker_.get(), |
| 690 &webkit_database::DatabaseTracker::Shutdown)); | 693 &webkit_database::DatabaseTracker::Shutdown)); |
| 691 } | 694 } |
| 692 | 695 |
| 693 // DownloadManager is lazily created, so check before accessing it. | 696 // DownloadManager is lazily created, so check before accessing it. |
| 694 if (download_manager_.get()) { | 697 if (download_manager_.get()) { |
| 695 // The download manager queries the history system and should be shut down | 698 // The download manager queries the history system and should be shut down |
| 696 // before the history is shut down so it can properly cancel all requests. | 699 // before the history is shut down so it can properly cancel all requests. |
| 697 download_manager_->Shutdown(); | 700 download_manager_->Shutdown(); |
| 698 download_manager_ = NULL; | 701 download_manager_ = NULL; |
| 699 } | 702 } |
| 700 | 703 |
| 701 // The sync service needs to be deleted before the services it calls. | |
| 702 sync_service_.reset(); | |
| 703 | |
| 704 // Password store uses WebDB, shut it down before the WebDB has been shutdown. | 704 // Password store uses WebDB, shut it down before the WebDB has been shutdown. |
| 705 if (password_store_.get()) | 705 if (password_store_.get()) |
| 706 password_store_->Shutdown(); | 706 password_store_->Shutdown(); |
| 707 | 707 |
| 708 // Both HistoryService and WebDataService maintain threads for background | 708 // Both HistoryService and WebDataService maintain threads for background |
| 709 // processing. Its possible each thread still has tasks on it that have | 709 // processing. Its possible each thread still has tasks on it that have |
| 710 // increased the ref count of the service. In such a situation, when we | 710 // increased the ref count of the service. In such a situation, when we |
| 711 // decrement the refcount, it won't be 0, and the threads/databases aren't | 711 // decrement the refcount, it won't be 0, and the threads/databases aren't |
| 712 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the | 712 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the |
| 713 // databases are properly closed. | 713 // databases are properly closed. |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 | 1732 |
| 1733 chrome_browser_net::Predictor* ProfileImpl::GetNetworkPredictor() { | 1733 chrome_browser_net::Predictor* ProfileImpl::GetNetworkPredictor() { |
| 1734 return predictor_; | 1734 return predictor_; |
| 1735 } | 1735 } |
| 1736 | 1736 |
| 1737 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1737 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
| 1738 if (!spellcheck_profile_.get()) | 1738 if (!spellcheck_profile_.get()) |
| 1739 spellcheck_profile_.reset(new SpellCheckProfile()); | 1739 spellcheck_profile_.reset(new SpellCheckProfile()); |
| 1740 return spellcheck_profile_.get(); | 1740 return spellcheck_profile_.get(); |
| 1741 } | 1741 } |
| OLD | NEW |