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

Unified Diff: base/threading/sequenced_worker_pool_task_runner.h

Issue 9703053: Remove old Sleep and PostDelayedTask interfaces that use int ms instead of TimeDelta. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase onto master. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/threading/sequenced_worker_pool.cc ('k') | base/threading/sequenced_worker_pool_task_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool_task_runner.h
diff --git a/base/threading/sequenced_worker_pool_task_runner.h b/base/threading/sequenced_worker_pool_task_runner.h
new file mode 100644
index 0000000000000000000000000000000000000000..682766301c3310ea7933f6709a8cf21a533af4c4
--- /dev/null
+++ b/base/threading/sequenced_worker_pool_task_runner.h
@@ -0,0 +1,63 @@
+// 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 BASE_THREADING_SEQUENCED_WORKER_POOL_TASK_RUNNER_H_
+#define BASE_THREADING_SEQUENCED_WORKER_POOL_TASK_RUNNER_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/callback_forward.h"
+#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
+#include "base/sequenced_task_runner.h"
+#include "base/threading/sequenced_worker_pool.h"
+#include "base/time.h"
+
+namespace tracked_objects {
+class Location;
+} // namespace tracked_objects
+
+namespace base {
+
+// A SequencedTaskRunner which posts tasks to a SequencedWorkerPool with a
+// fixed sequence token.
+//
+// Note that this class is RefCountedThreadSafe (inherited from TaskRunner).
+class BASE_EXPORT SequencedWorkerPoolTaskRunner : public SequencedTaskRunner {
+ public:
+ SequencedWorkerPoolTaskRunner(const scoped_refptr<SequencedWorkerPool>& pool,
+ SequencedWorkerPool::SequenceToken token);
+
+ // TaskRunner implementation
+ virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
+ const Closure& task,
+ TimeDelta delay) OVERRIDE;
+ virtual bool RunsTasksOnCurrentThread() const OVERRIDE;
+
+ // SequencedTaskRunner implementation
+ virtual bool PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ const Closure& task,
+ TimeDelta delay) OVERRIDE;
+
+ private:
+ virtual ~SequencedWorkerPoolTaskRunner();
+
+ // Helper function for posting a delayed task. Asserts that the delay is
+ // zero because non-zero delays are not yet supported.
+ bool PostDelayedTaskAssertZeroDelay(
+ const tracked_objects::Location& from_here,
+ const Closure& task,
+ TimeDelta delay);
+
+ const scoped_refptr<SequencedWorkerPool> pool_;
+
+ const SequencedWorkerPool::SequenceToken token_;
+
+ DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPoolTaskRunner);
+};
+
+} // namespace base
+
+#endif // BASE_THREADING_SEQUENCED_TASK_RUNNER_IMPL_H_
« no previous file with comments | « base/threading/sequenced_worker_pool.cc ('k') | base/threading/sequenced_worker_pool_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698