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