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

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

Issue 1907773002: Make QuicDispatcher's helper argument be a unique_ptr to make ownership (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119678304
Patch Set: Rebase Created 4 years, 8 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_server_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_server.h" 5 #include "net/tools/quic/quic_server.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <features.h> 8 #include <features.h>
9 #include <netinet/in.h> 9 #include <netinet/in.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 dispatcher_->InitializeWithWriter(CreateWriter(fd_)); 137 dispatcher_->InitializeWithWriter(CreateWriter(fd_));
138 138
139 return true; 139 return true;
140 } 140 }
141 141
142 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) { 142 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) {
143 return new QuicDefaultPacketWriter(fd); 143 return new QuicDefaultPacketWriter(fd);
144 } 144 }
145 145
146 QuicDispatcher* QuicServer::CreateQuicDispatcher() { 146 QuicDispatcher* QuicServer::CreateQuicDispatcher() {
147 return new QuicDispatcher(config_, &crypto_config_, supported_versions_, 147 return new QuicDispatcher(
148 new QuicEpollConnectionHelper( 148 config_, &crypto_config_, supported_versions_,
149 &epoll_server_, QuicAllocator::BUFFER_POOL)); 149 std::unique_ptr<QuicEpollConnectionHelper>(new QuicEpollConnectionHelper(
150 &epoll_server_, QuicAllocator::BUFFER_POOL)));
150 } 151 }
151 152
152 void QuicServer::WaitForEvents() { 153 void QuicServer::WaitForEvents() {
153 epoll_server_.WaitForEventsAndExecuteCallbacks(); 154 epoll_server_.WaitForEventsAndExecuteCallbacks();
154 } 155 }
155 156
156 void QuicServer::Shutdown() { 157 void QuicServer::Shutdown() {
157 // Before we shut down the epoll server, give all active sessions a chance to 158 // Before we shut down the epoll server, give all active sessions a chance to
158 // notify clients that they're closing. 159 // notify clients that they're closing.
159 dispatcher_->Shutdown(); 160 dispatcher_->Shutdown();
(...skipping 19 matching lines...) Expand all
179 dispatcher_->OnCanWrite(); 180 dispatcher_->OnCanWrite();
180 if (dispatcher_->HasPendingWrites()) { 181 if (dispatcher_->HasPendingWrites()) {
181 event->out_ready_mask |= EPOLLOUT; 182 event->out_ready_mask |= EPOLLOUT;
182 } 183 }
183 } 184 }
184 if (event->in_events & EPOLLERR) { 185 if (event->in_events & EPOLLERR) {
185 } 186 }
186 } 187 }
187 188
188 } // namespace net 189 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher_test.cc ('k') | net/tools/quic/quic_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698