| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // An implementation of WebThread in terms of base::MessageLoop and | 5 // An implementation of WebThread in terms of base::MessageLoop and |
| 6 // base::Thread | 6 // base::Thread |
| 7 | 7 |
| 8 #include "components/scheduler/child/webthread_base.h" | 8 #include "components/scheduler/child/webthread_base.h" |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 web_location.fileName(), -1, nullptr); | 95 web_location.fileName(), -1, nullptr); |
| 96 IdleTaskRunner()->PostIdleTaskAfterWakeup( | 96 IdleTaskRunner()->PostIdleTaskAfterWakeup( |
| 97 location, base::Bind(&WebThreadBase::RunWebThreadIdleTask, | 97 location, base::Bind(&WebThreadBase::RunWebThreadIdleTask, |
| 98 base::Passed(make_scoped_ptr(idle_task)))); | 98 base::Passed(make_scoped_ptr(idle_task)))); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool WebThreadBase::isCurrentThread() const { | 101 bool WebThreadBase::isCurrentThread() const { |
| 102 return TaskRunner()->BelongsToCurrentThread(); | 102 return TaskRunner()->BelongsToCurrentThread(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 double WebThreadBase::virtualTimeSeconds() { |
| 106 return base::Time::Now().ToDoubleT(); |
| 107 } |
| 108 |
| 109 double WebThreadBase::monotonicallyIncreasingVirtualTimeSeconds() { |
| 110 return base::TimeTicks::Now().ToInternalValue() / |
| 111 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
| 112 } |
| 113 |
| 105 } // namespace scheduler | 114 } // namespace scheduler |
| OLD | NEW |