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

Side by Side Diff: chrome/browser/net/passive_log_collector.cc

Issue 3119027: Adds HostResolveImpl Requests and Jobs to log. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Define the mapping between source types and the tracker objects. 50 // Define the mapping between source types and the tracker objects.
51 memset(&trackers_[0], 0, sizeof(trackers_)); 51 memset(&trackers_[0], 0, sizeof(trackers_));
52 trackers_[net::NetLog::SOURCE_NONE] = &global_source_tracker_; 52 trackers_[net::NetLog::SOURCE_NONE] = &global_source_tracker_;
53 trackers_[net::NetLog::SOURCE_URL_REQUEST] = &url_request_tracker_; 53 trackers_[net::NetLog::SOURCE_URL_REQUEST] = &url_request_tracker_;
54 trackers_[net::NetLog::SOURCE_SOCKET_STREAM] = &socket_stream_tracker_; 54 trackers_[net::NetLog::SOURCE_SOCKET_STREAM] = &socket_stream_tracker_;
55 trackers_[net::NetLog::SOURCE_CONNECT_JOB] = &connect_job_tracker_; 55 trackers_[net::NetLog::SOURCE_CONNECT_JOB] = &connect_job_tracker_;
56 trackers_[net::NetLog::SOURCE_SOCKET] = &socket_tracker_; 56 trackers_[net::NetLog::SOURCE_SOCKET] = &socket_tracker_;
57 trackers_[net::NetLog::SOURCE_INIT_PROXY_RESOLVER] = 57 trackers_[net::NetLog::SOURCE_INIT_PROXY_RESOLVER] =
58 &init_proxy_resolver_tracker_; 58 &init_proxy_resolver_tracker_;
59 trackers_[net::NetLog::SOURCE_SPDY_SESSION] = &spdy_session_tracker_; 59 trackers_[net::NetLog::SOURCE_SPDY_SESSION] = &spdy_session_tracker_;
60 60 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] =
61 &dns_request_tracker_;
62 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_;
61 // Make sure our mapping is up-to-date. 63 // Make sure our mapping is up-to-date.
62 for (size_t i = 0; i < arraysize(trackers_); ++i) 64 for (size_t i = 0; i < arraysize(trackers_); ++i)
63 DCHECK(trackers_[i]) << "Unhandled SourceType: " << i; 65 DCHECK(trackers_[i]) << "Unhandled SourceType: " << i;
64 } 66 }
65 67
66 PassiveLogCollector::~PassiveLogCollector() { 68 PassiveLogCollector::~PassiveLogCollector() {
67 } 69 }
68 70
69 void PassiveLogCollector::OnAddEntry( 71 void PassiveLogCollector::OnAddEntry(
70 net::NetLog::EventType type, 72 net::NetLog::EventType type,
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 PassiveLogCollector::SpdySessionTracker::DoAddEntry(const Entry& entry, 480 PassiveLogCollector::SpdySessionTracker::DoAddEntry(const Entry& entry,
479 SourceInfo* out_info) { 481 SourceInfo* out_info) {
480 AddEntryToSourceInfo(entry, out_info); 482 AddEntryToSourceInfo(entry, out_info);
481 if (entry.type == net::NetLog::TYPE_SPDY_SESSION && 483 if (entry.type == net::NetLog::TYPE_SPDY_SESSION &&
482 entry.phase == net::NetLog::PHASE_END) { 484 entry.phase == net::NetLog::PHASE_END) {
483 return ACTION_MOVE_TO_GRAVEYARD; 485 return ACTION_MOVE_TO_GRAVEYARD;
484 } else { 486 } else {
485 return ACTION_NONE; 487 return ACTION_NONE;
486 } 488 }
487 } 489 }
490
491 //----------------------------------------------------------------------------
492 // DNSRequestTracker
493 //----------------------------------------------------------------------------
494
495 const size_t PassiveLogCollector::DNSRequestTracker::kMaxNumSources = 200;
496 const size_t PassiveLogCollector::DNSRequestTracker::kMaxGraveyardSize = 20;
497
498 PassiveLogCollector::DNSRequestTracker::DNSRequestTracker()
499 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
500 }
501
502 PassiveLogCollector::SourceTracker::Action
503 PassiveLogCollector::DNSRequestTracker::DoAddEntry(const Entry& entry,
504 SourceInfo* out_info) {
505 AddEntryToSourceInfo(entry, out_info);
506 if (entry.type == net::NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST &&
507 entry.phase == net::NetLog::PHASE_END) {
508 return ACTION_MOVE_TO_GRAVEYARD;
509 } else {
510 return ACTION_NONE;
511 }
512 }
513
514 //----------------------------------------------------------------------------
515 // DNSJobTracker
516 //----------------------------------------------------------------------------
517
518 const size_t PassiveLogCollector::DNSJobTracker::kMaxNumSources = 100;
519 const size_t PassiveLogCollector::DNSJobTracker::kMaxGraveyardSize = 15;
520
521 PassiveLogCollector::DNSJobTracker::DNSJobTracker()
522 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
523 }
524
525 PassiveLogCollector::SourceTracker::Action
526 PassiveLogCollector::DNSJobTracker::DoAddEntry(const Entry& entry,
527 SourceInfo* out_info) {
528 AddEntryToSourceInfo(entry, out_info);
529 if (entry.type == net::NetLog::TYPE_HOST_RESOLVER_IMPL_JOB &&
530 entry.phase == net::NetLog::PHASE_END) {
531 return ACTION_MOVE_TO_GRAVEYARD;
532 } else {
533 return ACTION_NONE;
534 }
535 }
536
OLDNEW
« no previous file with comments | « chrome/browser/net/passive_log_collector.h ('k') | chrome/browser/resources/net_internals/main.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698