| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/dom_storage/dom_storage_task_runner.h" | 5 #include "content/browser/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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/tracked_objects.h" | 10 #include "base/tracked_objects.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 IDtoToken(sequence_id), from_here, task, | 61 IDtoToken(sequence_id), from_here, task, |
| 62 base::SequencedWorkerPool::BLOCK_SHUTDOWN); | 62 base::SequencedWorkerPool::BLOCK_SHUTDOWN); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool DOMStorageWorkerPoolTaskRunner::IsRunningOnSequence( | 65 bool DOMStorageWorkerPoolTaskRunner::IsRunningOnSequence( |
| 66 SequenceID sequence_id) const { | 66 SequenceID sequence_id) const { |
| 67 return sequenced_worker_pool_->IsRunningSequenceOnCurrentThread( | 67 return sequenced_worker_pool_->IsRunningSequenceOnCurrentThread( |
| 68 IDtoToken(sequence_id)); | 68 IDtoToken(sequence_id)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 scoped_refptr<base::SequencedTaskRunner> |
| 72 DOMStorageWorkerPoolTaskRunner::GetSequencedTaskRunner(SequenceID sequence_id) { |
| 73 return sequenced_worker_pool_->GetSequencedTaskRunner(IDtoToken(sequence_id)); |
| 74 } |
| 75 |
| 71 base::SequencedWorkerPool::SequenceToken | 76 base::SequencedWorkerPool::SequenceToken |
| 72 DOMStorageWorkerPoolTaskRunner::IDtoToken(SequenceID id) const { | 77 DOMStorageWorkerPoolTaskRunner::IDtoToken(SequenceID id) const { |
| 73 if (id == PRIMARY_SEQUENCE) | 78 if (id == PRIMARY_SEQUENCE) |
| 74 return primary_sequence_token_; | 79 return primary_sequence_token_; |
| 75 DCHECK_EQ(COMMIT_SEQUENCE, id); | 80 DCHECK_EQ(COMMIT_SEQUENCE, id); |
| 76 return commit_sequence_token_; | 81 return commit_sequence_token_; |
| 77 } | 82 } |
| 78 | 83 |
| 79 // MockDOMStorageTaskRunner | 84 // MockDOMStorageTaskRunner |
| 80 | 85 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 97 const tracked_objects::Location& from_here, | 102 const tracked_objects::Location& from_here, |
| 98 SequenceID sequence_id, | 103 SequenceID sequence_id, |
| 99 const base::Closure& task) { | 104 const base::Closure& task) { |
| 100 return task_runner_->PostTask(from_here, task); | 105 return task_runner_->PostTask(from_here, task); |
| 101 } | 106 } |
| 102 | 107 |
| 103 bool MockDOMStorageTaskRunner::IsRunningOnSequence(SequenceID) const { | 108 bool MockDOMStorageTaskRunner::IsRunningOnSequence(SequenceID) const { |
| 104 return task_runner_->RunsTasksOnCurrentThread(); | 109 return task_runner_->RunsTasksOnCurrentThread(); |
| 105 } | 110 } |
| 106 | 111 |
| 112 scoped_refptr<base::SequencedTaskRunner> |
| 113 MockDOMStorageTaskRunner::GetSequencedTaskRunner(SequenceID sequence_id) { |
| 114 return task_runner_; |
| 115 } |
| 116 |
| 107 } // namespace content | 117 } // namespace content |
| OLD | NEW |