| 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_SERVER_H_ | 5 #ifndef NET_SERVER_HTTP_SERVER_H_ |
| 6 #define NET_SERVER_HTTP_SERVER_H_ | 6 #define NET_SERVER_HTTP_SERVER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 void SetReceiveBufferSize(int connection_id, int32_t size); | 76 void SetReceiveBufferSize(int connection_id, int32_t size); |
| 77 void SetSendBufferSize(int connection_id, int32_t size); | 77 void SetSendBufferSize(int connection_id, int32_t size); |
| 78 | 78 |
| 79 // Copies the local address to |address|. Returns a network error code. | 79 // Copies the local address to |address|. Returns a network error code. |
| 80 int GetLocalAddress(IPEndPoint* address); | 80 int GetLocalAddress(IPEndPoint* address); |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 friend class HttpServerTest; | 83 friend class HttpServerTest; |
| 84 | 84 |
| 85 typedef std::map<int, HttpConnection*> IdToConnectionMap; | |
| 86 | |
| 87 void DoAcceptLoop(); | 85 void DoAcceptLoop(); |
| 88 void OnAcceptCompleted(int rv); | 86 void OnAcceptCompleted(int rv); |
| 89 int HandleAcceptResult(int rv); | 87 int HandleAcceptResult(int rv); |
| 90 | 88 |
| 91 void DoReadLoop(HttpConnection* connection); | 89 void DoReadLoop(HttpConnection* connection); |
| 92 void OnReadCompleted(int connection_id, int rv); | 90 void OnReadCompleted(int connection_id, int rv); |
| 93 int HandleReadResult(HttpConnection* connection, int rv); | 91 int HandleReadResult(HttpConnection* connection, int rv); |
| 94 | 92 |
| 95 void DoWriteLoop(HttpConnection* connection); | 93 void DoWriteLoop(HttpConnection* connection); |
| 96 void OnWriteCompleted(int connection_id, int rv); | 94 void OnWriteCompleted(int connection_id, int rv); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 HttpConnection* FindConnection(int connection_id); | 105 HttpConnection* FindConnection(int connection_id); |
| 108 | 106 |
| 109 // Whether or not Close() has been called during delegate callback processing. | 107 // Whether or not Close() has been called during delegate callback processing. |
| 110 bool HasClosedConnection(HttpConnection* connection); | 108 bool HasClosedConnection(HttpConnection* connection); |
| 111 | 109 |
| 112 const std::unique_ptr<ServerSocket> server_socket_; | 110 const std::unique_ptr<ServerSocket> server_socket_; |
| 113 std::unique_ptr<StreamSocket> accepted_socket_; | 111 std::unique_ptr<StreamSocket> accepted_socket_; |
| 114 HttpServer::Delegate* const delegate_; | 112 HttpServer::Delegate* const delegate_; |
| 115 | 113 |
| 116 int last_id_; | 114 int last_id_; |
| 117 IdToConnectionMap id_to_connection_; | 115 std::map<int, std::unique_ptr<HttpConnection>> id_to_connection_; |
| 118 | 116 |
| 119 base::WeakPtrFactory<HttpServer> weak_ptr_factory_; | 117 base::WeakPtrFactory<HttpServer> weak_ptr_factory_; |
| 120 | 118 |
| 121 DISALLOW_COPY_AND_ASSIGN(HttpServer); | 119 DISALLOW_COPY_AND_ASSIGN(HttpServer); |
| 122 }; | 120 }; |
| 123 | 121 |
| 124 } // namespace net | 122 } // namespace net |
| 125 | 123 |
| 126 #endif // NET_SERVER_HTTP_SERVER_H_ | 124 #endif // NET_SERVER_HTTP_SERVER_H_ |
| OLD | NEW |