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/server/http_connection.h" | 5 #include "net/server/http_connection.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "net/server/web_socket.h" | 10 #include "net/server/web_socket.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 if (IsEmpty()) { | 143 if (IsEmpty()) { |
144 DCHECK_EQ(0, total_size_); | 144 DCHECK_EQ(0, total_size_); |
145 return 0; | 145 return 0; |
146 } | 146 } |
147 DCHECK_GE(data_, pending_data_.front().data()); | 147 DCHECK_GE(data_, pending_data_.front().data()); |
148 int consumed = static_cast<int>(data_ - pending_data_.front().data()); | 148 int consumed = static_cast<int>(data_ - pending_data_.front().data()); |
149 DCHECK_GT(static_cast<int>(pending_data_.front().size()), consumed); | 149 DCHECK_GT(static_cast<int>(pending_data_.front().size()), consumed); |
150 return pending_data_.front().size() - consumed; | 150 return pending_data_.front().size() - consumed; |
151 } | 151 } |
152 | 152 |
153 HttpConnection::HttpConnection(int id, scoped_ptr<StreamSocket> socket) | 153 HttpConnection::HttpConnection(int id, std::unique_ptr<StreamSocket> socket) |
154 : id_(id), | 154 : id_(id), |
155 socket_(std::move(socket)), | 155 socket_(std::move(socket)), |
156 read_buf_(new ReadIOBuffer()), | 156 read_buf_(new ReadIOBuffer()), |
157 write_buf_(new QueuedWriteIOBuffer()) {} | 157 write_buf_(new QueuedWriteIOBuffer()) {} |
158 | 158 |
159 HttpConnection::~HttpConnection() { | 159 HttpConnection::~HttpConnection() { |
160 } | 160 } |
161 | 161 |
162 void HttpConnection::SetWebSocket(scoped_ptr<WebSocket> web_socket) { | 162 void HttpConnection::SetWebSocket(std::unique_ptr<WebSocket> web_socket) { |
163 DCHECK(!web_socket_); | 163 DCHECK(!web_socket_); |
164 web_socket_ = std::move(web_socket); | 164 web_socket_ = std::move(web_socket); |
165 } | 165 } |
166 | 166 |
167 } // namespace net | 167 } // namespace net |
OLD | NEW |