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

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

Issue 16701004: Fix webkit_storage exports definitions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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
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_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ 5 #ifndef WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_
6 #define WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ 6 #define WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_
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/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "webkit/storage/webkit_storage_export.h" 12 #include "webkit/browser/webkit_storage_browser_export.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 // DomStorage uses two task sequences (primary vs commit) to avoid 20 // DomStorage uses two task sequences (primary vs commit) to avoid
21 // primary access from queuing up behind commits to disk. 21 // primary access from queuing up behind commits to disk.
22 // * Initialization, shutdown, and administrative tasks are performed as 22 // * Initialization, shutdown, and administrative tasks are performed as
23 // shutdown-blocking primary sequence tasks. 23 // shutdown-blocking primary sequence tasks.
24 // * Tasks directly related to the javascript'able interface are performed 24 // * Tasks directly related to the javascript'able interface are performed
25 // as shutdown-blocking primary sequence tasks. 25 // as shutdown-blocking primary sequence tasks.
26 // TODO(michaeln): Skip tasks for reading during shutdown. 26 // TODO(michaeln): Skip tasks for reading during shutdown.
27 // * Internal tasks related to committing changes to disk are performed as 27 // * Internal tasks related to committing changes to disk are performed as
28 // shutdown-blocking commit sequence tasks. 28 // shutdown-blocking commit sequence tasks.
29 class WEBKIT_STORAGE_EXPORT DomStorageTaskRunner : public base::TaskRunner { 29 class WEBKIT_STORAGE_BROWSER_EXPORT DomStorageTaskRunner
30 : public base::TaskRunner {
30 public: 31 public:
31 enum SequenceID { 32 enum SequenceID {
32 PRIMARY_SEQUENCE, 33 PRIMARY_SEQUENCE,
33 COMMIT_SEQUENCE 34 COMMIT_SEQUENCE
34 }; 35 };
35 36
36 // The PostTask() and PostDelayedTask() methods defined by TaskRunner 37 // The PostTask() and PostDelayedTask() methods defined by TaskRunner
37 // post shutdown-blocking tasks on the primary sequence. 38 // post shutdown-blocking tasks on the primary sequence.
38 virtual bool PostDelayedTask( 39 virtual bool PostDelayedTask(
39 const tracked_objects::Location& from_here, 40 const tracked_objects::Location& from_here,
(...skipping 19 matching lines...) Expand all
59 return IsRunningOnSequence(COMMIT_SEQUENCE); 60 return IsRunningOnSequence(COMMIT_SEQUENCE);
60 } 61 }
61 62
62 protected: 63 protected:
63 virtual ~DomStorageTaskRunner() {} 64 virtual ~DomStorageTaskRunner() {}
64 }; 65 };
65 66
66 // A derived class used in chromium that utilizes a SequenceWorkerPool 67 // A derived class used in chromium that utilizes a SequenceWorkerPool
67 // under dom_storage specific SequenceTokens. The |delayed_task_loop| 68 // under dom_storage specific SequenceTokens. The |delayed_task_loop|
68 // is used to delay scheduling on the worker pool. 69 // is used to delay scheduling on the worker pool.
69 class WEBKIT_STORAGE_EXPORT DomStorageWorkerPoolTaskRunner : 70 class WEBKIT_STORAGE_BROWSER_EXPORT DomStorageWorkerPoolTaskRunner :
70 public DomStorageTaskRunner { 71 public DomStorageTaskRunner {
71 public: 72 public:
72 DomStorageWorkerPoolTaskRunner( 73 DomStorageWorkerPoolTaskRunner(
73 base::SequencedWorkerPool* sequenced_worker_pool, 74 base::SequencedWorkerPool* sequenced_worker_pool,
74 base::SequencedWorkerPool::SequenceToken primary_sequence_token, 75 base::SequencedWorkerPool::SequenceToken primary_sequence_token,
75 base::SequencedWorkerPool::SequenceToken commit_sequence_token, 76 base::SequencedWorkerPool::SequenceToken commit_sequence_token,
76 base::MessageLoopProxy* delayed_task_loop); 77 base::MessageLoopProxy* delayed_task_loop);
77 78
78 virtual bool PostDelayedTask( 79 virtual bool PostDelayedTask(
79 const tracked_objects::Location& from_here, 80 const tracked_objects::Location& from_here,
(...skipping 18 matching lines...) Expand all
98 const scoped_refptr<base::SequencedWorkerPool> sequenced_worker_pool_; 99 const scoped_refptr<base::SequencedWorkerPool> sequenced_worker_pool_;
99 base::SequencedWorkerPool::SequenceToken primary_sequence_token_; 100 base::SequencedWorkerPool::SequenceToken primary_sequence_token_;
100 base::SequencedWorkerPool::SequenceToken commit_sequence_token_; 101 base::SequencedWorkerPool::SequenceToken commit_sequence_token_;
101 }; 102 };
102 103
103 // A derived class used in unit tests that ignores all delays so 104 // A derived class used in unit tests that ignores all delays so
104 // we don't block in unit tests waiting for timeouts to expire. 105 // we don't block in unit tests waiting for timeouts to expire.
105 // There is no distinction between [non]-shutdown-blocking or 106 // There is no distinction between [non]-shutdown-blocking or
106 // the primary sequence vs the commit sequence in the mock, 107 // the primary sequence vs the commit sequence in the mock,
107 // all tasks are scheduled on |message_loop| with zero delay. 108 // all tasks are scheduled on |message_loop| with zero delay.
108 class WEBKIT_STORAGE_EXPORT MockDomStorageTaskRunner : 109 class WEBKIT_STORAGE_BROWSER_EXPORT MockDomStorageTaskRunner :
109 public DomStorageTaskRunner { 110 public DomStorageTaskRunner {
110 public: 111 public:
111 explicit MockDomStorageTaskRunner(base::MessageLoopProxy* message_loop); 112 explicit MockDomStorageTaskRunner(base::MessageLoopProxy* message_loop);
112 113
113 virtual bool PostDelayedTask( 114 virtual bool PostDelayedTask(
114 const tracked_objects::Location& from_here, 115 const tracked_objects::Location& from_here,
115 const base::Closure& task, 116 const base::Closure& task,
116 base::TimeDelta delay) OVERRIDE; 117 base::TimeDelta delay) OVERRIDE;
117 118
118 virtual bool PostShutdownBlockingTask( 119 virtual bool PostShutdownBlockingTask(
119 const tracked_objects::Location& from_here, 120 const tracked_objects::Location& from_here,
120 SequenceID sequence_id, 121 SequenceID sequence_id,
121 const base::Closure& task) OVERRIDE; 122 const base::Closure& task) OVERRIDE;
122 123
123 virtual bool IsRunningOnSequence(SequenceID sequence_id) const OVERRIDE; 124 virtual bool IsRunningOnSequence(SequenceID sequence_id) const OVERRIDE;
124 125
125 protected: 126 protected:
126 virtual ~MockDomStorageTaskRunner(); 127 virtual ~MockDomStorageTaskRunner();
127 128
128 private: 129 private:
129 const scoped_refptr<base::MessageLoopProxy> message_loop_; 130 const scoped_refptr<base::MessageLoopProxy> message_loop_;
130 }; 131 };
131 132
132 } // namespace dom_storage 133 } // namespace dom_storage
133 134
134 #endif // WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ 135 #endif // WEBKIT_BROWSER_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_
OLDNEW
« no previous file with comments | « webkit/browser/dom_storage/dom_storage_session.h ('k') | webkit/browser/dom_storage/local_storage_database_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698