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

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
« 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 e2d7eba1cab7f5423cf08c8510bffa3c3bba1c6f..5f5b1cf4f866484f20ecac9a60cf9d97a0d33190 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -77,7 +77,9 @@ 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());
@@ -299,17 +301,22 @@ 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);
+ if (RunningInProduction()) {
+ return content::BrowserThread::GetBlockingPool()->
+ 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) or if we're running as part of a unit test that does not
+ // set profile_.
task.Run();
return true;
}
}
bool BaseSessionService::RunningInProduction() const {
- return profile_ && BrowserThread::IsMessageLoopValid(BrowserThread::FILE);
+ base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
+ return profile_ && !pool->IsShutdownInProgress();
marja 2013/08/08 20:16:43 Why checking IsShutdownInProgress here? Will that
oshima 2013/08/08 20:36:53 This is just replacement of BrowserThread::IsMessa
}
« 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