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

Side by Side Diff: net/quic/quic_stream_factory.cc

Issue 1834273002: Add TRACE_EVENT macros to net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit. Created 4 years, 8 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
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 #include <utility>
10 10
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/metrics/sparse_histogram.h" 15 #include "base/metrics/sparse_histogram.h"
16 #include "base/rand_util.h" 16 #include "base/rand_util.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/stl_util.h" 18 #include "base/stl_util.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
21 #include "base/thread_task_runner_handle.h" 21 #include "base/thread_task_runner_handle.h"
22 #include "base/trace_event/trace_event.h"
22 #include "base/values.h" 23 #include "base/values.h"
23 #include "net/base/ip_address.h" 24 #include "net/base/ip_address.h"
24 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
25 #include "net/base/socket_performance_watcher.h" 26 #include "net/base/socket_performance_watcher.h"
26 #include "net/base/socket_performance_watcher_factory.h" 27 #include "net/base/socket_performance_watcher_factory.h"
27 #include "net/cert/cert_verifier.h" 28 #include "net/cert/cert_verifier.h"
28 #include "net/cert/ct_verifier.h" 29 #include "net/cert/ct_verifier.h"
29 #include "net/dns/host_resolver.h" 30 #include "net/dns/host_resolver.h"
30 #include "net/dns/single_request_host_resolver.h" 31 #include "net/dns/single_request_host_resolver.h"
31 #include "net/http/bidirectional_stream_impl.h" 32 #include "net/http/bidirectional_stream_impl.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 260
260 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { 261 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) {
261 int rv = DoLoop(OK); 262 int rv = DoLoop(OK);
262 if (rv == ERR_IO_PENDING) 263 if (rv == ERR_IO_PENDING)
263 callback_ = callback; 264 callback_ = callback;
264 265
265 return rv > 0 ? OK : rv; 266 return rv > 0 ? OK : rv;
266 } 267 }
267 268
268 int QuicStreamFactory::Job::DoLoop(int rv) { 269 int QuicStreamFactory::Job::DoLoop(int rv) {
270 TRACE_EVENT0("net", "QuicStreamFactory::Job::DoLoop");
269 do { 271 do {
270 IoState state = io_state_; 272 IoState state = io_state_;
271 io_state_ = STATE_NONE; 273 io_state_ = STATE_NONE;
272 switch (state) { 274 switch (state) {
273 case STATE_RESOLVE_HOST: 275 case STATE_RESOLVE_HOST:
274 CHECK_EQ(OK, rv); 276 CHECK_EQ(OK, rv);
275 rv = DoResolveHost(); 277 rv = DoResolveHost();
276 break; 278 break;
277 case STATE_RESOLVE_HOST_COMPLETE: 279 case STATE_RESOLVE_HOST_COMPLETE:
278 rv = DoResolveHostComplete(rv); 280 rv = DoResolveHostComplete(rv);
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 return OK; 1497 return OK;
1496 } 1498 }
1497 1499
1498 int QuicStreamFactory::CreateSession(const QuicServerId& server_id, 1500 int QuicStreamFactory::CreateSession(const QuicServerId& server_id,
1499 int cert_verify_flags, 1501 int cert_verify_flags,
1500 scoped_ptr<QuicServerInfo> server_info, 1502 scoped_ptr<QuicServerInfo> server_info,
1501 const AddressList& address_list, 1503 const AddressList& address_list,
1502 base::TimeTicks dns_resolution_end_time, 1504 base::TimeTicks dns_resolution_end_time,
1503 const BoundNetLog& net_log, 1505 const BoundNetLog& net_log,
1504 QuicChromiumClientSession** session) { 1506 QuicChromiumClientSession** session) {
1507 TRACE_EVENT0("net", "QuicStreamFactory::CreateSession");
1505 IPEndPoint addr = *address_list.begin(); 1508 IPEndPoint addr = *address_list.begin();
1506 bool enable_port_selection = enable_port_selection_; 1509 bool enable_port_selection = enable_port_selection_;
1507 if (enable_port_selection && ContainsKey(gone_away_aliases_, server_id)) { 1510 if (enable_port_selection && ContainsKey(gone_away_aliases_, server_id)) {
1508 // Disable port selection when the server is going away. 1511 // Disable port selection when the server is going away.
1509 // There is no point in trying to return to the same server, if 1512 // There is no point in trying to return to the same server, if
1510 // that server is no longer handling requests. 1513 // that server is no longer handling requests.
1511 enable_port_selection = false; 1514 enable_port_selection = false;
1512 gone_away_aliases_.erase(server_id); 1515 gone_away_aliases_.erase(server_id);
1513 } 1516 }
1514 scoped_refptr<PortSuggester> port_suggester = 1517 scoped_refptr<PortSuggester> port_suggester =
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 // Since the session was active, there's no longer an 1750 // Since the session was active, there's no longer an
1748 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1751 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1749 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1752 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1750 // it as recently broken, which means that 0-RTT will be disabled but we'll 1753 // it as recently broken, which means that 0-RTT will be disabled but we'll
1751 // still race. 1754 // still race.
1752 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1755 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1753 alternative_service); 1756 alternative_service);
1754 } 1757 }
1755 1758
1756 } // namespace net 1759 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698