| 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 676 } |
| 677 | 677 |
| 678 if (webkit_context_.get()) | 678 if (webkit_context_.get()) |
| 679 webkit_context_->DeleteSessionOnlyData(); | 679 webkit_context_->DeleteSessionOnlyData(); |
| 680 | 680 |
| 681 StopCreateSessionServiceTimer(); | 681 StopCreateSessionServiceTimer(); |
| 682 | 682 |
| 683 // Remove pref observers | 683 // Remove pref observers |
| 684 pref_change_registrar_.RemoveAll(); | 684 pref_change_registrar_.RemoveAll(); |
| 685 | 685 |
| 686 // The sync service needs to be deleted before the services it calls. |
| 687 // TODO(stevet): Make ProfileSyncService into a PKS and let the PDM take care |
| 688 // of the cleanup below. |
| 689 sync_service_.reset(); |
| 690 |
| 686 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 691 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 687 | 692 |
| 688 if (db_tracker_) { | 693 if (db_tracker_) { |
| 689 BrowserThread::PostTask( | 694 BrowserThread::PostTask( |
| 690 BrowserThread::FILE, FROM_HERE, | 695 BrowserThread::FILE, FROM_HERE, |
| 691 NewRunnableMethod( | 696 NewRunnableMethod( |
| 692 db_tracker_.get(), | 697 db_tracker_.get(), |
| 693 &webkit_database::DatabaseTracker::Shutdown)); | 698 &webkit_database::DatabaseTracker::Shutdown)); |
| 694 } | 699 } |
| 695 | 700 |
| 696 // DownloadManager is lazily created, so check before accessing it. | 701 // DownloadManager is lazily created, so check before accessing it. |
| 697 if (download_manager_.get()) { | 702 if (download_manager_.get()) { |
| 698 // The download manager queries the history system and should be shut down | 703 // The download manager queries the history system and should be shut down |
| 699 // before the history is shut down so it can properly cancel all requests. | 704 // before the history is shut down so it can properly cancel all requests. |
| 700 download_manager_->Shutdown(); | 705 download_manager_->Shutdown(); |
| 701 download_manager_ = NULL; | 706 download_manager_ = NULL; |
| 702 } | 707 } |
| 703 | 708 |
| 704 // The sync service needs to be deleted before the services it calls. | |
| 705 sync_service_.reset(); | |
| 706 | |
| 707 // Password store uses WebDB, shut it down before the WebDB has been shutdown. | 709 // Password store uses WebDB, shut it down before the WebDB has been shutdown. |
| 708 if (password_store_.get()) | 710 if (password_store_.get()) |
| 709 password_store_->Shutdown(); | 711 password_store_->Shutdown(); |
| 710 | 712 |
| 711 // Both HistoryService and WebDataService maintain threads for background | 713 // Both HistoryService and WebDataService maintain threads for background |
| 712 // processing. Its possible each thread still has tasks on it that have | 714 // processing. Its possible each thread still has tasks on it that have |
| 713 // increased the ref count of the service. In such a situation, when we | 715 // increased the ref count of the service. In such a situation, when we |
| 714 // decrement the refcount, it won't be 0, and the threads/databases aren't | 716 // decrement the refcount, it won't be 0, and the threads/databases aren't |
| 715 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the | 717 // properly shut down. By explicitly calling Cleanup/Shutdown we ensure the |
| 716 // databases are properly closed. | 718 // databases are properly closed. |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1734 #endif | 1736 #endif |
| 1735 } | 1737 } |
| 1736 return prerender_manager_.get(); | 1738 return prerender_manager_.get(); |
| 1737 } | 1739 } |
| 1738 | 1740 |
| 1739 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1741 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
| 1740 if (!spellcheck_profile_.get()) | 1742 if (!spellcheck_profile_.get()) |
| 1741 spellcheck_profile_.reset(new SpellCheckProfile()); | 1743 spellcheck_profile_.reset(new SpellCheckProfile()); |
| 1742 return spellcheck_profile_.get(); | 1744 return spellcheck_profile_.get(); |
| 1743 } | 1745 } |
| OLD | NEW |