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

Side by Side Diff: net/tools/quic/quic_simple_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_server_test.cc ('k') | net/tools/quic/quic_simple_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_simple_server.h" 5 #include "net/tools/quic/quic_simple_server.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 19 matching lines...) Expand all
30 // Allocate some extra space so we can send an error if the client goes over 30 // Allocate some extra space so we can send an error if the client goes over
31 // the limit. 31 // the limit.
32 const int kReadBufferSize = 2 * kMaxPacketSize; 32 const int kReadBufferSize = 2 * kMaxPacketSize;
33 33
34 class SimpleQuicDispatcher : public QuicDispatcher { 34 class SimpleQuicDispatcher : public QuicDispatcher {
35 public: 35 public:
36 SimpleQuicDispatcher(const QuicConfig& config, 36 SimpleQuicDispatcher(const QuicConfig& config,
37 const QuicCryptoServerConfig* crypto_config, 37 const QuicCryptoServerConfig* crypto_config,
38 const QuicVersionVector& supported_versions, 38 const QuicVersionVector& supported_versions,
39 QuicConnectionHelperInterface* helper) 39 QuicConnectionHelperInterface* helper)
40 : QuicDispatcher(config, crypto_config, supported_versions, helper) {} 40 : QuicDispatcher(config, crypto_config, supported_versions,
41 std::unique_ptr<QuicConnectionHelperInterface>(helper)) { }
41 42
42 protected: 43 protected:
43 QuicServerSessionBase* CreateQuicSession( 44 QuicServerSessionBase* CreateQuicSession(
44 QuicConnectionId connection_id, 45 QuicConnectionId connection_id,
45 const IPEndPoint& client_address) override { 46 const IPEndPoint& client_address) override {
46 QuicServerSessionBase* session = 47 QuicServerSessionBase* session =
47 QuicDispatcher::CreateQuicSession(connection_id, client_address); 48 QuicDispatcher::CreateQuicSession(connection_id, client_address);
48 static_cast<QuicSimplePerConnectionPacketWriter*>( 49 static_cast<QuicSimplePerConnectionPacketWriter*>(
49 session->connection()->writer()) 50 session->connection()->writer())
50 ->set_connection(session->connection()); 51 ->set_connection(session->connection());
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 204 }
204 205
205 QuicReceivedPacket packet(read_buffer_->data(), result, 206 QuicReceivedPacket packet(read_buffer_->data(), result,
206 helper_->GetClock()->Now(), false); 207 helper_->GetClock()->Now(), false);
207 dispatcher_->ProcessPacket(server_address_, client_address_, packet); 208 dispatcher_->ProcessPacket(server_address_, client_address_, packet);
208 209
209 StartReading(); 210 StartReading();
210 } 211 }
211 212
212 } // namespace net 213 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_test.cc ('k') | net/tools/quic/quic_simple_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698