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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 6901031: Profile shouldn't own Session/TabRestore services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again and hope upload works this time Created 9 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 8cd12c67fc123f7a4a0784216f0bea9206fe76e8..c41f6f847d9c87f098d1afc26e5ad078229f0660 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -58,8 +58,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search_engines/template_url_fetcher.h"
#include "chrome/browser/search_engines/template_url_model.h"
-#include "chrome/browser/sessions/session_service.h"
-#include "chrome/browser/sessions/tab_restore_service.h"
+#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/spellcheck_host.h"
#include "chrome/browser/ssl/ssl_host_state.h"
#include "chrome/browser/status_icons/status_tray.h"
@@ -280,7 +279,6 @@ ProfileImpl::ProfileImpl(const FilePath& path,
#if defined(OS_WIN)
checked_instant_promo_(false),
#endif
- shutdown_session_service_(false),
delegate_(delegate) {
DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
"profile files to the root directory!";
@@ -587,11 +585,10 @@ ProfileImpl::~ProfileImpl() {
Source<Profile>(this),
NotificationService::NoDetails());
- ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
+ StopCreateSessionServiceTimer();
- tab_restore_service_.reset();
+ ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
- StopCreateSessionServiceTimer();
// TemplateURLModel schedules a task on the WebDataService from its
// destructor. Delete it first to ensure the task gets scheduled before we
// shut down the database.
@@ -1178,30 +1175,6 @@ quota::QuotaManager* ProfileImpl::GetQuotaManager() {
return quota_manager_.get();
}
-SessionService* ProfileImpl::GetSessionService() {
- if (!session_service_.get() && !shutdown_session_service_) {
- session_service_.reset(new SessionService(this));
- session_service_->ResetFromCurrentBrowsers();
- }
- return session_service_.get();
-}
-
-void ProfileImpl::ShutdownSessionService() {
- if (shutdown_session_service_)
- return;
-
- // We're about to exit, force creation of the session service if it hasn't
- // been created yet. We do this to ensure session state matches the point in
- // time the user exited.
- GetSessionService();
- shutdown_session_service_ = true;
- session_service_.reset();
-}
-
-bool ProfileImpl::HasSessionService() const {
- return (session_service_.get() != NULL);
-}
-
bool ProfileImpl::HasProfileSyncService() const {
return (sync_service_.get() != NULL);
}
@@ -1236,12 +1209,6 @@ Time ProfileImpl::GetStartTime() const {
return start_time_;
}
-TabRestoreService* ProfileImpl::GetTabRestoreService() {
- if (!tab_restore_service_.get())
- tab_restore_service_.reset(new TabRestoreService(this));
- return tab_restore_service_.get();
-}
-
history::TopSites* ProfileImpl::GetTopSites() {
if (!top_sites_.get()) {
top_sites_ = new history::TopSites(this);
@@ -1254,10 +1221,6 @@ history::TopSites* ProfileImpl::GetTopSitesWithoutCreating() {
return top_sites_;
}
-void ProfileImpl::ResetTabRestoreService() {
- tab_restore_service_.reset();
-}
-
SpellCheckHost* ProfileImpl::GetSpellCheckHost() {
return spellcheck_host_ready_ ? spellcheck_host_.get() : NULL;
}
@@ -1366,6 +1329,10 @@ void ProfileImpl::StopCreateSessionServiceTimer() {
create_session_service_timer_.Stop();
}
+void ProfileImpl::EnsureSessionServiceCreated() {
+ SessionServiceFactory::GetForProfile(this);
+}
+
TokenService* ProfileImpl::GetTokenService() {
if (!token_service_.get()) {
token_service_.reset(new TokenService());
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698