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 "components/scheduler/child/web_task_runner_impl.h" | 5 #include "components/scheduler/child/web_task_runner_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/scheduler/base/task_queue.h" | 10 #include "components/scheduler/base/task_queue.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return Now().ToInternalValue() / | 46 return Now().ToInternalValue() / |
47 static_cast<double>(base::Time::kMicrosecondsPerSecond); | 47 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
48 } | 48 } |
49 | 49 |
50 base::TimeTicks WebTaskRunnerImpl::Now() const { | 50 base::TimeTicks WebTaskRunnerImpl::Now() const { |
51 TimeDomain* time_domain = task_queue_->GetTimeDomain(); | 51 TimeDomain* time_domain = task_queue_->GetTimeDomain(); |
52 // It's possible task_queue_ has been Unregistered which can lead to a null | 52 // It's possible task_queue_ has been Unregistered which can lead to a null |
53 // TimeDomain. If that happens just return the current real time. | 53 // TimeDomain. If that happens just return the current real time. |
54 if (!time_domain) | 54 if (!time_domain) |
55 return base::TimeTicks::Now(); | 55 return base::TimeTicks::Now(); |
56 return time_domain->Now(); | 56 return time_domain->BlinkNow(); |
57 } | 57 } |
58 | 58 |
59 blink::WebTaskRunner* WebTaskRunnerImpl::clone() { | 59 blink::WebTaskRunner* WebTaskRunnerImpl::clone() { |
60 return new WebTaskRunnerImpl(task_queue_); | 60 return new WebTaskRunnerImpl(task_queue_); |
61 } | 61 } |
62 | 62 |
63 void WebTaskRunnerImpl::runTask( | 63 void WebTaskRunnerImpl::runTask( |
64 std::unique_ptr<blink::WebTaskRunner::Task> task) { | 64 std::unique_ptr<blink::WebTaskRunner::Task> task) { |
65 task->run(); | 65 task->run(); |
66 } | 66 } |
67 | 67 |
68 } // namespace scheduler | 68 } // namespace scheduler |
OLD | NEW |