| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 */ | 33 */ |
| 34 SDK.NetworkLog = class extends SDK.SDKModel { | 34 SDK.NetworkLog = class extends SDK.SDKModel { |
| 35 /** | 35 /** |
| 36 * @param {!SDK.Target} target | 36 * @param {!SDK.Target} target |
| 37 * @param {!SDK.ResourceTreeModel} resourceTreeModel | 37 * @param {!SDK.ResourceTreeModel} resourceTreeModel |
| 38 * @param {!SDK.NetworkManager} networkManager | 38 * @param {!SDK.NetworkManager} networkManager |
| 39 */ | 39 */ |
| 40 constructor(target, resourceTreeModel, networkManager) { | 40 constructor(target, resourceTreeModel, networkManager) { |
| 41 super(SDK.NetworkLog, target); | 41 super(SDK.NetworkLog, target); |
| 42 | 42 |
| 43 /** @type {!Array<!SDK.NetworkRequest>} */ |
| 43 this._requests = []; | 44 this._requests = []; |
| 45 /** @type {!Object<string, !SDK.NetworkRequest>} */ |
| 44 this._requestForId = {}; | 46 this._requestForId = {}; |
| 45 networkManager.addEventListener(SDK.NetworkManager.Events.RequestStarted, th
is._onRequestStarted, this); | 47 networkManager.addEventListener(SDK.NetworkManager.Events.RequestStarted, th
is._onRequestStarted, this); |
| 46 resourceTreeModel.addEventListener( | 48 resourceTreeModel.addEventListener( |
| 47 SDK.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNaviga
ted, this); | 49 SDK.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNaviga
ted, this); |
| 48 resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.Load, this._
onLoad, this); | 50 resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.Load, this._
onLoad, this); |
| 49 resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.DOMContentLo
aded, this._onDOMContentLoaded, this); | 51 resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.DOMContentLo
aded, this._onDOMContentLoaded, this); |
| 50 } | 52 } |
| 51 | 53 |
| 52 /** | 54 /** |
| 53 * @param {!SDK.Target} target | 55 * @param {!SDK.Target} target |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 requests() { | 92 requests() { |
| 91 return this._requests; | 93 return this._requests; |
| 92 } | 94 } |
| 93 | 95 |
| 94 /** | 96 /** |
| 95 * @param {string} url | 97 * @param {string} url |
| 96 * @return {?SDK.NetworkRequest} | 98 * @return {?SDK.NetworkRequest} |
| 97 */ | 99 */ |
| 98 requestForURL(url) { | 100 requestForURL(url) { |
| 99 for (var i = 0; i < this._requests.length; ++i) { | 101 for (var i = 0; i < this._requests.length; ++i) { |
| 100 if (this._requests[i].url === url) | 102 if (this._requests[i].url() === url) |
| 101 return this._requests[i]; | 103 return this._requests[i]; |
| 102 } | 104 } |
| 103 return null; | 105 return null; |
| 104 } | 106 } |
| 105 | 107 |
| 106 /** | 108 /** |
| 107 * @param {!SDK.NetworkRequest} request | 109 * @param {!SDK.NetworkRequest} request |
| 108 * @return {!SDK.PageLoad} | 110 * @return {!SDK.PageLoad} |
| 109 */ | 111 */ |
| 110 pageLoadForRequest(request) { | 112 pageLoadForRequest(request) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 172 |
| 171 /** | 173 /** |
| 172 * @unrestricted | 174 * @unrestricted |
| 173 */ | 175 */ |
| 174 SDK.PageLoad = class { | 176 SDK.PageLoad = class { |
| 175 /** | 177 /** |
| 176 * @param {!SDK.NetworkRequest} mainRequest | 178 * @param {!SDK.NetworkRequest} mainRequest |
| 177 */ | 179 */ |
| 178 constructor(mainRequest) { | 180 constructor(mainRequest) { |
| 179 this.id = ++SDK.PageLoad._lastIdentifier; | 181 this.id = ++SDK.PageLoad._lastIdentifier; |
| 180 this.url = mainRequest.url; | 182 this.url = mainRequest.url(); |
| 181 this.startTime = mainRequest.startTime; | 183 this.startTime = mainRequest.startTime; |
| 182 } | 184 } |
| 183 }; | 185 }; |
| 184 | 186 |
| 185 SDK.PageLoad._lastIdentifier = 0; | 187 SDK.PageLoad._lastIdentifier = 0; |
| OLD | NEW |