diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/threading/sequenced_worker_pool_task_runner.cc | 52 | ||||
-rw-r--r-- | base/threading/sequenced_worker_pool_task_runner.h | 62 |
2 files changed, 0 insertions, 114 deletions
diff --git a/base/threading/sequenced_worker_pool_task_runner.cc b/base/threading/sequenced_worker_pool_task_runner.cc deleted file mode 100644 index b7579a7..0000000 --- a/base/threading/sequenced_worker_pool_task_runner.cc +++ /dev/null @@ -1,52 +0,0 @@ -// 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. - -#include "base/threading/sequenced_worker_pool_task_runner.h" - -#include "base/callback.h" -#include "base/location.h" -#include "base/logging.h" - -namespace base { - -SequencedWorkerPoolTaskRunner::SequencedWorkerPoolTaskRunner( - const scoped_refptr<SequencedWorkerPool>& pool, - SequencedWorkerPool::SequenceToken token) - : pool_(pool), - token_(token) { -} - -SequencedWorkerPoolTaskRunner::~SequencedWorkerPoolTaskRunner() { -} - -bool SequencedWorkerPoolTaskRunner::PostDelayedTask( - const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) { - return PostDelayedTaskAssertZeroDelay(from_here, task, delay); -} - -bool SequencedWorkerPoolTaskRunner::RunsTasksOnCurrentThread() const { - return pool_->IsRunningSequenceOnCurrentThread(token_); -} - -bool SequencedWorkerPoolTaskRunner::PostNonNestableDelayedTask( - const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) { - return PostDelayedTaskAssertZeroDelay(from_here, task, delay); -} - -bool SequencedWorkerPoolTaskRunner::PostDelayedTaskAssertZeroDelay( - const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) { - // TODO(francoisk777@gmail.com): Change the following two statements once - // SequencedWorkerPool supports non-zero delays. - DCHECK_EQ(delay.InMillisecondsRoundedUp(), 0) - << "SequencedWorkerPoolTaskRunner does not yet support non-zero delays"; - return pool_->PostSequencedWorkerTask(token_, from_here, task); -} - -} // namespace base diff --git a/base/threading/sequenced_worker_pool_task_runner.h b/base/threading/sequenced_worker_pool_task_runner.h deleted file mode 100644 index 6d6ff94..0000000 --- a/base/threading/sequenced_worker_pool_task_runner.h +++ /dev/null @@ -1,62 +0,0 @@ -// 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_ - -#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_WORKER_POOL_TASK_RUNNER_H_ |