| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
| 4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 /** @type {!Components.Linkifier} */ | 93 /** @type {!Components.Linkifier} */ |
| 94 this.linkifier = new Components.Linkifier(); | 94 this.linkifier = new Components.Linkifier(); |
| 95 | 95 |
| 96 this._recording = false; | 96 this._recording = false; |
| 97 this._preserveLog = false; | 97 this._preserveLog = false; |
| 98 | 98 |
| 99 this._headerHeight = 0; | 99 this._headerHeight = 0; |
| 100 | 100 |
| 101 /** @type {!Map<string, !Network.GroupLookupInterface>} */ | 101 /** @type {!Map<string, !Network.GroupLookupInterface>} */ |
| 102 this._groupLookups = new Map(); | 102 this._groupLookups = new Map(); |
| 103 this._groupLookups.set('Frame', new Network.FrameGrouper(this)); | 103 this._groupLookups.set('Frame', new Network.NetworkFrameGrouper(this)); |
| 104 | 104 |
| 105 /** @type {?Network.GroupLookupInterface} */ | 105 /** @type {?Network.GroupLookupInterface} */ |
| 106 this._activeGroupLookup = null; | 106 this._activeGroupLookup = null; |
| 107 | 107 |
| 108 this._addFilters(); | 108 this._addFilters(); |
| 109 this._resetSuggestionBuilder(); | 109 this._resetSuggestionBuilder(); |
| 110 this._initializeView(); | 110 this._initializeView(); |
| 111 | 111 |
| 112 Common.moduleSetting('networkColorCodeResourceTypes') | 112 Common.moduleSetting('networkColorCodeResourceTypes') |
| 113 .addChangeListener(this._invalidateAllItems.bind(this, false), this); | 113 .addChangeListener(this._invalidateAllItems.bind(this, false), this); |
| 114 | 114 |
| 115 SDK.targetManager.observeModels(SDK.NetworkManager, this); | 115 SDK.targetManager.observeModels(SDK.NetworkManager, this); |
| 116 SDK.targetManager.addModelListener( | 116 SDK.targetManager.addModelListener( |
| 117 SDK.NetworkManager, SDK.NetworkManager.Events.RequestStarted, this._onRe
questStarted, this); | 117 SDK.NetworkManager, SDK.NetworkManager.Events.RequestStarted, this._onRe
questStarted, this); |
| 118 SDK.targetManager.addModelListener( | 118 SDK.targetManager.addModelListener( |
| 119 SDK.NetworkManager, SDK.NetworkManager.Events.RequestUpdated, this._onRe
questUpdated, this); | 119 SDK.NetworkManager, SDK.NetworkManager.Events.RequestUpdated, this._onRe
questUpdated, this); |
| 120 SDK.targetManager.addModelListener( | 120 SDK.targetManager.addModelListener( |
| 121 SDK.NetworkManager, SDK.NetworkManager.Events.RequestFinished, this._onR
equestUpdated, this); | 121 SDK.NetworkManager, SDK.NetworkManager.Events.RequestFinished, this._onR
equestUpdated, this); |
| 122 |
| 123 this._updateGroupByFrame(); |
| 124 Common.moduleSetting('network.group-by-frame').addChangeListener(() => this.
_updateGroupByFrame()); |
| 125 } |
| 126 |
| 127 _updateGroupByFrame() { |
| 128 var value = Common.moduleSetting('network.group-by-frame').get(); |
| 129 this._setGrouping(value ? 'Frame' : null); |
| 122 } | 130 } |
| 123 | 131 |
| 124 /** | 132 /** |
| 125 * @param {!Network.NetworkLogView.Filter} filter | 133 * @param {!Network.NetworkLogView.Filter} filter |
| 126 * @param {!SDK.NetworkRequest} request | 134 * @param {!SDK.NetworkRequest} request |
| 127 * @return {boolean} | 135 * @return {boolean} |
| 128 */ | 136 */ |
| 129 static _negativeFilter(filter, request) { | 137 static _negativeFilter(filter, request) { |
| 130 return !filter(request); | 138 return !filter(request); |
| 131 } | 139 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 */ | 352 */ |
| 345 static _requestTimeFilter(windowStart, windowEnd, request) { | 353 static _requestTimeFilter(windowStart, windowEnd, request) { |
| 346 if (request.issueTime() > windowEnd) | 354 if (request.issueTime() > windowEnd) |
| 347 return false; | 355 return false; |
| 348 if (request.endTime !== -1 && request.endTime < windowStart) | 356 if (request.endTime !== -1 && request.endTime < windowStart) |
| 349 return false; | 357 return false; |
| 350 return true; | 358 return true; |
| 351 } | 359 } |
| 352 | 360 |
| 353 /** | 361 /** |
| 354 * @return {!Map<string, !Network.GroupLookupInterface>} | 362 * @param {?string} groupKey |
| 355 */ | 363 */ |
| 356 groupLookups() { | 364 _setGrouping(groupKey) { |
| 357 return this._groupLookups; | 365 var groupLookup = groupKey ? this._groupLookups.get(groupKey) || null : null
; |
| 366 this._activeGroupLookup = groupLookup; |
| 367 if (groupLookup) |
| 368 groupLookup.reset(); |
| 369 this._invalidateAllItems(); |
| 358 } | 370 } |
| 359 | 371 |
| 360 /** | 372 /** |
| 361 * @param {string} groupKey | |
| 362 */ | |
| 363 setGrouping(groupKey) { | |
| 364 var groupLookup = this._groupLookups.get(groupKey) || null; | |
| 365 this._activeGroupLookup = groupLookup; | |
| 366 if (!groupLookup) { | |
| 367 this._invalidateAllItems(); | |
| 368 return; | |
| 369 } | |
| 370 groupLookup.initialize().then(() => { | |
| 371 if (this._activeGroupLookup !== groupLookup) | |
| 372 return; | |
| 373 this._activeGroupLookup.reset(); | |
| 374 this._invalidateAllItems(); | |
| 375 }); | |
| 376 } | |
| 377 | |
| 378 /** | |
| 379 * @param {!SDK.NetworkRequest} request | 373 * @param {!SDK.NetworkRequest} request |
| 380 * @return {?Network.NetworkRequestNode} | 374 * @return {?Network.NetworkRequestNode} |
| 381 */ | 375 */ |
| 382 nodeForRequest(request) { | 376 nodeForRequest(request) { |
| 383 return this._nodesByRequestId.get(request.requestId()); | 377 return this._nodesByRequestId.get(request.requestId()); |
| 384 } | 378 } |
| 385 | 379 |
| 386 /** | 380 /** |
| 387 * @return {number} | 381 * @return {number} |
| 388 */ | 382 */ |
| (...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 /** @typedef {function(!SDK.NetworkRequest): boolean} */ | 1810 /** @typedef {function(!SDK.NetworkRequest): boolean} */ |
| 1817 Network.NetworkLogView.Filter; | 1811 Network.NetworkLogView.Filter; |
| 1818 | 1812 |
| 1819 /** | 1813 /** |
| 1820 * @interface | 1814 * @interface |
| 1821 */ | 1815 */ |
| 1822 Network.GroupLookupInterface = function() {}; | 1816 Network.GroupLookupInterface = function() {}; |
| 1823 | 1817 |
| 1824 Network.GroupLookupInterface.prototype = { | 1818 Network.GroupLookupInterface.prototype = { |
| 1825 /** | 1819 /** |
| 1826 * @return {!Promise} | |
| 1827 */ | |
| 1828 initialize: function() {}, | |
| 1829 | |
| 1830 /** | |
| 1831 * @param {!SDK.NetworkRequest} request | 1820 * @param {!SDK.NetworkRequest} request |
| 1832 * @return {?Network.NetworkGroupNode} | 1821 * @return {?Network.NetworkGroupNode} |
| 1833 */ | 1822 */ |
| 1834 groupNodeForRequest: function(request) {}, | 1823 groupNodeForRequest: function(request) {}, |
| 1835 | 1824 |
| 1836 reset: function() {} | 1825 reset: function() {} |
| 1837 }; | 1826 }; |
| OLD | NEW |