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

Unified Diff: chrome/browser/sessions/base_session_service.cc

Issue 10443056: Fix: service processes started before chrome prevented session restore from working. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/sessions/base_session_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/base_session_service.cc
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc
index 6fbcd2bac3ded415f6dc9d521c3e928544f2feea..bc63250fbd22e9b571b5a2aa53f320e6fbe10b3f 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -87,8 +87,15 @@ BaseSessionService::BaseSessionService(SessionType type,
backend_ = new SessionBackend(type, profile_ ? profile_->GetPath() : path);
DCHECK(backend_.get());
- RunTaskOnBackendThread(FROM_HERE,
- base::Bind(&SessionBackend::Init, backend_));
+ // SessionBackend::Init() cannot be scheduled to be called here. There are
+ // service processes which create the BaseSessionService, but they should not
+ // initialize the backend. If they do, the backend will cycle the session
+ // restore files. That in turn prevents the session restore from working when
+ // the normal chromium process is launched. Normally, the backend will be
+ // initialized before it's actually used. However, if we're running as a part
+ // of a test, it must be initialized now.
+ if (!RunningInProduction())
+ backend_->Init();
}
BaseSessionService::~BaseSessionService() {
@@ -380,3 +387,7 @@ bool BaseSessionService::RunTaskOnBackendThread(
return true;
}
}
+
+bool BaseSessionService::RunningInProduction() const {
+ return profile_ && BrowserThread::IsMessageLoopValid(BrowserThread::FILE);
+}
« no previous file with comments | « chrome/browser/sessions/base_session_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698