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

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

Issue 2533953005: Standardize "net" category trace events (Closed)
Patch Set: Move constants to its own target Created 4 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 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/chromium/quic_stream_factory.h" 5 #include "net/quic/chromium/quic_stream_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.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/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.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/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "base/trace_event/trace_event.h" 22 #include "base/trace_event/trace_event.h"
23 #include "base/values.h" 23 #include "base/values.h"
24 #include "crypto/openssl_util.h" 24 #include "crypto/openssl_util.h"
25 #include "net/base/ip_address.h" 25 #include "net/base/ip_address.h"
26 #include "net/base/net_errors.h" 26 #include "net/base/net_errors.h"
27 #include "net/base/proxy_delegate.h" 27 #include "net/base/proxy_delegate.h"
28 #include "net/base/trace_constants.h"
28 #include "net/cert/cert_verifier.h" 29 #include "net/cert/cert_verifier.h"
29 #include "net/cert/ct_verifier.h" 30 #include "net/cert/ct_verifier.h"
30 #include "net/dns/host_resolver.h" 31 #include "net/dns/host_resolver.h"
31 #include "net/http/bidirectional_stream_impl.h" 32 #include "net/http/bidirectional_stream_impl.h"
32 #include "net/log/net_log_capture_mode.h" 33 #include "net/log/net_log_capture_mode.h"
33 #include "net/log/net_log_event_type.h" 34 #include "net/log/net_log_event_type.h"
34 #include "net/log/net_log_source_type.h" 35 #include "net/log/net_log_source_type.h"
35 #include "net/quic/chromium/bidirectional_stream_quic_impl.h" 36 #include "net/quic/chromium/bidirectional_stream_quic_impl.h"
36 #include "net/quic/chromium/crypto/channel_id_chromium.h" 37 #include "net/quic/chromium/crypto/channel_id_chromium.h"
37 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" 38 #include "net/quic/chromium/crypto/proof_verifier_chromium.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 396
396 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { 397 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) {
397 int rv = DoLoop(OK); 398 int rv = DoLoop(OK);
398 if (rv == ERR_IO_PENDING) 399 if (rv == ERR_IO_PENDING)
399 callback_ = callback; 400 callback_ = callback;
400 401
401 return rv > 0 ? OK : rv; 402 return rv > 0 ? OK : rv;
402 } 403 }
403 404
404 int QuicStreamFactory::Job::DoLoop(int rv) { 405 int QuicStreamFactory::Job::DoLoop(int rv) {
405 TRACE_EVENT0("net", "QuicStreamFactory::Job::DoLoop"); 406 TRACE_EVENT0(kNetTracingCategory, "QuicStreamFactory::Job::DoLoop");
406 do { 407 do {
407 IoState state = io_state_; 408 IoState state = io_state_;
408 io_state_ = STATE_NONE; 409 io_state_ = STATE_NONE;
409 switch (state) { 410 switch (state) {
410 case STATE_RESOLVE_HOST: 411 case STATE_RESOLVE_HOST:
411 CHECK_EQ(OK, rv); 412 CHECK_EQ(OK, rv);
412 rv = DoResolveHost(); 413 rv = DoResolveHost();
413 break; 414 break;
414 case STATE_RESOLVE_HOST_COMPLETE: 415 case STATE_RESOLVE_HOST_COMPLETE:
415 rv = DoResolveHostComplete(rv); 416 rv = DoResolveHostComplete(rv);
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 QuicChromiumClientSession** session) { 1611 QuicChromiumClientSession** session) {
1611 if (need_to_evaluate_consecutive_disabled_count_) { 1612 if (need_to_evaluate_consecutive_disabled_count_) {
1612 task_runner_->PostDelayedTask( 1613 task_runner_->PostDelayedTask(
1613 FROM_HERE, 1614 FROM_HERE,
1614 base::Bind(&QuicStreamFactory::MaybeClearConsecutiveDisabledCount, 1615 base::Bind(&QuicStreamFactory::MaybeClearConsecutiveDisabledCount,
1615 weak_factory_.GetWeakPtr()), 1616 weak_factory_.GetWeakPtr()),
1616 base::TimeDelta::FromSeconds(kDisableQuicTimeoutSecs)); 1617 base::TimeDelta::FromSeconds(kDisableQuicTimeoutSecs));
1617 1618
1618 need_to_evaluate_consecutive_disabled_count_ = false; 1619 need_to_evaluate_consecutive_disabled_count_ = false;
1619 } 1620 }
1620 TRACE_EVENT0("net", "QuicStreamFactory::CreateSession"); 1621 TRACE_EVENT0(kNetTracingCategory, "QuicStreamFactory::CreateSession");
1621 IPEndPoint addr = *address_list.begin(); 1622 IPEndPoint addr = *address_list.begin();
1622 bool enable_port_selection = enable_port_selection_; 1623 bool enable_port_selection = enable_port_selection_;
1623 if (enable_port_selection && base::ContainsKey(gone_away_aliases_, key)) { 1624 if (enable_port_selection && base::ContainsKey(gone_away_aliases_, key)) {
1624 // Disable port selection when the server is going away. 1625 // Disable port selection when the server is going away.
1625 // There is no point in trying to return to the same server, if 1626 // There is no point in trying to return to the same server, if
1626 // that server is no longer handling requests. 1627 // that server is no longer handling requests.
1627 enable_port_selection = false; 1628 enable_port_selection = false;
1628 gone_away_aliases_.erase(key); 1629 gone_away_aliases_.erase(key);
1629 } 1630 }
1630 const QuicServerId& server_id = key.server_id(); 1631 const QuicServerId& server_id = key.server_id();
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 void QuicStreamFactory::OpenFactory() { 1925 void QuicStreamFactory::OpenFactory() {
1925 status_ = OPEN; 1926 status_ = OPEN;
1926 } 1927 }
1927 1928
1928 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() { 1929 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() {
1929 if (status_ == OPEN) 1930 if (status_ == OPEN)
1930 consecutive_disabled_count_ = 0; 1931 consecutive_disabled_count_ = 0;
1931 } 1932 }
1932 1933
1933 } // namespace net 1934 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698