OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/scheduler/child/web_task_runner_impl.h" | 5 #include "platform/scheduler/child/web_task_runner_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "public/platform/scheduler/base/task_queue.h" | 12 #include "public/platform/scheduler/base/task_queue.h" |
13 #include "platform/scheduler/base/time_domain.h" | 13 #include "platform/scheduler/base/time_domain.h" |
14 #include "public/platform/WebTraceLocation.h" | 14 #include "public/platform/WebTraceLocation.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 namespace scheduler { | 17 namespace scheduler { |
18 | 18 |
19 RefPtr<WebTaskRunnerImpl> WebTaskRunnerImpl::create( | 19 RefPtr<WebTaskRunnerImpl> WebTaskRunnerImpl::create( |
20 scoped_refptr<TaskQueue> task_queue) { | 20 scoped_refptr<TaskQueue> task_queue) { |
21 return adoptRef(new WebTaskRunnerImpl(std::move(task_queue))); | 21 return adoptRef(new WebTaskRunnerImpl(std::move(task_queue))); |
22 } | 22 } |
23 | 23 |
24 void WebTaskRunnerImpl::postDelayedTask(const WebTraceLocation& location, | 24 void WebTaskRunnerImpl::postDelayedTask(const WebTraceLocation& location, |
25 base::Closure task, | 25 base::OnceClosure task, |
26 double delayMs) { | 26 double delayMs) { |
27 DCHECK_GE(delayMs, 0.0) << location.function_name() << " " | 27 DCHECK_GE(delayMs, 0.0) << location.function_name() << " " |
28 << location.file_name(); | 28 << location.file_name(); |
29 task_queue_->PostDelayedTask(location, std::move(task), | 29 task_queue_->PostDelayedTask(location, std::move(task), |
30 base::TimeDelta::FromMillisecondsD(delayMs)); | 30 base::TimeDelta::FromMillisecondsD(delayMs)); |
31 } | 31 } |
32 | 32 |
33 bool WebTaskRunnerImpl::runsTasksOnCurrentThread() { | 33 bool WebTaskRunnerImpl::runsTasksOnCurrentThread() { |
34 return task_queue_->RunsTasksOnCurrentThread(); | 34 return task_queue_->RunsTasksOnCurrentThread(); |
35 } | 35 } |
(...skipping 20 matching lines...) Expand all Loading... |
56 return base::TimeTicks::Now(); | 56 return base::TimeTicks::Now(); |
57 return time_domain->Now(); | 57 return time_domain->Now(); |
58 } | 58 } |
59 | 59 |
60 base::SingleThreadTaskRunner* WebTaskRunnerImpl::toSingleThreadTaskRunner() { | 60 base::SingleThreadTaskRunner* WebTaskRunnerImpl::toSingleThreadTaskRunner() { |
61 return task_queue_.get(); | 61 return task_queue_.get(); |
62 } | 62 } |
63 | 63 |
64 } // namespace scheduler | 64 } // namespace scheduler |
65 } // namespace blink | 65 } // namespace blink |
OLD | NEW |