| 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);
|
| +}
|
|
|