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

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

Issue 4118004: Update NetLog to be thread safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync with trunk Created 10 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/main.js
===================================================================
--- chrome/browser/resources/net_internals/main.js (revision 67714)
+++ chrome/browser/resources/net_internals/main.js (working copy)
@@ -308,9 +308,6 @@
//------------------------------------------------------------------------------
BrowserBridge.prototype.receivedLogEntry = function(logEntry) {
- // Silently drop entries received before ready to receive them.
- if (!this.areLogTypesReady_())
- return;
// Assign unique ID, if needed.
if (logEntry.source.id == 0) {
logEntry.source.id = this.nextSourcelessEventId_;
@@ -388,12 +385,27 @@
};
BrowserBridge.prototype.receivedPassiveLogEntries = function(entries) {
- this.numPassivelyCapturedEvents_ += entries.length;
+ // Due to an expected race condition, it is possible to receive actively
+ // captured log entries before the passively logged entries are received.
+ //
+ // When that happens, we create a copy the actively logged entries, delete all
+ // entries, and after handling all the passively logged entries, add back the
+ // actively logged entries.
+ var earlyActivelyCapturedEvents = this.capturedEvents_.slice(0);
+ if (earlyActivelyCapturedEvents.length > 0)
+ this.deleteAllEvents();
+
+ this.numPassivelyCapturedEvents_ = entries.length;
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
entry.wasPassivelyCaptured = true;
this.receivedLogEntry(entry);
}
+
+ // Add back in early actively captured events, if any.
+ for (var i = 0; i < earlyActivelyCapturedEvents.length; ++i) {
+ this.receivedLogEntry(earlyActivelyCapturedEvents[i]);
+ }
};
@@ -427,12 +439,6 @@
this.pollableDataHelpers_.httpCacheInfo.update(info);
};
-BrowserBridge.prototype.areLogTypesReady_ = function() {
- return (LogEventType != null &&
- LogEventPhase != null &&
- LogSourceType != null);
-};
-
//------------------------------------------------------------------------------
/**

Powered by Google App Engine
This is Rietveld 408576698