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

Unified Diff: chrome/browser/resources/net_internals/source_tracker.js

Issue 8474001: Add a timeline view to about:net-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Update comments Created 9 years, 1 month 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
Index: chrome/browser/resources/net_internals/source_tracker.js
===================================================================
--- chrome/browser/resources/net_internals/source_tracker.js (revision 109671)
+++ chrome/browser/resources/net_internals/source_tracker.js (working copy)
@@ -13,8 +13,13 @@
* @constructor
*/
function SourceTracker() {
- this.observers_ = [];
+ // Observers that are sent all events as they happen. This allows for easy
+ // watching for particular events.
+ this.logEntryObservers_ = [];
+ // Observers that only want to receive lists of updated SourceEntries.
+ this.sourceEntryObservers_ = [];
+
// True when cookies and authentication information should be removed from
// displayed events. When true, such information should be hidden from
// all pages.
@@ -115,7 +120,7 @@
},
/**
- * Sends each entry to all log observers, and updates |capturedEvents_|.
+ * Sends each entry to all observers and updates |capturedEvents_|.
* Also assigns unique ids to log entries without a source.
*/
onReceivedLogEntries: function(logEntries) {
@@ -153,8 +158,12 @@
}
this.capturedEvents_ = this.capturedEvents_.concat(logEntries);
- for (var i = 0; i < this.observers_.length; ++i)
- this.observers_[i].onSourceEntriesUpdated(updatedSourceEntries);
+ for (var i = 0; i < this.sourceEntryObservers_.length; ++i) {
+ this.sourceEntryObservers_[i].onSourceEntriesUpdated(
+ updatedSourceEntries);
+ }
+ for (var i = 0; i < this.logEntryObservers_.length; ++i)
+ this.logEntryObservers_[i].onReceivedLogEntries(logEntries);
},
/**
@@ -179,8 +188,8 @@
}
this.capturedEvents_ = newEventList;
- for (var i = 0; i < this.observers_.length; ++i)
- this.observers_[i].onSourceEntriesDeleted(sourceEntryIds);
+ for (var i = 0; i < this.sourceEntryObservers_.length; ++i)
+ this.sourceEntryObservers_[i].onSourceEntriesDeleted(sourceEntryIds);
},
/**
@@ -188,8 +197,10 @@
*/
deleteAllSourceEntries: function() {
this.clearEntries_();
- for (var i = 0; i < this.observers_.length; ++i)
- this.observers_[i].onAllSourceEntriesDeleted();
+ for (var i = 0; i < this.sourceEntryObservers_.length; ++i)
+ this.sourceEntryObservers_[i].onAllSourceEntriesDeleted();
+ for (var i = 0; i < this.logEntryObservers_.length; ++i)
+ this.logEntryObservers_[i].onAllLogEntriesDeleted();
},
/**
@@ -198,9 +209,9 @@
*/
setSecurityStripping: function(enableSecurityStripping) {
this.enableSecurityStripping_ = enableSecurityStripping;
- for (var i = 0; i < this.observers_.length; ++i) {
- if (this.observers_[i].onSecurityStrippingChanged)
- this.observers_[i].onSecurityStrippingChanged();
+ for (var i = 0; i < this.sourceEntryObservers_.length; ++i) {
+ if (this.sourceEntryObservers_[i].onSecurityStrippingChanged)
+ this.sourceEntryObservers_[i].onSecurityStrippingChanged();
}
},
@@ -213,17 +224,28 @@
},
/**
- * Adds a listener of log entries. |observer| will be called back when new
- * log data arrives, source entries are deleted, or security stripping
- * changes through:
+ * Adds a listener of SourceEntries. |observer| will be called back when
+ * SourceEntries are added or modified, source entries are deleted, or
+ * security stripping changes through:
eroman 2011/11/16 04:03:46 nit: "through" seems unnecessary, can probably rem
mmenke 2011/11/16 18:39:35 Done.
*
* observer.onSourceEntriesUpdated(sourceEntries)
- * observer.deleteSourceEntries(sourceEntryIds)
- * ovserver.deleteAllSourceEntries()
+ * observer.onSourceEntriesDeleted(sourceEntryIds)
+ * ovserver.onAllSourceEntriesDeleted()
* observer.onSecurityStrippingChanged()
*/
- addObserver: function(observer) {
- this.observers_.push(observer);
+ addSourceEntryObserver: function(observer) {
+ this.sourceEntryObservers_.push(observer);
+ },
+
+ /**
+ * Adds a listener of log entries. |observer| will be called back when new
+ * log data arrives or all entries are deleted through:
+ *
+ * observer.onReceivedLogEntries(entries)
+ * ovserver.onAllLogEntriesDeleted()
+ */
+ addLogEntryObserver: function(observer) {
+ this.logEntryObservers_.push(observer);
}
};

Powered by Google App Engine
This is Rietveld 408576698