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

Side by Side Diff: net/server/http_connection.cc

Issue 20142003: Remove ref-counting from StreamListenSocket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/server/http_connection.h ('k') | net/server/http_server.h » ('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 #include "net/server/http_connection.h" 5 #include "net/server/http_connection.h"
6 6
7 #include "net/server/http_server.h" 7 #include "net/server/http_server.h"
8 #include "net/server/http_server_response_info.h" 8 #include "net/server/http_server_response_info.h"
9 #include "net/server/web_socket.h" 9 #include "net/server/web_socket.h"
10 #include "net/socket/stream_listen_socket.h" 10 #include "net/socket/stream_listen_socket.h"
(...skipping 11 matching lines...) Expand all
22 void HttpConnection::Send(const char* bytes, int len) { 22 void HttpConnection::Send(const char* bytes, int len) {
23 if (!socket_.get()) 23 if (!socket_.get())
24 return; 24 return;
25 socket_->Send(bytes, len); 25 socket_->Send(bytes, len);
26 } 26 }
27 27
28 void HttpConnection::Send(const HttpServerResponseInfo& response) { 28 void HttpConnection::Send(const HttpServerResponseInfo& response) {
29 Send(response.Serialize()); 29 Send(response.Serialize());
30 } 30 }
31 31
32 HttpConnection::HttpConnection(HttpServer* server, StreamListenSocket* sock) 32 HttpConnection::HttpConnection(HttpServer* server,
33 scoped_ptr<StreamListenSocket> sock)
33 : server_(server), 34 : server_(server),
34 socket_(sock) { 35 socket_(sock.Pass()) {
35 id_ = last_id_++; 36 id_ = last_id_++;
36 } 37 }
37 38
38 HttpConnection::~HttpConnection() { 39 HttpConnection::~HttpConnection() {
39 DetachSocket();
40 server_->delegate_->OnClose(id_); 40 server_->delegate_->OnClose(id_);
41 } 41 }
42 42
43 void HttpConnection::DetachSocket() {
44 socket_ = NULL;
45 }
46
47 void HttpConnection::Shift(int num_bytes) { 43 void HttpConnection::Shift(int num_bytes) {
48 recv_data_ = recv_data_.substr(num_bytes); 44 recv_data_ = recv_data_.substr(num_bytes);
49 } 45 }
50 46
51 } // namespace net 47 } // namespace net
OLDNEW
« no previous file with comments | « net/server/http_connection.h ('k') | net/server/http_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698