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

Unified Diff: chrome/browser/net/passive_log_collector.cc

Issue 1052002: Move over another legacy "LoadLog-style" event generator to routing its messa... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address willchan's comments Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/passive_log_collector.h ('k') | chrome/browser/net/resolve_proxy_msg_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/passive_log_collector.cc
===================================================================
--- chrome/browser/net/passive_log_collector.cc (revision 41695)
+++ chrome/browser/net/passive_log_collector.cc (working copy)
@@ -65,6 +65,9 @@
case net::NetLog::SOURCE_CONNECT_JOB:
connect_job_tracker_.OnAddEntry(entry);
break;
+ case net::NetLog::SOURCE_INIT_PROXY_RESOLVER:
+ init_proxy_resolver_tracker_.OnAddEntry(entry);
+ break;
default:
// Drop all other logged events.
break;
@@ -316,3 +319,35 @@
AddEntryToRequestInfo(e, is_unbounded(), live_entry);
}
}
+
+//----------------------------------------------------------------------------
+// InitProxyResolverTracker
+//----------------------------------------------------------------------------
+
+PassiveLogCollector::InitProxyResolverTracker::InitProxyResolverTracker() {}
+
+void PassiveLogCollector::InitProxyResolverTracker::OnAddEntry(
+ const net::NetLog::Entry& entry) {
+ if (entry.type == net::NetLog::Entry::TYPE_EVENT &&
+ entry.event.type == net::NetLog::TYPE_INIT_PROXY_RESOLVER &&
+ entry.event.phase == net::NetLog::PHASE_BEGIN) {
+ // If this is the start of a new InitProxyResolver, overwrite the old data.
+ entries_.clear();
+ entries_.push_back(entry);
+ } else {
+ // Otherwise append it to the log for the latest InitProxyResolver.
+ if (!entries_.empty() && entries_[0].source.id != entry.source.id) {
+ // If this entry doesn't match what we think was the latest
+ // InitProxyResolver, drop it. (This shouldn't happen, but we will guard
+ // against it).
+ return;
+ }
+ entries_.push_back(entry);
+ }
+
+ // Safety net: INIT_PROXY_RESOLVER shouldn't generate many messages, but in
+ // case something goes wrong, avoid exploding the memory usage.
+ if (entries_.size() > kMaxNumEntriesPerLog)
+ entries_.clear();
+}
+
« no previous file with comments | « chrome/browser/net/passive_log_collector.h ('k') | chrome/browser/net/resolve_proxy_msg_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698