Chromium Code Reviews| Index: webkit/dom_storage/dom_storage_task_runner.h |
| =================================================================== |
| --- webkit/dom_storage/dom_storage_task_runner.h (revision 0) |
| +++ webkit/dom_storage/dom_storage_task_runner.h (revision 0) |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ |
| +#define WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ |
| +#pragma once |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/threading/sequenced_worker_pool.h" |
| + |
| +namespace base { |
| +class MessageLoopProxy; |
| +} |
| + |
| +namespace dom_storage { |
| + |
| +// Tasks are gauranteed to run serially with respect to |
|
benm (inactive)
2012/01/31 18:03:38
guaranteed
michaeln
2012/01/31 21:17:45
thnx (geez, i misspell that word a lot)
|
| +// one another, but may execute on different OS threads. |
| +// They're executed via the SequenceWorkerPool under a |
| +// dom_storage specific SequenceToken. |
| +class DomStorageTaskRunner |
| + : public base::RefCountedThreadSafe<DomStorageTaskRunner> { |
| + public: |
| + DomStorageTaskRunner( |
| + base::SequencedWorkerPool* sequenced_worker_pool, |
| + base::MessageLoopProxy* delayed_task_loop); |
| + ~DomStorageTaskRunner(); |
| + |
| + // Schedules a sequenced worker task to be run immediately. |
| + void PostTask( |
| + const tracked_objects::Location& from_here, |
| + const base::Closure& task); |
| + |
| + // Schedules a sequenced worker task to be run after a delay. |
| + void PostDelayedTask( |
| + const tracked_objects::Location& from_here, |
| + const base::Closure& task, |
| + base::TimeDelta delay); |
| + |
| + private: |
| + // Tasks are executed in sequence via the SequencedWorkerPool. |
| + base::SequencedWorkerPool* sequenced_worker_pool_; // not owned |
| + base::SequencedWorkerPool::SequenceToken sequence_token_; |
| + |
| + // Delayed tasks are scheduled on the worker pool only |
| + // after the delay has passed. This seperate message |
| + // loop provides the delay. |
| + scoped_refptr<base::MessageLoopProxy> delayed_task_loop_; |
| +}; |
| + |
| +} // namespace dom_storage |
| + |
| +#endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_TASK_RUNNER_ |
| Property changes on: webkit\dom_storage\dom_storage_task_runner.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |