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

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

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 | « no previous file | net/server/web_socket.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_server.h" 5 #include "net/server/http_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 size_t pos = 0; 229 size_t pos = 0;
230 if (!ParseHeaders(read_buf->StartOfBuffer(), read_buf->GetSize(), 230 if (!ParseHeaders(read_buf->StartOfBuffer(), read_buf->GetSize(),
231 &request, &pos)) { 231 &request, &pos)) {
232 break; 232 break;
233 } 233 }
234 234
235 // Sets peer address if exists. 235 // Sets peer address if exists.
236 connection->socket()->GetPeerAddress(&request.peer); 236 connection->socket()->GetPeerAddress(&request.peer);
237 237
238 if (request.HasHeaderValue("connection", "upgrade")) { 238 if (request.HasHeaderValue("connection", "upgrade")) {
239 scoped_ptr<WebSocket> websocket( 239 scoped_ptr<WebSocket> websocket =
240 WebSocket::CreateWebSocket(this, connection, request)); 240 WebSocket::CreateWebSocket(this, connection, request);
241 if (!websocket) // Not enough data was received. 241 if (!websocket) // Not enough data was received.
242 break; 242 break;
243 connection->SetWebSocket(websocket.Pass()); 243 connection->SetWebSocket(websocket.Pass());
244 read_buf->DidConsume(pos); 244 read_buf->DidConsume(pos);
245 delegate_->OnWebSocketRequest(connection->id(), request); 245 delegate_->OnWebSocketRequest(connection->id(), request);
246 if (HasClosedConnection(connection)) 246 if (HasClosedConnection(connection))
247 return ERR_CONNECTION_CLOSED; 247 return ERR_CONNECTION_CLOSED;
248 continue; 248 continue;
249 } 249 }
250 250
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 463
464 // This is called after any delegate callbacks are called to check if Close() 464 // This is called after any delegate callbacks are called to check if Close()
465 // has been called during callback processing. Using the pointer of connection, 465 // has been called during callback processing. Using the pointer of connection,
466 // |connection| is safe here because Close() deletes the connection in next run 466 // |connection| is safe here because Close() deletes the connection in next run
467 // loop. 467 // loop.
468 bool HttpServer::HasClosedConnection(HttpConnection* connection) { 468 bool HttpServer::HasClosedConnection(HttpConnection* connection) {
469 return FindConnection(connection->id()) != connection; 469 return FindConnection(connection->id()) != connection;
470 } 470 }
471 471
472 } // namespace net 472 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/server/web_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698