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

Side by Side Diff: net/tools/quic/quic_epoll_alarm_factory.cc

Issue 2132623002: Landing Recent QUIC changes until 2016-07-02 02:45 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing comment about RPCs Created 4 years, 5 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/tools/quic/quic_dispatcher_test.cc ('k') | net/tools/quic/quic_epoll_alarm_factory_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/tools/quic/quic_epoll_alarm_factory.h" 5 #include "net/tools/quic/quic_epoll_alarm_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/tools/epoll_server/epoll_server.h" 8 #include "net/tools/epoll_server/epoll_server.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 namespace { 12 namespace {
13 13
14 class QuicEpollAlarm : public QuicAlarm { 14 class QuicEpollAlarm : public QuicAlarm {
15 public: 15 public:
16 QuicEpollAlarm(EpollServer* epoll_server, 16 QuicEpollAlarm(EpollServer* epoll_server,
17 QuicArenaScopedPtr<Delegate> delegate) 17 QuicArenaScopedPtr<Delegate> delegate)
18 : QuicAlarm(std::move(delegate)), 18 : QuicAlarm(std::move(delegate)),
19 epoll_server_(epoll_server), 19 epoll_server_(epoll_server),
20 epoll_alarm_impl_(this) {} 20 epoll_alarm_impl_(this) {}
21 21
22 protected: 22 protected:
23 void SetImpl() override { 23 void SetImpl() override {
24 DCHECK(deadline().IsInitialized()); 24 DCHECK(deadline().IsInitialized());
25 epoll_server_->RegisterAlarm( 25 epoll_server_->RegisterAlarm(
26 deadline().Subtract(QuicTime::Zero()).ToMicroseconds(), 26 (deadline() - QuicTime::Zero()).ToMicroseconds(), &epoll_alarm_impl_);
27 &epoll_alarm_impl_);
28 } 27 }
29 28
30 void CancelImpl() override { 29 void CancelImpl() override {
31 DCHECK(!deadline().IsInitialized()); 30 DCHECK(!deadline().IsInitialized());
32 epoll_alarm_impl_.UnregisterIfRegistered(); 31 epoll_alarm_impl_.UnregisterIfRegistered();
33 } 32 }
34 33
35 private: 34 private:
36 class EpollAlarmImpl : public EpollAlarm { 35 class EpollAlarmImpl : public EpollAlarm {
37 public: 36 public:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 QuicConnectionArena* arena) { 68 QuicConnectionArena* arena) {
70 if (arena != nullptr) { 69 if (arena != nullptr) {
71 return arena->New<QuicEpollAlarm>(epoll_server_, std::move(delegate)); 70 return arena->New<QuicEpollAlarm>(epoll_server_, std::move(delegate));
72 } else { 71 } else {
73 return QuicArenaScopedPtr<QuicAlarm>( 72 return QuicArenaScopedPtr<QuicAlarm>(
74 new QuicEpollAlarm(epoll_server_, std::move(delegate))); 73 new QuicEpollAlarm(epoll_server_, std::move(delegate)));
75 } 74 }
76 } 75 }
77 76
78 } // namespace net 77 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher_test.cc ('k') | net/tools/quic/quic_epoll_alarm_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698