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

Unified Diff: webkit/dom_storage/dom_storage_task_runner.h

Issue 9146025: Framing for a DOMStorage backend that does not depend on in-process-webkit. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/dom_storage/dom_storage_session.cc ('k') | webkit/dom_storage/dom_storage_task_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,70 @@
+// 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 must run serially with respect to one another, but may
darin (slow to review) 2012/02/04 05:26:07 there's actually work underway by akalin to create
+// execute on different OS threads. The base class is implemented
+// in terms of a MessageLoopProxy for use in testing.
+class DomStorageTaskRunner
+ : public base::RefCountedThreadSafe<DomStorageTaskRunner> {
+ public:
+ explicit DomStorageTaskRunner(base::MessageLoopProxy* message_loop);
+ virtual ~DomStorageTaskRunner();
+
+ // Schedules a task to be run immediately.
+ virtual void PostTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task);
+
+ // Schedules a task to be run after a delay.
+ virtual void PostDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay);
+
+ protected:
+ scoped_refptr<base::MessageLoopProxy> message_loop_;
+};
+
+// A derived class that utlizes the SequenceWorkerPool under a
+// dom_storage specific SequenceToken. The MessageLoopProxy
+// is used to delay scheduling on the worker pool.
+class DomStorageWorkerPoolTaskRunner : public DomStorageTaskRunner {
+ public:
+ DomStorageWorkerPoolTaskRunner(
+ base::SequencedWorkerPool* sequenced_worker_pool,
+ base::MessageLoopProxy* delayed_task_loop);
+ virtual ~DomStorageWorkerPoolTaskRunner();
+
+ // Schedules a sequenced worker task to be run immediately.
+ virtual void PostTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task) OVERRIDE;
+
+ // Schedules a sequenced worker task to be run after a delay.
+ virtual void PostDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) OVERRIDE;
+
+ private:
+ base::SequencedWorkerPool* sequenced_worker_pool_; // not owned
+ base::SequencedWorkerPool::SequenceToken sequence_token_;
+};
+
+} // 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
« no previous file with comments | « webkit/dom_storage/dom_storage_session.cc ('k') | webkit/dom_storage/dom_storage_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698