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
|
} |