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

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

Issue 1357693003: Returning scoped_ptr<> instead of raw pointer in WebSocket::CreateWebSocket (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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_server.cc ('k') | net/server/web_socket.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_WEB_SOCKET_H_ 5 #ifndef NET_SERVER_WEB_SOCKET_H_
6 #define NET_SERVER_WEB_SOCKET_H_ 6 #define NET_SERVER_WEB_SOCKET_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 class HttpConnection; 16 class HttpConnection;
17 class HttpServer; 17 class HttpServer;
18 class HttpServerRequestInfo; 18 class HttpServerRequestInfo;
19 class WebSocketEncoder; 19 class WebSocketEncoder;
20 20
21 class WebSocket final { 21 class WebSocket final {
22 public: 22 public:
23 enum ParseResult { 23 enum ParseResult {
24 FRAME_OK, 24 FRAME_OK,
25 FRAME_INCOMPLETE, 25 FRAME_INCOMPLETE,
26 FRAME_CLOSE, 26 FRAME_CLOSE,
27 FRAME_ERROR 27 FRAME_ERROR
28 }; 28 };
29 29
30 static WebSocket* CreateWebSocket(HttpServer* server, 30 static scoped_ptr<WebSocket> CreateWebSocket(
31 HttpConnection* connection, 31 HttpServer* server,
32 const HttpServerRequestInfo& request); 32 HttpConnection* connection,
33 const HttpServerRequestInfo& request);
33 34
34 void Accept(const HttpServerRequestInfo& request); 35 void Accept(const HttpServerRequestInfo& request);
35 ParseResult Read(std::string* message); 36 ParseResult Read(std::string* message);
36 void Send(const std::string& message); 37 void Send(const std::string& message);
37 ~WebSocket(); 38 ~WebSocket();
38 39
39 private: 40 private:
40 WebSocket(HttpServer* server, 41 WebSocket(HttpServer* server,
41 HttpConnection* connection, 42 HttpConnection* connection,
42 const HttpServerRequestInfo& request); 43 const HttpServerRequestInfo& request);
43 44
44 HttpServer* const server_; 45 HttpServer* const server_;
45 HttpConnection* const connection_; 46 HttpConnection* const connection_;
46 scoped_ptr<WebSocketEncoder> encoder_; 47 scoped_ptr<WebSocketEncoder> encoder_;
47 std::string response_extensions_; 48 std::string response_extensions_;
48 bool closed_; 49 bool closed_;
49 50
50 DISALLOW_COPY_AND_ASSIGN(WebSocket); 51 DISALLOW_COPY_AND_ASSIGN(WebSocket);
51 }; 52 };
52 53
53 } // namespace net 54 } // namespace net
54 55
55 #endif // NET_SERVER_WEB_SOCKET_H_ 56 #endif // NET_SERVER_WEB_SOCKET_H_
OLDNEW
« no previous file with comments | « net/server/http_server.cc ('k') | net/server/web_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698