Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: content/browser/dom_storage/dom_storage_task_runner.h

Issue 2823103003: Introduce TaskRunner::RunsTasksInCurrentSequence() (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/sequence_checker.h" 10 #include "base/sequence_checker.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // A DOMStorageTaskRunner which manages a primary and a commit sequence. 56 // A DOMStorageTaskRunner which manages a primary and a commit sequence.
57 class CONTENT_EXPORT DOMStorageWorkerPoolTaskRunner : 57 class CONTENT_EXPORT DOMStorageWorkerPoolTaskRunner :
58 public DOMStorageTaskRunner { 58 public DOMStorageTaskRunner {
59 public: 59 public:
60 // |primary_sequence| and |commit_sequence| should have 60 // |primary_sequence| and |commit_sequence| should have
61 // TaskShutdownBehaviour::BLOCK_SHUTDOWN semantics. 61 // TaskShutdownBehaviour::BLOCK_SHUTDOWN semantics.
62 DOMStorageWorkerPoolTaskRunner( 62 DOMStorageWorkerPoolTaskRunner(
63 scoped_refptr<base::SequencedTaskRunner> primary_sequence, 63 scoped_refptr<base::SequencedTaskRunner> primary_sequence,
64 scoped_refptr<base::SequencedTaskRunner> commit_sequence); 64 scoped_refptr<base::SequencedTaskRunner> commit_sequence);
65 65
66 bool RunsTasksOnCurrentThread() const override; 66 bool RunsTasksInCurrentSequence() const override;
67 67
68 bool PostDelayedTask(const tracked_objects::Location& from_here, 68 bool PostDelayedTask(const tracked_objects::Location& from_here,
69 base::OnceClosure task, 69 base::OnceClosure task,
70 base::TimeDelta delay) override; 70 base::TimeDelta delay) override;
71 71
72 bool PostShutdownBlockingTask(const tracked_objects::Location& from_here, 72 bool PostShutdownBlockingTask(const tracked_objects::Location& from_here,
73 SequenceID sequence_id, 73 SequenceID sequence_id,
74 base::OnceClosure task) override; 74 base::OnceClosure task) override;
75 75
76 void AssertIsRunningOnPrimarySequence() const override; 76 void AssertIsRunningOnPrimarySequence() const override;
(...skipping 16 matching lines...) Expand all
93 // we don't block in unit tests waiting for timeouts to expire. 93 // we don't block in unit tests waiting for timeouts to expire.
94 // There is no distinction between [non]-shutdown-blocking or 94 // There is no distinction between [non]-shutdown-blocking or
95 // the primary sequence vs the commit sequence in the mock, 95 // the primary sequence vs the commit sequence in the mock,
96 // all tasks are scheduled on |task_runner| with zero delay. 96 // all tasks are scheduled on |task_runner| with zero delay.
97 class CONTENT_EXPORT MockDOMStorageTaskRunner : 97 class CONTENT_EXPORT MockDOMStorageTaskRunner :
98 public DOMStorageTaskRunner { 98 public DOMStorageTaskRunner {
99 public: 99 public:
100 explicit MockDOMStorageTaskRunner( 100 explicit MockDOMStorageTaskRunner(
101 scoped_refptr<base::SequencedTaskRunner> task_runner); 101 scoped_refptr<base::SequencedTaskRunner> task_runner);
102 102
103 bool RunsTasksOnCurrentThread() const override; 103 bool RunsTasksInCurrentSequence() const override;
104 104
105 bool PostDelayedTask(const tracked_objects::Location& from_here, 105 bool PostDelayedTask(const tracked_objects::Location& from_here,
106 base::OnceClosure task, 106 base::OnceClosure task,
107 base::TimeDelta delay) override; 107 base::TimeDelta delay) override;
108 108
109 bool PostShutdownBlockingTask(const tracked_objects::Location& from_here, 109 bool PostShutdownBlockingTask(const tracked_objects::Location& from_here,
110 SequenceID sequence_id, 110 SequenceID sequence_id,
111 base::OnceClosure task) override; 111 base::OnceClosure task) override;
112 112
113 void AssertIsRunningOnPrimarySequence() const override; 113 void AssertIsRunningOnPrimarySequence() const override;
114 void AssertIsRunningOnCommitSequence() const override; 114 void AssertIsRunningOnCommitSequence() const override;
115 115
116 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner( 116 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner(
117 SequenceID sequence_id) override; 117 SequenceID sequence_id) override;
118 118
119 protected: 119 protected:
120 ~MockDOMStorageTaskRunner() override; 120 ~MockDOMStorageTaskRunner() override;
121 121
122 private: 122 private:
123 const scoped_refptr<base::SequencedTaskRunner> task_runner_; 123 const scoped_refptr<base::SequencedTaskRunner> task_runner_;
124 124
125 DISALLOW_COPY_AND_ASSIGN(MockDOMStorageTaskRunner); 125 DISALLOW_COPY_AND_ASSIGN(MockDOMStorageTaskRunner);
126 }; 126 };
127 127
128 } // namespace content 128 } // namespace content
129 129
130 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_H_ 130 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698