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