OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/net/passive_log_collector.h" | 5 #include "chrome/browser/net/passive_log_collector.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 &dns_request_tracker_; | 73 &dns_request_tracker_; |
74 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_; | 74 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_; |
75 trackers_[net::NetLog::SOURCE_DISK_CACHE_ENTRY] = &disk_cache_entry_tracker_; | 75 trackers_[net::NetLog::SOURCE_DISK_CACHE_ENTRY] = &disk_cache_entry_tracker_; |
76 trackers_[net::NetLog::SOURCE_MEMORY_CACHE_ENTRY] = &mem_cache_entry_tracker_; | 76 trackers_[net::NetLog::SOURCE_MEMORY_CACHE_ENTRY] = &mem_cache_entry_tracker_; |
77 trackers_[net::NetLog::SOURCE_HTTP_STREAM_JOB] = &http_stream_job_tracker_; | 77 trackers_[net::NetLog::SOURCE_HTTP_STREAM_JOB] = &http_stream_job_tracker_; |
78 trackers_[net::NetLog::SOURCE_EXPONENTIAL_BACKOFF_THROTTLING] = | 78 trackers_[net::NetLog::SOURCE_EXPONENTIAL_BACKOFF_THROTTLING] = |
79 &exponential_backoff_throttling_tracker_; | 79 &exponential_backoff_throttling_tracker_; |
80 trackers_[net::NetLog::SOURCE_DNS_TRANSACTION] = &dns_transaction_tracker_; | 80 trackers_[net::NetLog::SOURCE_DNS_TRANSACTION] = &dns_transaction_tracker_; |
81 trackers_[net::NetLog::SOURCE_ASYNC_HOST_RESOLVER_REQUEST] = | 81 trackers_[net::NetLog::SOURCE_ASYNC_HOST_RESOLVER_REQUEST] = |
82 &async_host_resolver_request_tracker_; | 82 &async_host_resolver_request_tracker_; |
| 83 trackers_[net::NetLog::SOURCE_UDP_SOCKET] = &udp_socket_tracker_; |
83 // Make sure our mapping is up-to-date. | 84 // Make sure our mapping is up-to-date. |
84 for (size_t i = 0; i < arraysize(trackers_); ++i) | 85 for (size_t i = 0; i < arraysize(trackers_); ++i) |
85 DCHECK(trackers_[i]) << "Unhandled SourceType: " << i; | 86 DCHECK(trackers_[i]) << "Unhandled SourceType: " << i; |
86 } | 87 } |
87 | 88 |
88 PassiveLogCollector::~PassiveLogCollector() { | 89 PassiveLogCollector::~PassiveLogCollector() { |
89 } | 90 } |
90 | 91 |
91 void PassiveLogCollector::OnAddEntry( | 92 void PassiveLogCollector::OnAddEntry( |
92 net::NetLog::EventType type, | 93 net::NetLog::EventType type, |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 PassiveLogCollector::AsyncHostResolverRequestTracker::DoAddEntry( | 718 PassiveLogCollector::AsyncHostResolverRequestTracker::DoAddEntry( |
718 const ChromeNetLog::Entry& entry, | 719 const ChromeNetLog::Entry& entry, |
719 SourceInfo* out_info) { | 720 SourceInfo* out_info) { |
720 AddEntryToSourceInfo(entry, out_info); | 721 AddEntryToSourceInfo(entry, out_info); |
721 if (entry.type == net::NetLog::TYPE_ASYNC_HOST_RESOLVER_REQUEST && | 722 if (entry.type == net::NetLog::TYPE_ASYNC_HOST_RESOLVER_REQUEST && |
722 entry.phase == net::NetLog::PHASE_END) { | 723 entry.phase == net::NetLog::PHASE_END) { |
723 return ACTION_MOVE_TO_GRAVEYARD; | 724 return ACTION_MOVE_TO_GRAVEYARD; |
724 } | 725 } |
725 return ACTION_NONE; | 726 return ACTION_NONE; |
726 } | 727 } |
| 728 |
| 729 //---------------------------------------------------------------------------- |
| 730 // UDPSocketTracker |
| 731 //---------------------------------------------------------------------------- |
| 732 |
| 733 const size_t PassiveLogCollector::UDPSocketTracker::kMaxNumSources = 200; |
| 734 const size_t PassiveLogCollector::UDPSocketTracker::kMaxGraveyardSize = 15; |
| 735 |
| 736 PassiveLogCollector::UDPSocketTracker::UDPSocketTracker() |
| 737 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) { |
| 738 } |
| 739 |
| 740 PassiveLogCollector::UDPSocketTracker::Action |
| 741 PassiveLogCollector::UDPSocketTracker::DoAddEntry( |
| 742 const ChromeNetLog::Entry& entry, |
| 743 SourceInfo* out_info) { |
| 744 if (entry.type == net::NetLog::TYPE_UDP_BYTES_SENT || |
| 745 entry.type == net::NetLog::TYPE_UDP_BYTES_RECEIVED) { |
| 746 return ACTION_NONE; |
| 747 } |
| 748 |
| 749 AddEntryToSourceInfo(entry, out_info); |
| 750 |
| 751 if (entry.type == net::NetLog::TYPE_SOCKET_ALIVE && |
| 752 entry.phase == net::NetLog::PHASE_END) { |
| 753 return ACTION_MOVE_TO_GRAVEYARD; |
| 754 } |
| 755 |
| 756 return ACTION_NONE; |
| 757 } |
OLD | NEW |