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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline 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
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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @param {!WebInspector.TimelineModel.Filter} eventFilter 33 * @param {!WebInspector.TimelineModel.Filter} eventFilter
34 */ 34 */
35 WebInspector.TimelineModel = function(eventFilter) 35 WebInspector.TimelineModel = function(eventFilter)
36 { 36 {
37 this._eventFilter = eventFilter; 37 this._eventFilter = eventFilter;
38 this.reset(); 38 this.reset();
39 } 39 };
40 40
41 /** 41 /**
42 * @enum {string} 42 * @enum {string}
43 */ 43 */
44 WebInspector.TimelineModel.RecordType = { 44 WebInspector.TimelineModel.RecordType = {
45 Task: "Task", 45 Task: "Task",
46 Program: "Program", 46 Program: "Program",
47 EventDispatch: "EventDispatch", 47 EventDispatch: "EventDispatch",
48 48
49 GPUTask: "GPUTask", 49 GPUTask: "GPUTask",
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 InputLatencyMouseWheel: "InputLatency::MouseWheel", 156 InputLatencyMouseWheel: "InputLatency::MouseWheel",
157 ImplSideFling: "InputHandlerProxy::HandleGestureFling::started", 157 ImplSideFling: "InputHandlerProxy::HandleGestureFling::started",
158 GCIdleLazySweep: "ThreadState::performIdleLazySweep", 158 GCIdleLazySweep: "ThreadState::performIdleLazySweep",
159 GCCompleteSweep: "ThreadState::completeSweep", 159 GCCompleteSweep: "ThreadState::completeSweep",
160 GCCollectGarbage: "BlinkGCMarking", 160 GCCollectGarbage: "BlinkGCMarking",
161 161
162 // CpuProfile is a virtual event created on frontend to support 162 // CpuProfile is a virtual event created on frontend to support
163 // serialization of CPU Profiles within tracing timeline data. 163 // serialization of CPU Profiles within tracing timeline data.
164 CpuProfile: "CpuProfile", 164 CpuProfile: "CpuProfile",
165 Profile: "Profile" 165 Profile: "Profile"
166 } 166 };
167 167
168 WebInspector.TimelineModel.Category = { 168 WebInspector.TimelineModel.Category = {
169 Console: "blink.console", 169 Console: "blink.console",
170 UserTiming: "blink.user_timing", 170 UserTiming: "blink.user_timing",
171 LatencyInfo: "latencyInfo" 171 LatencyInfo: "latencyInfo"
172 }; 172 };
173 173
174 /** 174 /**
175 * @enum {string} 175 * @enum {string}
176 */ 176 */
177 WebInspector.TimelineModel.WarningType = { 177 WebInspector.TimelineModel.WarningType = {
178 ForcedStyle: "ForcedStyle", 178 ForcedStyle: "ForcedStyle",
179 ForcedLayout: "ForcedLayout", 179 ForcedLayout: "ForcedLayout",
180 IdleDeadlineExceeded: "IdleDeadlineExceeded", 180 IdleDeadlineExceeded: "IdleDeadlineExceeded",
181 V8Deopt: "V8Deopt" 181 V8Deopt: "V8Deopt"
182 } 182 };
183 183
184 WebInspector.TimelineModel.MainThreadName = "main"; 184 WebInspector.TimelineModel.MainThreadName = "main";
185 WebInspector.TimelineModel.WorkerThreadName = "DedicatedWorker Thread"; 185 WebInspector.TimelineModel.WorkerThreadName = "DedicatedWorker Thread";
186 WebInspector.TimelineModel.RendererMainThreadName = "CrRendererMain"; 186 WebInspector.TimelineModel.RendererMainThreadName = "CrRendererMain";
187 187
188 /** 188 /**
189 * @enum {symbol} 189 * @enum {symbol}
190 */ 190 */
191 WebInspector.TimelineModel.AsyncEventGroup = { 191 WebInspector.TimelineModel.AsyncEventGroup = {
192 animation: Symbol("animation"), 192 animation: Symbol("animation"),
(...skipping 27 matching lines...) Expand all
220 onEndEvent(stack.pop()); 220 onEndEvent(stack.pop());
221 if (e.duration) { 221 if (e.duration) {
222 onStartEvent(e); 222 onStartEvent(e);
223 stack.push(e); 223 stack.push(e);
224 } else { 224 } else {
225 onInstantEvent && onInstantEvent(e, stack.peekLast() || null); 225 onInstantEvent && onInstantEvent(e, stack.peekLast() || null);
226 } 226 }
227 } 227 }
228 while (stack.length) 228 while (stack.length)
229 onEndEvent(stack.pop()); 229 onEndEvent(stack.pop());
230 } 230 };
231 231
232 WebInspector.TimelineModel.DevToolsMetadataEvent = { 232 WebInspector.TimelineModel.DevToolsMetadataEvent = {
233 TracingStartedInBrowser: "TracingStartedInBrowser", 233 TracingStartedInBrowser: "TracingStartedInBrowser",
234 TracingStartedInPage: "TracingStartedInPage", 234 TracingStartedInPage: "TracingStartedInPage",
235 TracingSessionIdForWorker: "TracingSessionIdForWorker", 235 TracingSessionIdForWorker: "TracingSessionIdForWorker",
236 }; 236 };
237 237
238 /** 238 /**
239 * @constructor 239 * @constructor
240 * @param {string} name 240 * @param {string} name
241 */ 241 */
242 WebInspector.TimelineModel.VirtualThread = function(name) 242 WebInspector.TimelineModel.VirtualThread = function(name)
243 { 243 {
244 this.name = name; 244 this.name = name;
245 /** @type {!Array<!WebInspector.TracingModel.Event>} */ 245 /** @type {!Array<!WebInspector.TracingModel.Event>} */
246 this.events = []; 246 this.events = [];
247 /** @type {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!WebInsp ector.TracingModel.AsyncEvent>>} */ 247 /** @type {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!WebInsp ector.TracingModel.AsyncEvent>>} */
248 this.asyncEventsByGroup = new Map(); 248 this.asyncEventsByGroup = new Map();
249 } 249 };
250 250
251 WebInspector.TimelineModel.VirtualThread.prototype = { 251 WebInspector.TimelineModel.VirtualThread.prototype = {
252 /** 252 /**
253 * @return {boolean} 253 * @return {boolean}
254 */ 254 */
255 isWorker: function() 255 isWorker: function()
256 { 256 {
257 return this.name === WebInspector.TimelineModel.WorkerThreadName; 257 return this.name === WebInspector.TimelineModel.WorkerThreadName;
258 } 258 }
259 } 259 };
260 260
261 /** 261 /**
262 * @constructor 262 * @constructor
263 * @param {!WebInspector.TracingModel.Event} traceEvent 263 * @param {!WebInspector.TracingModel.Event} traceEvent
264 */ 264 */
265 WebInspector.TimelineModel.Record = function(traceEvent) 265 WebInspector.TimelineModel.Record = function(traceEvent)
266 { 266 {
267 this._event = traceEvent; 267 this._event = traceEvent;
268 this._children = []; 268 this._children = [];
269 } 269 };
270 270
271 /** 271 /**
272 * @param {!WebInspector.TimelineModel.Record} a 272 * @param {!WebInspector.TimelineModel.Record} a
273 * @param {!WebInspector.TimelineModel.Record} b 273 * @param {!WebInspector.TimelineModel.Record} b
274 * @return {number} 274 * @return {number}
275 */ 275 */
276 WebInspector.TimelineModel.Record._compareStartTime = function(a, b) 276 WebInspector.TimelineModel.Record._compareStartTime = function(a, b)
277 { 277 {
278 // Never return 0 as otherwise equal records would be merged. 278 // Never return 0 as otherwise equal records would be merged.
279 return a.startTime() <= b.startTime() ? -1 : 1; 279 return a.startTime() <= b.startTime() ? -1 : 1;
280 } 280 };
281 281
282 WebInspector.TimelineModel.Record.prototype = { 282 WebInspector.TimelineModel.Record.prototype = {
283 /** 283 /**
284 * @return {?WebInspector.Target} 284 * @return {?WebInspector.Target}
285 */ 285 */
286 target: function() 286 target: function()
287 { 287 {
288 var threadName = this._event.thread.name(); 288 var threadName = this._event.thread.name();
289 // FIXME: correctly specify target 289 // FIXME: correctly specify target
290 return threadName === WebInspector.TimelineModel.RendererMainThreadName ? WebInspector.targetManager.targets()[0] || null : null; 290 return threadName === WebInspector.TimelineModel.RendererMainThreadName ? WebInspector.targetManager.targets()[0] || null : null;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 }, 363 },
364 364
365 /** 365 /**
366 * @param {!WebInspector.TimelineModel.Record} child 366 * @param {!WebInspector.TimelineModel.Record} child
367 */ 367 */
368 _addChild: function(child) 368 _addChild: function(child)
369 { 369 {
370 this._children.push(child); 370 this._children.push(child);
371 child.parent = this; 371 child.parent = this;
372 } 372 }
373 } 373 };
374 374
375 /** @typedef {!{page: !Array<!WebInspector.TracingModel.Event>, workers: !Array< !WebInspector.TracingModel.Event>}} */ 375 /** @typedef {!{page: !Array<!WebInspector.TracingModel.Event>, workers: !Array< !WebInspector.TracingModel.Event>}} */
376 WebInspector.TimelineModel.MetadataEvents; 376 WebInspector.TimelineModel.MetadataEvents;
377 377
378 /** 378 /**
379 * @return {!WebInspector.TimelineModel.RecordType} 379 * @return {!WebInspector.TimelineModel.RecordType}
380 */ 380 */
381 WebInspector.TimelineModel._eventType = function(event) 381 WebInspector.TimelineModel._eventType = function(event)
382 { 382 {
383 if (event.hasCategory(WebInspector.TimelineModel.Category.Console)) 383 if (event.hasCategory(WebInspector.TimelineModel.Category.Console))
384 return WebInspector.TimelineModel.RecordType.ConsoleTime; 384 return WebInspector.TimelineModel.RecordType.ConsoleTime;
385 if (event.hasCategory(WebInspector.TimelineModel.Category.UserTiming)) 385 if (event.hasCategory(WebInspector.TimelineModel.Category.UserTiming))
386 return WebInspector.TimelineModel.RecordType.UserTiming; 386 return WebInspector.TimelineModel.RecordType.UserTiming;
387 if (event.hasCategory(WebInspector.TimelineModel.Category.LatencyInfo)) 387 if (event.hasCategory(WebInspector.TimelineModel.Category.LatencyInfo))
388 return WebInspector.TimelineModel.RecordType.LatencyInfo; 388 return WebInspector.TimelineModel.RecordType.LatencyInfo;
389 return /** @type !WebInspector.TimelineModel.RecordType */ (event.name); 389 return /** @type !WebInspector.TimelineModel.RecordType */ (event.name);
390 } 390 };
391 391
392 WebInspector.TimelineModel.prototype = { 392 WebInspector.TimelineModel.prototype = {
393 /** 393 /**
394 * @deprecated Test use only! 394 * @deprecated Test use only!
395 * @param {?function(!WebInspector.TimelineModel.Record)|?function(!WebInspe ctor.TimelineModel.Record,number)} preOrderCallback 395 * @param {?function(!WebInspector.TimelineModel.Record)|?function(!WebInspe ctor.TimelineModel.Record,number)} preOrderCallback
396 * @param {function(!WebInspector.TimelineModel.Record)|function(!WebInspect or.TimelineModel.Record,number)=} postOrderCallback 396 * @param {function(!WebInspector.TimelineModel.Record)|function(!WebInspect or.TimelineModel.Record,number)=} postOrderCallback
397 * @return {boolean} 397 * @return {boolean}
398 */ 398 */
399 forAllRecords: function(preOrderCallback, postOrderCallback) 399 forAllRecords: function(preOrderCallback, postOrderCallback)
400 { 400 {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 }, 862 },
863 863
864 /** 864 /**
865 * @param {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!WebInsp ector.TracingModel.AsyncEvent>>} asyncEventsByGroup 865 * @param {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!WebInsp ector.TracingModel.AsyncEvent>>} asyncEventsByGroup
866 * @param {!Array<!WebInspector.TracingModel.AsyncEvent>} asyncEvents 866 * @param {!Array<!WebInspector.TracingModel.AsyncEvent>} asyncEvents
867 * @param {number=} startTime 867 * @param {number=} startTime
868 * @param {number=} endTime 868 * @param {number=} endTime
869 */ 869 */
870 _processAsyncEvents: function(asyncEventsByGroup, asyncEvents, startTime, en dTime) 870 _processAsyncEvents: function(asyncEventsByGroup, asyncEvents, startTime, en dTime)
871 { 871 {
872 var i = startTime ? asyncEvents.lowerBound(startTime, function(time, asy ncEvent) { return time - asyncEvent.startTime }) : 0; 872 var i = startTime ? asyncEvents.lowerBound(startTime, function(time, asy ncEvent) { return time - asyncEvent.startTime; }) : 0;
873 for (; i < asyncEvents.length; ++i) { 873 for (; i < asyncEvents.length; ++i) {
874 var asyncEvent = asyncEvents[i]; 874 var asyncEvent = asyncEvents[i];
875 if (endTime && asyncEvent.startTime >= endTime) 875 if (endTime && asyncEvent.startTime >= endTime)
876 break; 876 break;
877 var asyncGroup = this._processAsyncEvent(asyncEvent); 877 var asyncGroup = this._processAsyncEvent(asyncEvent);
878 if (!asyncGroup) 878 if (!asyncGroup)
879 continue; 879 continue;
880 var groupAsyncEvents = asyncEventsByGroup.get(asyncGroup); 880 var groupAsyncEvents = asyncEventsByGroup.get(asyncGroup);
881 if (!groupAsyncEvents) { 881 if (!groupAsyncEvents) {
882 groupAsyncEvents = []; 882 groupAsyncEvents = [];
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 request = new WebInspector.TimelineModel.NetworkRequest(e); 1321 request = new WebInspector.TimelineModel.NetworkRequest(e);
1322 requests.set(id, request); 1322 requests.set(id, request);
1323 if (request.startTime) 1323 if (request.startTime)
1324 requestsList.push(request); 1324 requestsList.push(request);
1325 else 1325 else
1326 zeroStartRequestsList.push(request); 1326 zeroStartRequestsList.push(request);
1327 } 1327 }
1328 } 1328 }
1329 return zeroStartRequestsList.concat(requestsList); 1329 return zeroStartRequestsList.concat(requestsList);
1330 }, 1330 },
1331 } 1331 };
1332 1332
1333 /** 1333 /**
1334 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters 1334 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters
1335 * @param {!WebInspector.TracingModel.Event} event 1335 * @param {!WebInspector.TracingModel.Event} event
1336 * @return {boolean} 1336 * @return {boolean}
1337 */ 1337 */
1338 WebInspector.TimelineModel.isVisible = function(filters, event) 1338 WebInspector.TimelineModel.isVisible = function(filters, event)
1339 { 1339 {
1340 for (var i = 0; i < filters.length; ++i) { 1340 for (var i = 0; i < filters.length; ++i) {
1341 if (!filters[i].accept(event)) 1341 if (!filters[i].accept(event))
1342 return false; 1342 return false;
1343 } 1343 }
1344 return true; 1344 return true;
1345 } 1345 };
1346 1346
1347 /** 1347 /**
1348 * @param {!WebInspector.TracingModel.Event} event 1348 * @param {!WebInspector.TracingModel.Event} event
1349 * @return {boolean} 1349 * @return {boolean}
1350 */ 1350 */
1351 WebInspector.TimelineModel.isMarkerEvent = function(event) 1351 WebInspector.TimelineModel.isMarkerEvent = function(event)
1352 { 1352 {
1353 var recordTypes = WebInspector.TimelineModel.RecordType; 1353 var recordTypes = WebInspector.TimelineModel.RecordType;
1354 switch (event.name) { 1354 switch (event.name) {
1355 case recordTypes.TimeStamp: 1355 case recordTypes.TimeStamp:
1356 case recordTypes.MarkFirstPaint: 1356 case recordTypes.MarkFirstPaint:
1357 return true; 1357 return true;
1358 case recordTypes.MarkDOMContent: 1358 case recordTypes.MarkDOMContent:
1359 case recordTypes.MarkLoad: 1359 case recordTypes.MarkLoad:
1360 return event.args["data"]["isMainFrame"]; 1360 return event.args["data"]["isMainFrame"];
1361 default: 1361 default:
1362 return false; 1362 return false;
1363 } 1363 }
1364 } 1364 };
1365 1365
1366 /** 1366 /**
1367 * @constructor 1367 * @constructor
1368 * @param {!WebInspector.TracingModel.Event} event 1368 * @param {!WebInspector.TracingModel.Event} event
1369 */ 1369 */
1370 WebInspector.TimelineModel.NetworkRequest = function(event) 1370 WebInspector.TimelineModel.NetworkRequest = function(event)
1371 { 1371 {
1372 this.startTime = event.name === WebInspector.TimelineModel.RecordType.Resour ceSendRequest ? event.startTime : 0; 1372 this.startTime = event.name === WebInspector.TimelineModel.RecordType.Resour ceSendRequest ? event.startTime : 0;
1373 this.endTime = Infinity; 1373 this.endTime = Infinity;
1374 /** @type {!Array<!WebInspector.TracingModel.Event>} */ 1374 /** @type {!Array<!WebInspector.TracingModel.Event>} */
1375 this.children = []; 1375 this.children = [];
1376 this.addEvent(event); 1376 this.addEvent(event);
1377 } 1377 };
1378 1378
1379 WebInspector.TimelineModel.NetworkRequest.prototype = { 1379 WebInspector.TimelineModel.NetworkRequest.prototype = {
1380 /** 1380 /**
1381 * @param {!WebInspector.TracingModel.Event} event 1381 * @param {!WebInspector.TracingModel.Event} event
1382 */ 1382 */
1383 addEvent: function(event) 1383 addEvent: function(event)
1384 { 1384 {
1385 this.children.push(event); 1385 this.children.push(event);
1386 var recordType = WebInspector.TimelineModel.RecordType; 1386 var recordType = WebInspector.TimelineModel.RecordType;
1387 this.startTime = Math.min(this.startTime, event.startTime); 1387 this.startTime = Math.min(this.startTime, event.startTime);
1388 var eventData = event.args["data"]; 1388 var eventData = event.args["data"];
1389 if (eventData["mimeType"]) 1389 if (eventData["mimeType"])
1390 this.mimeType = eventData["mimeType"]; 1390 this.mimeType = eventData["mimeType"];
1391 if ("priority" in eventData) 1391 if ("priority" in eventData)
1392 this.priority = eventData["priority"]; 1392 this.priority = eventData["priority"];
1393 if (event.name === recordType.ResourceFinish) 1393 if (event.name === recordType.ResourceFinish)
1394 this.endTime = event.startTime; 1394 this.endTime = event.startTime;
1395 if (!this.responseTime && (event.name === recordType.ResourceReceiveResp onse || event.name === recordType.ResourceReceivedData)) 1395 if (!this.responseTime && (event.name === recordType.ResourceReceiveResp onse || event.name === recordType.ResourceReceivedData))
1396 this.responseTime = event.startTime; 1396 this.responseTime = event.startTime;
1397 if (!this.url) 1397 if (!this.url)
1398 this.url = eventData["url"]; 1398 this.url = eventData["url"];
1399 if (!this.requestMethod) 1399 if (!this.requestMethod)
1400 this.requestMethod = eventData["requestMethod"]; 1400 this.requestMethod = eventData["requestMethod"];
1401 } 1401 }
1402 } 1402 };
1403 1403
1404 /** 1404 /**
1405 * @constructor 1405 * @constructor
1406 */ 1406 */
1407 WebInspector.TimelineModel.Filter = function() 1407 WebInspector.TimelineModel.Filter = function()
1408 { 1408 {
1409 } 1409 };
1410 1410
1411 WebInspector.TimelineModel.Filter.prototype = { 1411 WebInspector.TimelineModel.Filter.prototype = {
1412 /** 1412 /**
1413 * @param {!WebInspector.TracingModel.Event} event 1413 * @param {!WebInspector.TracingModel.Event} event
1414 * @return {boolean} 1414 * @return {boolean}
1415 */ 1415 */
1416 accept: function(event) 1416 accept: function(event)
1417 { 1417 {
1418 return true; 1418 return true;
1419 } 1419 }
1420 } 1420 };
1421 1421
1422 /** 1422 /**
1423 * @constructor 1423 * @constructor
1424 * @extends {WebInspector.TimelineModel.Filter} 1424 * @extends {WebInspector.TimelineModel.Filter}
1425 * @param {!Array.<string>} visibleTypes 1425 * @param {!Array.<string>} visibleTypes
1426 */ 1426 */
1427 WebInspector.TimelineVisibleEventsFilter = function(visibleTypes) 1427 WebInspector.TimelineVisibleEventsFilter = function(visibleTypes)
1428 { 1428 {
1429 WebInspector.TimelineModel.Filter.call(this); 1429 WebInspector.TimelineModel.Filter.call(this);
1430 this._visibleTypes = new Set(visibleTypes); 1430 this._visibleTypes = new Set(visibleTypes);
1431 } 1431 };
1432 1432
1433 WebInspector.TimelineVisibleEventsFilter.prototype = { 1433 WebInspector.TimelineVisibleEventsFilter.prototype = {
1434 /** 1434 /**
1435 * @override 1435 * @override
1436 * @param {!WebInspector.TracingModel.Event} event 1436 * @param {!WebInspector.TracingModel.Event} event
1437 * @return {boolean} 1437 * @return {boolean}
1438 */ 1438 */
1439 accept: function(event) 1439 accept: function(event)
1440 { 1440 {
1441 return this._visibleTypes.has(WebInspector.TimelineModel._eventType(even t)); 1441 return this._visibleTypes.has(WebInspector.TimelineModel._eventType(even t));
1442 }, 1442 },
1443 1443
1444 __proto__: WebInspector.TimelineModel.Filter.prototype 1444 __proto__: WebInspector.TimelineModel.Filter.prototype
1445 } 1445 };
1446 1446
1447 /** 1447 /**
1448 * @constructor 1448 * @constructor
1449 * @extends {WebInspector.TimelineModel.Filter} 1449 * @extends {WebInspector.TimelineModel.Filter}
1450 * @param {!Array<string>} excludeNames 1450 * @param {!Array<string>} excludeNames
1451 */ 1451 */
1452 WebInspector.ExclusiveNameFilter = function(excludeNames) 1452 WebInspector.ExclusiveNameFilter = function(excludeNames)
1453 { 1453 {
1454 WebInspector.TimelineModel.Filter.call(this); 1454 WebInspector.TimelineModel.Filter.call(this);
1455 this._excludeNames = new Set(excludeNames); 1455 this._excludeNames = new Set(excludeNames);
1456 } 1456 };
1457 1457
1458 WebInspector.ExclusiveNameFilter.prototype = { 1458 WebInspector.ExclusiveNameFilter.prototype = {
1459 /** 1459 /**
1460 * @override 1460 * @override
1461 * @param {!WebInspector.TracingModel.Event} event 1461 * @param {!WebInspector.TracingModel.Event} event
1462 * @return {boolean} 1462 * @return {boolean}
1463 */ 1463 */
1464 accept: function(event) 1464 accept: function(event)
1465 { 1465 {
1466 return !this._excludeNames.has(event.name); 1466 return !this._excludeNames.has(event.name);
1467 }, 1467 },
1468 1468
1469 __proto__: WebInspector.TimelineModel.Filter.prototype 1469 __proto__: WebInspector.TimelineModel.Filter.prototype
1470 } 1470 };
1471 1471
1472 /** 1472 /**
1473 * @constructor 1473 * @constructor
1474 * @extends {WebInspector.TimelineModel.Filter} 1474 * @extends {WebInspector.TimelineModel.Filter}
1475 */ 1475 */
1476 WebInspector.ExcludeTopLevelFilter = function() 1476 WebInspector.ExcludeTopLevelFilter = function()
1477 { 1477 {
1478 WebInspector.TimelineModel.Filter.call(this); 1478 WebInspector.TimelineModel.Filter.call(this);
1479 } 1479 };
1480 1480
1481 WebInspector.ExcludeTopLevelFilter.prototype = { 1481 WebInspector.ExcludeTopLevelFilter.prototype = {
1482 /** 1482 /**
1483 * @override 1483 * @override
1484 * @param {!WebInspector.TracingModel.Event} event 1484 * @param {!WebInspector.TracingModel.Event} event
1485 * @return {boolean} 1485 * @return {boolean}
1486 */ 1486 */
1487 accept: function(event) 1487 accept: function(event)
1488 { 1488 {
1489 return !WebInspector.TracingModel.isTopLevelEvent(event); 1489 return !WebInspector.TracingModel.isTopLevelEvent(event);
1490 }, 1490 },
1491 1491
1492 __proto__: WebInspector.TimelineModel.Filter.prototype 1492 __proto__: WebInspector.TimelineModel.Filter.prototype
1493 } 1493 };
1494 1494
1495 /** 1495 /**
1496 * @constructor 1496 * @constructor
1497 * @param {!WebInspector.TracingModel.Event} event 1497 * @param {!WebInspector.TracingModel.Event} event
1498 */ 1498 */
1499 WebInspector.InvalidationTrackingEvent = function(event) 1499 WebInspector.InvalidationTrackingEvent = function(event)
1500 { 1500 {
1501 /** @type {string} */ 1501 /** @type {string} */
1502 this.type = event.name; 1502 this.type = event.name;
1503 /** @type {number} */ 1503 /** @type {number} */
(...skipping 28 matching lines...) Expand all
1532 /** @type {?string} */ 1532 /** @type {?string} */
1533 this.extraData = eventData["extraData"]; 1533 this.extraData = eventData["extraData"];
1534 /** @type {?Array.<!Object.<string, number>>} */ 1534 /** @type {?Array.<!Object.<string, number>>} */
1535 this.invalidationList = eventData["invalidationList"]; 1535 this.invalidationList = eventData["invalidationList"];
1536 /** @type {!WebInspector.InvalidationCause} */ 1536 /** @type {!WebInspector.InvalidationCause} */
1537 this.cause = {reason: eventData["reason"], stackTrace: eventData["stackTrace "]}; 1537 this.cause = {reason: eventData["reason"], stackTrace: eventData["stackTrace "]};
1538 1538
1539 // FIXME: Move this to TimelineUIUtils.js. 1539 // FIXME: Move this to TimelineUIUtils.js.
1540 if (!this.cause.reason && this.cause.stackTrace && this.type === WebInspecto r.TimelineModel.RecordType.LayoutInvalidationTracking) 1540 if (!this.cause.reason && this.cause.stackTrace && this.type === WebInspecto r.TimelineModel.RecordType.LayoutInvalidationTracking)
1541 this.cause.reason = "Layout forced"; 1541 this.cause.reason = "Layout forced";
1542 } 1542 };
1543 1543
1544 /** @typedef {{reason: string, stackTrace: ?Array<!RuntimeAgent.CallFrame>}} */ 1544 /** @typedef {{reason: string, stackTrace: ?Array<!RuntimeAgent.CallFrame>}} */
1545 WebInspector.InvalidationCause; 1545 WebInspector.InvalidationCause;
1546 1546
1547 /** 1547 /**
1548 * @constructor 1548 * @constructor
1549 */ 1549 */
1550 WebInspector.InvalidationTracker = function() 1550 WebInspector.InvalidationTracker = function()
1551 { 1551 {
1552 this._initializePerFrameState(); 1552 this._initializePerFrameState();
1553 } 1553 };
1554 1554
1555 WebInspector.InvalidationTracker.prototype = { 1555 WebInspector.InvalidationTracker.prototype = {
1556 /** 1556 /**
1557 * @param {!WebInspector.InvalidationTrackingEvent} invalidation 1557 * @param {!WebInspector.InvalidationTrackingEvent} invalidation
1558 */ 1558 */
1559 addInvalidation: function(invalidation) 1559 addInvalidation: function(invalidation)
1560 { 1560 {
1561 this._startNewFrameIfNeeded(); 1561 this._startNewFrameIfNeeded();
1562 1562
1563 if (!invalidation.nodeId && !invalidation.paintId) { 1563 if (!invalidation.nodeId && !invalidation.paintId) {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 { 1792 {
1793 /** @type {!Object.<string, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */ 1793 /** @type {!Object.<string, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */
1794 this._invalidations = {}; 1794 this._invalidations = {};
1795 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */ 1795 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */
1796 this._invalidationsByNodeId = {}; 1796 this._invalidationsByNodeId = {};
1797 1797
1798 this._lastRecalcStyle = undefined; 1798 this._lastRecalcStyle = undefined;
1799 this._lastPaintWithLayer = undefined; 1799 this._lastPaintWithLayer = undefined;
1800 this._didPaint = false; 1800 this._didPaint = false;
1801 } 1801 }
1802 } 1802 };
1803 1803
1804 /** 1804 /**
1805 * @constructor 1805 * @constructor
1806 */ 1806 */
1807 WebInspector.TimelineAsyncEventTracker = function() 1807 WebInspector.TimelineAsyncEventTracker = function()
1808 { 1808 {
1809 WebInspector.TimelineAsyncEventTracker._initialize(); 1809 WebInspector.TimelineAsyncEventTracker._initialize();
1810 /** @type {!Map<!WebInspector.TimelineModel.RecordType, !Map<string, !WebIns pector.TracingModel.Event>>} */ 1810 /** @type {!Map<!WebInspector.TimelineModel.RecordType, !Map<string, !WebIns pector.TracingModel.Event>>} */
1811 this._initiatorByType = new Map(); 1811 this._initiatorByType = new Map();
1812 for (var initiator of WebInspector.TimelineAsyncEventTracker._asyncEvents.ke ys()) 1812 for (var initiator of WebInspector.TimelineAsyncEventTracker._asyncEvents.ke ys())
1813 this._initiatorByType.set(initiator, new Map()); 1813 this._initiatorByType.set(initiator, new Map());
1814 } 1814 };
1815 1815
1816 WebInspector.TimelineAsyncEventTracker._initialize = function() 1816 WebInspector.TimelineAsyncEventTracker._initialize = function()
1817 { 1817 {
1818 if (WebInspector.TimelineAsyncEventTracker._asyncEvents) 1818 if (WebInspector.TimelineAsyncEventTracker._asyncEvents)
1819 return; 1819 return;
1820 var events = new Map(); 1820 var events = new Map();
1821 var type = WebInspector.TimelineModel.RecordType; 1821 var type = WebInspector.TimelineModel.RecordType;
1822 1822
1823 events.set(type.TimerInstall, {causes: [type.TimerFire], joinBy: "timerId"}) ; 1823 events.set(type.TimerInstall, {causes: [type.TimerFire], joinBy: "timerId"}) ;
1824 events.set(type.ResourceSendRequest, {causes: [type.ResourceReceiveResponse, type.ResourceReceivedData, type.ResourceFinish], joinBy: "requestId"}); 1824 events.set(type.ResourceSendRequest, {causes: [type.ResourceReceiveResponse, type.ResourceReceivedData, type.ResourceFinish], joinBy: "requestId"});
1825 events.set(type.RequestAnimationFrame, {causes: [type.FireAnimationFrame], j oinBy: "id"}); 1825 events.set(type.RequestAnimationFrame, {causes: [type.FireAnimationFrame], j oinBy: "id"});
1826 events.set(type.RequestIdleCallback, {causes: [type.FireIdleCallback], joinB y: "id"}); 1826 events.set(type.RequestIdleCallback, {causes: [type.FireIdleCallback], joinB y: "id"});
1827 events.set(type.WebSocketCreate, {causes: [type.WebSocketSendHandshakeReques t, type.WebSocketReceiveHandshakeResponse, type.WebSocketDestroy], joinBy: "iden tifier"}); 1827 events.set(type.WebSocketCreate, {causes: [type.WebSocketSendHandshakeReques t, type.WebSocketReceiveHandshakeResponse, type.WebSocketDestroy], joinBy: "iden tifier"});
1828 1828
1829 WebInspector.TimelineAsyncEventTracker._asyncEvents = events; 1829 WebInspector.TimelineAsyncEventTracker._asyncEvents = events;
1830 /** @type {!Map<!WebInspector.TimelineModel.RecordType, !WebInspector.Timeli neModel.RecordType>} */ 1830 /** @type {!Map<!WebInspector.TimelineModel.RecordType, !WebInspector.Timeli neModel.RecordType>} */
1831 WebInspector.TimelineAsyncEventTracker._typeToInitiator = new Map(); 1831 WebInspector.TimelineAsyncEventTracker._typeToInitiator = new Map();
1832 for (var entry of events) { 1832 for (var entry of events) {
1833 var types = entry[1].causes; 1833 var types = entry[1].causes;
1834 for (type of types) 1834 for (type of types)
1835 WebInspector.TimelineAsyncEventTracker._typeToInitiator.set(type, en try[0]); 1835 WebInspector.TimelineAsyncEventTracker._typeToInitiator.set(type, en try[0]);
1836 } 1836 }
1837 } 1837 };
1838 1838
1839 WebInspector.TimelineAsyncEventTracker.prototype = { 1839 WebInspector.TimelineAsyncEventTracker.prototype = {
1840 /** 1840 /**
1841 * @param {!WebInspector.TracingModel.Event} event 1841 * @param {!WebInspector.TracingModel.Event} event
1842 */ 1842 */
1843 processEvent: function(event) 1843 processEvent: function(event)
1844 { 1844 {
1845 var initiatorType = WebInspector.TimelineAsyncEventTracker._typeToInitia tor.get(/** @type {!WebInspector.TimelineModel.RecordType} */ (event.name)); 1845 var initiatorType = WebInspector.TimelineAsyncEventTracker._typeToInitia tor.get(/** @type {!WebInspector.TimelineModel.RecordType} */ (event.name));
1846 var isInitiator = !initiatorType; 1846 var isInitiator = !initiatorType;
1847 if (!initiatorType) 1847 if (!initiatorType)
1848 initiatorType = /** @type {!WebInspector.TimelineModel.RecordType} * / (event.name); 1848 initiatorType = /** @type {!WebInspector.TimelineModel.RecordType} * / (event.name);
1849 var initiatorInfo = WebInspector.TimelineAsyncEventTracker._asyncEvents. get(initiatorType); 1849 var initiatorInfo = WebInspector.TimelineAsyncEventTracker._asyncEvents. get(initiatorType);
1850 if (!initiatorInfo) 1850 if (!initiatorInfo)
1851 return; 1851 return;
1852 var id = event.args["data"][initiatorInfo.joinBy]; 1852 var id = event.args["data"][initiatorInfo.joinBy];
1853 if (!id) 1853 if (!id)
1854 return; 1854 return;
1855 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */ 1855 /** @type {!Map<string, !WebInspector.TracingModel.Event>|undefined} */
1856 var initiatorMap = this._initiatorByType.get(initiatorType); 1856 var initiatorMap = this._initiatorByType.get(initiatorType);
1857 if (isInitiator) 1857 if (isInitiator)
1858 initiatorMap.set(id, event); 1858 initiatorMap.set(id, event);
1859 else 1859 else
1860 event.initiator = initiatorMap.get(id) || null; 1860 event.initiator = initiatorMap.get(id) || null;
1861 } 1861 }
1862 } 1862 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698