OLD | NEW |
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/test/embedded_test_server/http_connection.h" | 5 #include "net/test/embedded_test_server/http_connection.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/socket/stream_socket.h" | 10 #include "net/socket/stream_socket.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 namespace test_server { | 13 namespace test_server { |
14 | 14 |
15 HttpConnection::HttpConnection(scoped_ptr<StreamSocket> socket, | 15 HttpConnection::HttpConnection(std::unique_ptr<StreamSocket> socket, |
16 const HandleRequestCallback& callback) | 16 const HandleRequestCallback& callback) |
17 : socket_(std::move(socket)), | 17 : socket_(std::move(socket)), |
18 callback_(callback), | 18 callback_(callback), |
19 read_buf_(new IOBufferWithSize(4096)), | 19 read_buf_(new IOBufferWithSize(4096)), |
20 weak_factory_(this) {} | 20 weak_factory_(this) {} |
21 | 21 |
22 HttpConnection::~HttpConnection() { | 22 HttpConnection::~HttpConnection() { |
23 weak_factory_.InvalidateWeakPtrs(); | 23 weak_factory_.InvalidateWeakPtrs(); |
24 } | 24 } |
25 | 25 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 buf->DidConsume(rv); | 77 buf->DidConsume(rv); |
78 SendInternal(callback, buf); | 78 SendInternal(callback, buf); |
79 } | 79 } |
80 | 80 |
81 base::WeakPtr<HttpConnection> HttpConnection::GetWeakPtr() { | 81 base::WeakPtr<HttpConnection> HttpConnection::GetWeakPtr() { |
82 return weak_factory_.GetWeakPtr(); | 82 return weak_factory_.GetWeakPtr(); |
83 } | 83 } |
84 | 84 |
85 } // namespace test_server | 85 } // namespace test_server |
86 } // namespace net | 86 } // namespace net |
OLD | NEW |