Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: net/server/http_server.h

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/server/http_connection.cc ('k') | net/server/http_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include <map> 11 #include <map>
12 #include <memory>
12 #include <string> 13 #include <string>
13 14
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "net/http/http_status_code.h" 17 #include "net/http/http_status_code.h"
18 18
19 namespace net { 19 namespace net {
20 20
21 class HttpConnection; 21 class HttpConnection;
22 class HttpServerRequestInfo; 22 class HttpServerRequestInfo;
23 class HttpServerResponseInfo; 23 class HttpServerResponseInfo;
24 class IPEndPoint; 24 class IPEndPoint;
25 class ServerSocket; 25 class ServerSocket;
(...skipping 15 matching lines...) Expand all
41 const HttpServerRequestInfo& info) = 0; 41 const HttpServerRequestInfo& info) = 0;
42 virtual void OnWebSocketMessage(int connection_id, 42 virtual void OnWebSocketMessage(int connection_id,
43 const std::string& data) = 0; 43 const std::string& data) = 0;
44 virtual void OnClose(int connection_id) = 0; 44 virtual void OnClose(int connection_id) = 0;
45 }; 45 };
46 46
47 // Instantiates a http server with |server_socket| which already started 47 // Instantiates a http server with |server_socket| which already started
48 // listening, but not accepting. This constructor schedules accepting 48 // listening, but not accepting. This constructor schedules accepting
49 // connections asynchronously in case when |delegate| is not ready to get 49 // connections asynchronously in case when |delegate| is not ready to get
50 // callbacks yet. 50 // callbacks yet.
51 HttpServer(scoped_ptr<ServerSocket> server_socket, 51 HttpServer(std::unique_ptr<ServerSocket> server_socket,
52 HttpServer::Delegate* delegate); 52 HttpServer::Delegate* delegate);
53 ~HttpServer(); 53 ~HttpServer();
54 54
55 void AcceptWebSocket(int connection_id, 55 void AcceptWebSocket(int connection_id,
56 const HttpServerRequestInfo& request); 56 const HttpServerRequestInfo& request);
57 void SendOverWebSocket(int connection_id, const std::string& data); 57 void SendOverWebSocket(int connection_id, const std::string& data);
58 // Sends the provided data directly to the given connection. No validation is 58 // Sends the provided data directly to the given connection. No validation is
59 // performed that data constitutes a valid HTTP response. A valid HTTP 59 // performed that data constitutes a valid HTTP response. A valid HTTP
60 // response may be split across multiple calls to SendRaw. 60 // response may be split across multiple calls to SendRaw.
61 void SendRaw(int connection_id, const std::string& data); 61 void SendRaw(int connection_id, const std::string& data);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 bool ParseHeaders(const char* data, 102 bool ParseHeaders(const char* data,
103 size_t data_len, 103 size_t data_len,
104 HttpServerRequestInfo* info, 104 HttpServerRequestInfo* info,
105 size_t* pos); 105 size_t* pos);
106 106
107 HttpConnection* FindConnection(int connection_id); 107 HttpConnection* FindConnection(int connection_id);
108 108
109 // Whether or not Close() has been called during delegate callback processing. 109 // Whether or not Close() has been called during delegate callback processing.
110 bool HasClosedConnection(HttpConnection* connection); 110 bool HasClosedConnection(HttpConnection* connection);
111 111
112 const scoped_ptr<ServerSocket> server_socket_; 112 const std::unique_ptr<ServerSocket> server_socket_;
113 scoped_ptr<StreamSocket> accepted_socket_; 113 std::unique_ptr<StreamSocket> accepted_socket_;
114 HttpServer::Delegate* const delegate_; 114 HttpServer::Delegate* const delegate_;
115 115
116 int last_id_; 116 int last_id_;
117 IdToConnectionMap id_to_connection_; 117 IdToConnectionMap id_to_connection_;
118 118
119 base::WeakPtrFactory<HttpServer> weak_ptr_factory_; 119 base::WeakPtrFactory<HttpServer> weak_ptr_factory_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(HttpServer); 121 DISALLOW_COPY_AND_ASSIGN(HttpServer);
122 }; 122 };
123 123
124 } // namespace net 124 } // namespace net
125 125
126 #endif // NET_SERVER_HTTP_SERVER_H_ 126 #endif // NET_SERVER_HTTP_SERVER_H_
OLDNEW
« no previous file with comments | « net/server/http_connection.cc ('k') | net/server/http_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698