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

Side by Side Diff: Source/devtools/front_end/TimelineView.js

Issue 183893010: DevTools: extract TimelineModel.Record from TimelinePresentationModel.Record. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 30 matching lines...) Expand all
41 WebInspector.TimelineView = function(delegate, model, presentationModel, frameMo del) 41 WebInspector.TimelineView = function(delegate, model, presentationModel, frameMo del)
42 { 42 {
43 WebInspector.View.call(this); 43 WebInspector.View.call(this);
44 this.element.classList.add("timeline-view"); 44 this.element.classList.add("timeline-view");
45 this.element.classList.add("hbox"); 45 this.element.classList.add("hbox");
46 46
47 this._delegate = delegate; 47 this._delegate = delegate;
48 this._model = model; 48 this._model = model;
49 this._presentationModel = presentationModel; 49 this._presentationModel = presentationModel;
50 this._frameModel = frameModel; 50 this._frameModel = frameModel;
51 this._calculator = new WebInspector.TimelineCalculator(this._presentationMod el); 51 this._calculator = new WebInspector.TimelineCalculator(model);
52 this._linkifier = new WebInspector.Linkifier(); 52 this._linkifier = new WebInspector.Linkifier();
53 53
54 this._boundariesAreValid = true; 54 this._boundariesAreValid = true;
55 this._scrollTop = 0; 55 this._scrollTop = 0;
56 56
57 this._recordsView = this._createRecordsView(); 57 this._recordsView = this._createRecordsView();
58 this._recordsView.addEventListener(WebInspector.SplitView.Events.SidebarSize Changed, this._sidebarResized, this); 58 this._recordsView.addEventListener(WebInspector.SplitView.Events.SidebarSize Changed, this._sidebarResized, this);
59 this._recordsView.show(this.element); 59 this._recordsView.show(this.element);
60 this.element.appendChild(this._timelineGrid.gridHeaderElement); 60 this.element.appendChild(this._timelineGrid.gridHeaderElement);
61 61
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 // Create gpu tasks containers. 105 // Create gpu tasks containers.
106 var utilizationStripsElement = this._timelineGrid.gridHeaderElement.crea teChild("div", "timeline-utilization-strips vbox"); 106 var utilizationStripsElement = this._timelineGrid.gridHeaderElement.crea teChild("div", "timeline-utilization-strips vbox");
107 this._cpuBarsElement = utilizationStripsElement.createChild("div", "time line-utilization-strip"); 107 this._cpuBarsElement = utilizationStripsElement.createChild("div", "time line-utilization-strip");
108 if (WebInspector.experimentsSettings.gpuTimeline.isEnabled()) 108 if (WebInspector.experimentsSettings.gpuTimeline.isEnabled())
109 this._gpuBarsElement = utilizationStripsElement.createChild("div", " timeline-utilization-strip gpu"); 109 this._gpuBarsElement = utilizationStripsElement.createChild("div", " timeline-utilization-strip gpu");
110 110
111 return recordsView; 111 return recordsView;
112 }, 112 },
113 113
114 get calculator()
115 {
116 return this._calculator;
117 },
118
119 _rootRecord: function() 114 _rootRecord: function()
120 { 115 {
121 return this._presentationModel.rootRecord(); 116 return this._presentationModel.rootRecord();
122 }, 117 },
123 118
124 _updateEventDividers: function() 119 _updateEventDividers: function()
125 { 120 {
126 this._timelineGrid.removeEventDividers(); 121 this._timelineGrid.removeEventDividers();
127 var clientWidth = this._graphRowsElementWidth; 122 var clientWidth = this._graphRowsElementWidth;
128 var dividers = []; 123 var dividers = [];
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 183
189 _onFrameDoubleClicked: function(event) 184 _onFrameDoubleClicked: function(event)
190 { 185 {
191 var frameBar = event.target.enclosingNodeOrSelfWithClass("timeline-frame -strip"); 186 var frameBar = event.target.enclosingNodeOrSelfWithClass("timeline-frame -strip");
192 if (!frameBar) 187 if (!frameBar)
193 return; 188 return;
194 this._delegate.requestWindowTimes(frameBar._frame.startTime, frameBar._f rame.endTime); 189 this._delegate.requestWindowTimes(frameBar._frame.startTime, frameBar._f rame.endTime);
195 }, 190 },
196 191
197 /** 192 /**
198 * @param {!TimelineAgent.TimelineEvent} record 193 * @param {!WebInspector.TimelineModel.Record} record
199 * @param {!Array.<!WebInspector.TimelinePresentationModel.Record>} presenta tionRecords
200 */ 194 */
201 addRecord: function(record, presentationRecords) 195 addRecord: function(record)
202 { 196 {
203 if (this._innerAddRecordToTimeline(record, presentationRecords)) 197 if (this._innerAddRecordToTimeline(record))
204 this._invalidateAndScheduleRefresh(false, false); 198 this._invalidateAndScheduleRefresh(false, false);
205 }, 199 },
206 200
207 /** 201 /**
208 * @param {!TimelineAgent.TimelineEvent} record 202 * @param {!WebInspector.TimelineModel.Record} record
209 * @param {!Array.<!WebInspector.TimelinePresentationModel.Record>} presenta tionRecords
210 * @return {boolean} 203 * @return {boolean}
211 */ 204 */
212 _innerAddRecordToTimeline: function(record, presentationRecords) 205 _innerAddRecordToTimeline: function(record)
213 { 206 {
214 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask) 207 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask)
215 return record.startTime < this._windowEndTime; 208 return record.startTime < this._windowEndTime;
216 209
217 var hasVisibleRecords = false; 210 var hasVisibleRecords = false;
218 var presentationModel = this._presentationModel; 211 var presentationModel = this._presentationModel;
219 function checkVisible(record) 212 function checkVisible(record)
220 { 213 {
221 hasVisibleRecords |= presentationModel.isVisible(record); 214 hasVisibleRecords |= presentationModel.isVisible(record);
222 } 215 }
223 WebInspector.TimelinePresentationModel.forAllRecords(presentationRecords , checkVisible); 216 WebInspector.TimelineModel.forAllRecords([record], checkVisible);
224 217 return hasVisibleRecords;
225 function isAdoptedRecord(record)
226 {
227 return record.parent !== presentationModel.rootRecord;
228 }
229 // Tell caller update is necessary either if we added a visible record o r if we re-parented a record.
230 return hasVisibleRecords || presentationRecords.some(isAdoptedRecord);
231 }, 218 },
232 219
233 /** 220 /**
234 * @param {number} width 221 * @param {number} width
235 */ 222 */
236 setSidebarSize: function(width) 223 setSidebarSize: function(width)
237 { 224 {
238 this._recordsView.setSidebarSize(width); 225 this._recordsView.setSidebarSize(width);
239 }, 226 },
240 227
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 { 317 {
331 this._presentationModel.invalidateFilteredRecords(); 318 this._presentationModel.invalidateFilteredRecords();
332 this._scheduleRefresh(preserveBoundaries, userGesture); 319 this._scheduleRefresh(preserveBoundaries, userGesture);
333 }, 320 },
334 321
335 /** 322 /**
336 * @param {?WebInspector.TimelinePresentationModel.Record} record 323 * @param {?WebInspector.TimelinePresentationModel.Record} record
337 */ 324 */
338 _selectRecord: function(record) 325 _selectRecord: function(record)
339 { 326 {
340 this._delegate.selectRecord(record); 327 this._delegate.selectRecord(record ? record.record() : null);
341 }, 328 },
342 329
343 /** 330 /**
344 * @param {?WebInspector.TimelinePresentationModel.Record} record 331 * @param {?WebInspector.TimelineModel.Record} record
345 */ 332 */
346 setSelectedRecord: function(record) 333 setSelectedRecord: function(record)
347 { 334 {
348 if (record === this._lastSelectedRecord) 335 var presentationRecord = this._presentationModel.toPresentationRecord(re cord);
336 if (presentationRecord === this._lastSelectedRecord)
349 return; 337 return;
350 338
351 // Remove selection rendering. 339 // Remove selection rendering.p
352 if (this._lastSelectedRecord) { 340 if (this._lastSelectedRecord) {
353 var listRow = /** @type {!WebInspector.TimelineRecordListRow} */ (th is._lastSelectedRecord.getUserObject("WebInspector.TimelineRecordListRow")); 341 if (this._lastSelectedRecord.listRow())
354 if (listRow) 342 this._lastSelectedRecord.listRow().renderAsSelected(false);
355 listRow.renderAsSelected(false); 343 if (this._lastSelectedRecord.graphRow())
356 var graphRow = /** @type {!WebInspector.TimelineRecordGraphRow} */ ( this._lastSelectedRecord.getUserObject("WebInspector.TimelineRecordGraphRow")); 344 this._lastSelectedRecord.graphRow().renderAsSelected(false);
357 if (graphRow)
358 graphRow.renderAsSelected(false);
359 } 345 }
360 346
361 this._lastSelectedRecord = record; 347 this._lastSelectedRecord = presentationRecord;
362 if (!record) 348 if (!presentationRecord)
363 return; 349 return;
364 350
365 this._innerRevealRecord(record); 351 this._innerRevealRecord(presentationRecord);
366 var listRow = /** @type {!WebInspector.TimelineRecordListRow} */ (record .getUserObject("WebInspector.TimelineRecordListRow")); 352 if (presentationRecord.listRow())
367 if (listRow) 353 presentationRecord.listRow().renderAsSelected(true);
368 listRow.renderAsSelected(true); 354 if (presentationRecord.graphRow())
369 var graphRow = /** @type {!WebInspector.TimelineRecordListRow} */ (recor d.getUserObject("WebInspector.TimelineRecordGraphRow")); 355 presentationRecord.graphRow().renderAsSelected(true);
370 if (graphRow)
371 graphRow.renderAsSelected(true);
372 }, 356 },
373 357
374 /** 358 /**
375 * @param {number} startTime 359 * @param {number} startTime
376 * @param {number} endTime 360 * @param {number} endTime
377 */ 361 */
378 setWindowTimes: function(startTime, endTime) 362 setWindowTimes: function(startTime, endTime)
379 { 363 {
380 this._windowStartTime = startTime; 364 this._windowStartTime = startTime;
381 this._windowEndTime = endTime; 365 this._windowEndTime = endTime;
(...skipping 24 matching lines...) Expand all
406 390
407 _refresh: function() 391 _refresh: function()
408 { 392 {
409 if (this._refreshTimeout) { 393 if (this._refreshTimeout) {
410 clearTimeout(this._refreshTimeout); 394 clearTimeout(this._refreshTimeout);
411 delete this._refreshTimeout; 395 delete this._refreshTimeout;
412 } 396 }
413 var windowStartTime = this._windowStartTime; 397 var windowStartTime = this._windowStartTime;
414 var windowEndTime = this._windowEndTime; 398 var windowEndTime = this._windowEndTime;
415 this._timelinePaddingLeft = this._expandOffset; 399 this._timelinePaddingLeft = this._expandOffset;
400 if (windowStartTime === -1)
401 windowStartTime = this._model.minimumRecordTime();
402 if (windowEndTime === -1)
403 windowEndTime = this._model.maximumRecordTime();
416 this._calculator.setWindow(windowStartTime, windowEndTime); 404 this._calculator.setWindow(windowStartTime, windowEndTime);
417 this._calculator.setDisplayWindow(this._timelinePaddingLeft, this._graph RowsElementWidth); 405 this._calculator.setDisplayWindow(this._timelinePaddingLeft, this._graph RowsElementWidth);
418 406
419 this._refreshRecords(); 407 this._refreshRecords();
420 if (!this._boundariesAreValid) { 408 if (!this._boundariesAreValid) {
421 this._updateEventDividers(); 409 this._updateEventDividers();
422 if (this._frameModel) { 410 if (this._frameModel) {
423 var frames = this._frameModel.filteredFrames(windowStartTime, wi ndowEndTime); 411 var frames = this._frameModel.filteredFrames(windowStartTime, wi ndowEndTime);
424 const maxFramesForFrameBars = 30; 412 const maxFramesForFrameBars = 30;
425 if (frames.length && frames.length < maxFramesForFrameBars) { 413 if (frames.length && frames.length < maxFramesForFrameBars) {
(...skipping 11 matching lines...) Expand all
437 this._boundariesAreValid = true; 425 this._boundariesAreValid = true;
438 }, 426 },
439 427
440 /** 428 /**
441 * @param {!WebInspector.TimelinePresentationModel.Record} recordToReveal 429 * @param {!WebInspector.TimelinePresentationModel.Record} recordToReveal
442 */ 430 */
443 _innerRevealRecord: function(recordToReveal) 431 _innerRevealRecord: function(recordToReveal)
444 { 432 {
445 var needRefresh = false; 433 var needRefresh = false;
446 // Expand all ancestors. 434 // Expand all ancestors.
447 for (var parent = recordToReveal.parent; parent !== this._rootRecord(); parent = parent.parent) { 435 for (var parent = recordToReveal.presentationParent(); parent !== this._ rootRecord(); parent = parent.presentationParent()) {
448 if (!parent.collapsed) 436 if (!parent.collapsed())
449 continue; 437 continue;
450 this._presentationModel.invalidateFilteredRecords(); 438 this._presentationModel.invalidateFilteredRecords();
451 parent.collapsed = false; 439 parent.setCollapsed(false);
452 needRefresh = true; 440 needRefresh = true;
453 } 441 }
454 var recordsInWindow = this._presentationModel.filteredRecords(); 442 var recordsInWindow = this._presentationModel.filteredRecords();
455 var index = recordsInWindow.indexOf(recordToReveal); 443 var index = recordsInWindow.indexOf(recordToReveal);
456 444
457 var itemOffset = index * WebInspector.TimelinePanel.rowHeight; 445 var itemOffset = index * WebInspector.TimelinePanel.rowHeight;
458 var visibleTop = this._scrollTop - WebInspector.TimelinePanel.headerHeig ht; 446 var visibleTop = this._scrollTop - WebInspector.TimelinePanel.headerHeig ht;
459 var visibleBottom = visibleTop + this._containerElementHeight - WebInspe ctor.TimelinePanel.rowHeight; 447 var visibleBottom = visibleTop + this._containerElementHeight - WebInspe ctor.TimelinePanel.rowHeight;
460 if (itemOffset < visibleTop) 448 if (itemOffset < visibleTop)
461 this._containerElement.scrollTop = itemOffset; 449 this._containerElement.scrollTop = itemOffset;
(...skipping 15 matching lines...) Expand all
477 var headerHeight = WebInspector.TimelinePanel.headerHeight; 465 var headerHeight = WebInspector.TimelinePanel.headerHeight;
478 466
479 // Convert visible area to visible indexes. Always include top-level rec ord for a visible nested record. 467 // Convert visible area to visible indexes. Always include top-level rec ord for a visible nested record.
480 var startIndex = Math.max(0, Math.min(Math.floor((visibleTop - headerHei ght) / rowHeight), recordsInWindow.length - 1)); 468 var startIndex = Math.max(0, Math.min(Math.floor((visibleTop - headerHei ght) / rowHeight), recordsInWindow.length - 1));
481 var endIndex = Math.min(recordsInWindow.length, Math.ceil(visibleBottom / rowHeight)); 469 var endIndex = Math.min(recordsInWindow.length, Math.ceil(visibleBottom / rowHeight));
482 var lastVisibleLine = Math.max(0, Math.floor((visibleBottom - headerHeig ht) / rowHeight)); 470 var lastVisibleLine = Math.max(0, Math.floor((visibleBottom - headerHeig ht) / rowHeight));
483 if (this._automaticallySizeWindow && recordsInWindow.length > lastVisibl eLine) { 471 if (this._automaticallySizeWindow && recordsInWindow.length > lastVisibl eLine) {
484 this._automaticallySizeWindow = false; 472 this._automaticallySizeWindow = false;
485 this._selectRecord(null); 473 this._selectRecord(null);
486 // If we're at the top, always use real timeline start as a left win dow bound so that expansion arrow padding logic works. 474 // If we're at the top, always use real timeline start as a left win dow bound so that expansion arrow padding logic works.
487 var windowStartTime = startIndex ? recordsInWindow[startIndex].start Time : this._presentationModel.minimumRecordTime(); 475 var windowStartTime = startIndex ? recordsInWindow[startIndex].recor d().startTime : this._presentationModel.minimumRecordTime();
488 var windowEndTime = recordsInWindow[Math.max(0, lastVisibleLine - 1) ].endTime; 476 var windowEndTime = recordsInWindow[Math.max(0, lastVisibleLine - 1) ].record().endTime;
489 this._delegate.requestWindowTimes(windowStartTime, windowEndTime); 477 this._delegate.requestWindowTimes(windowStartTime, windowEndTime);
490 recordsInWindow = this._presentationModel.filteredRecords(); 478 recordsInWindow = this._presentationModel.filteredRecords();
491 endIndex = Math.min(recordsInWindow.length, lastVisibleLine); 479 endIndex = Math.min(recordsInWindow.length, lastVisibleLine);
492 } 480 }
493 481
494 // Resize gaps first. 482 // Resize gaps first.
495 this._topGapElement.style.height = (startIndex * rowHeight) + "px"; 483 this._topGapElement.style.height = (startIndex * rowHeight) + "px";
496 this._recordsView.sidebarElement().firstElementChild.style.flexBasis = ( startIndex * rowHeight + headerHeight) + "px"; 484 this._recordsView.sidebarElement().firstElementChild.style.flexBasis = ( startIndex * rowHeight + headerHeight) + "px";
497 this._bottomGapElement.style.height = (recordsInWindow.length - endIndex ) * rowHeight + "px"; 485 this._bottomGapElement.style.height = (recordsInWindow.length - endIndex ) * rowHeight + "px";
498 var rowsHeight = headerHeight + recordsInWindow.length * rowHeight; 486 var rowsHeight = headerHeight + recordsInWindow.length * rowHeight;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 553
566 _refreshAllUtilizationBars: function() 554 _refreshAllUtilizationBars: function()
567 { 555 {
568 this._refreshUtilizationBars(WebInspector.UIString("CPU"), this._present ationModel.mainThreadTasks(), this._cpuBarsElement); 556 this._refreshUtilizationBars(WebInspector.UIString("CPU"), this._present ationModel.mainThreadTasks(), this._cpuBarsElement);
569 if (WebInspector.experimentsSettings.gpuTimeline.isEnabled()) 557 if (WebInspector.experimentsSettings.gpuTimeline.isEnabled())
570 this._refreshUtilizationBars(WebInspector.UIString("GPU"), this._pre sentationModel.gpuThreadTasks(), this._gpuBarsElement); 558 this._refreshUtilizationBars(WebInspector.UIString("GPU"), this._pre sentationModel.gpuThreadTasks(), this._gpuBarsElement);
571 }, 559 },
572 560
573 /** 561 /**
574 * @param {string} name 562 * @param {string} name
575 * @param {!Array.<!TimelineAgent.TimelineEvent>} tasks 563 * @param {!Array.<!WebInspector.TimelineModel.Record>} tasks
576 * @param {?Element} container 564 * @param {?Element} container
577 */ 565 */
578 _refreshUtilizationBars: function(name, tasks, container) 566 _refreshUtilizationBars: function(name, tasks, container)
579 { 567 {
580 if (!container) 568 if (!container)
581 return; 569 return;
582 570
583 const barOffset = 3; 571 const barOffset = 3;
584 const minGap = 3; 572 const minGap = 3;
585 573
586 var minWidth = WebInspector.TimelineCalculator._minWidth; 574 var minWidth = WebInspector.TimelineCalculator._minWidth;
587 var widthAdjustment = minWidth / 2; 575 var widthAdjustment = minWidth / 2;
588 576
589 var width = this._graphRowsElementWidth; 577 var width = this._graphRowsElementWidth;
590 var boundarySpan = this._windowEndTime - this._windowStartTime; 578 var boundarySpan = this._windowEndTime - this._windowStartTime;
591 var scale = boundarySpan / (width - minWidth - this._timelinePaddingLeft ); 579 var scale = boundarySpan / (width - minWidth - this._timelinePaddingLeft );
592 var startTime = (this._windowStartTime - this._timelinePaddingLeft * sca le); 580 var startTime = (this._windowStartTime - this._timelinePaddingLeft * sca le);
593 var endTime = startTime + width * scale; 581 var endTime = startTime + width * scale;
594 582
595 /** 583 /**
596 * @param {number} value 584 * @param {number} value
597 * @param {!TimelineAgent.TimelineEvent} task 585 * @param {!WebInspector.TimelineModel.Record} task
598 * @return {number} 586 * @return {number}
599 */ 587 */
600 function compareEndTime(value, task) 588 function compareEndTime(value, task)
601 { 589 {
602 return value < task.endTime ? -1 : 1; 590 return value < task.endTime ? -1 : 1;
603 } 591 }
604 592
605 var taskIndex = insertionIndexForObjectInListSortedByFunction(startTime, tasks, compareEndTime); 593 var taskIndex = insertionIndexForObjectInListSortedByFunction(startTime, tasks, compareEndTime);
606 594
607 var foreignStyle = "gpu-task-foreign"; 595 var foreignStyle = "gpu-task-foreign";
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 { 660 {
673 this._hideQuadHighlight(); 661 this._hideQuadHighlight();
674 }, 662 },
675 663
676 /** 664 /**
677 * @param {?Event} e 665 * @param {?Event} e
678 */ 666 */
679 _mouseMove: function(e) 667 _mouseMove: function(e)
680 { 668 {
681 var rowElement = e.target.enclosingNodeOrSelfWithClass("timeline-tree-it em"); 669 var rowElement = e.target.enclosingNodeOrSelfWithClass("timeline-tree-it em");
682 if (rowElement && rowElement.row && rowElement.row._record.highlightQuad ) 670 if (rowElement && rowElement.row && rowElement.row._record.record().high lightQuad)
683 this._highlightQuad(rowElement.row._record.highlightQuad); 671 this._highlightQuad(rowElement.row._record.record().highlightQuad);
684 else 672 else
685 this._hideQuadHighlight(); 673 this._hideQuadHighlight();
686 674
687 var taskBarElement = e.target.enclosingNodeOrSelfWithClass("timeline-gra ph-bar"); 675 var taskBarElement = e.target.enclosingNodeOrSelfWithClass("timeline-gra ph-bar");
688 if (taskBarElement && taskBarElement._tasksInfo) { 676 if (taskBarElement && taskBarElement._tasksInfo) {
689 var offset = taskBarElement.offsetLeft; 677 var offset = taskBarElement.offsetLeft;
690 this._timelineGrid.showCurtains(offset >= 0 ? offset : 0, taskBarEle ment.offsetWidth); 678 this._timelineGrid.showCurtains(offset >= 0 ? offset : 0, taskBarEle ment.offsetWidth);
691 } else 679 } else
692 this._timelineGrid.hideCurtains(); 680 this._timelineGrid.hideCurtains();
693 }, 681 },
(...skipping 10 matching lines...) Expand all
704 var recordsInWindow = this._presentationModel.filteredRecords(); 692 var recordsInWindow = this._presentationModel.filteredRecords();
705 var index = recordsInWindow.indexOf(record); 693 var index = recordsInWindow.indexOf(record);
706 var recordsInPage = Math.floor(this._containerElementHeight / WebInspect or.TimelinePanel.rowHeight); 694 var recordsInPage = Math.floor(this._containerElementHeight / WebInspect or.TimelinePanel.rowHeight);
707 var rowHeight = WebInspector.TimelinePanel.rowHeight; 695 var rowHeight = WebInspector.TimelinePanel.rowHeight;
708 696
709 if (index === -1) 697 if (index === -1)
710 index = 0; 698 index = 0;
711 699
712 switch (event.keyIdentifier) { 700 switch (event.keyIdentifier) {
713 case "Left": 701 case "Left":
714 if (record.parent) { 702 if (record.presentationParent()) {
715 if ((!record.expandable || record.collapsed) && record.parent != = this._presentationModel.rootRecord()) { 703 if ((!record.expandable() || record.collapsed()) && record.prese ntationParent() !== this._presentationModel.rootRecord()) {
716 this._selectRecord(record.parent); 704 this._selectRecord(record.presentationParent());
717 } else { 705 } else {
718 record.collapsed = true; 706 record.setCollapsed(true);
719 record.clicked = true; 707 record.clicked = true;
720 this._invalidateAndScheduleRefresh(true, true); 708 this._invalidateAndScheduleRefresh(true, true);
721 } 709 }
722 } 710 }
723 event.consume(true); 711 event.consume(true);
724 break; 712 break;
725 case "Up": 713 case "Up":
726 if (--index < 0) 714 if (--index < 0)
727 break; 715 break;
728 this._selectRecord(recordsInWindow[index]); 716 this._selectRecord(recordsInWindow[index]);
729 event.consume(true); 717 event.consume(true);
730 break; 718 break;
731 case "Right": 719 case "Right":
732 if (record.expandable && record.collapsed) { 720 if (record.expandable() && record.collapsed()) {
733 record.collapsed = false; 721 record.setCollapsed(false);
734 record.clicked = true; 722 record.clicked = true;
735 this._invalidateAndScheduleRefresh(true, true); 723 this._invalidateAndScheduleRefresh(true, true);
736 } else { 724 } else {
737 if (++index >= recordsInWindow.length) 725 if (++index >= recordsInWindow.length)
738 break; 726 break;
739 this._selectRecord(recordsInWindow[index]); 727 this._selectRecord(recordsInWindow[index]);
740 } 728 }
741 event.consume(true); 729 event.consume(true);
742 break; 730 break;
743 case "Down": 731 case "Down":
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 782
795 /** 783 /**
796 * @param {!Element} anchor 784 * @param {!Element} anchor
797 * @param {!WebInspector.Popover} popover 785 * @param {!WebInspector.Popover} popover
798 */ 786 */
799 _showPopover: function(anchor, popover) 787 _showPopover: function(anchor, popover)
800 { 788 {
801 if (anchor.classList.contains("timeline-frame-strip")) { 789 if (anchor.classList.contains("timeline-frame-strip")) {
802 var frame = anchor._frame; 790 var frame = anchor._frame;
803 popover.show(WebInspector.TimelineUIUtils.generatePopupContentForFra me(frame), anchor); 791 popover.show(WebInspector.TimelineUIUtils.generatePopupContentForFra me(frame), anchor);
804 } else { 792 } else if (anchor._tasksInfo) {
805 if (anchor.row && anchor.row._record) 793 popover.show(WebInspector.TimelineUIUtils.generateMainThreadBarPopup Content(this._model, anchor._tasksInfo), anchor, null, null, WebInspector.Popove r.Orientation.Bottom);
806 WebInspector.TimelineUIUtils.generatePopupContent.generatePopupC ontent(anchor.row._record, this._linkifier, showCallback);
807 else if (anchor._tasksInfo)
808 popover.show(WebInspector.TimelineUIUtils.generateMainThreadBarP opupContent(this._model, anchor._tasksInfo), anchor, null, null, WebInspector.Po pover.Orientation.Bottom);
809 } 794 }
810 795
811 function showCallback(popupContent) 796 function showCallback(popupContent)
812 { 797 {
813 popover.show(popupContent, anchor); 798 popover.show(popupContent, anchor);
814 } 799 }
815 }, 800 },
816 801
817 _closeRecordDetails: function() 802 _closeRecordDetails: function()
818 { 803 {
819 this._popoverHelper.hidePopover(); 804 this._popoverHelper.hidePopover();
820 }, 805 },
821 806
822 _injectCategoryStyles: function() 807 _injectCategoryStyles: function()
823 { 808 {
824 var style = document.createElement("style"); 809 var style = document.createElement("style");
825 var categories = WebInspector.TimelineUIUtils.categories(); 810 var categories = WebInspector.TimelineUIUtils.categories();
826 811
827 style.textContent = Object.values(categories).map(WebInspector.TimelineU IUtils.createStyleRuleForCategory).join("\n"); 812 style.textContent = Object.values(categories).map(WebInspector.TimelineU IUtils.createStyleRuleForCategory).join("\n");
828 document.head.appendChild(style); 813 document.head.appendChild(style);
829 }, 814 },
830 815
831 /** 816 /**
832 * @param {?WebInspector.TimelinePresentationModel.Record} record 817 * @param {?WebInspector.TimelineModel.Record} record
833 * @param {string=} regex 818 * @param {string=} regex
834 * @param {boolean=} selectRecord 819 * @param {boolean=} selectRecord
835 */ 820 */
836 highlightSearchResult: function(record, regex, selectRecord) 821 highlightSearchResult: function(record, regex, selectRecord)
837 { 822 {
838 if (this._highlightDomChanges) 823 if (this._highlightDomChanges)
839 WebInspector.revertDomChanges(this._highlightDomChanges); 824 WebInspector.revertDomChanges(this._highlightDomChanges);
840 this._highlightDomChanges = []; 825 this._highlightDomChanges = [];
841 826
842 if (!record) 827 var presentationRecord = this._presentationModel.toPresentationRecord(re cord);
828 if (!presentationRecord)
843 return; 829 return;
844 830
845 if (selectRecord) 831 if (selectRecord)
846 this._selectRecord(record); 832 this._selectRecord(presentationRecord);
847 833
848 for (var element = this._sidebarListElement.firstChild; element; element = element.nextSibling) { 834 for (var element = this._sidebarListElement.firstChild; element; element = element.nextSibling) {
849 if (element.row._record === record) { 835 if (element.row._record === presentationRecord) {
850 element.row.highlight(regex, this._highlightDomChanges); 836 element.row.highlight(regex, this._highlightDomChanges);
851 break; 837 break;
852 } 838 }
853 } 839 }
854 }, 840 },
855 841
856 __proto__: WebInspector.View.prototype 842 __proto__: WebInspector.View.prototype
857 } 843 }
858 844
859 /** 845 /**
860 * @constructor 846 * @constructor
861 * @param {!WebInspector.TimelinePresentationModel} presentationModel 847 * @param {!WebInspector.TimelineModel} model
862 * @implements {WebInspector.TimelineGrid.Calculator} 848 * @implements {WebInspector.TimelineGrid.Calculator}
863 */ 849 */
864 WebInspector.TimelineCalculator = function(presentationModel) 850 WebInspector.TimelineCalculator = function(model)
865 { 851 {
866 this._presentationModel = presentationModel; 852 this._model = model;
867 } 853 }
868 854
869 WebInspector.TimelineCalculator._minWidth = 5; 855 WebInspector.TimelineCalculator._minWidth = 5;
870 856
871 WebInspector.TimelineCalculator.prototype = { 857 WebInspector.TimelineCalculator.prototype = {
872 /** 858 /**
873 * @return {number} 859 * @return {number}
874 */ 860 */
875 paddingLeft: function() 861 paddingLeft: function()
876 { 862 {
(...skipping 10 matching lines...) Expand all
887 }, 873 },
888 874
889 /** 875 /**
890 * @return {!{start: number, end: number, endWithChildren: number, cpuWidth: number}} 876 * @return {!{start: number, end: number, endWithChildren: number, cpuWidth: number}}
891 */ 877 */
892 computeBarGraphPercentages: function(record) 878 computeBarGraphPercentages: function(record)
893 { 879 {
894 var start = (record.startTime - this._minimumBoundary) / this.boundarySp an() * 100; 880 var start = (record.startTime - this._minimumBoundary) / this.boundarySp an() * 100;
895 var end = (record.startTime + record.selfTime - this._minimumBoundary) / this.boundarySpan() * 100; 881 var end = (record.startTime + record.selfTime - this._minimumBoundary) / this.boundarySpan() * 100;
896 var endWithChildren = (record.lastChildEndTime - this._minimumBoundary) / this.boundarySpan() * 100; 882 var endWithChildren = (record.lastChildEndTime - this._minimumBoundary) / this.boundarySpan() * 100;
897 var cpuWidth = record.coalesced ? endWithChildren - start : record.cpuTi me / this.boundarySpan() * 100; 883 var cpuWidth = record.cpuTime / this.boundarySpan() * 100;
898 return {start: start, end: end, endWithChildren: endWithChildren, cpuWid th: cpuWidth}; 884 return {start: start, end: end, endWithChildren: endWithChildren, cpuWid th: cpuWidth};
899 }, 885 },
900 886
901 /** 887 /**
902 * @return {!{left: number, width: number, widthWithChildren: number, cpuWid th: number}} 888 * @return {!{left: number, width: number, widthWithChildren: number, cpuWid th: number}}
903 */ 889 */
904 computeBarGraphWindowPosition: function(record) 890 computeBarGraphWindowPosition: function(record)
905 { 891 {
906 var percentages = this.computeBarGraphPercentages(record); 892 var percentages = this.computeBarGraphPercentages(record);
907 var widthAdjustment = 0; 893 var widthAdjustment = 0;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 minimumBoundary: function() 945 minimumBoundary: function()
960 { 946 {
961 return this._minimumBoundary; 947 return this._minimumBoundary;
962 }, 948 },
963 949
964 /** 950 /**
965 * @return {number} 951 * @return {number}
966 */ 952 */
967 zeroTime: function() 953 zeroTime: function()
968 { 954 {
969 return this._presentationModel.minimumRecordTime(); 955 return this._model.minimumRecordTime();
970 }, 956 },
971 957
972 /** 958 /**
973 * @return {number} 959 * @return {number}
974 */ 960 */
975 boundarySpan: function() 961 boundarySpan: function()
976 { 962 {
977 return this._maximumBoundary - this._minimumBoundary; 963 return this._maximumBoundary - this._minimumBoundary;
978 } 964 }
979 } 965 }
(...skipping 21 matching lines...) Expand all
1001 this._expandArrowElement.addEventListener("click", this._onExpandClick.bind( this), false); 987 this._expandArrowElement.addEventListener("click", this._onExpandClick.bind( this), false);
1002 var iconElement = this.element.createChild("span", "timeline-tree-icon"); 988 var iconElement = this.element.createChild("span", "timeline-tree-icon");
1003 this._typeElement = this.element.createChild("span", "type"); 989 this._typeElement = this.element.createChild("span", "type");
1004 990
1005 this._dataElement = this.element.createChild("span", "data dimmed"); 991 this._dataElement = this.element.createChild("span", "data dimmed");
1006 this._scheduleRefresh = scheduleRefresh; 992 this._scheduleRefresh = scheduleRefresh;
1007 this._selectRecord = selectRecord; 993 this._selectRecord = selectRecord;
1008 } 994 }
1009 995
1010 WebInspector.TimelineRecordListRow.prototype = { 996 WebInspector.TimelineRecordListRow.prototype = {
1011 update: function(record, offset) 997 /**
998 * @param {!WebInspector.TimelinePresentationModel.Record} presentationRecor d
999 * @param {number} offset
1000 */
1001 update: function(presentationRecord, offset)
1012 { 1002 {
1013 this._record = record; 1003 this._record = presentationRecord;
1004 var record = presentationRecord.record();
1014 this._offset = offset; 1005 this._offset = offset;
1015 1006
1016 this.element.className = "timeline-tree-item timeline-category-" + recor d.category.name; 1007 this.element.className = "timeline-tree-item timeline-category-" + recor d.category.name;
1017 var paddingLeft = 5; 1008 var paddingLeft = 5;
1018 var step = -3; 1009 var step = -3;
1019 for (var currentRecord = record.parent ? record.parent.parent : null; cu rrentRecord; currentRecord = currentRecord.parent) 1010 for (var currentRecord = presentationRecord.presentationParent() ? prese ntationRecord.presentationParent().presentationParent() : null; currentRecord; c urrentRecord = currentRecord.presentationParent())
1020 paddingLeft += 12 / (Math.max(1, step++)); 1011 paddingLeft += 12 / (Math.max(1, step++));
1021 this.element.style.paddingLeft = paddingLeft + "px"; 1012 this.element.style.paddingLeft = paddingLeft + "px";
1022 if (record.isBackground()) 1013 if (record.thread)
1023 this.element.classList.add("background"); 1014 this.element.classList.add("background");
1024 1015
1025 this._typeElement.textContent = record.title(); 1016 this._typeElement.textContent = record.title();
1026 1017
1027 if (this._dataElement.firstChild) 1018 if (this._dataElement.firstChild)
1028 this._dataElement.removeChildren(); 1019 this._dataElement.removeChildren();
1029 1020
1030 this._warningElement.enableStyleClass("hidden", !record.hasWarnings() && !record.childHasWarnings()); 1021 this._warningElement.enableStyleClass("hidden", !presentationRecord.hasW arnings() && !presentationRecord.childHasWarnings());
1031 this._warningElement.enableStyleClass("timeline-tree-item-child-warning" , record.childHasWarnings() && !record.hasWarnings()); 1022 this._warningElement.enableStyleClass("timeline-tree-item-child-warning" , presentationRecord.childHasWarnings() && !presentationRecord.hasWarnings());
1032 1023
1033 var detailsNode = WebInspector.TimelineUIUtils.buildDetailsNode(record, this._linkifier); 1024 if (presentationRecord.coalesced()) {
1034 if (detailsNode) { 1025 this._dataElement.createTextChild(WebInspector.UIString("× %d", pres entationRecord.presentationChildren().length));
1035 this._dataElement.appendChild(document.createTextNode("(")); 1026 } else {
1036 this._dataElement.appendChild(detailsNode); 1027 var detailsNode = WebInspector.TimelineUIUtils.buildDetailsNode(reco rd, this._linkifier);
1037 this._dataElement.appendChild(document.createTextNode(")")); 1028 if (detailsNode) {
1029 this._dataElement.appendChild(document.createTextNode("("));
1030 this._dataElement.appendChild(detailsNode);
1031 this._dataElement.appendChild(document.createTextNode(")"));
1032 }
1038 } 1033 }
1039 this._expandArrowElement.enableStyleClass("parent", record.children && r ecord.children.length); 1034
1040 this._expandArrowElement.enableStyleClass("expanded", record.visibleChil drenCount); 1035 this._expandArrowElement.enableStyleClass("parent", presentationRecord.h asPresentationChildren());
1041 this._record.setUserObject("WebInspector.TimelineRecordListRow", this); 1036 this._expandArrowElement.enableStyleClass("expanded", presentationRecord .visibleChildrenCount());
1037 this._record.setListRow(this);
1042 }, 1038 },
1043 1039
1044 highlight: function(regExp, domChanges) 1040 highlight: function(regExp, domChanges)
1045 { 1041 {
1046 var matchInfo = this.element.textContent.match(regExp); 1042 var matchInfo = this.element.textContent.match(regExp);
1047 if (matchInfo) 1043 if (matchInfo)
1048 WebInspector.highlightSearchResult(this.element, matchInfo.index, ma tchInfo[0].length, domChanges); 1044 WebInspector.highlightSearchResult(this.element, matchInfo.index, ma tchInfo[0].length, domChanges);
1049 }, 1045 },
1050 1046
1051 dispose: function() 1047 dispose: function()
1052 { 1048 {
1053 this.element.remove(); 1049 this.element.remove();
1054 }, 1050 },
1055 1051
1056 /** 1052 /**
1057 * @param {!Event} event 1053 * @param {!Event} event
1058 */ 1054 */
1059 _onExpandClick: function(event) 1055 _onExpandClick: function(event)
1060 { 1056 {
1061 this._record.collapsed = !this._record.collapsed; 1057 this._record.setCollapsed(!this._record.collapsed());
1062 this._record.clicked = true; 1058 this._record.clicked = true;
1063 this._scheduleRefresh(); 1059 this._scheduleRefresh();
1064 event.consume(true); 1060 event.consume(true);
1065 }, 1061 },
1066 1062
1067 /** 1063 /**
1068 * @param {?Event} event 1064 * @param {?Event} event
1069 */ 1065 */
1070 _onClick: function(event) 1066 _onClick: function(event)
1071 { 1067 {
1072 this._selectRecord(this._record); 1068 this._selectRecord(this._record);
1073 }, 1069 },
1074 1070
1075 /** 1071 /**
1076 * @param {boolean} selected 1072 * @param {boolean} selected
1077 */ 1073 */
1078 renderAsSelected: function(selected) 1074 renderAsSelected: function(selected)
1079 { 1075 {
1080 this.element.enableStyleClass("selected", selected); 1076 this.element.enableStyleClass("selected", selected);
1081 }, 1077 },
1082 1078
1083 /** 1079 /**
1084 * @param {?Event} event 1080 * @param {?Event} event
1085 */ 1081 */
1086 _onMouseOver: function(event) 1082 _onMouseOver: function(event)
1087 { 1083 {
1088 this.element.classList.add("hovered"); 1084 this.element.classList.add("hovered");
1089 var graphRow = /** @type {!WebInspector.TimelineRecordGraphRow} */ (this ._record.getUserObject("WebInspector.TimelineRecordGraphRow")); 1085 if (this._record.graphRow())
1090 graphRow.element.classList.add("hovered"); 1086 this._record.graphRow().element.classList.add("hovered");
1091 }, 1087 },
1092 1088
1093 /** 1089 /**
1094 * @param {?Event} event 1090 * @param {?Event} event
1095 */ 1091 */
1096 _onMouseOut: function(event) 1092 _onMouseOut: function(event)
1097 { 1093 {
1098 this.element.classList.remove("hovered"); 1094 this.element.classList.remove("hovered");
1099 var graphRow = /** @type {!WebInspector.TimelineRecordGraphRow} */ (this ._record.getUserObject("WebInspector.TimelineRecordGraphRow")); 1095 if (this._record.graphRow())
1100 graphRow.element.classList.remove("hovered"); 1096 this._record.graphRow().element.classList.remove("hovered");
1101 } 1097 }
1102 } 1098 }
1103 1099
1104 /** 1100 /**
1105 * @constructor 1101 * @constructor
1106 * @param {function(!WebInspector.TimelinePresentationModel.Record)} selectRecor d 1102 * @param {function(!WebInspector.TimelinePresentationModel.Record)} selectRecor d
1107 * @param {function()} scheduleRefresh 1103 * @param {function()} scheduleRefresh
1108 */ 1104 */
1109 WebInspector.TimelineRecordGraphRow = function(graphContainer, selectRecord, sch eduleRefresh) 1105 WebInspector.TimelineRecordGraphRow = function(graphContainer, selectRecord, sch eduleRefresh)
1110 { 1106 {
(...skipping 22 matching lines...) Expand all
1133 this._barElement.row = this; 1129 this._barElement.row = this;
1134 this._barAreaElement.appendChild(this._barElement); 1130 this._barAreaElement.appendChild(this._barElement);
1135 1131
1136 this._expandElement = new WebInspector.TimelineExpandableElement(graphContai ner); 1132 this._expandElement = new WebInspector.TimelineExpandableElement(graphContai ner);
1137 1133
1138 this._selectRecord = selectRecord; 1134 this._selectRecord = selectRecord;
1139 this._scheduleRefresh = scheduleRefresh; 1135 this._scheduleRefresh = scheduleRefresh;
1140 } 1136 }
1141 1137
1142 WebInspector.TimelineRecordGraphRow.prototype = { 1138 WebInspector.TimelineRecordGraphRow.prototype = {
1143 update: function(record, calculator, expandOffset, index) 1139 /**
1140 * @param {!WebInspector.TimelinePresentationModel.Record} presentationRecor d
1141 * @param {!WebInspector.TimelineCalculator} calculator
1142 * @param {number} expandOffset
1143 * @param {number} index
1144 */
1145 update: function(presentationRecord, calculator, expandOffset, index)
1144 { 1146 {
1145 this._record = record; 1147 this._record = presentationRecord;
1148 var record = presentationRecord.record();
1146 this.element.className = "timeline-graph-side timeline-category-" + reco rd.category.name; 1149 this.element.className = "timeline-graph-side timeline-category-" + reco rd.category.name;
1147 if (record.isBackground()) 1150 if (record.thread)
1148 this.element.classList.add("background"); 1151 this.element.classList.add("background");
1149 1152
1150 var barPosition = calculator.computeBarGraphWindowPosition(record); 1153 var barPosition = calculator.computeBarGraphWindowPosition(record);
1151 this._barWithChildrenElement.style.left = barPosition.left + "px"; 1154 this._barWithChildrenElement.style.left = barPosition.left + "px";
1152 this._barWithChildrenElement.style.width = barPosition.widthWithChildren + "px"; 1155 this._barWithChildrenElement.style.width = barPosition.widthWithChildren + "px";
1153 this._barElement.style.left = barPosition.left + "px"; 1156 this._barElement.style.left = barPosition.left + "px";
1154 this._barElement.style.width = barPosition.width + "px"; 1157 this._barElement.style.width = (presentationRecord.coalesced() ? barPosi tion.widthWithChildren : barPosition.width) + "px";
1155 this._barCpuElement.style.left = barPosition.left + "px"; 1158 this._barCpuElement.style.left = barPosition.left + "px";
1156 this._barCpuElement.style.width = barPosition.cpuWidth + "px"; 1159 this._barCpuElement.style.width = (presentationRecord.coalesced() ? barP osition.widthWithChildren : barPosition.cpuWidth) + "px";
1157 this._expandElement._update(record, index, barPosition.left - expandOffs et, barPosition.width); 1160 this._expandElement._update(presentationRecord, index, barPosition.left - expandOffset, barPosition.width);
1158 1161 this._record.setGraphRow(this);
1159 this._record.setUserObject("WebInspector.TimelineRecordGraphRow", this);
1160 }, 1162 },
1161 1163
1162 /** 1164 /**
1163 * @param {?Event} event 1165 * @param {?Event} event
1164 */ 1166 */
1165 _onClick: function(event) 1167 _onClick: function(event)
1166 { 1168 {
1167 // check if we click arrow and expand if yes. 1169 // check if we click arrow and expand if yes.
1168 if (this._expandElement._arrow.containsEventPoint(event)) 1170 if (this._expandElement._arrow.containsEventPoint(event))
1169 this._expand(); 1171 this._expand();
1170 this._selectRecord(this._record); 1172 this._selectRecord(this._record);
1171 }, 1173 },
1172 1174
1173 /** 1175 /**
1174 * @param {boolean} selected 1176 * @param {boolean} selected
1175 */ 1177 */
1176 renderAsSelected: function(selected) 1178 renderAsSelected: function(selected)
1177 { 1179 {
1178 this.element.enableStyleClass("selected", selected); 1180 this.element.enableStyleClass("selected", selected);
1179 }, 1181 },
1180 1182
1181 _expand: function() 1183 _expand: function()
1182 { 1184 {
1183 this._record.collapsed = !this._record.collapsed; 1185 this._record.setCollapsed(!this._record.collapsed());
1184 this._record.clicked = true; 1186 this._record.clicked = true;
1185 this._scheduleRefresh(); 1187 this._scheduleRefresh();
1186 }, 1188 },
1187 1189
1188 /** 1190 /**
1189 * @param {?Event} event 1191 * @param {?Event} event
1190 */ 1192 */
1191 _onMouseOver: function(event) 1193 _onMouseOver: function(event)
1192 { 1194 {
1193 this.element.classList.add("hovered"); 1195 this.element.classList.add("hovered");
1194 var listRow = /** @type {!WebInspector.TimelineRecordListRow} */ (this._ record.getUserObject("WebInspector.TimelineRecordListRow")); 1196 if (this._record.listRow())
1195 listRow.element.classList.add("hovered"); 1197 this._record.listRow().element.classList.add("hovered");
1196 }, 1198 },
1197 1199
1198 /** 1200 /**
1199 * @param {?Event} event 1201 * @param {?Event} event
1200 */ 1202 */
1201 _onMouseOut: function(event) 1203 _onMouseOut: function(event)
1202 { 1204 {
1203 this.element.classList.remove("hovered"); 1205 this.element.classList.remove("hovered");
1204 var listRow = /** @type {!WebInspector.TimelineRecordListRow} */ (this._ record.getUserObject("WebInspector.TimelineRecordListRow")); 1206 if (this._record.listRow())
1205 listRow.element.classList.remove("hovered"); 1207 this._record.listRow().element.classList.remove("hovered");
1206 }, 1208 },
1207 1209
1208 dispose: function() 1210 dispose: function()
1209 { 1211 {
1210 this.element.remove(); 1212 this.element.remove();
1211 this._expandElement._dispose(); 1213 this._expandElement._dispose();
1212 } 1214 }
1213 } 1215 }
1214 1216
1215 /** 1217 /**
1216 * @constructor 1218 * @constructor
1217 */ 1219 */
1218 WebInspector.TimelineExpandableElement = function(container) 1220 WebInspector.TimelineExpandableElement = function(container)
1219 { 1221 {
1220 this._element = container.createChild("div", "timeline-expandable"); 1222 this._element = container.createChild("div", "timeline-expandable");
1221 this._element.createChild("div", "timeline-expandable-left"); 1223 this._element.createChild("div", "timeline-expandable-left");
1222 this._arrow = this._element.createChild("div", "timeline-expandable-arrow"); 1224 this._arrow = this._element.createChild("div", "timeline-expandable-arrow");
1223 } 1225 }
1224 1226
1225 WebInspector.TimelineExpandableElement.prototype = { 1227 WebInspector.TimelineExpandableElement.prototype = {
1228 /**
1229 * @param {!WebInspector.TimelinePresentationModel.Record} record
1230 */
1226 _update: function(record, index, left, width) 1231 _update: function(record, index, left, width)
1227 { 1232 {
1228 const rowHeight = WebInspector.TimelinePanel.rowHeight; 1233 const rowHeight = WebInspector.TimelinePanel.rowHeight;
1229 if (record.visibleChildrenCount || record.expandable) { 1234 if (record.visibleChildrenCount || record.expandable) {
1230 this._element.style.top = index * rowHeight + "px"; 1235 this._element.style.top = index * rowHeight + "px";
1231 this._element.style.left = left + "px"; 1236 this._element.style.left = left + "px";
1232 this._element.style.width = Math.max(12, width + 25) + "px"; 1237 this._element.style.width = Math.max(12, width + 25) + "px";
1233 if (!record.collapsed) { 1238 if (!record.collapsed()) {
1234 this._element.style.height = (record.visibleChildrenCount + 1) * rowHeight + "px"; 1239 this._element.style.height = (record.visibleChildrenCount + 1) * rowHeight + "px";
1235 this._element.classList.add("timeline-expandable-expanded"); 1240 this._element.classList.add("timeline-expandable-expanded");
1236 this._element.classList.remove("timeline-expandable-collapsed"); 1241 this._element.classList.remove("timeline-expandable-collapsed");
1237 } else { 1242 } else {
1238 this._element.style.height = rowHeight + "px"; 1243 this._element.style.height = rowHeight + "px";
1239 this._element.classList.add("timeline-expandable-collapsed"); 1244 this._element.classList.add("timeline-expandable-collapsed");
1240 this._element.classList.remove("timeline-expandable-expanded"); 1245 this._element.classList.remove("timeline-expandable-expanded");
1241 } 1246 }
1242 this._element.classList.remove("hidden"); 1247 this._element.classList.remove("hidden");
1243 } else 1248 } else
1244 this._element.classList.add("hidden"); 1249 this._element.classList.add("hidden");
1245 }, 1250 },
1246 1251
1247 _dispose: function() 1252 _dispose: function()
1248 { 1253 {
1249 this._element.remove(); 1254 this._element.remove();
1250 } 1255 }
1251 } 1256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698