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/Timer.h" | 5 #include "platform/Timer.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <queue> | 8 #include <queue> |
9 #include "platform/scheduler/base/task_queue_impl.h" | 9 #include "platform/scheduler/base/task_queue_impl.h" |
10 #include "platform/scheduler/child/web_scheduler.h" | 10 #include "platform/scheduler/child/web_scheduler.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 private: | 91 private: |
92 Record() = default; | 92 Record() = default; |
93 | 93 |
94 bool timer_has_fired_ = false; | 94 bool timer_has_fired_ = false; |
95 bool is_disposed_ = false; | 95 bool is_disposed_ = false; |
96 bool owner_is_destructed_ = false; | 96 bool owner_is_destructed_ = false; |
97 }; | 97 }; |
98 | 98 |
99 explicit OnHeapTimerOwner(PassRefPtr<Record> record) | 99 explicit OnHeapTimerOwner(PassRefPtr<Record> record) |
100 : timer_(this, &OnHeapTimerOwner::Fired), record_(record) {} | 100 : timer_(this, &OnHeapTimerOwner::Fired), record_(std::move(record)) {} |
101 ~OnHeapTimerOwner() { record_->SetOwnerIsDestructed(); } | 101 ~OnHeapTimerOwner() { record_->SetOwnerIsDestructed(); } |
102 | 102 |
103 void StartOneShot(double interval, const WebTraceLocation& caller) { | 103 void StartOneShot(double interval, const WebTraceLocation& caller) { |
104 timer_.StartOneShot(interval, caller); | 104 timer_.StartOneShot(interval, caller); |
105 } | 105 } |
106 | 106 |
107 DEFINE_INLINE_TRACE() {} | 107 DEFINE_INLINE_TRACE() {} |
108 | 108 |
109 private: | 109 private: |
110 void Fired(TimerBase*) { | 110 void Fired(TimerBase*) { |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 &TimerTest::CountingTask); | 721 &TimerTest::CountingTask); |
722 | 722 |
723 platform_->RunUntilIdle(); | 723 platform_->RunUntilIdle(); |
724 EXPECT_TRUE(!run_times_.size()); | 724 EXPECT_TRUE(!run_times_.size()); |
725 EXPECT_TRUE(task_runner1->IsEmpty()); | 725 EXPECT_TRUE(task_runner1->IsEmpty()); |
726 EXPECT_TRUE(task_runner2->IsEmpty()); | 726 EXPECT_TRUE(task_runner2->IsEmpty()); |
727 } | 727 } |
728 | 728 |
729 } // namespace | 729 } // namespace |
730 } // namespace blink | 730 } // namespace blink |
OLD | NEW |