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

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

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 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/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 20 matching lines...) Expand all
31 : public base::TaskRunner { 31 : public base::TaskRunner {
32 public: 32 public:
33 enum SequenceID { 33 enum SequenceID {
34 PRIMARY_SEQUENCE, 34 PRIMARY_SEQUENCE,
35 COMMIT_SEQUENCE 35 COMMIT_SEQUENCE
36 }; 36 };
37 37
38 // The PostTask() and PostDelayedTask() methods defined by TaskRunner 38 // The PostTask() and PostDelayedTask() methods defined by TaskRunner
39 // post shutdown-blocking tasks on the primary sequence. 39 // post shutdown-blocking tasks on the primary sequence.
40 bool PostDelayedTask(const tracked_objects::Location& from_here, 40 bool PostDelayedTask(const tracked_objects::Location& from_here,
41 const base::Closure& task, 41 base::OnceClosure task,
42 base::TimeDelta delay) override = 0; 42 base::TimeDelta delay) override = 0;
43 43
44 // Posts a shutdown blocking task to |sequence_id|. 44 // Posts a shutdown blocking task to |sequence_id|.
45 virtual bool PostShutdownBlockingTask( 45 virtual bool PostShutdownBlockingTask(
46 const tracked_objects::Location& from_here, 46 const tracked_objects::Location& from_here,
47 SequenceID sequence_id, 47 SequenceID sequence_id,
48 const base::Closure& task) = 0; 48 base::OnceClosure task) = 0;
49 49
50 // The TaskRunner override returns true if the current thread is running 50 // The TaskRunner override returns true if the current thread is running
51 // on the primary sequence. 51 // on the primary sequence.
52 bool RunsTasksOnCurrentThread() const override; 52 bool RunsTasksOnCurrentThread() const override;
53 53
54 // Returns true if the current thread is running on the given |sequence_id|. 54 // Returns true if the current thread is running on the given |sequence_id|.
55 virtual bool IsRunningOnSequence(SequenceID sequence_id) const = 0; 55 virtual bool IsRunningOnSequence(SequenceID sequence_id) const = 0;
56 bool IsRunningOnPrimarySequence() const { 56 bool IsRunningOnPrimarySequence() const {
57 return IsRunningOnSequence(PRIMARY_SEQUENCE); 57 return IsRunningOnSequence(PRIMARY_SEQUENCE);
58 } 58 }
(...skipping 14 matching lines...) Expand all
73 class CONTENT_EXPORT DOMStorageWorkerPoolTaskRunner : 73 class CONTENT_EXPORT DOMStorageWorkerPoolTaskRunner :
74 public DOMStorageTaskRunner { 74 public DOMStorageTaskRunner {
75 public: 75 public:
76 DOMStorageWorkerPoolTaskRunner( 76 DOMStorageWorkerPoolTaskRunner(
77 base::SequencedWorkerPool* sequenced_worker_pool, 77 base::SequencedWorkerPool* sequenced_worker_pool,
78 base::SequencedWorkerPool::SequenceToken primary_sequence_token, 78 base::SequencedWorkerPool::SequenceToken primary_sequence_token,
79 base::SequencedWorkerPool::SequenceToken commit_sequence_token, 79 base::SequencedWorkerPool::SequenceToken commit_sequence_token,
80 base::SingleThreadTaskRunner* delayed_task_task_runner); 80 base::SingleThreadTaskRunner* delayed_task_task_runner);
81 81
82 bool PostDelayedTask(const tracked_objects::Location& from_here, 82 bool PostDelayedTask(const tracked_objects::Location& from_here,
83 const base::Closure& task, 83 base::OnceClosure task,
84 base::TimeDelta delay) override; 84 base::TimeDelta delay) override;
85 85
86 bool PostShutdownBlockingTask(const tracked_objects::Location& from_here, 86 bool PostShutdownBlockingTask(const tracked_objects::Location& from_here,
87 SequenceID sequence_id, 87 SequenceID sequence_id,
88 const base::Closure& task) override; 88 base::OnceClosure task) override;
89 89
90 bool IsRunningOnSequence(SequenceID sequence_id) const override; 90 bool IsRunningOnSequence(SequenceID sequence_id) const override;
91 91
92 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner( 92 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner(
93 SequenceID sequence_id) override; 93 SequenceID sequence_id) override;
94 94
95 protected: 95 protected:
96 ~DOMStorageWorkerPoolTaskRunner() override; 96 ~DOMStorageWorkerPoolTaskRunner() override;
97 97
98 private: 98 private:
(...skipping 10 matching lines...) Expand all
109 // we don't block in unit tests waiting for timeouts to expire. 109 // we don't block in unit tests waiting for timeouts to expire.
110 // There is no distinction between [non]-shutdown-blocking or 110 // There is no distinction between [non]-shutdown-blocking or
111 // the primary sequence vs the commit sequence in the mock, 111 // the primary sequence vs the commit sequence in the mock,
112 // all tasks are scheduled on |message_loop| with zero delay. 112 // all tasks are scheduled on |message_loop| with zero delay.
113 class CONTENT_EXPORT MockDOMStorageTaskRunner : 113 class CONTENT_EXPORT MockDOMStorageTaskRunner :
114 public DOMStorageTaskRunner { 114 public DOMStorageTaskRunner {
115 public: 115 public:
116 explicit MockDOMStorageTaskRunner(base::SingleThreadTaskRunner* task_runner); 116 explicit MockDOMStorageTaskRunner(base::SingleThreadTaskRunner* task_runner);
117 117
118 bool PostDelayedTask(const tracked_objects::Location& from_here, 118 bool PostDelayedTask(const tracked_objects::Location& from_here,
119 const base::Closure& task, 119 base::OnceClosure task,
120 base::TimeDelta delay) override; 120 base::TimeDelta delay) override;
121 121
122 bool PostShutdownBlockingTask(const tracked_objects::Location& from_here, 122 bool PostShutdownBlockingTask(const tracked_objects::Location& from_here,
123 SequenceID sequence_id, 123 SequenceID sequence_id,
124 const base::Closure& task) override; 124 base::OnceClosure task) override;
125 125
126 bool IsRunningOnSequence(SequenceID sequence_id) const override; 126 bool IsRunningOnSequence(SequenceID sequence_id) const override;
127 127
128 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner( 128 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner(
129 SequenceID sequence_id) override; 129 SequenceID sequence_id) override;
130 130
131 protected: 131 protected:
132 ~MockDOMStorageTaskRunner() override; 132 ~MockDOMStorageTaskRunner() override;
133 133
134 private: 134 private:
135 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 135 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
136 }; 136 };
137 137
138 } // namespace content 138 } // namespace content
139 139
140 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_H_ 140 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « content/browser/compositor/reflector_impl_unittest.cc ('k') | content/browser/dom_storage/dom_storage_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698