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

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

Issue 10066045: RefCounted types should not have public destructors, net/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deprecated cookiestore fix Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/sync_host_resolver_bridge.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 16 matching lines...) Expand all
27 virtual void OnHttpRequest(int connection_id, 27 virtual void OnHttpRequest(int connection_id,
28 const HttpServerRequestInfo& info) = 0; 28 const HttpServerRequestInfo& info) = 0;
29 29
30 virtual void OnWebSocketRequest(int connection_id, 30 virtual void OnWebSocketRequest(int connection_id,
31 const HttpServerRequestInfo& info) = 0; 31 const HttpServerRequestInfo& info) = 0;
32 32
33 virtual void OnWebSocketMessage(int connection_id, 33 virtual void OnWebSocketMessage(int connection_id,
34 const std::string& data) = 0; 34 const std::string& data) = 0;
35 35
36 virtual void OnClose(int connection_id) = 0; 36 virtual void OnClose(int connection_id) = 0;
37
37 protected: 38 protected:
38 virtual ~Delegate() {} 39 virtual ~Delegate() {}
39 }; 40 };
40 41
41 HttpServer(const std::string& host, int port, HttpServer::Delegate* del); 42 HttpServer(const std::string& host, int port, HttpServer::Delegate* del);
42 virtual ~HttpServer();
43 43
44 void AcceptWebSocket(int connection_id, 44 void AcceptWebSocket(int connection_id,
45 const HttpServerRequestInfo& request); 45 const HttpServerRequestInfo& request);
46 void SendOverWebSocket(int connection_id, const std::string& data); 46 void SendOverWebSocket(int connection_id, const std::string& data);
47 void Send(int connection_id, const std::string& data); 47 void Send(int connection_id, const std::string& data);
48 void Send(int connection_id, const char* bytes, int len); 48 void Send(int connection_id, const char* bytes, int len);
49 void Send200(int connection_id, 49 void Send200(int connection_id,
50 const std::string& data, 50 const std::string& data,
51 const std::string& mime_type); 51 const std::string& mime_type);
52 void Send404(int connection_id); 52 void Send404(int connection_id);
53 void Send500(int connection_id, const std::string& message); 53 void Send500(int connection_id, const std::string& message);
54 void Close(int connection_id); 54 void Close(int connection_id);
55 55
56 private:
57 friend class base::RefCountedThreadSafe<HttpServer>;
58 friend class HttpConnection;
59
60 // ListenSocketDelegate 56 // ListenSocketDelegate
61 virtual void DidAccept(ListenSocket* server, ListenSocket* socket) OVERRIDE; 57 virtual void DidAccept(ListenSocket* server, ListenSocket* socket) OVERRIDE;
62 virtual void DidRead(ListenSocket* socket, 58 virtual void DidRead(ListenSocket* socket,
63 const char* data, 59 const char* data,
64 int len) OVERRIDE; 60 int len) OVERRIDE;
65 virtual void DidClose(ListenSocket* socket) OVERRIDE; 61 virtual void DidClose(ListenSocket* socket) OVERRIDE;
66 62
63 protected:
64 virtual ~HttpServer();
65
66 private:
67 friend class base::RefCountedThreadSafe<HttpServer>;
68 friend class HttpConnection;
69
67 // Expects the raw data to be stored in recv_data_. If parsing is successful, 70 // Expects the raw data to be stored in recv_data_. If parsing is successful,
68 // will remove the data parsed from recv_data_, leaving only the unused 71 // will remove the data parsed from recv_data_, leaving only the unused
69 // recv data. 72 // recv data.
70 bool ParseHeaders(HttpConnection* connection, 73 bool ParseHeaders(HttpConnection* connection,
71 HttpServerRequestInfo* info, 74 HttpServerRequestInfo* info,
72 size_t* pos); 75 size_t* pos);
73 76
74 HttpConnection* FindConnection(int connection_id); 77 HttpConnection* FindConnection(int connection_id);
75 HttpConnection* FindConnection(ListenSocket* socket); 78 HttpConnection* FindConnection(ListenSocket* socket);
76 79
77 HttpServer::Delegate* delegate_; 80 HttpServer::Delegate* delegate_;
78 scoped_refptr<ListenSocket> server_; 81 scoped_refptr<ListenSocket> server_;
79 typedef std::map<int, HttpConnection*> IdToConnectionMap; 82 typedef std::map<int, HttpConnection*> IdToConnectionMap;
80 IdToConnectionMap id_to_connection_; 83 IdToConnectionMap id_to_connection_;
81 typedef std::map<ListenSocket*, HttpConnection*> SocketToConnectionMap; 84 typedef std::map<ListenSocket*, HttpConnection*> SocketToConnectionMap;
82 SocketToConnectionMap socket_to_connection_; 85 SocketToConnectionMap socket_to_connection_;
83 86
84 DISALLOW_COPY_AND_ASSIGN(HttpServer); 87 DISALLOW_COPY_AND_ASSIGN(HttpServer);
85 }; 88 };
86 89
87 } // namespace net 90 } // namespace net
88 91
89 #endif // NET_SERVER_HTTP_SERVER_H_ 92 #endif // NET_SERVER_HTTP_SERVER_H_
OLDNEW
« no previous file with comments | « net/proxy/sync_host_resolver_bridge.cc ('k') | net/server/http_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698