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

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

Issue 2969473002: Stop warning "missing clientInfo.numericDate" when loading (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | chrome/test/data/webui/net_internals/log_util.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/log_util.js
diff --git a/chrome/browser/resources/net_internals/log_util.js b/chrome/browser/resources/net_internals/log_util.js
index 623bc27ed2d3834d29d4b66c4f7828cb90b0449c..f690352a5caefeef6680b8f9c2e18fb1b310926a 100644
--- a/chrome/browser/resources/net_internals/log_util.js
+++ b/chrome/browser/resources/net_internals/log_util.js
@@ -166,20 +166,29 @@ log_util = (function() {
}
}
- // Make sure the loaded log contained an export date. If not we will
- // synthesize one. This can legitimately happen for dump files created
- // via command line flag, or for older dump formats (before Chrome 17).
+ // Determine the export date for the loaded log.
+ //
+ // Dumps created from chrome://net-internals (Chrome 17 - Chrome 59) will
+ // have this set in constants.clientInfo.numericDate.
+ //
+ // However more recent dumping mechanisms (chrome://net-export/ and
+ // --log-net-log) write the constants object directly to a file when the
+ // dump is *started* so lack this ability.
+ //
+ // In this case, we will synthesize this field by looking at the timestamp
+ // of the last event logged. In practice this works fine since there tend
+ // to be lots of events logged.
+ //
+ // TODO(eroman): Fix the log format / writers to avoid this problem. Dumps
+ // *should* contain the time when capturing started, and when capturing
+ // ended.
if (typeof logDump.constants.clientInfo.numericDate != 'number') {
- errorString += 'The log file is missing clientInfo.numericDate.\n';
-
if (validEvents.length > 0) {
- errorString +=
- 'Synthesizing export date as time of last event captured.\n';
var lastEvent = validEvents[validEvents.length - 1];
ClientInfo.numericDate =
timeutil.convertTimeTicksToDate(lastEvent.time).getTime();
} else {
- errorString += 'Can\'t guess export date!\n';
+ errorString += 'Can\'t guess export date as there are no events.\n';
ClientInfo.numericDate = 0;
}
}
« no previous file with comments | « no previous file | chrome/test/data/webui/net_internals/log_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698