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

Side by Side Diff: chrome/browser/resources/net_internals/source_tracker.js

Issue 9585026: Add a source id to global NetLog entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Missed one Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/chrome_net_log_unittest.cc ('k') | net/base/capturing_net_log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var SourceTracker = (function() { 5 var SourceTracker = (function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * This class keeps track of all NetLog events, grouped into per-source 9 * This class keeps track of all NetLog events, grouped into per-source
10 * streams. It receives events from EventsTracker, and passes 10 * streams. It receives events from EventsTracker, and passes
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // List source entries with new log entries. Sorted chronologically, by 82 // List source entries with new log entries. Sorted chronologically, by
83 // first new log entry. 83 // first new log entry.
84 var updatedSourceEntries = []; 84 var updatedSourceEntries = [];
85 85
86 var updatedSourceEntryIdMap = {}; 86 var updatedSourceEntryIdMap = {};
87 87
88 for (var e = 0; e < logEntries.length; ++e) { 88 for (var e = 0; e < logEntries.length; ++e) {
89 var logEntry = logEntries[e]; 89 var logEntry = logEntries[e];
90 90
91 // Assign unique ID, if needed. 91 // Assign unique ID, if needed.
92 // TODO(mmenke): Remove this, and all other code to handle 0 source
93 // IDs when M19 hits stable.
92 if (logEntry.source.id == 0) { 94 if (logEntry.source.id == 0) {
93 logEntry.source.id = this.nextSourcelessEventId_; 95 logEntry.source.id = this.nextSourcelessEventId_;
94 --this.nextSourcelessEventId_; 96 --this.nextSourcelessEventId_;
95 } else if (this.maxReceivedSourceId_ < logEntry.source.id) { 97 } else if (this.maxReceivedSourceId_ < logEntry.source.id) {
96 this.maxReceivedSourceId_ = logEntry.source.id; 98 this.maxReceivedSourceId_ = logEntry.source.id;
97 } 99 }
98 100
99 // Create/update SourceEntry object. 101 // Create/update SourceEntry object.
100 var sourceEntry = this.sourceEntries_[logEntry.source.id]; 102 var sourceEntry = this.sourceEntries_[logEntry.source.id];
101 if (!sourceEntry) { 103 if (!sourceEntry) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 * ovserver.onAllSourceEntriesDeleted() 159 * ovserver.onAllSourceEntriesDeleted()
158 * observer.onSecurityStrippingChanged() 160 * observer.onSecurityStrippingChanged()
159 */ 161 */
160 addSourceEntryObserver: function(observer) { 162 addSourceEntryObserver: function(observer) {
161 this.sourceEntryObservers_.push(observer); 163 this.sourceEntryObservers_.push(observer);
162 } 164 }
163 }; 165 };
164 166
165 return SourceTracker; 167 return SourceTracker;
166 })(); 168 })();
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_net_log_unittest.cc ('k') | net/base/capturing_net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698