Chromium Code Reviews| 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 "webkit/dom_storage/dom_storage_task_runner.h" | 5 #include "webkit/dom_storage/dom_storage_task_runner.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/tracked_objects.h" | 10 #include "base/tracked_objects.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 bool DomStorageWorkerPoolTaskRunner::PostDelayedTask( | 44 bool DomStorageWorkerPoolTaskRunner::PostDelayedTask( |
| 45 const tracked_objects::Location& from_here, | 45 const tracked_objects::Location& from_here, |
| 46 const base::Closure& task, | 46 const base::Closure& task, |
| 47 base::TimeDelta delay) { | 47 base::TimeDelta delay) { |
| 48 // Note base::TaskRunner implements PostTask in terms of PostDelayedTask | 48 // Note base::TaskRunner implements PostTask in terms of PostDelayedTask |
| 49 // with a delay of zero, we detect that usage and avoid the unecessary | 49 // with a delay of zero, we detect that usage and avoid the unecessary |
| 50 // trip thru the message loop. | 50 // trip thru the message loop. |
| 51 if (delay == base::TimeDelta()) { | 51 if (delay == base::TimeDelta()) { |
| 52 return sequenced_worker_pool_->PostSequencedWorkerTaskWithShutdownBehavior( | 52 return sequenced_worker_pool_->PostSequencedWorkerTaskWithShutdownBehavior( |
| 53 primary_sequence_token_, from_here, task, | 53 primary_sequence_token_, from_here, task, |
| 54 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 54 base::SequencedWorkerPool::BLOCK_SHUTDOWN); |
|
ericu
2012/05/29 20:35:11
As discussed, perhaps a TODO to have read tasks be
| |
| 55 } | 55 } |
| 56 // Post a task to call this->PostTask() after the delay. | 56 // Post a task to call this->PostTask() after the delay. |
| 57 return message_loop_->PostDelayedTask( | 57 return message_loop_->PostDelayedTask( |
| 58 FROM_HERE, | 58 FROM_HERE, |
| 59 base::Bind(base::IgnoreResult(&DomStorageWorkerPoolTaskRunner::PostTask), | 59 base::Bind(base::IgnoreResult(&DomStorageWorkerPoolTaskRunner::PostTask), |
| 60 this, from_here, task), | 60 this, from_here, task), |
| 61 delay); | 61 delay); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool DomStorageWorkerPoolTaskRunner::PostShutdownBlockingTask( | 64 bool DomStorageWorkerPoolTaskRunner::PostShutdownBlockingTask( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 SequenceID sequence_id, | 106 SequenceID sequence_id, |
| 107 const base::Closure& task) { | 107 const base::Closure& task) { |
| 108 return message_loop_->PostTask(from_here, task); | 108 return message_loop_->PostTask(from_here, task); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool MockDomStorageTaskRunner::IsRunningOnSequence(SequenceID) const { | 111 bool MockDomStorageTaskRunner::IsRunningOnSequence(SequenceID) const { |
| 112 return message_loop_->RunsTasksOnCurrentThread(); | 112 return message_loop_->RunsTasksOnCurrentThread(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace dom_storage | 115 } // namespace dom_storage |
| OLD | NEW |