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

Side by Side Diff: net/websockets/websocket_job.cc

Issue 4291001: Convert implicit scoped_refptr constructor calls to explicit ones, part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/build
Patch Set: comments Created 10 years, 1 month 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/websockets/websocket.cc ('k') | remoting/base/multiple_array_input_stream.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/websockets/websocket_job.h" 5 #include "net/websockets/websocket_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/string_tokenizer.h" 9 #include "base/string_tokenizer.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 GetURLForCookies(), cookie_options); 306 GetURLForCookies(), cookie_options);
307 if (!cookie.empty()) 307 if (!cookie.empty())
308 handshake_request_->AppendHeaderIfMissing("Cookie", cookie); 308 handshake_request_->AppendHeaderIfMissing("Cookie", cookie);
309 } 309 }
310 } 310 }
311 311
312 const std::string& handshake_request = handshake_request_->GetRawRequest(); 312 const std::string& handshake_request = handshake_request_->GetRawRequest();
313 handshake_request_sent_ = 0; 313 handshake_request_sent_ = 0;
314 socket_->net_log()->AddEvent( 314 socket_->net_log()->AddEvent(
315 NetLog::TYPE_WEB_SOCKET_SEND_REQUEST_HEADERS, 315 NetLog::TYPE_WEB_SOCKET_SEND_REQUEST_HEADERS,
316 new NetLogWebSocketHandshakeParameter(handshake_request)); 316 make_scoped_refptr(
317 new NetLogWebSocketHandshakeParameter(handshake_request)));
317 socket_->SendData(handshake_request.data(), 318 socket_->SendData(handshake_request.data(),
318 handshake_request.size()); 319 handshake_request.size());
319 } 320 }
320 Release(); // Balance AddRef taken in AddCookieHeaderAndSend 321 Release(); // Balance AddRef taken in AddCookieHeaderAndSend
321 } 322 }
322 323
323 void WebSocketJob::OnSentHandshakeRequest( 324 void WebSocketJob::OnSentHandshakeRequest(
324 SocketStream* socket, int amount_sent) { 325 SocketStream* socket, int amount_sent) {
325 DCHECK_EQ(state_, CONNECTING); 326 DCHECK_EQ(state_, CONNECTING);
326 handshake_request_sent_ += amount_sent; 327 handshake_request_sent_ += amount_sent;
(...skipping 20 matching lines...) Expand all
347 } 348 }
348 349
349 size_t response_length = handshake_response_->ParseRawResponse(data, len); 350 size_t response_length = handshake_response_->ParseRawResponse(data, len);
350 if (!handshake_response_->HasResponse()) { 351 if (!handshake_response_->HasResponse()) {
351 // not yet. we need more data. 352 // not yet. we need more data.
352 return; 353 return;
353 } 354 }
354 // handshake message is completed. 355 // handshake message is completed.
355 socket_->net_log()->AddEvent( 356 socket_->net_log()->AddEvent(
356 NetLog::TYPE_WEB_SOCKET_READ_RESPONSE_HEADERS, 357 NetLog::TYPE_WEB_SOCKET_READ_RESPONSE_HEADERS,
357 new NetLogWebSocketHandshakeParameter( 358 make_scoped_refptr(new NetLogWebSocketHandshakeParameter(
358 handshake_response_->GetRawResponse())); 359 handshake_response_->GetRawResponse())));
359 if (len - response_length > 0) { 360 if (len - response_length > 0) {
360 // If we received extra data, it should be frame data. 361 // If we received extra data, it should be frame data.
361 receive_frame_handler_->AppendData(data + response_length, 362 receive_frame_handler_->AppendData(data + response_length,
362 len - response_length); 363 len - response_length);
363 } 364 }
364 SaveCookiesAndNotifyHeaderComplete(); 365 SaveCookiesAndNotifyHeaderComplete();
365 } 366 }
366 367
367 void WebSocketJob::SaveCookiesAndNotifyHeaderComplete() { 368 void WebSocketJob::SaveCookiesAndNotifyHeaderComplete() {
368 // handshake message is completed. 369 // handshake message is completed.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 socket_->Close(); 499 socket_->Close();
499 return; 500 return;
500 } 501 }
501 current_buffer_ = new DrainableIOBuffer( 502 current_buffer_ = new DrainableIOBuffer(
502 send_frame_handler_->GetCurrentBuffer(), 503 send_frame_handler_->GetCurrentBuffer(),
503 send_frame_handler_->GetCurrentBufferSize()); 504 send_frame_handler_->GetCurrentBufferSize());
504 socket_->SendData(current_buffer_->data(), current_buffer_->BytesRemaining()); 505 socket_->SendData(current_buffer_->data(), current_buffer_->BytesRemaining());
505 } 506 }
506 507
507 } // namespace net 508 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket.cc ('k') | remoting/base/multiple_array_input_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698