Chromium Code Reviews| Index: chrome/browser/resources/net_internals/main.js |
| =================================================================== |
| --- chrome/browser/resources/net_internals/main.js (revision 65207) |
| +++ chrome/browser/resources/net_internals/main.js (working copy) |
| @@ -189,6 +189,13 @@ |
| this.numPassivelyCapturedEvents_ = 0; |
| this.capturedEvents_ = []; |
| + // It's possible for a few actively captured events to be received before any |
| + // passively captured events. When this happens, the actively captured |
| + // events aren't processed until after the passively captured events have been |
| + // received. |
| + this.receivedPassivelyCapturedEvents_ = false; |
| + this.delayedActivelyCapturedEvents_ = []; |
| + |
| // Next unique id to be assigned to a log entry without a source. |
| // Needed to simplify deletion, identify associated GUI elements, etc. |
| this.nextSourcelessEventId_ = -1; |
| @@ -308,9 +315,11 @@ |
| //------------------------------------------------------------------------------ |
| BrowserBridge.prototype.receivedLogEntry = function(logEntry) { |
| - // Silently drop entries received before ready to receive them. |
| - if (!this.areLogTypesReady_()) |
| + // Delay processing any active events received before passive events. |
| + if (!this.receivedPassivelyCapturedEvents_) { |
|
eroman
2010/11/18 18:04:03
What I don't like about this approach, is we pay a
mmenke
2010/11/23 16:48:45
Don't really like the idea of starting to populate
|
| + this.delayedActivelyCapturedEvents_.push(logEntry); |
| return; |
| + } |
| // Assign unique ID, if needed. |
| if (logEntry.source.id == 0) { |
| logEntry.source.id = this.nextSourcelessEventId_; |
| @@ -389,11 +398,17 @@ |
| BrowserBridge.prototype.receivedPassiveLogEntries = function(entries) { |
| this.numPassivelyCapturedEvents_ += entries.length; |
| + this.receivedPassivelyCapturedEvents_ = true; |
| for (var i = 0; i < entries.length; ++i) { |
| var entry = entries[i]; |
| entry.wasPassivelyCaptured = true; |
| this.receivedLogEntry(entry); |
| } |
| + // Handle delayed actively captured events, if any. |
| + for (var i = 0; i < this.delayedActivelyCapturedEvents_.length; ++i) { |
| + this.receivedLogEntry(this.delayedActivelyCapturedEvents_[i]); |
| + } |
| + this.delayedActivelyCapturedEvents_ = []; |
| }; |
| @@ -427,12 +442,6 @@ |
| this.pollableDataHelpers_.httpCacheInfo.update(info); |
| }; |
| -BrowserBridge.prototype.areLogTypesReady_ = function() { |
| - return (LogEventType != null && |
| - LogEventPhase != null && |
| - LogSourceType != null); |
| -}; |
| - |
| //------------------------------------------------------------------------------ |
| /** |