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

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

Issue 1308183005: Introduce WebTaskRunner Patch 2/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final tweaks Created 5 years, 3 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..e108fc2b21ee5f46a9f2cdd72e4ac640c866f9ae
--- /dev/null
+++ b/components/scheduler/child/web_task_runner_impl.cc
@@ -0,0 +1,50 @@
+// 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/single_thread_task_runner.h"
+#include "third_party/WebKit/public/platform/WebTraceLocation.h"
+
+namespace scheduler {
+
+WebTaskRunnerImpl::WebTaskRunnerImpl(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : task_runner_(task_runner) {}
+
+WebTaskRunnerImpl::~WebTaskRunnerImpl() {}
+
+void WebTaskRunnerImpl::postTask(const blink::WebTraceLocation& web_location,
+ blink::WebTaskRunner::Task* task) {
+ tracked_objects::Location location(web_location.functionName(),
+ web_location.fileName(), -1, nullptr);
+ task_runner_->PostTask(location, base::Bind(&blink::WebTaskRunner::Task::run,
+ base::Owned(task)));
+}
+
+void WebTaskRunnerImpl::postDelayedTask(
+ const blink::WebTraceLocation& web_location,
+ blink::WebTaskRunner::Task* task,
+ long long delayMs) {
+ tracked_objects::Location location(web_location.functionName(),
+ web_location.fileName(), -1, nullptr);
+ task_runner_->PostDelayedTask(
+ location, base::Bind(&blink::WebTaskRunner::Task::run, base::Owned(task)),
+ base::TimeDelta::FromMilliseconds(delayMs));
+}
+
+void WebTaskRunnerImpl::postDelayedTask(
+ const blink::WebTraceLocation& web_location,
+ blink::WebTaskRunner::Task* task,
+ double delayMs) {
+ tracked_objects::Location location(web_location.functionName(),
+ web_location.fileName(), -1, nullptr);
+ task_runner_->PostDelayedTask(
+ location, base::Bind(&blink::WebTaskRunner::Task::run, base::Owned(task)),
+ base::TimeDelta::FromMillisecondsD(delayMs));
+}
+
+} // namespace scheduler
« no previous file with comments | « components/scheduler/child/web_task_runner_impl.h ('k') | components/scheduler/child/webthread_impl_for_worker_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698