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

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

Issue 6125001: Fixed first pass at adding http/backend cache events to the NetLog. ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix Created 9 years, 11 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/lock.h" 10 #include "base/lock.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 trackers_[net::NetLog::SOURCE_URL_REQUEST] = &url_request_tracker_; 63 trackers_[net::NetLog::SOURCE_URL_REQUEST] = &url_request_tracker_;
64 trackers_[net::NetLog::SOURCE_SOCKET_STREAM] = &socket_stream_tracker_; 64 trackers_[net::NetLog::SOURCE_SOCKET_STREAM] = &socket_stream_tracker_;
65 trackers_[net::NetLog::SOURCE_CONNECT_JOB] = &connect_job_tracker_; 65 trackers_[net::NetLog::SOURCE_CONNECT_JOB] = &connect_job_tracker_;
66 trackers_[net::NetLog::SOURCE_SOCKET] = &socket_tracker_; 66 trackers_[net::NetLog::SOURCE_SOCKET] = &socket_tracker_;
67 trackers_[net::NetLog::SOURCE_INIT_PROXY_RESOLVER] = 67 trackers_[net::NetLog::SOURCE_INIT_PROXY_RESOLVER] =
68 &init_proxy_resolver_tracker_; 68 &init_proxy_resolver_tracker_;
69 trackers_[net::NetLog::SOURCE_SPDY_SESSION] = &spdy_session_tracker_; 69 trackers_[net::NetLog::SOURCE_SPDY_SESSION] = &spdy_session_tracker_;
70 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] = 70 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] =
71 &dns_request_tracker_; 71 &dns_request_tracker_;
72 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_; 72 trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_;
73 trackers_[net::NetLog::SOURCE_DISK_CACHE_ENTRY] = &disk_cache_entry_tracker_;
73 // Make sure our mapping is up-to-date. 74 // Make sure our mapping is up-to-date.
74 for (size_t i = 0; i < arraysize(trackers_); ++i) 75 for (size_t i = 0; i < arraysize(trackers_); ++i)
75 DCHECK(trackers_[i]) << "Unhandled SourceType: " << i; 76 DCHECK(trackers_[i]) << "Unhandled SourceType: " << i;
76 } 77 }
77 78
78 PassiveLogCollector::~PassiveLogCollector() { 79 PassiveLogCollector::~PassiveLogCollector() {
79 } 80 }
80 81
81 void PassiveLogCollector::OnAddEntry( 82 void PassiveLogCollector::OnAddEntry(
82 net::NetLog::EventType type, 83 net::NetLog::EventType type,
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 PassiveLogCollector::DNSJobTracker::DoAddEntry(const ChromeNetLog::Entry& entry, 554 PassiveLogCollector::DNSJobTracker::DoAddEntry(const ChromeNetLog::Entry& entry,
554 SourceInfo* out_info) { 555 SourceInfo* out_info) {
555 AddEntryToSourceInfo(entry, out_info); 556 AddEntryToSourceInfo(entry, out_info);
556 if (entry.type == net::NetLog::TYPE_HOST_RESOLVER_IMPL_JOB && 557 if (entry.type == net::NetLog::TYPE_HOST_RESOLVER_IMPL_JOB &&
557 entry.phase == net::NetLog::PHASE_END) { 558 entry.phase == net::NetLog::PHASE_END) {
558 return ACTION_MOVE_TO_GRAVEYARD; 559 return ACTION_MOVE_TO_GRAVEYARD;
559 } else { 560 } else {
560 return ACTION_NONE; 561 return ACTION_NONE;
561 } 562 }
562 } 563 }
564
565 //----------------------------------------------------------------------------
566 // DiskCacheEntryTracker
567 //----------------------------------------------------------------------------
568
569 const size_t PassiveLogCollector::DiskCacheEntryTracker::kMaxNumSources = 100;
570 const size_t PassiveLogCollector::DiskCacheEntryTracker::kMaxGraveyardSize = 25;
571
572 PassiveLogCollector::DiskCacheEntryTracker::DiskCacheEntryTracker()
573 : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
574 }
575
576 PassiveLogCollector::SourceTracker::Action
577 PassiveLogCollector::DiskCacheEntryTracker::DoAddEntry(
578 const ChromeNetLog::Entry& entry, SourceInfo* out_info) {
579 AddEntryToSourceInfo(entry, out_info);
580
581 // If the request has ended, move it to the graveyard.
582 if (entry.type == net::NetLog::TYPE_DISK_CACHE_ENTRY &&
583 entry.phase == net::NetLog::PHASE_END) {
584 return ACTION_MOVE_TO_GRAVEYARD;
585 }
586
587 return ACTION_NONE;
588 }
OLDNEW
« no previous file with comments | « chrome/browser/net/passive_log_collector.h ('k') | chrome/browser/resources/net_internals/logviewpainter.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698