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

Unified Diff: components/scheduler/child/web_task_runner_impl.cc

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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 | « components/scheduler/child/web_task_runner_impl.h ('k') | components/scheduler/child/webthread_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/scheduler/child/web_task_runner_impl.cc
diff --git a/components/scheduler/child/web_task_runner_impl.cc b/components/scheduler/child/web_task_runner_impl.cc
deleted file mode 100644
index 0b227800bf11cd022c9dfc2fda5c0d18afe40b93..0000000000000000000000000000000000000000
--- a/components/scheduler/child/web_task_runner_impl.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 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 "components/scheduler/child/web_task_runner_impl.h"
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/memory/ptr_util.h"
-#include "components/scheduler/base/task_queue.h"
-#include "components/scheduler/base/time_domain.h"
-#include "third_party/WebKit/public/platform/WebTraceLocation.h"
-
-namespace scheduler {
-
-WebTaskRunnerImpl::WebTaskRunnerImpl(scoped_refptr<TaskQueue> task_queue)
- : task_queue_(task_queue) {}
-
-WebTaskRunnerImpl::~WebTaskRunnerImpl() {}
-
-void WebTaskRunnerImpl::postTask(const blink::WebTraceLocation& location,
- blink::WebTaskRunner::Task* task) {
- task_queue_->PostTask(
- location,
- base::Bind(&WebTaskRunnerImpl::runTask,
- base::Passed(base::WrapUnique(task))));
-}
-
-void WebTaskRunnerImpl::postDelayedTask(
- const blink::WebTraceLocation& location,
- blink::WebTaskRunner::Task* task,
- double delayMs) {
- DCHECK_GE(delayMs, 0.0);
- task_queue_->PostDelayedTask(
- location,
- base::Bind(&WebTaskRunnerImpl::runTask,
- base::Passed(base::WrapUnique(task))),
- base::TimeDelta::FromMillisecondsD(delayMs));
-}
-
-bool WebTaskRunnerImpl::runsTasksOnCurrentThread() {
- return task_queue_->RunsTasksOnCurrentThread();
-}
-
-double WebTaskRunnerImpl::virtualTimeSeconds() const {
- return (Now() - base::TimeTicks::UnixEpoch()).InSecondsF();
-}
-
-double WebTaskRunnerImpl::monotonicallyIncreasingVirtualTimeSeconds() const {
- return Now().ToInternalValue() /
- static_cast<double>(base::Time::kMicrosecondsPerSecond);
-}
-
-base::TimeTicks WebTaskRunnerImpl::Now() const {
- TimeDomain* time_domain = task_queue_->GetTimeDomain();
- // It's possible task_queue_ has been Unregistered which can lead to a null
- // TimeDomain. If that happens just return the current real time.
- if (!time_domain)
- return base::TimeTicks::Now();
- return time_domain->Now();
-}
-
-std::unique_ptr<blink::WebTaskRunner> WebTaskRunnerImpl::clone() {
- return base::WrapUnique(new WebTaskRunnerImpl(task_queue_));
-}
-
-void WebTaskRunnerImpl::runTask(
- std::unique_ptr<blink::WebTaskRunner::Task> task) {
- task->run();
-}
-
-} // namespace scheduler
« no previous file with comments | « components/scheduler/child/web_task_runner_impl.h ('k') | components/scheduler/child/webthread_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698