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

Side by Side Diff: net/spdy/spdy_proxy_client_socket.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_session.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 #include "net/spdy/spdy_proxy_client_socket.h" 5 #include "net/spdy/spdy_proxy_client_socket.h"
6 6
7 #include <algorithm> // min 7 #include <algorithm> // min
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
11 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
12 #include "base/location.h" 13 #include "base/location.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
17 #include "base/values.h" 18 #include "base/values.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 net_log_.AddEvent( 367 net_log_.AddEvent(
367 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 368 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
368 base::Bind(&HttpRequestHeaders::NetLogCallback, 369 base::Bind(&HttpRequestHeaders::NetLogCallback,
369 base::Unretained(&request_.extra_headers), &request_line)); 370 base::Unretained(&request_.extra_headers), &request_line));
370 371
371 scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock()); 372 scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock());
372 CreateSpdyHeadersFromHttpRequest(request_, request_.extra_headers, 373 CreateSpdyHeadersFromHttpRequest(request_, request_.extra_headers,
373 spdy_stream_->GetProtocolVersion(), true, 374 spdy_stream_->GetProtocolVersion(), true,
374 headers.get()); 375 headers.get());
375 376
376 return spdy_stream_->SendRequestHeaders(headers.Pass(), MORE_DATA_TO_SEND); 377 return spdy_stream_->SendRequestHeaders(std::move(headers),
378 MORE_DATA_TO_SEND);
377 } 379 }
378 380
379 int SpdyProxyClientSocket::DoSendRequestComplete(int result) { 381 int SpdyProxyClientSocket::DoSendRequestComplete(int result) {
380 if (result < 0) 382 if (result < 0)
381 return result; 383 return result;
382 384
383 // Wait for SYN_REPLY frame from the server 385 // Wait for SYN_REPLY frame from the server
384 next_state_ = STATE_READ_REPLY_COMPLETE; 386 next_state_ = STATE_READ_REPLY_COMPLETE;
385 return ERR_IO_PENDING; 387 return ERR_IO_PENDING;
386 } 388 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 OnIOComplete(OK); 463 OnIOComplete(OK);
462 return RESPONSE_HEADERS_ARE_COMPLETE; 464 return RESPONSE_HEADERS_ARE_COMPLETE;
463 } 465 }
464 466
465 // Called when data is received or on EOF (if |buffer| is NULL). 467 // Called when data is received or on EOF (if |buffer| is NULL).
466 void SpdyProxyClientSocket::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { 468 void SpdyProxyClientSocket::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) {
467 if (buffer) { 469 if (buffer) {
468 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, 470 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
469 buffer->GetRemainingSize(), 471 buffer->GetRemainingSize(),
470 buffer->GetRemainingData()); 472 buffer->GetRemainingData());
471 read_buffer_queue_.Enqueue(buffer.Pass()); 473 read_buffer_queue_.Enqueue(std::move(buffer));
472 } else { 474 } else {
473 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, 0, NULL); 475 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, 0, NULL);
474 } 476 }
475 477
476 if (!read_callback_.is_null()) { 478 if (!read_callback_.is_null()) {
477 int rv = PopulateUserReadBuffer(user_buffer_->data(), user_buffer_len_); 479 int rv = PopulateUserReadBuffer(user_buffer_->data(), user_buffer_len_);
478 CompletionCallback c = read_callback_; 480 CompletionCallback c = read_callback_;
479 read_callback_.Reset(); 481 read_callback_.Reset();
480 user_buffer_ = NULL; 482 user_buffer_ = NULL;
481 user_buffer_len_ = 0; 483 user_buffer_len_ = 0;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } else if (!read_callback_.is_null()) { 531 } else if (!read_callback_.is_null()) {
530 // If we have a read_callback_, the we need to make sure we call it back. 532 // If we have a read_callback_, the we need to make sure we call it back.
531 OnDataReceived(scoped_ptr<SpdyBuffer>()); 533 OnDataReceived(scoped_ptr<SpdyBuffer>());
532 } 534 }
533 // This may have been deleted by read_callback_, so check first. 535 // This may have been deleted by read_callback_, so check first.
534 if (weak_ptr.get() && !write_callback.is_null()) 536 if (weak_ptr.get() && !write_callback.is_null())
535 write_callback.Run(ERR_CONNECTION_CLOSED); 537 write_callback.Run(ERR_CONNECTION_CLOSED);
536 } 538 }
537 539
538 } // namespace net 540 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698