| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/test/scheduler_test_common.h" | 5 #include "cc/test/scheduler_test_common.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 void FakeThread::runPendingTask() | 25 void FakeThread::runPendingTask() |
| 26 { | 26 { |
| 27 ASSERT_TRUE(m_pendingTask); | 27 ASSERT_TRUE(m_pendingTask); |
| 28 scoped_ptr<base::Closure> task = m_pendingTask.Pass(); | 28 scoped_ptr<base::Closure> task = m_pendingTask.Pass(); |
| 29 task->Run(); | 29 task->Run(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void FakeThread::postTask(base::Closure cb) | 32 void FakeThread::postTask(base::Closure cb) |
| 33 { | 33 { |
| 34 postDelayedTask(cb, 0); | 34 postDelayedTask(cb, base::TimeDelta()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void FakeThread::postDelayedTask(base::Closure cb, long long delay) | 37 void FakeThread::postDelayedTask(base::Closure cb, base::TimeDelta delay) |
| 38 { | 38 { |
| 39 if (m_runPendingTaskOnOverwrite && hasPendingTask()) | 39 if (m_runPendingTaskOnOverwrite && hasPendingTask()) |
| 40 runPendingTask(); | 40 runPendingTask(); |
| 41 | 41 |
| 42 ASSERT_FALSE(hasPendingTask()); | 42 ASSERT_FALSE(hasPendingTask()); |
| 43 m_pendingTask.reset(new base::Closure(cb)); | 43 m_pendingTask.reset(new base::Closure(cb)); |
| 44 m_pendingTaskDelay = delay; | 44 m_pendingTaskDelay = delay.InMilliseconds(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool FakeThread::belongsToCurrentThread() const | 47 bool FakeThread::belongsToCurrentThread() const |
| 48 { | 48 { |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void FakeTimeSource::setClient(cc::TimeSourceClient* client) | 52 void FakeTimeSource::setClient(cc::TimeSourceClient* client) |
| 53 { | 53 { |
| 54 m_client = client; | 54 m_client = client; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 73 { | 73 { |
| 74 return base::TimeTicks(); | 74 return base::TimeTicks(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 base::TimeTicks FakeDelayBasedTimeSource::now() const | 77 base::TimeTicks FakeDelayBasedTimeSource::now() const |
| 78 { | 78 { |
| 79 return m_now; | 79 return m_now; |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace cc | 82 } // namespace cc |
| OLD | NEW |