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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js

Issue 2470593002: [Devtools] New network canvas timeline now properly shows initiators (Closed)
Patch Set: changes Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 Receive: "receive", 122 Receive: "receive",
123 Error: "error" 123 Error: "error"
124 }; 124 };
125 125
126 /** @typedef {!{type: WebInspector.NetworkRequest.WebSocketFrameType, time: numb er, text: string, opCode: number, mask: boolean}} */ 126 /** @typedef {!{type: WebInspector.NetworkRequest.WebSocketFrameType, time: numb er, text: string, opCode: number, mask: boolean}} */
127 WebInspector.NetworkRequest.WebSocketFrame; 127 WebInspector.NetworkRequest.WebSocketFrame;
128 128
129 /** @typedef {!{time: number, eventName: string, eventId: string, data: string}} */ 129 /** @typedef {!{time: number, eventName: string, eventId: string, data: string}} */
130 WebInspector.NetworkRequest.EventSourceMessage; 130 WebInspector.NetworkRequest.EventSourceMessage;
131 131
132 /** @typedef {!{initiators: !Set<!WebInspector.NetworkRequest>, initiated: !Set< !WebInspector.NetworkRequest>}} */
133 WebInspector.NetworkRequest.InitiatorGraph;
134
132 WebInspector.NetworkRequest.prototype = { 135 WebInspector.NetworkRequest.prototype = {
133 /** 136 /**
134 * @param {!WebInspector.NetworkRequest} other 137 * @param {!WebInspector.NetworkRequest} other
135 * @return {number} 138 * @return {number}
136 */ 139 */
137 indentityCompare: function(other) 140 indentityCompare: function(other)
138 { 141 {
139 if (this._requestId > other._requestId) 142 if (this._requestId > other._requestId)
140 return 1; 143 return 1;
141 if (this._requestId < other._requestId) 144 if (this._requestId < other._requestId)
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 * @return {?WebInspector.NetworkRequest} 1169 * @return {?WebInspector.NetworkRequest}
1167 */ 1170 */
1168 initiatorRequest: function() 1171 initiatorRequest: function()
1169 { 1172 {
1170 if (this._initiatorRequest === undefined) 1173 if (this._initiatorRequest === undefined)
1171 this._initiatorRequest = this._networkLog.requestForURL(this.initiat orInfo().url); 1174 this._initiatorRequest = this._networkLog.requestForURL(this.initiat orInfo().url);
1172 return this._initiatorRequest; 1175 return this._initiatorRequest;
1173 }, 1176 },
1174 1177
1175 /** 1178 /**
1179 * @return {!WebInspector.NetworkRequest.InitiatorGraph}
1180 */
1181 initiatorGraph: function()
1182 {
1183 var initiated = new Set();
1184 var requests = this._networkLog.requests();
1185 for (var request of requests) {
1186 var localInitiators = request._initiatorChain();
1187 if (localInitiators.has(this))
1188 initiated.add(request);
1189 }
1190 return {initiators: this._initiatorChain(), initiated: initiated};
1191 },
1192
1193 /**
1176 * @return {!Set<!WebInspector.NetworkRequest>} 1194 * @return {!Set<!WebInspector.NetworkRequest>}
1177 */ 1195 */
1178 initiatorChain: function() 1196 _initiatorChain: function()
1179 { 1197 {
1180 if (this._initiatorChain) 1198 if (this._initiatorChainCache)
1181 return this._initiatorChain; 1199 return this._initiatorChainCache;
1182 this._initiatorChain = new Set(); 1200 this._initiatorChainCache = new Set();
1183 var request = this; 1201 var request = this;
1184 while (request) { 1202 while (request) {
1185 this._initiatorChain.add(request); 1203 this._initiatorChainCache.add(request);
1186 request = request.initiatorRequest(); 1204 request = request.initiatorRequest();
1187 } 1205 }
1188 return this._initiatorChain; 1206 return this._initiatorChainCache;
1189 }, 1207 },
1190 1208
1191 /** 1209 /**
1192 * @return {!Array.<!WebInspector.NetworkRequest.WebSocketFrame>} 1210 * @return {!Array.<!WebInspector.NetworkRequest.WebSocketFrame>}
1193 */ 1211 */
1194 frames: function() 1212 frames: function()
1195 { 1213 {
1196 return this._frames; 1214 return this._frames;
1197 }, 1215 },
1198 1216
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 /** 1280 /**
1263 * @return {!WebInspector.NetworkManager} 1281 * @return {!WebInspector.NetworkManager}
1264 */ 1282 */
1265 networkManager: function() 1283 networkManager: function()
1266 { 1284 {
1267 return this._networkManager; 1285 return this._networkManager;
1268 }, 1286 },
1269 1287
1270 __proto__: WebInspector.SDKObject.prototype 1288 __proto__: WebInspector.SDKObject.prototype
1271 }; 1289 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698