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

Unified Diff: net/spdy/spdy_session.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.cc ('k') | net/spdy/spdy_session_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 4a13b641ca4f6a7c08a40e7db7812de7e880f1d2..a2fec98d21edd9a6411975b372c9a9aad7e7fb9c 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <limits>
#include <map>
+#include <utility>
#include "base/bind.h"
#include "base/compiler_specific.h"
@@ -78,7 +79,7 @@ scoped_ptr<base::ListValue> SpdyHeaderBlockToListValue(
ElideHeaderValueForNetLog(capture_mode, it->first.as_string(),
it->second.as_string()));
}
- return headers_list.Pass();
+ return headers_list;
}
scoped_ptr<base::Value> NetLogSpdySynStreamSentCallback(
@@ -94,7 +95,7 @@ scoped_ptr<base::Value> NetLogSpdySynStreamSentCallback(
dict->SetBoolean("unidirectional", unidirectional);
dict->SetInteger("priority", static_cast<int>(spdy_priority));
dict->SetInteger("stream_id", stream_id);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdySynStreamReceivedCallback(
@@ -112,7 +113,7 @@ scoped_ptr<base::Value> NetLogSpdySynStreamReceivedCallback(
dict->SetInteger("priority", static_cast<int>(spdy_priority));
dict->SetInteger("stream_id", stream_id);
dict->SetInteger("associated_stream", associated_stream);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdySynReplyOrHeadersReceivedCallback(
@@ -124,7 +125,7 @@ scoped_ptr<base::Value> NetLogSpdySynReplyOrHeadersReceivedCallback(
dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode));
dict->SetBoolean("fin", fin);
dict->SetInteger("stream_id", stream_id);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdySessionCloseCallback(
@@ -134,7 +135,7 @@ scoped_ptr<base::Value> NetLogSpdySessionCloseCallback(
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetInteger("net_error", net_error);
dict->SetString("description", *description);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdySessionCallback(
@@ -143,7 +144,7 @@ scoped_ptr<base::Value> NetLogSpdySessionCallback(
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("host", host_pair->first.ToString());
dict->SetString("proxy", host_pair->second.ToPacString());
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdyInitializedCallback(
@@ -156,7 +157,7 @@ scoped_ptr<base::Value> NetLogSpdyInitializedCallback(
}
dict->SetString("protocol",
SSLClientSocket::NextProtoToString(protocol_version));
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdySettingsCallback(
@@ -166,7 +167,7 @@ scoped_ptr<base::Value> NetLogSpdySettingsCallback(
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("host", host_port_pair.ToString());
dict->SetBoolean("clear_persisted", clear_persisted);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdySettingCallback(
@@ -180,7 +181,7 @@ scoped_ptr<base::Value> NetLogSpdySettingCallback(
SpdyConstants::SerializeSettingId(protocol_version, id));
dict->SetInteger("flags", flags);
dict->SetInteger("value", value);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdySendSettingsCallback(
@@ -200,8 +201,8 @@ scoped_ptr<base::Value> NetLogSpdySendSettingsCallback(
flags,
value)));
}
- dict->Set("settings", settings_list.Pass());
- return dict.Pass();
+ dict->Set("settings", std::move(settings_list));
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdyWindowUpdateFrameCallback(
@@ -211,7 +212,7 @@ scoped_ptr<base::Value> NetLogSpdyWindowUpdateFrameCallback(
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetInteger("stream_id", static_cast<int>(stream_id));
dict->SetInteger("delta", delta);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdySessionWindowUpdateCallback(
@@ -221,7 +222,7 @@ scoped_ptr<base::Value> NetLogSpdySessionWindowUpdateCallback(
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetInteger("delta", delta);
dict->SetInteger("window_size", window_size);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdyDataCallback(
@@ -233,7 +234,7 @@ scoped_ptr<base::Value> NetLogSpdyDataCallback(
dict->SetInteger("stream_id", static_cast<int>(stream_id));
dict->SetInteger("size", size);
dict->SetBoolean("fin", fin);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdyRstCallback(
@@ -245,7 +246,7 @@ scoped_ptr<base::Value> NetLogSpdyRstCallback(
dict->SetInteger("stream_id", static_cast<int>(stream_id));
dict->SetInteger("status", status);
dict->SetString("description", *description);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdyPingCallback(
@@ -257,7 +258,7 @@ scoped_ptr<base::Value> NetLogSpdyPingCallback(
dict->SetInteger("unique_id", static_cast<int>(unique_id));
dict->SetString("type", type);
dict->SetBoolean("is_ack", is_ack);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdyGoAwayCallback(
@@ -275,7 +276,7 @@ scoped_ptr<base::Value> NetLogSpdyGoAwayCallback(
dict->SetInteger("status", static_cast<int>(status));
dict->SetString("debug_data",
ElideGoAwayDebugDataForNetLog(capture_mode, debug_data));
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdyPushPromiseReceivedCallback(
@@ -287,7 +288,7 @@ scoped_ptr<base::Value> NetLogSpdyPushPromiseReceivedCallback(
dict->Set("headers", SpdyHeaderBlockToListValue(*headers, capture_mode));
dict->SetInteger("id", stream_id);
dict->SetInteger("promised_stream_id", promised_stream_id);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> NetLogSpdyAdoptedPushStreamCallback(
@@ -297,7 +298,7 @@ scoped_ptr<base::Value> NetLogSpdyAdoptedPushStreamCallback(
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetInteger("stream_id", stream_id);
dict->SetString("url", url->spec());
- return dict.Pass();
+ return std::move(dict);
}
// Helper function to return the total size of an array of objects
@@ -746,7 +747,7 @@ void SpdySession::InitializeWithSocket(
// requires re-working CreateFakeSpdySession(), though.
DCHECK(connection->socket());
- connection_ = connection.Pass();
+ connection_ = std::move(connection);
is_secure_ = is_secure;
certificate_error_code_ = certificate_error_code;
@@ -921,7 +922,7 @@ int SpdySession::CreateStream(const SpdyStreamRequest& request,
request.priority(), stream_initial_send_window_size_,
stream_max_recv_window_size_, request.net_log()));
*stream = new_stream->GetWeakPtr();
- InsertCreatedStream(new_stream.Pass());
+ InsertCreatedStream(std::move(new_stream));
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Net.SpdyPriorityCount",
@@ -1068,7 +1069,7 @@ void SpdySession::EnqueueStreamWrite(
DCHECK(frame_type == HEADERS ||
frame_type == DATA ||
frame_type == SYN_STREAM);
- EnqueueWrite(stream->priority(), frame_type, producer.Pass(), stream);
+ EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream);
}
scoped_ptr<SpdyFrame> SpdySession::CreateSynStream(
@@ -1154,7 +1155,7 @@ scoped_ptr<SpdyFrame> SpdySession::CreateSynStream(
spdy_priority, stream_id));
}
- return syn_frame.Pass();
+ return syn_frame;
}
scoped_ptr<SpdyBuffer> SpdySession::CreateDataBuffer(SpdyStreamId stream_id,
@@ -1267,7 +1268,7 @@ scoped_ptr<SpdyBuffer> SpdySession::CreateDataBuffer(SpdyStreamId stream_id,
scoped_ptr<SpdyFrame> frame(buffered_spdy_framer_->CreateDataFrame(
stream_id, data->data(), static_cast<uint32_t>(effective_len), flags));
- scoped_ptr<SpdyBuffer> data_buffer(new SpdyBuffer(frame.Pass()));
+ scoped_ptr<SpdyBuffer> data_buffer(new SpdyBuffer(std::move(frame)));
// Send window size is based on payload size, so nothing to do if this is
// just a FIN with no payload.
@@ -1280,7 +1281,7 @@ scoped_ptr<SpdyBuffer> SpdySession::CreateDataBuffer(SpdyStreamId stream_id,
static_cast<size_t>(effective_len)));
}
- return data_buffer.Pass();
+ return data_buffer;
}
void SpdySession::CloseActiveStream(SpdyStreamId stream_id, int status) {
@@ -1356,7 +1357,7 @@ void SpdySession::CloseActiveStreamIterator(ActiveStreamMap::iterator it,
num_active_pushed_streams_--;
}
- DeleteStream(owned_stream.Pass(), status);
+ DeleteStream(std::move(owned_stream), status);
// If there are no active streams and the socket pool is stalled, close the
// session to free up a socket slot.
@@ -1370,7 +1371,7 @@ void SpdySession::CloseCreatedStreamIterator(CreatedStreamSet::iterator it,
int status) {
scoped_ptr<SpdyStream> owned_stream(*it);
created_streams_.erase(it);
- DeleteStream(owned_stream.Pass(), status);
+ DeleteStream(std::move(owned_stream), status);
}
void SpdySession::ResetStreamIterator(ActiveStreamMap::iterator it,
@@ -1401,7 +1402,7 @@ void SpdySession::EnqueueResetStreamFrame(SpdyStreamId stream_id,
scoped_ptr<SpdyFrame> rst_frame(
buffered_spdy_framer_->CreateRstStream(stream_id, status));
- EnqueueSessionWrite(priority, RST_STREAM, rst_frame.Pass());
+ EnqueueSessionWrite(priority, RST_STREAM, std::move(rst_frame));
RecordProtocolErrorHistogram(MapRstStreamStatusToProtocolError(status));
}
@@ -1603,7 +1604,7 @@ int SpdySession::DoWrite() {
CHECK_EQ(stream->stream_id(), 0u);
scoped_ptr<SpdyStream> owned_stream =
ActivateCreatedStream(stream.get());
- InsertActivatedStream(owned_stream.Pass());
+ InsertActivatedStream(std::move(owned_stream));
if (stream_hi_water_mark_ > kLastStreamId) {
CHECK_EQ(stream->stream_id(), kLastStreamId);
@@ -1875,7 +1876,7 @@ scoped_ptr<base::Value> SpdySession::GetInfoAsValue() const {
for (const auto& alias : pooled_aliases_) {
alias_list->AppendString(alias.host_port_pair().ToString());
}
- dict->Set("aliases", alias_list.Pass());
+ dict->Set("aliases", std::move(alias_list));
}
dict->SetString("proxy", host_port_proxy_pair().second.ToURI());
@@ -1908,7 +1909,7 @@ scoped_ptr<base::Value> SpdySession::GetInfoAsValue() const {
dict->SetInteger("recv_window_size", session_recv_window_size_);
dict->SetInteger("unacked_recv_window_bytes",
session_unacked_recv_window_bytes_);
- return dict.Pass();
+ return std::move(dict);
}
bool SpdySession::IsReused() const {
@@ -1952,12 +1953,10 @@ void SpdySession::EnqueueSessionWrite(RequestPriority priority,
DCHECK(frame_type == RST_STREAM || frame_type == SETTINGS ||
frame_type == WINDOW_UPDATE || frame_type == PING ||
frame_type == GOAWAY);
- EnqueueWrite(
- priority, frame_type,
- scoped_ptr<SpdyBufferProducer>(
- new SimpleBufferProducer(
- scoped_ptr<SpdyBuffer>(new SpdyBuffer(frame.Pass())))),
- base::WeakPtr<SpdyStream>());
+ EnqueueWrite(priority, frame_type,
+ scoped_ptr<SpdyBufferProducer>(new SimpleBufferProducer(
+ scoped_ptr<SpdyBuffer>(new SpdyBuffer(std::move(frame))))),
+ base::WeakPtr<SpdyStream>());
}
void SpdySession::EnqueueWrite(RequestPriority priority,
@@ -1967,7 +1966,7 @@ void SpdySession::EnqueueWrite(RequestPriority priority,
if (availability_state_ == STATE_DRAINING)
return;
- write_queue_.Enqueue(priority, frame_type, producer.Pass(), stream);
+ write_queue_.Enqueue(priority, frame_type, std::move(producer), stream);
MaybePostWriteLoop();
}
@@ -1994,7 +1993,7 @@ scoped_ptr<SpdyStream> SpdySession::ActivateCreatedStream(SpdyStream* stream) {
stream->set_stream_id(GetNewStreamId());
scoped_ptr<SpdyStream> owned_stream(stream);
created_streams_.erase(stream);
- return owned_stream.Pass();
+ return owned_stream;
}
void SpdySession::InsertActivatedStream(scoped_ptr<SpdyStream> stream) {
@@ -2151,7 +2150,7 @@ void SpdySession::OnStreamFrameData(SpdyStreamId stream_id,
return;
}
- stream->OnDataReceived(buffer.Pass());
+ stream->OnDataReceived(std::move(buffer));
}
void SpdySession::OnStreamPadding(SpdyStreamId stream_id, size_t len) {
@@ -2782,7 +2781,7 @@ bool SpdySession::TryCreatePushStream(SpdyStreamId stream_id,
DCHECK(inserted_pushed_it != pushed_it);
DeleteExpiredPushedStreams();
- InsertActivatedStream(stream.Pass());
+ InsertActivatedStream(std::move(stream));
ActiveStreamMap::iterator active_it = active_streams_.find(stream_id);
if (active_it == active_streams_.end()) {
@@ -2834,7 +2833,7 @@ void SpdySession::SendInitialData() {
false /* take_ownership */));
// Count the prefix as part of the subsequent SETTINGS frame.
EnqueueSessionWrite(HIGHEST, SETTINGS,
- connection_header_prefix_frame.Pass());
+ std::move(connection_header_prefix_frame));
}
// First, notify the server about the settings they should use when
@@ -2902,7 +2901,7 @@ void SpdySession::SendSettings(const SettingsMap& settings) {
scoped_ptr<SpdyFrame> settings_frame(
buffered_spdy_framer_->CreateSettings(settings));
sent_settings_ = true;
- EnqueueSessionWrite(HIGHEST, SETTINGS, settings_frame.Pass());
+ EnqueueSessionWrite(HIGHEST, SETTINGS, std::move(settings_frame));
}
void SpdySession::HandleSetting(uint32_t id, uint32_t value) {
@@ -2985,14 +2984,14 @@ void SpdySession::SendWindowUpdateFrame(SpdyStreamId stream_id,
DCHECK(buffered_spdy_framer_.get());
scoped_ptr<SpdyFrame> window_update_frame(
buffered_spdy_framer_->CreateWindowUpdate(stream_id, delta_window_size));
- EnqueueSessionWrite(priority, WINDOW_UPDATE, window_update_frame.Pass());
+ EnqueueSessionWrite(priority, WINDOW_UPDATE, std::move(window_update_frame));
}
void SpdySession::WritePingFrame(SpdyPingId unique_id, bool is_ack) {
DCHECK(buffered_spdy_framer_.get());
scoped_ptr<SpdyFrame> ping_frame(
buffered_spdy_framer_->CreatePingFrame(unique_id, is_ack));
- EnqueueSessionWrite(HIGHEST, PING, ping_frame.Pass());
+ EnqueueSessionWrite(HIGHEST, PING, std::move(ping_frame));
if (net_log().IsCapturing()) {
net_log().AddEvent(
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.cc ('k') | net/spdy/spdy_session_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698