| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 5 /** |
| 6 * This class keeps track of all NetLog events. | 6 * This class keeps track of all NetLog events. |
| 7 * It receives events from the browser and when loading a log file, and passes | 7 * It receives events from the browser and when loading a log file, and passes |
| 8 * them on to all its observers. | 8 * them on to all its observers. |
| 9 * | 9 * |
| 10 * @constructor | 10 * @constructor |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return this.numPassivelyCapturedEvents_; | 70 return this.numPassivelyCapturedEvents_; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Returns the specified SourceEntry. | 74 * Returns the specified SourceEntry. |
| 75 */ | 75 */ |
| 76 SourceTracker.prototype.getSourceEntry = function(id) { | 76 SourceTracker.prototype.getSourceEntry = function(id) { |
| 77 return this.sourceEntries_[id]; | 77 return this.sourceEntries_[id]; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 /** |
| 81 * Returns the description of the specified SourceEntry, or an empty string if |
| 82 * it doesn't exist. |
| 83 */ |
| 84 SourceTracker.prototype.getDescription = function(id) { |
| 85 var entry = this.getSourceEntry(id); |
| 86 if (entry) |
| 87 return entry.getDescription(); |
| 88 return ''; |
| 89 }; |
| 90 |
| 80 SourceTracker.prototype.onReceivedPassiveLogEntries = function(logEntries) { | 91 SourceTracker.prototype.onReceivedPassiveLogEntries = function(logEntries) { |
| 81 // Due to an expected race condition, it is possible to receive actively | 92 // Due to an expected race condition, it is possible to receive actively |
| 82 // captured log entries before the passively logged entries are received. | 93 // captured log entries before the passively logged entries are received. |
| 83 // | 94 // |
| 84 // When that happens, we create a copy of the actively logged entries, delete | 95 // When that happens, we create a copy of the actively logged entries, delete |
| 85 // all entries, and, after handling all the passively logged entries, add back | 96 // all entries, and, after handling all the passively logged entries, add back |
| 86 // the deleted actively logged entries. | 97 // the deleted actively logged entries. |
| 87 var earlyActivelyCapturedEvents = this.capturedEvents_.slice(0); | 98 var earlyActivelyCapturedEvents = this.capturedEvents_.slice(0); |
| 88 if (earlyActivelyCapturedEvents.length > 0) | 99 if (earlyActivelyCapturedEvents.length > 0) |
| 89 this.deleteAllSourceEntries(); | 100 this.deleteAllSourceEntries(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 * through: | 215 * through: |
| 205 * | 216 * |
| 206 * observer.onSourceEntriesUpdated(sourceEntries) | 217 * observer.onSourceEntriesUpdated(sourceEntries) |
| 207 * observer.deleteSourceEntries(sourceEntryIds) | 218 * observer.deleteSourceEntries(sourceEntryIds) |
| 208 * ovserver.deleteAllSourceEntries() | 219 * ovserver.deleteAllSourceEntries() |
| 209 * observer.onSecurityStrippingChanged() | 220 * observer.onSecurityStrippingChanged() |
| 210 */ | 221 */ |
| 211 SourceTracker.prototype.addObserver = function(observer) { | 222 SourceTracker.prototype.addObserver = function(observer) { |
| 212 this.observers_.push(observer); | 223 this.observers_.push(observer); |
| 213 }; | 224 }; |
| OLD | NEW |