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

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

Issue 22363005: Switch BaseSessionService to use SequencedWorkerPool instead of FILE thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
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 e2d7eba1cab7f5423cf08c8510bffa3c3bba1c6f..b30f1f14eb45fd0aca79f720ac91002a079648c4 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -77,23 +77,15 @@ BaseSessionService::BaseSessionService(SessionType type,
: profile_(profile),
weak_factory_(this),
pending_reset_(false),
- commands_since_reset_(0) {
+ commands_since_reset_(0),
+ sequence_token_(
+ content::BrowserThread::GetBlockingPool()->GetSequenceToken()) {
if (profile) {
// We should never be created when incognito.
DCHECK(!profile->IsOffTheRecord());
}
backend_ = new SessionBackend(type, profile_ ? profile_->GetPath() : path);
DCHECK(backend_.get());
-
- // 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() {
@@ -299,17 +291,16 @@ CancelableTaskTracker::TaskId
bool BaseSessionService::RunTaskOnBackendThread(
const tracked_objects::Location& from_here,
const base::Closure& task) {
- if (profile_ && BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) {
- return BrowserThread::PostTask(BrowserThread::FILE, from_here, task);
+ base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
+ if (!pool->IsShutdownInProgress()) {
+ return pool->PostSequencedWorkerTask(sequence_token_,
+ from_here,
+ task);
} else {
- // Fall back to executing on the main thread if the file thread
- // has gone away (around shutdown time) or if we're running as
- // part of a unit test that does not set profile_.
+ // Fall back to executing on the main thread if the sequence
+ // worker pool has been requested to shutdown (around shutdown
+ // time).
task.Run();
jochen (gone - plz use gerrit) 2013/08/09 11:49:56 that means that the tasks will ran in an random or
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') | chrome/browser/sessions/persistent_tab_restore_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698