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 #ifndef NET_SERVER_HTTP_CONNECTION_H_ | 5 #ifndef NET_SERVER_HTTP_CONNECTION_H_ |
6 #define NET_SERVER_HTTP_CONNECTION_H_ | 6 #define NET_SERVER_HTTP_CONNECTION_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <queue> | 9 #include <queue> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 class StreamSocket; | 18 class StreamSocket; |
19 class WebSocket; | 19 class WebSocket; |
20 | 20 |
21 // A container which has all information of an http connection. It includes | 21 // A container which has all information of an http connection. It includes |
22 // id, underlying socket, and pending read/write data. | 22 // id, underlying socket, and pending read/write data. |
23 class HttpConnection { | 23 class HttpConnection { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 private: | 103 private: |
104 ~QueuedWriteIOBuffer() override; | 104 ~QueuedWriteIOBuffer() override; |
105 | 105 |
106 std::queue<std::string> pending_data_; | 106 std::queue<std::string> pending_data_; |
107 int total_size_; | 107 int total_size_; |
108 int max_buffer_size_; | 108 int max_buffer_size_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(QueuedWriteIOBuffer); | 110 DISALLOW_COPY_AND_ASSIGN(QueuedWriteIOBuffer); |
111 }; | 111 }; |
112 | 112 |
113 HttpConnection(int id, scoped_ptr<StreamSocket> socket); | 113 HttpConnection(int id, std::unique_ptr<StreamSocket> socket); |
114 ~HttpConnection(); | 114 ~HttpConnection(); |
115 | 115 |
116 int id() const { return id_; } | 116 int id() const { return id_; } |
117 StreamSocket* socket() const { return socket_.get(); } | 117 StreamSocket* socket() const { return socket_.get(); } |
118 ReadIOBuffer* read_buf() const { return read_buf_.get(); } | 118 ReadIOBuffer* read_buf() const { return read_buf_.get(); } |
119 QueuedWriteIOBuffer* write_buf() const { return write_buf_.get(); } | 119 QueuedWriteIOBuffer* write_buf() const { return write_buf_.get(); } |
120 | 120 |
121 WebSocket* web_socket() const { return web_socket_.get(); } | 121 WebSocket* web_socket() const { return web_socket_.get(); } |
122 void SetWebSocket(scoped_ptr<WebSocket> web_socket); | 122 void SetWebSocket(std::unique_ptr<WebSocket> web_socket); |
123 | 123 |
124 private: | 124 private: |
125 const int id_; | 125 const int id_; |
126 const scoped_ptr<StreamSocket> socket_; | 126 const std::unique_ptr<StreamSocket> socket_; |
127 const scoped_refptr<ReadIOBuffer> read_buf_; | 127 const scoped_refptr<ReadIOBuffer> read_buf_; |
128 const scoped_refptr<QueuedWriteIOBuffer> write_buf_; | 128 const scoped_refptr<QueuedWriteIOBuffer> write_buf_; |
129 | 129 |
130 scoped_ptr<WebSocket> web_socket_; | 130 std::unique_ptr<WebSocket> web_socket_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(HttpConnection); | 132 DISALLOW_COPY_AND_ASSIGN(HttpConnection); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace net | 135 } // namespace net |
136 | 136 |
137 #endif // NET_SERVER_HTTP_CONNECTION_H_ | 137 #endif // NET_SERVER_HTTP_CONNECTION_H_ |
OLD | NEW |