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

Unified Diff: chrome/browser/net/chrome_net_log.h

Issue 848006: Generalize the net module's LoadLog facility from a passive container, to an event stream (NetLog). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Split up RequestTracker into ConnectJobTracker+RequestTracker+RequestTrackerBase, address 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/io_thread.cc ('k') | chrome/browser/net/chrome_net_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/chrome_net_log.h
===================================================================
--- chrome/browser/net/chrome_net_log.h (revision 0)
+++ chrome/browser/net/chrome_net_log.h (revision 0)
@@ -0,0 +1,54 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NET_CHROME_NET_LOG_H_
+#define CHROME_BROWSER_NET_CHROME_NET_LOG_H_
+
+#include "base/observer_list.h"
+#include "net/base/net_log.h"
+
+class PassiveLogCollector;
+
+// ChromeNetLog is an implementation of NetLog that dispatches network log
+// messages to a list of observers.
+//
+// By default, ChromeNetLog will attach the observer PassiveLogCollector which
+// will keep track of recent request information (which used when displaying
+// the about:net-internals page).
+//
+// TODO(eroman): Move this default observer out of ChromeNetLog.
+//
+class ChromeNetLog : public net::NetLog {
+ public:
+ // Interface for observing the events logged by the network stack.
+ class Observer {
+ public:
+ virtual ~Observer() {}
+ virtual void OnAddEntry(const Entry& entry) = 0;
+ };
+
+ ChromeNetLog();
+ ~ChromeNetLog();
+
+ // NetLog implementation:
+ virtual void AddEntry(const Entry& entry);
+ virtual int NextID();
+ virtual bool HasListener() const;
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ PassiveLogCollector* passive_collector() {
+ return passive_collector_.get();
+ }
+
+ private:
+ int next_id_;
+ scoped_ptr<PassiveLogCollector> passive_collector_;
+ ObserverList<Observer, true> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeNetLog);
+};
+
+#endif // CHROME_BROWSER_NET_CHROME_NET_LOG_H_
Property changes on: chrome\browser\net\chrome_net_log.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/chrome_net_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698