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

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

Issue 1556018: Add support for attaching custom parameters to NetLog events. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address willchan's comments Created 10 years, 8 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/resources/net_internals/main.js ('k') | net/base/host_resolver_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/sourceentry.js
===================================================================
--- chrome/browser/resources/net_internals/sourceentry.js (revision 44049)
+++ chrome/browser/resources/net_internals/sourceentry.js (working copy)
@@ -61,9 +61,12 @@
};
SourceEntry.prototype.update = function(logEntry) {
+ var prevStartEntry = this.getStartEntry_();
this.entries_.push(logEntry);
+ var curStartEntry = this.getStartEntry_();
- if (this.entries_.length == 1) {
+ // If we just got the first entry for this source.
+ if (!prevStartEntry && curStartEntry) {
this.createRow_();
// Only apply the filter during the first update.
@@ -149,15 +152,30 @@
};
SourceEntry.prototype.getDescription = function() {
- var e = this.entries_[0];
- if (e.type == LogEntryType.TYPE_EVENT &&
- e.event.phase == LogEventPhase.PHASE_BEGIN &&
- e.string != undefined) {
- return e.string; // The URL / hostname / whatever.
- }
- return '';
+ var e = this.getStartEntry_();
+ if (!e || e.extra_parameters == undefined)
+ return '';
+ return e.extra_parameters; // The URL / hostname / whatever.
};
+/**
+ * Returns the starting entry for this source. Conceptually this is the
+ * first entry that was logged to this source. However, we skip over the
+ * TYPE_REQUEST_ALIVE entries which wrap TYPE_URL_REQUEST_START /
+ * TYPE_SOCKET_STREAM_CONNECT.
+ *
+ * TODO(eroman): Get rid of TYPE_REQUEST_ALIVE so this isn't necessary.
+ */
+SourceEntry.prototype.getStartEntry_ = function() {
+ if (this.entries_.length < 1)
+ return undefined;
+ if (this.entries_[0].type != LogEventType.REQUEST_ALIVE)
+ return this.entries_[0];
+ if (this.entries_.length < 2)
+ return undefined;
+ return this.entries_[1];
+};
+
SourceEntry.prototype.getLogEntries = function() {
return this.entries_;
};
« no previous file with comments | « chrome/browser/resources/net_internals/main.js ('k') | net/base/host_resolver_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698