| OLD | NEW |
| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 rv = DoLoop(rv); | 305 rv = DoLoop(rv); |
| 306 | 306 |
| 307 if (rv != ERR_IO_PENDING && !callback_.is_null()) { | 307 if (rv != ERR_IO_PENDING && !callback_.is_null()) { |
| 308 callback_.Run(rv); | 308 callback_.Run(rv); |
| 309 } | 309 } |
| 310 } | 310 } |
| 311 | 311 |
| 312 int QuicStreamFactory::Job::DoResolveHost() { | 312 int QuicStreamFactory::Job::DoResolveHost() { |
| 313 // Start loading the data now, and wait for it after we resolve the host. | 313 // Start loading the data now, and wait for it after we resolve the host. |
| 314 if (server_info_) { | 314 if (server_info_) { |
| 315 disk_cache_load_start_time_ = base::TimeTicks::Now(); | |
| 316 server_info_->Start(); | 315 server_info_->Start(); |
| 317 } | 316 } |
| 318 | 317 |
| 319 io_state_ = STATE_RESOLVE_HOST_COMPLETE; | 318 io_state_ = STATE_RESOLVE_HOST_COMPLETE; |
| 320 dns_resolution_start_time_ = base::TimeTicks::Now(); | 319 dns_resolution_start_time_ = base::TimeTicks::Now(); |
| 321 return host_resolver_.Resolve( | 320 return host_resolver_.Resolve( |
| 322 HostResolver::RequestInfo(server_id_.host_port_pair()), | 321 HostResolver::RequestInfo(server_id_.host_port_pair()), |
| 323 DEFAULT_PRIORITY, | 322 DEFAULT_PRIORITY, |
| 324 &address_list_, | 323 &address_list_, |
| 325 base::Bind(&QuicStreamFactory::Job::OnIOComplete, | 324 base::Bind(&QuicStreamFactory::Job::OnIOComplete, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 344 io_state_ = STATE_LOAD_SERVER_INFO; | 343 io_state_ = STATE_LOAD_SERVER_INFO; |
| 345 return OK; | 344 return OK; |
| 346 } | 345 } |
| 347 | 346 |
| 348 int QuicStreamFactory::Job::DoLoadServerInfo() { | 347 int QuicStreamFactory::Job::DoLoadServerInfo() { |
| 349 io_state_ = STATE_LOAD_SERVER_INFO_COMPLETE; | 348 io_state_ = STATE_LOAD_SERVER_INFO_COMPLETE; |
| 350 | 349 |
| 351 if (!server_info_) | 350 if (!server_info_) |
| 352 return OK; | 351 return OK; |
| 353 | 352 |
| 353 disk_cache_load_start_time_ = base::TimeTicks::Now(); |
| 354 return server_info_->WaitForDataReady( | 354 return server_info_->WaitForDataReady( |
| 355 base::Bind(&QuicStreamFactory::Job::OnIOComplete, | 355 base::Bind(&QuicStreamFactory::Job::OnIOComplete, |
| 356 weak_factory_.GetWeakPtr())); | 356 weak_factory_.GetWeakPtr())); |
| 357 } | 357 } |
| 358 | 358 |
| 359 int QuicStreamFactory::Job::DoLoadServerInfoComplete(int rv) { | 359 int QuicStreamFactory::Job::DoLoadServerInfoComplete(int rv) { |
| 360 if (server_info_) { | 360 if (server_info_) { |
| 361 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheReadTime", | 361 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheWaitForDataReadyTime", |
| 362 base::TimeTicks::Now() - disk_cache_load_start_time_); | 362 base::TimeTicks::Now() - disk_cache_load_start_time_); |
| 363 } | 363 } |
| 364 | 364 |
| 365 if (rv != OK) { | 365 if (rv != OK) { |
| 366 server_info_.reset(); | 366 server_info_.reset(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 io_state_ = STATE_CONNECT; | 369 io_state_ = STATE_CONNECT; |
| 370 return OK; | 370 return OK; |
| 371 } | 371 } |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 http_server_properties_->ClearAlternateProtocol(server); | 1026 http_server_properties_->ClearAlternateProtocol(server); |
| 1027 http_server_properties_->SetAlternateProtocol( | 1027 http_server_properties_->SetAlternateProtocol( |
| 1028 server, alternate.port, alternate.protocol, 1); | 1028 server, alternate.port, alternate.protocol, 1); |
| 1029 DCHECK_EQ(QUIC, | 1029 DCHECK_EQ(QUIC, |
| 1030 http_server_properties_->GetAlternateProtocol(server).protocol); | 1030 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1031 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1031 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1032 server)); | 1032 server)); |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 } // namespace net | 1035 } // namespace net |
| OLD | NEW |