Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: net/quic/quic_connection_helper.cc

Issue 623213004: replace OVERRIDE and FINAL with override and final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo unwanted change in comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_connection_helper.h ('k') | net/quic/quic_connection_helper_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "net/quic/quic_connection_helper.h" 5 #include "net/quic/quic_connection_helper.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
10 #include "base/task_runner.h" 10 #include "base/task_runner.h"
(...skipping 11 matching lines...) Expand all
22 QuicChromeAlarm(const QuicClock* clock, 22 QuicChromeAlarm(const QuicClock* clock,
23 base::TaskRunner* task_runner, 23 base::TaskRunner* task_runner,
24 QuicAlarm::Delegate* delegate) 24 QuicAlarm::Delegate* delegate)
25 : QuicAlarm(delegate), 25 : QuicAlarm(delegate),
26 clock_(clock), 26 clock_(clock),
27 task_runner_(task_runner), 27 task_runner_(task_runner),
28 task_deadline_(QuicTime::Zero()), 28 task_deadline_(QuicTime::Zero()),
29 weak_factory_(this) {} 29 weak_factory_(this) {}
30 30
31 protected: 31 protected:
32 virtual void SetImpl() OVERRIDE { 32 virtual void SetImpl() override {
33 DCHECK(deadline().IsInitialized()); 33 DCHECK(deadline().IsInitialized());
34 if (task_deadline_.IsInitialized()) { 34 if (task_deadline_.IsInitialized()) {
35 if (task_deadline_ <= deadline()) { 35 if (task_deadline_ <= deadline()) {
36 // Since tasks can not be un-posted, OnAlarm will be invoked which 36 // Since tasks can not be un-posted, OnAlarm will be invoked which
37 // will notice that deadline has not yet been reached, and will set 37 // will notice that deadline has not yet been reached, and will set
38 // the alarm for the new deadline. 38 // the alarm for the new deadline.
39 return; 39 return;
40 } 40 }
41 // The scheduled task is after new deadline. Invalidate the weak ptrs 41 // The scheduled task is after new deadline. Invalidate the weak ptrs
42 // so that task does not execute when we're not expecting it. 42 // so that task does not execute when we're not expecting it.
43 weak_factory_.InvalidateWeakPtrs(); 43 weak_factory_.InvalidateWeakPtrs();
44 } 44 }
45 45
46 int64 delay_us = deadline().Subtract(clock_->Now()).ToMicroseconds(); 46 int64 delay_us = deadline().Subtract(clock_->Now()).ToMicroseconds();
47 if (delay_us < 0) { 47 if (delay_us < 0) {
48 delay_us = 0; 48 delay_us = 0;
49 } 49 }
50 task_runner_->PostDelayedTask( 50 task_runner_->PostDelayedTask(
51 FROM_HERE, 51 FROM_HERE,
52 base::Bind(&QuicChromeAlarm::OnAlarm, weak_factory_.GetWeakPtr()), 52 base::Bind(&QuicChromeAlarm::OnAlarm, weak_factory_.GetWeakPtr()),
53 base::TimeDelta::FromMicroseconds(delay_us)); 53 base::TimeDelta::FromMicroseconds(delay_us));
54 task_deadline_ = deadline(); 54 task_deadline_ = deadline();
55 } 55 }
56 56
57 virtual void CancelImpl() OVERRIDE { 57 virtual void CancelImpl() override {
58 DCHECK(!deadline().IsInitialized()); 58 DCHECK(!deadline().IsInitialized());
59 // Since tasks can not be un-posted, OnAlarm will be invoked which 59 // Since tasks can not be un-posted, OnAlarm will be invoked which
60 // will notice that deadline is not Initialized and will do nothing. 60 // will notice that deadline is not Initialized and will do nothing.
61 } 61 }
62 62
63 private: 63 private:
64 void OnAlarm() { 64 void OnAlarm() {
65 DCHECK(task_deadline_.IsInitialized()); 65 DCHECK(task_deadline_.IsInitialized());
66 task_deadline_ = QuicTime::Zero(); 66 task_deadline_ = QuicTime::Zero();
67 // The alarm may have been cancelled. 67 // The alarm may have been cancelled.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 QuicRandom* QuicConnectionHelper::GetRandomGenerator() { 110 QuicRandom* QuicConnectionHelper::GetRandomGenerator() {
111 return random_generator_; 111 return random_generator_;
112 } 112 }
113 113
114 QuicAlarm* QuicConnectionHelper::CreateAlarm(QuicAlarm::Delegate* delegate) { 114 QuicAlarm* QuicConnectionHelper::CreateAlarm(QuicAlarm::Delegate* delegate) {
115 return new QuicChromeAlarm(clock_, task_runner_, delegate); 115 return new QuicChromeAlarm(clock_, task_runner_, delegate);
116 } 116 }
117 117
118 } // namespace net 118 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection_helper.h ('k') | net/quic/quic_connection_helper_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698