OLD | NEW |
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 SourceEntry = (function() { | 5 var SourceEntry = (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * A SourceEntry gathers all log entries with the same source. | 9 * A SourceEntry gathers all log entries with the same source. |
10 * | 10 * |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // Otherwise, if the file was opened, use that name | 187 // Otherwise, if the file was opened, use that name |
188 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_FILE_OPENED); | 188 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_FILE_OPENED); |
189 if (e != undefined) | 189 if (e != undefined) |
190 return e; | 190 return e; |
191 // History items are never opened, so use the activation info | 191 // History items are never opened, so use the activation info |
192 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_ITEM_ACTIVE); | 192 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_ITEM_ACTIVE); |
193 if (e != undefined) | 193 if (e != undefined) |
194 return e; | 194 return e; |
195 } | 195 } |
196 if (this.entries_.length >= 2) { | 196 if (this.entries_.length >= 2) { |
197 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE || | 197 if (this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB || |
198 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB || | |
199 this.entries_[1].type == LogEventType.UDP_CONNECT) { | 198 this.entries_[1].type == LogEventType.UDP_CONNECT) { |
200 return this.entries_[1]; | 199 return this.entries_[1]; |
201 } | 200 } |
| 201 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE) { |
| 202 var start_index = 1; |
| 203 // Skip over URL_REQUEST_BLOCKED_ON_DELEGATE events for URL_REQUESTs. |
| 204 while (start_index + 1 < this.entries_.length && |
| 205 this.entries_[start_index].type == |
| 206 LogEventType.URL_REQUEST_BLOCKED_ON_DELEGATE) { |
| 207 ++start_index; |
| 208 } |
| 209 return this.entries_[start_index]; |
| 210 } |
202 } | 211 } |
203 return this.entries_[0]; | 212 return this.entries_[0]; |
204 }, | 213 }, |
205 | 214 |
206 /** | 215 /** |
207 * Returns the first entry with the specified type, or undefined if not | 216 * Returns the first entry with the specified type, or undefined if not |
208 * found. | 217 * found. |
209 */ | 218 */ |
210 findLogEntryByType_: function(type) { | 219 findLogEntryByType_: function(type) { |
211 for (var i = 0; i < this.entries_.length; ++i) { | 220 for (var i = 0; i < this.entries_.length; ++i) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 * Prints descriptive text about |entries_| to a new node added to the end | 299 * Prints descriptive text about |entries_| to a new node added to the end |
291 * of |parent|. | 300 * of |parent|. |
292 */ | 301 */ |
293 printAsText: function(parent) { | 302 printAsText: function(parent) { |
294 printLogEntriesAsText(this.entries_, parent); | 303 printLogEntriesAsText(this.entries_, parent); |
295 } | 304 } |
296 }; | 305 }; |
297 | 306 |
298 return SourceEntry; | 307 return SourceEntry; |
299 })(); | 308 })(); |
OLD | NEW |