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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 DOMStorageWorkerPoolTaskRunner::~DOMStorageWorkerPoolTaskRunner() = default; | 25 DOMStorageWorkerPoolTaskRunner::~DOMStorageWorkerPoolTaskRunner() = default; |
26 | 26 |
27 bool DOMStorageWorkerPoolTaskRunner::RunsTasksOnCurrentThread() const { | 27 bool DOMStorageWorkerPoolTaskRunner::RunsTasksOnCurrentThread() const { |
28 // It is valid for an implementation to always return true. | 28 // It is valid for an implementation to always return true. |
29 return true; | 29 return true; |
30 } | 30 } |
31 | 31 |
32 bool DOMStorageWorkerPoolTaskRunner::PostDelayedTask( | 32 bool DOMStorageWorkerPoolTaskRunner::PostDelayedTask( |
33 const tracked_objects::Location& from_here, | 33 const tracked_objects::Location& from_here, |
34 base::Closure task, | 34 base::OnceClosure task, |
35 base::TimeDelta delay) { | 35 base::TimeDelta delay) { |
36 return primary_sequence_->PostDelayedTask(from_here, std::move(task), delay); | 36 return primary_sequence_->PostDelayedTask(from_here, std::move(task), delay); |
37 } | 37 } |
38 | 38 |
39 bool DOMStorageWorkerPoolTaskRunner::PostShutdownBlockingTask( | 39 bool DOMStorageWorkerPoolTaskRunner::PostShutdownBlockingTask( |
40 const tracked_objects::Location& from_here, | 40 const tracked_objects::Location& from_here, |
41 SequenceID sequence_id, | 41 SequenceID sequence_id, |
42 base::Closure task) { | 42 base::OnceClosure task) { |
43 return GetSequencedTaskRunner(sequence_id) | 43 return GetSequencedTaskRunner(sequence_id) |
44 ->PostTask(from_here, std::move(task)); | 44 ->PostTask(from_here, std::move(task)); |
45 } | 45 } |
46 | 46 |
47 void DOMStorageWorkerPoolTaskRunner::AssertIsRunningOnPrimarySequence() const { | 47 void DOMStorageWorkerPoolTaskRunner::AssertIsRunningOnPrimarySequence() const { |
48 DCHECK(primary_sequence_->RunsTasksOnCurrentThread()); | 48 DCHECK(primary_sequence_->RunsTasksOnCurrentThread()); |
49 } | 49 } |
50 | 50 |
51 void DOMStorageWorkerPoolTaskRunner::AssertIsRunningOnCommitSequence() const { | 51 void DOMStorageWorkerPoolTaskRunner::AssertIsRunningOnCommitSequence() const { |
52 DCHECK(commit_sequence_->RunsTasksOnCurrentThread()); | 52 DCHECK(commit_sequence_->RunsTasksOnCurrentThread()); |
(...skipping 14 matching lines...) Expand all Loading... |
67 : task_runner_(std::move(task_runner)) {} | 67 : task_runner_(std::move(task_runner)) {} |
68 | 68 |
69 MockDOMStorageTaskRunner::~MockDOMStorageTaskRunner() = default; | 69 MockDOMStorageTaskRunner::~MockDOMStorageTaskRunner() = default; |
70 | 70 |
71 bool MockDOMStorageTaskRunner::RunsTasksOnCurrentThread() const { | 71 bool MockDOMStorageTaskRunner::RunsTasksOnCurrentThread() const { |
72 return task_runner_->RunsTasksOnCurrentThread(); | 72 return task_runner_->RunsTasksOnCurrentThread(); |
73 } | 73 } |
74 | 74 |
75 bool MockDOMStorageTaskRunner::PostDelayedTask( | 75 bool MockDOMStorageTaskRunner::PostDelayedTask( |
76 const tracked_objects::Location& from_here, | 76 const tracked_objects::Location& from_here, |
77 base::Closure task, | 77 base::OnceClosure task, |
78 base::TimeDelta delay) { | 78 base::TimeDelta delay) { |
79 return task_runner_->PostTask(from_here, std::move(task)); | 79 return task_runner_->PostTask(from_here, std::move(task)); |
80 } | 80 } |
81 | 81 |
82 bool MockDOMStorageTaskRunner::PostShutdownBlockingTask( | 82 bool MockDOMStorageTaskRunner::PostShutdownBlockingTask( |
83 const tracked_objects::Location& from_here, | 83 const tracked_objects::Location& from_here, |
84 SequenceID sequence_id, | 84 SequenceID sequence_id, |
85 base::Closure task) { | 85 base::OnceClosure task) { |
86 return task_runner_->PostTask(from_here, std::move(task)); | 86 return task_runner_->PostTask(from_here, std::move(task)); |
87 } | 87 } |
88 | 88 |
89 void MockDOMStorageTaskRunner::AssertIsRunningOnPrimarySequence() const { | 89 void MockDOMStorageTaskRunner::AssertIsRunningOnPrimarySequence() const { |
90 DCHECK(RunsTasksOnCurrentThread()); | 90 DCHECK(RunsTasksOnCurrentThread()); |
91 } | 91 } |
92 | 92 |
93 void MockDOMStorageTaskRunner::AssertIsRunningOnCommitSequence() const { | 93 void MockDOMStorageTaskRunner::AssertIsRunningOnCommitSequence() const { |
94 DCHECK(RunsTasksOnCurrentThread()); | 94 DCHECK(RunsTasksOnCurrentThread()); |
95 } | 95 } |
96 | 96 |
97 scoped_refptr<base::SequencedTaskRunner> | 97 scoped_refptr<base::SequencedTaskRunner> |
98 MockDOMStorageTaskRunner::GetSequencedTaskRunner(SequenceID sequence_id) { | 98 MockDOMStorageTaskRunner::GetSequencedTaskRunner(SequenceID sequence_id) { |
99 return task_runner_; | 99 return task_runner_; |
100 } | 100 } |
101 | 101 |
102 } // namespace content | 102 } // namespace content |
OLD | NEW |