Roll src/third_party/WebKit 605a979:06cb9e9 (svn 202556:202558)
[chromium-blink-merge.git] / components / scheduler / child / web_task_runner_impl.cc
blobe108fc2b21ee5f46a9f2cdd72e4ac640c866f9ae
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/scheduler/child/web_task_runner_impl.h"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
12 namespace scheduler {
14 WebTaskRunnerImpl::WebTaskRunnerImpl(
15 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
16 : task_runner_(task_runner) {}
18 WebTaskRunnerImpl::~WebTaskRunnerImpl() {}
20 void WebTaskRunnerImpl::postTask(const blink::WebTraceLocation& web_location,
21 blink::WebTaskRunner::Task* task) {
22 tracked_objects::Location location(web_location.functionName(),
23 web_location.fileName(), -1, nullptr);
24 task_runner_->PostTask(location, base::Bind(&blink::WebTaskRunner::Task::run,
25 base::Owned(task)));
28 void WebTaskRunnerImpl::postDelayedTask(
29 const blink::WebTraceLocation& web_location,
30 blink::WebTaskRunner::Task* task,
31 long long delayMs) {
32 tracked_objects::Location location(web_location.functionName(),
33 web_location.fileName(), -1, nullptr);
34 task_runner_->PostDelayedTask(
35 location, base::Bind(&blink::WebTaskRunner::Task::run, base::Owned(task)),
36 base::TimeDelta::FromMilliseconds(delayMs));
39 void WebTaskRunnerImpl::postDelayedTask(
40 const blink::WebTraceLocation& web_location,
41 blink::WebTaskRunner::Task* task,
42 double delayMs) {
43 tracked_objects::Location location(web_location.functionName(),
44 web_location.fileName(), -1, nullptr);
45 task_runner_->PostDelayedTask(
46 location, base::Bind(&blink::WebTaskRunner::Task::run, base::Owned(task)),
47 base::TimeDelta::FromMillisecondsD(delayMs));
50 } // namespace scheduler