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

Side by Side Diff: net/quic/quic_stream_factory.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/quic/quic_http_utils.cc ('k') | net/quic/test_tools/crypto_test_utils_chromium.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/quic/quic_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility>
9 10
10 #include "base/location.h" 11 #include "base/location.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
14 #include "base/metrics/sparse_histogram.h" 15 #include "base/metrics/sparse_histogram.h"
15 #include "base/rand_util.h" 16 #include "base/rand_util.h"
16 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
17 #include "base/stl_util.h" 18 #include "base/stl_util.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 422 }
422 423
423 io_state_ = STATE_CONNECT; 424 io_state_ = STATE_CONNECT;
424 return OK; 425 return OK;
425 } 426 }
426 427
427 int QuicStreamFactory::Job::DoConnect() { 428 int QuicStreamFactory::Job::DoConnect() {
428 io_state_ = STATE_CONNECT_COMPLETE; 429 io_state_ = STATE_CONNECT_COMPLETE;
429 430
430 int rv = factory_->CreateSession( 431 int rv = factory_->CreateSession(
431 server_id_, cert_verify_flags_, server_info_.Pass(), address_list_, 432 server_id_, cert_verify_flags_, std::move(server_info_), address_list_,
432 dns_resolution_end_time_, net_log_, &session_); 433 dns_resolution_end_time_, net_log_, &session_);
433 if (rv != OK) { 434 if (rv != OK) {
434 DCHECK(rv != ERR_IO_PENDING); 435 DCHECK(rv != ERR_IO_PENDING);
435 DCHECK(!session_); 436 DCHECK(!session_);
436 return rv; 437 return rv;
437 } 438 }
438 439
439 if (!session_->connection()->connected()) { 440 if (!session_->connection()->connected()) {
440 return ERR_CONNECTION_CLOSED; 441 return ERR_CONNECTION_CLOSED;
441 } 442 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } else { 512 } else {
512 factory_ = nullptr; 513 factory_ = nullptr;
513 } 514 }
514 if (rv == OK) 515 if (rv == OK)
515 DCHECK(stream_); 516 DCHECK(stream_);
516 return rv; 517 return rv;
517 } 518 }
518 519
519 void QuicStreamRequest::set_stream(scoped_ptr<QuicHttpStream> stream) { 520 void QuicStreamRequest::set_stream(scoped_ptr<QuicHttpStream> stream) {
520 DCHECK(stream); 521 DCHECK(stream);
521 stream_ = stream.Pass(); 522 stream_ = std::move(stream);
522 } 523 }
523 524
524 void QuicStreamRequest::OnRequestComplete(int rv) { 525 void QuicStreamRequest::OnRequestComplete(int rv) {
525 factory_ = nullptr; 526 factory_ = nullptr;
526 callback_.Run(rv); 527 callback_.Run(rv);
527 } 528 }
528 529
529 base::TimeDelta QuicStreamRequest::GetTimeDelayForWaitingJob() const { 530 base::TimeDelta QuicStreamRequest::GetTimeDelayForWaitingJob() const {
530 if (!factory_) 531 if (!factory_)
531 return base::TimeDelta(); 532 return base::TimeDelta();
532 return factory_->GetTimeDelayForWaitingJob( 533 return factory_->GetTimeDelayForWaitingJob(
533 QuicServerId(host_port_pair_, privacy_mode_)); 534 QuicServerId(host_port_pair_, privacy_mode_));
534 } 535 }
535 536
536 scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() { 537 scoped_ptr<QuicHttpStream> QuicStreamRequest::ReleaseStream() {
537 DCHECK(stream_); 538 DCHECK(stream_);
538 return stream_.Pass(); 539 return std::move(stream_);
539 } 540 }
540 541
541 QuicStreamFactory::QuicStreamFactory( 542 QuicStreamFactory::QuicStreamFactory(
542 HostResolver* host_resolver, 543 HostResolver* host_resolver,
543 ClientSocketFactory* client_socket_factory, 544 ClientSocketFactory* client_socket_factory,
544 base::WeakPtr<HttpServerProperties> http_server_properties, 545 base::WeakPtr<HttpServerProperties> http_server_properties,
545 CertVerifier* cert_verifier, 546 CertVerifier* cert_verifier,
546 CertPolicyEnforcer* cert_policy_enforcer, 547 CertPolicyEnforcer* cert_policy_enforcer,
547 ChannelIDService* channel_id_service, 548 ChannelIDService* channel_id_service,
548 TransportSecurityState* transport_security_state, 549 TransportSecurityState* transport_security_state,
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 // Only add a session to the list once. 1128 // Only add a session to the list once.
1128 if (server_id == *aliases.begin()) { 1129 if (server_id == *aliases.begin()) {
1129 std::set<HostPortPair> hosts; 1130 std::set<HostPortPair> hosts;
1130 for (AliasSet::const_iterator alias_it = aliases.begin(); 1131 for (AliasSet::const_iterator alias_it = aliases.begin();
1131 alias_it != aliases.end(); ++alias_it) { 1132 alias_it != aliases.end(); ++alias_it) {
1132 hosts.insert(alias_it->host_port_pair()); 1133 hosts.insert(alias_it->host_port_pair());
1133 } 1134 }
1134 list->Append(session->GetInfoAsValue(hosts)); 1135 list->Append(session->GetInfoAsValue(hosts));
1135 } 1136 }
1136 } 1137 }
1137 return list.Pass(); 1138 return std::move(list);
1138 } 1139 }
1139 1140
1140 void QuicStreamFactory::ClearCachedStatesInCryptoConfig() { 1141 void QuicStreamFactory::ClearCachedStatesInCryptoConfig() {
1141 crypto_config_.ClearCachedStates(); 1142 crypto_config_.ClearCachedStates();
1142 } 1143 }
1143 1144
1144 void QuicStreamFactory::OnIPAddressChanged() { 1145 void QuicStreamFactory::OnIPAddressChanged() {
1145 CloseAllSessions(ERR_NETWORK_CHANGED); 1146 CloseAllSessions(ERR_NETWORK_CHANGED);
1146 set_require_confirmation(true); 1147 set_require_confirmation(true);
1147 } 1148 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 // Use the factory to create a new socket performance watcher, and pass the 1290 // Use the factory to create a new socket performance watcher, and pass the
1290 // ownership to QuicChromiumClientSession. 1291 // ownership to QuicChromiumClientSession.
1291 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher; 1292 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher;
1292 if (socket_performance_watcher_factory_) { 1293 if (socket_performance_watcher_factory_) {
1293 socket_performance_watcher = 1294 socket_performance_watcher =
1294 socket_performance_watcher_factory_->CreateSocketPerformanceWatcher( 1295 socket_performance_watcher_factory_->CreateSocketPerformanceWatcher(
1295 SocketPerformanceWatcherFactory::PROTOCOL_QUIC); 1296 SocketPerformanceWatcherFactory::PROTOCOL_QUIC);
1296 } 1297 }
1297 1298
1298 *session = new QuicChromiumClientSession( 1299 *session = new QuicChromiumClientSession(
1299 connection, socket.Pass(), this, quic_crypto_client_stream_factory_, 1300 connection, std::move(socket), this, quic_crypto_client_stream_factory_,
1300 clock_.get(), transport_security_state_, server_info.Pass(), server_id, 1301 clock_.get(), transport_security_state_, std::move(server_info),
1301 yield_after_packets_, yield_after_duration_, cert_verify_flags, config, 1302 server_id, yield_after_packets_, yield_after_duration_, cert_verify_flags,
1302 &crypto_config_, network_connection_.GetDescription(), 1303 config, &crypto_config_, network_connection_.GetDescription(),
1303 dns_resolution_end_time, base::ThreadTaskRunnerHandle::Get().get(), 1304 dns_resolution_end_time, base::ThreadTaskRunnerHandle::Get().get(),
1304 socket_performance_watcher.Pass(), net_log.net_log()); 1305 std::move(socket_performance_watcher), net_log.net_log());
1305 1306
1306 all_sessions_[*session] = server_id; // owning pointer 1307 all_sessions_[*session] = server_id; // owning pointer
1307 1308
1308 (*session)->Initialize(); 1309 (*session)->Initialize();
1309 bool closed_during_initialize = !ContainsKey(all_sessions_, *session) || 1310 bool closed_during_initialize = !ContainsKey(all_sessions_, *session) ||
1310 !(*session)->connection()->connected(); 1311 !(*session)->connection()->connected();
1311 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", 1312 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession",
1312 closed_during_initialize); 1313 closed_during_initialize);
1313 if (closed_during_initialize) { 1314 if (closed_during_initialize) {
1314 DLOG(DFATAL) << "Session closed during initialize"; 1315 DLOG(DFATAL) << "Session closed during initialize";
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 // Since the session was active, there's no longer an 1456 // Since the session was active, there's no longer an
1456 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1457 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1457 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1458 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1458 // it as recently broken, which means that 0-RTT will be disabled but we'll 1459 // it as recently broken, which means that 0-RTT will be disabled but we'll
1459 // still race. 1460 // still race.
1460 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1461 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1461 alternative_service); 1462 alternative_service);
1462 } 1463 }
1463 1464
1464 } // namespace net 1465 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_utils.cc ('k') | net/quic/test_tools/crypto_test_utils_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698