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

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: Rebase and address comments. 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
« no previous file with comments | « net/proxy/proxy_resolver_v8_tracing.cc ('k') | net/socket/client_socket_handle.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 #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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 261
261 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { 262 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) {
262 int rv = DoLoop(OK); 263 int rv = DoLoop(OK);
263 if (rv == ERR_IO_PENDING) 264 if (rv == ERR_IO_PENDING)
264 callback_ = callback; 265 callback_ = callback;
265 266
266 return rv > 0 ? OK : rv; 267 return rv > 0 ? OK : rv;
267 } 268 }
268 269
269 int QuicStreamFactory::Job::DoLoop(int rv) { 270 int QuicStreamFactory::Job::DoLoop(int rv) {
271 TRACE_EVENT0("net", "QuicStreamFactory::Job::DoLoop");
270 do { 272 do {
271 IoState state = io_state_; 273 IoState state = io_state_;
272 io_state_ = STATE_NONE; 274 io_state_ = STATE_NONE;
273 switch (state) { 275 switch (state) {
274 case STATE_RESOLVE_HOST: 276 case STATE_RESOLVE_HOST:
275 CHECK_EQ(OK, rv); 277 CHECK_EQ(OK, rv);
276 rv = DoResolveHost(); 278 rv = DoResolveHost();
277 break; 279 break;
278 case STATE_RESOLVE_HOST_COMPLETE: 280 case STATE_RESOLVE_HOST_COMPLETE:
279 rv = DoResolveHostComplete(rv); 281 rv = DoResolveHostComplete(rv);
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 return OK; 1509 return OK;
1508 } 1510 }
1509 1511
1510 int QuicStreamFactory::CreateSession(const QuicServerId& server_id, 1512 int QuicStreamFactory::CreateSession(const QuicServerId& server_id,
1511 int cert_verify_flags, 1513 int cert_verify_flags,
1512 scoped_ptr<QuicServerInfo> server_info, 1514 scoped_ptr<QuicServerInfo> server_info,
1513 const AddressList& address_list, 1515 const AddressList& address_list,
1514 base::TimeTicks dns_resolution_end_time, 1516 base::TimeTicks dns_resolution_end_time,
1515 const BoundNetLog& net_log, 1517 const BoundNetLog& net_log,
1516 QuicChromiumClientSession** session) { 1518 QuicChromiumClientSession** session) {
1519 TRACE_EVENT0("net", "QuicStreamFactory::CreateSession");
1517 IPEndPoint addr = *address_list.begin(); 1520 IPEndPoint addr = *address_list.begin();
1518 bool enable_port_selection = enable_port_selection_; 1521 bool enable_port_selection = enable_port_selection_;
1519 if (enable_port_selection && ContainsKey(gone_away_aliases_, server_id)) { 1522 if (enable_port_selection && ContainsKey(gone_away_aliases_, server_id)) {
1520 // Disable port selection when the server is going away. 1523 // Disable port selection when the server is going away.
1521 // There is no point in trying to return to the same server, if 1524 // There is no point in trying to return to the same server, if
1522 // that server is no longer handling requests. 1525 // that server is no longer handling requests.
1523 enable_port_selection = false; 1526 enable_port_selection = false;
1524 gone_away_aliases_.erase(server_id); 1527 gone_away_aliases_.erase(server_id);
1525 } 1528 }
1526 scoped_refptr<PortSuggester> port_suggester = 1529 scoped_refptr<PortSuggester> port_suggester =
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 // Since the session was active, there's no longer an 1762 // Since the session was active, there's no longer an
1760 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1763 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1761 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1764 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1762 // it as recently broken, which means that 0-RTT will be disabled but we'll 1765 // it as recently broken, which means that 0-RTT will be disabled but we'll
1763 // still race. 1766 // still race.
1764 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1767 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1765 alternative_service); 1768 alternative_service);
1766 } 1769 }
1767 1770
1768 } // namespace net 1771 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_v8_tracing.cc ('k') | net/socket/client_socket_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698