diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-12 17:38:16 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-12 17:38:16 +0000 |
commit | d2cbfbecea747a8f122acddda8075bcf7ba9b53e (patch) | |
tree | afc07994409290f7ca0436130999af32481a518e /chrome | |
parent | 10987f444135ee7a7eb014972f305f6cde90ac97 (diff) | |
download | chromium_src-d2cbfbecea747a8f122acddda8075bcf7ba9b53e.zip chromium_src-d2cbfbecea747a8f122acddda8075bcf7ba9b53e.tar.gz chromium_src-d2cbfbecea747a8f122acddda8075bcf7ba9b53e.tar.bz2 |
Net-internal's Javascript code no longer requires all enties have a unique source id. It will assign entries with a source type of NONE their own unique negative id, which will never be displayed.
Also, the id column in the Requests tab is now right-aligned.
BUG= 48806
TEST= Run chromium while your ip address changes.
Alternatively, add the following code to
ConnectJob::LogConnectStart(), or somewhere else
that looks promising:
net_log().net_log()->AddEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSSES_CHANGED,
base::TimeTicks::Now(),
net::NetLog::Source(),
net::NetLog::PHASE_NONE,
NULL);
Review URL: http://codereview.chromium.org/2883061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/io_thread.cc | 10 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/dataview.js | 18 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/requestsview.js | 17 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/sourceentry.js | 12 |
4 files changed, 36 insertions, 21 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 3d1adb3..21d71b3 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -111,17 +111,9 @@ class LoggingNetworkChangeObserver virtual void OnIPAddressChanged() { LOG(INFO) << "Observed a change to the network IP addresses"; - net::NetLog::Source global_source; - - // TODO(eroman): We shouldn't need to assign an ID to this source, since - // conceptually it is the "global event stream". However - // currently the javascript does a grouping on source id, so - // the display will look weird if we don't give it one. - global_source.id = net_log_->NextID(); - net_log_->AddEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSSES_CHANGED, base::TimeTicks::Now(), - global_source, + net::NetLog::Source(), net::NetLog::PHASE_NONE, NULL); } diff --git a/chrome/browser/resources/net_internals/dataview.js b/chrome/browser/resources/net_internals/dataview.js index 4a1ce73..c4b08eb 100644 --- a/chrome/browser/resources/net_internals/dataview.js +++ b/chrome/browser/resources/net_internals/dataview.js @@ -146,14 +146,19 @@ DataView.prototype.appendRequestsPrintedAsText_ = function(out) { // Group the events into buckets by source ID, and buckets by source type. var sourceIds = []; var sourceIdToEventList = {}; - var sourceTypeToSourceIdList = {} + var sourceTypeToSourceIdList = {}; + + // Lists used for actual output. + var eventLists = []; for (var i = 0; i < allEvents.length; ++i) { var e = allEvents[i]; var eventList = sourceIdToEventList[e.source.id]; if (!eventList) { eventList = []; - sourceIdToEventList[e.source.id] = eventList; + eventLists.push(eventList); + if (e.source.type != LogSourceType.NONE) + sourceIdToEventList[e.source.id] = eventList; // Update sourceIds sourceIds.push(e.source.id); @@ -170,10 +175,11 @@ DataView.prototype.appendRequestsPrintedAsText_ = function(out) { } - // For each source (ordered by when that source was first started). - for (var i = 0; i < sourceIds.length; ++i) { - var sourceId = sourceIds[i]; - var eventList = sourceIdToEventList[sourceId]; + // For each source or event without a source (ordered by when the first + // output event for that source happened). + for (var i = 0; i < eventLists.length; ++i) { + var eventList = eventLists[i]; + var sourceId = eventList[0].source.id; var sourceType = eventList[0].source.type; var startDate = g_browser.convertTimeTicksToDate(eventList[0].time); diff --git a/chrome/browser/resources/net_internals/requestsview.js b/chrome/browser/resources/net_internals/requestsview.js index 2d16704..27209613 100644 --- a/chrome/browser/resources/net_internals/requestsview.js +++ b/chrome/browser/resources/net_internals/requestsview.js @@ -32,6 +32,9 @@ function RequestsView(tableBodyId, filterInputId, filterCountId, topbarId, middleboxId, bottombarId, sizerId) { View.call(this); + // Next unique id to be assigned to a log entry without a source. + this.nextId_ = -1; + // Initialize the sub-views. var leftPane = new TopMidBottomView(new DivView(topbarId), new DivView(middleboxId), @@ -103,12 +106,20 @@ RequestsView.prototype.setFilter_ = function(filterText) { }; RequestsView.prototype.onLogEntryAdded = function(logEntry) { + var id = logEntry.source.id; + + // Assign a unique source ID, if it has no source. + if (logEntry.source.type == LogSourceType.NONE) { + id = this.nextId_; + --this.nextId_; + } + // Lookup the source. - var sourceEntry = this.sourceIdToEntryMap_[logEntry.source.id]; + var sourceEntry = this.sourceIdToEntryMap_[id]; if (!sourceEntry) { - sourceEntry = new SourceEntry(this); - this.sourceIdToEntryMap_[logEntry.source.id] = sourceEntry; + sourceEntry = new SourceEntry(this, id); + this.sourceIdToEntryMap_[id] = sourceEntry; this.incrementPrefilterCount(1); } diff --git a/chrome/browser/resources/net_internals/sourceentry.js b/chrome/browser/resources/net_internals/sourceentry.js index 74313d2..2cbbf4e 100644 --- a/chrome/browser/resources/net_internals/sourceentry.js +++ b/chrome/browser/resources/net_internals/sourceentry.js @@ -9,7 +9,8 @@ * * @constructor */ -function SourceEntry(parentView) { +function SourceEntry(parentView, id) { + this.id_ = id; this.entries_ = []; this.parentView_ = parentView; this.isSelected_ = false; @@ -126,6 +127,8 @@ SourceEntry.prototype.createRow_ = function() { checkbox.type = 'checkbox'; var idCell = addNode(tr, 'td'); + idCell.style.textAlign = 'right'; + var typeCell = addNode(tr, 'td'); var descriptionCell = addNode(tr, 'td'); @@ -141,7 +144,10 @@ SourceEntry.prototype.createRow_ = function() { tr.onmouseout = this.onMouseout_.bind(this); // Set the cell values to match this source's data. - addTextNode(idCell, this.getSourceId()); + if (this.getSourceId() >= 0) + addTextNode(idCell, this.getSourceId()); + else + addTextNode(idCell, "-"); var sourceTypeString = this.getSourceTypeString(); addTextNode(typeCell, sourceTypeString); addTextNode(descriptionCell, this.getDescription()); @@ -210,7 +216,7 @@ SourceEntry.prototype.getSelectionCheckbox = function() { }; SourceEntry.prototype.getSourceId = function() { - return this.entries_[0].source.id; + return this.id_; }; SourceEntry.prototype.remove = function() { |