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

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

Issue 1572353002: QuicAlarms are now allocated out of an arena in QuicConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge recent changes. Created 4 years, 11 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_alarm.h ('k') | net/quic/quic_alarm_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_alarm.h" 5 #include "net/quic/quic_alarm.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 QuicAlarm::QuicAlarm(Delegate* delegate) 11 QuicAlarm::QuicAlarm(QuicArenaScopedPtr<Delegate> delegate)
12 : delegate_(delegate), deadline_(QuicTime::Zero()) {} 12 : delegate_(std::move(delegate)), deadline_(QuicTime::Zero()) {}
13 13
14 QuicAlarm::~QuicAlarm() {} 14 QuicAlarm::~QuicAlarm() {}
15 15
16 void QuicAlarm::Set(QuicTime deadline) { 16 void QuicAlarm::Set(QuicTime deadline) {
17 DCHECK(!IsSet()); 17 DCHECK(!IsSet());
18 DCHECK(deadline.IsInitialized()); 18 DCHECK(deadline.IsInitialized());
19 deadline_ = deadline; 19 deadline_ = deadline;
20 SetImpl(); 20 SetImpl();
21 } 21 }
22 22
(...skipping 27 matching lines...) Expand all
50 deadline_ = QuicTime::Zero(); 50 deadline_ = QuicTime::Zero();
51 QuicTime deadline = delegate_->OnAlarm(); 51 QuicTime deadline = delegate_->OnAlarm();
52 // delegate_->OnAlarm() might call Set(), in which case deadline_ will 52 // delegate_->OnAlarm() might call Set(), in which case deadline_ will
53 // already contain the new value, so don't overwrite it. 53 // already contain the new value, so don't overwrite it.
54 if (!deadline_.IsInitialized() && deadline.IsInitialized()) { 54 if (!deadline_.IsInitialized() && deadline.IsInitialized()) {
55 Set(deadline); 55 Set(deadline);
56 } 56 }
57 } 57 }
58 58
59 } // namespace net 59 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_alarm.h ('k') | net/quic/quic_alarm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698