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

Side by Side Diff: webkit/dom_storage/dom_storage_task_runner.h

Issue 9706004: Really now... derive DomStorageTaskRunner from base::SequencedTaskRunner. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/dom_storage/dom_storage_task_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 13
14 namespace base { 14 namespace base {
15 class MessageLoopProxy; 15 class MessageLoopProxy;
16 } 16 }
17 17
18 namespace dom_storage { 18 namespace dom_storage {
19 19
20 // Tasks must run serially with respect to one another, but may 20 // Tasks must run serially with respect to one another, but may
21 // execute on different OS threads. The base class is implemented 21 // execute on different OS threads. The base class is implemented
22 // in terms of a MessageLoopProxy. 22 // in terms of a MessageLoopProxy.
23 class DomStorageTaskRunner : public base::TaskRunner { 23 class DomStorageTaskRunner : public base::SequencedTaskRunner {
24 public: 24 public:
25 explicit DomStorageTaskRunner(base::MessageLoopProxy* message_loop); 25 explicit DomStorageTaskRunner(base::MessageLoopProxy* message_loop);
26 virtual ~DomStorageTaskRunner(); 26 virtual ~DomStorageTaskRunner();
27 27
28 // The PostTask() method, defined by TaskRunner, schedules a task 28 // The PostTask() method, defined by TaskRunner, schedules a task
29 // to run immediately. 29 // to run immediately.
30 30
31 // Schedules a task to be run after a delay. 31 // Schedules a task to be run after a delay.
32 virtual bool PostDelayedTask( 32 virtual bool PostDelayedTask(
33 const tracked_objects::Location& from_here, 33 const tracked_objects::Location& from_here,
34 const base::Closure& task, 34 const base::Closure& task,
35 base::TimeDelta delay) OVERRIDE; 35 base::TimeDelta delay) OVERRIDE;
36 36
37 // DEPRECATED: Only here because base::TaskRunner requires it, implemented 37 // DEPRECATED: Only here because base::TaskRunner requires it, implemented
38 // by calling the virtual PostDelayedTask(..., TimeDelta) variant. 38 // by calling the virtual PostDelayedTask(..., TimeDelta) variant.
39 virtual bool PostDelayedTask( 39 virtual bool PostDelayedTask(
40 const tracked_objects::Location& from_here, 40 const tracked_objects::Location& from_here,
41 const base::Closure& task, 41 const base::Closure& task,
42 int64 delay_ms) OVERRIDE; 42 int64 delay_ms) OVERRIDE;
43 43
44 // Only here because base::TaskRunner requires it, the return 44 // Only here because base::TaskRunner requires it, the return
45 // value is hard coded to true. 45 // value is hard coded to true.
46 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; 46 virtual bool RunsTasksOnCurrentThread() const OVERRIDE;
47 47
48 // SequencedTaskRunner overrides, these are implemented in
49 // terms of PostDelayedTask and the later is similarly deprecated.
50 virtual bool PostNonNestableDelayedTask(
51 const tracked_objects::Location& from_here,
52 const base::Closure& task,
53 base::TimeDelta delay) OVERRIDE;
54 virtual bool PostNonNestableDelayedTask(
55 const tracked_objects::Location& from_here,
56 const base::Closure& task,
57 int64 delay_ms) OVERRIDE;
58
48 protected: 59 protected:
49 const scoped_refptr<base::MessageLoopProxy> message_loop_; 60 const scoped_refptr<base::MessageLoopProxy> message_loop_;
50 }; 61 };
51 62
52 // A derived class that utlizes the SequenceWorkerPool under a 63 // A derived class that utlizes the SequenceWorkerPool under a
53 // dom_storage specific SequenceToken. The MessageLoopProxy 64 // dom_storage specific SequenceToken. The MessageLoopProxy
54 // is used to delay scheduling on the worker pool. 65 // is used to delay scheduling on the worker pool.
55 class DomStorageWorkerPoolTaskRunner : public DomStorageTaskRunner { 66 class DomStorageWorkerPoolTaskRunner : public DomStorageTaskRunner {
56 public: 67 public:
57 DomStorageWorkerPoolTaskRunner( 68 DomStorageWorkerPoolTaskRunner(
(...skipping 25 matching lines...) Expand all
83 94
84 virtual bool PostDelayedTask( 95 virtual bool PostDelayedTask(
85 const tracked_objects::Location& from_here, 96 const tracked_objects::Location& from_here,
86 const base::Closure& task, 97 const base::Closure& task,
87 base::TimeDelta delay) OVERRIDE; 98 base::TimeDelta delay) OVERRIDE;
88 }; 99 };
89 100
90 } // namespace dom_storage 101 } // namespace dom_storage
91 102
92 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ 103 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_
OLDNEW
« no previous file with comments | « no previous file | webkit/dom_storage/dom_storage_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698