| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 "net/quic/quartc/quartc_factory.h" | 5 #include "net/quic/quartc/quartc_factory.h" |
| 6 | 6 |
| 7 #include "net/quic/core/crypto/quic_random.h" | 7 #include "net/quic/core/crypto/quic_random.h" |
| 8 #include "net/quic/quartc/quartc_alarm_factory.h" | 8 #include "net/quic/quartc/quartc_alarm_factory.h" |
| 9 #include "net/quic/quartc/quartc_session.h" | 9 #include "net/quic/quartc/quartc_session.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Cancel it if already set. | 34 // Cancel it if already set. |
| 35 CancelImpl(); | 35 CancelImpl(); |
| 36 | 36 |
| 37 int64_t delay_ms = (deadline() - (clock_->Now())).ToMilliseconds(); | 37 int64_t delay_ms = (deadline() - (clock_->Now())).ToMilliseconds(); |
| 38 if (delay_ms < 0) { | 38 if (delay_ms < 0) { |
| 39 delay_ms = 0; | 39 delay_ms = 0; |
| 40 } | 40 } |
| 41 | 41 |
| 42 DCHECK(task_runner_); | 42 DCHECK(task_runner_); |
| 43 DCHECK(!scheduled_task_); | 43 DCHECK(!scheduled_task_); |
| 44 scheduled_task_.reset((task_runner_->Schedule(this, delay_ms)).release()); | 44 scheduled_task_ = task_runner_->Schedule(this, delay_ms); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void CancelImpl() override { | 47 void CancelImpl() override { |
| 48 if (scheduled_task_) { | 48 if (scheduled_task_) { |
| 49 scheduled_task_->Cancel(); | 49 scheduled_task_->Cancel(); |
| 50 scheduled_task_.reset(); | 50 scheduled_task_.reset(); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 // QuartcTaskRunner::Task overrides. | 54 // QuartcTaskRunner::Task overrides. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return &buffer_allocator_; | 148 return &buffer_allocator_; |
| 149 } | 149 } |
| 150 | 150 |
| 151 std::unique_ptr<QuartcFactoryInterface> CreateQuartcFactory( | 151 std::unique_ptr<QuartcFactoryInterface> CreateQuartcFactory( |
| 152 const QuartcFactoryConfig& factory_config) { | 152 const QuartcFactoryConfig& factory_config) { |
| 153 return std::unique_ptr<QuartcFactoryInterface>( | 153 return std::unique_ptr<QuartcFactoryInterface>( |
| 154 new QuartcFactory(factory_config)); | 154 new QuartcFactory(factory_config)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace net | 157 } // namespace net |
| OLD | NEW |