| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sessions/base_session_service.h" | 5 #include "chrome/browser/sessions/base_session_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 base::Bind(&PostOrRunInternalGetCommandsCallback, | 287 base::Bind(&PostOrRunInternalGetCommandsCallback, |
| 288 base::MessageLoopProxy::current(), run_if_not_canceled); | 288 base::MessageLoopProxy::current(), run_if_not_canceled); |
| 289 | 289 |
| 290 RunTaskOnBackendThread( | 290 RunTaskOnBackendThread( |
| 291 FROM_HERE, | 291 FROM_HERE, |
| 292 base::Bind(&SessionBackend::ReadLastSessionCommands, backend(), | 292 base::Bind(&SessionBackend::ReadLastSessionCommands, backend(), |
| 293 is_canceled, callback_runner)); | 293 is_canceled, callback_runner)); |
| 294 return id; | 294 return id; |
| 295 } | 295 } |
| 296 | 296 |
| 297 bool BaseSessionService::RunTaskOnBackendThread( | 297 void BaseSessionService::RunTaskOnBackendThread( |
| 298 const tracked_objects::Location& from_here, | 298 const tracked_objects::Location& from_here, |
| 299 const base::Closure& task) { | 299 const base::Closure& task) { |
| 300 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 300 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 301 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); | 301 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); |
| 302 if (!pool->IsShutdownInProgress()) { | 302 if (!pool->IsShutdownInProgress()) { |
| 303 return pool->PostSequencedWorkerTask(sequence_token_, | 303 pool->PostSequencedWorkerTask(sequence_token_, from_here, task); |
| 304 from_here, | |
| 305 task); | |
| 306 } else { | 304 } else { |
| 307 // Fall back to executing on the main thread if the sequence | 305 // Fall back to executing on the main thread if the sequence |
| 308 // worker pool has been requested to shutdown (around shutdown | 306 // worker pool has been requested to shutdown (around shutdown |
| 309 // time). | 307 // time). |
| 310 task.Run(); | 308 task.Run(); |
| 311 return true; | |
| 312 } | 309 } |
| 313 } | 310 } |
| OLD | NEW |