Index: chrome_linux64/resources/inspector/TimelinePanel.js |
=================================================================== |
--- chrome_linux64/resources/inspector/TimelinePanel.js (revision 237140) |
+++ chrome_linux64/resources/inspector/TimelinePanel.js (working copy) |
@@ -24,8 +24,9 @@ |
{throw new Error("Not implemented");},_createCounterUIList:function() |
{throw new Error("Not implemented");},_onRecordsCleared:function() |
{this._counters=[];},setMainTimelineGrid:function(timelineGrid) |
-{this._mainTimelineGrid=timelineGrid;},setTopPosition:function(top) |
-{this._memorySidebarView.element.style.top=top+"px";this._updateSize();},setSidebarWidth:function(width) |
+{this._mainTimelineGrid=timelineGrid;},height:function() |
+{return this._memorySidebarView.element.offsetHeight;},setHeight:function(height) |
+{this._memorySidebarView.element.style.flexBasis=height+"px";this._updateSize();},setSidebarWidth:function(width) |
{if(this._ignoreSidebarResize) |
return;this._ignoreSidebarResize=true;this._memorySidebarView.setSidebarWidth(width);this._ignoreSidebarResize=false;},_sidebarResized:function(event) |
{if(this._ignoreSidebarResize) |
@@ -115,7 +116,7 @@ |
{for(var i=0;i<this._counterUI.length;i++) |
this._counterUI[i].discardImageUnderMarker();},__proto__:WebInspector.MemoryStatistics.prototype};WebInspector.TimelineModel=function() |
{this._records=[];this._stringPool=new StringPool();this._minimumRecordTime=-1;this._maximumRecordTime=-1;WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,this._onRecordAdded,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted,this._onStarted,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStopped,this._onStopped,this);} |
-WebInspector.TimelineModel.TransferChunkLengthBytes=5000000;WebInspector.TimelineModel.RecordType={Root:"Root",Program:"Program",EventDispatch:"EventDispatch",BeginFrame:"BeginFrame",ScheduleStyleRecalculation:"ScheduleStyleRecalculation",RecalculateStyles:"RecalculateStyles",InvalidateLayout:"InvalidateLayout",Layout:"Layout",PaintSetup:"PaintSetup",Paint:"Paint",Rasterize:"Rasterize",ScrollLayer:"ScrollLayer",DecodeImage:"DecodeImage",ResizeImage:"ResizeImage",CompositeLayers:"CompositeLayers",ParseHTML:"ParseHTML",TimerInstall:"TimerInstall",TimerRemove:"TimerRemove",TimerFire:"TimerFire",XHRReadyStateChange:"XHRReadyStateChange",XHRLoad:"XHRLoad",EvaluateScript:"EvaluateScript",MarkLoad:"MarkLoad",MarkDOMContent:"MarkDOMContent",TimeStamp:"TimeStamp",Time:"Time",TimeEnd:"TimeEnd",ScheduleResourceRequest:"ScheduleResourceRequest",ResourceSendRequest:"ResourceSendRequest",ResourceReceiveResponse:"ResourceReceiveResponse",ResourceReceivedData:"ResourceReceivedData",ResourceFinish:"ResourceFinish",FunctionCall:"FunctionCall",GCEvent:"GCEvent",RequestAnimationFrame:"RequestAnimationFrame",CancelAnimationFrame:"CancelAnimationFrame",FireAnimationFrame:"FireAnimationFrame",WebSocketCreate:"WebSocketCreate",WebSocketSendHandshakeRequest:"WebSocketSendHandshakeRequest",WebSocketReceiveHandshakeResponse:"WebSocketReceiveHandshakeResponse",WebSocketDestroy:"WebSocketDestroy",} |
+WebInspector.TimelineModel.TransferChunkLengthBytes=5000000;WebInspector.TimelineModel.RecordType={Root:"Root",Program:"Program",EventDispatch:"EventDispatch",BeginFrame:"BeginFrame",ScheduleStyleRecalculation:"ScheduleStyleRecalculation",RecalculateStyles:"RecalculateStyles",InvalidateLayout:"InvalidateLayout",Layout:"Layout",AutosizeText:"AutosizeText",PaintSetup:"PaintSetup",Paint:"Paint",Rasterize:"Rasterize",ScrollLayer:"ScrollLayer",DecodeImage:"DecodeImage",ResizeImage:"ResizeImage",CompositeLayers:"CompositeLayers",ParseHTML:"ParseHTML",TimerInstall:"TimerInstall",TimerRemove:"TimerRemove",TimerFire:"TimerFire",XHRReadyStateChange:"XHRReadyStateChange",XHRLoad:"XHRLoad",EvaluateScript:"EvaluateScript",MarkLoad:"MarkLoad",MarkDOMContent:"MarkDOMContent",TimeStamp:"TimeStamp",Time:"Time",TimeEnd:"TimeEnd",ScheduleResourceRequest:"ScheduleResourceRequest",ResourceSendRequest:"ResourceSendRequest",ResourceReceiveResponse:"ResourceReceiveResponse",ResourceReceivedData:"ResourceReceivedData",ResourceFinish:"ResourceFinish",FunctionCall:"FunctionCall",GCEvent:"GCEvent",RequestAnimationFrame:"RequestAnimationFrame",CancelAnimationFrame:"CancelAnimationFrame",FireAnimationFrame:"FireAnimationFrame",WebSocketCreate:"WebSocketCreate",WebSocketSendHandshakeRequest:"WebSocketSendHandshakeRequest",WebSocketReceiveHandshakeResponse:"WebSocketReceiveHandshakeResponse",WebSocketDestroy:"WebSocketDestroy",} |
WebInspector.TimelineModel.Events={RecordAdded:"RecordAdded",RecordsCleared:"RecordsCleared",RecordingStarted:"RecordingStarted",RecordingStopped:"RecordingStopped"} |
WebInspector.TimelineModel.startTimeInSeconds=function(record) |
{return record.startTime/1000;} |
@@ -130,10 +131,10 @@ |
{for(var category in addend) |
total[category]=(total[category]||0)+addend[category];} |
WebInspector.TimelineModel.prototype={startRecording:function(includeDomCounters) |
-{this._clientInitiatedRecording=true;this.reset();var maxStackFrames=WebInspector.settings.timelineLimitStackFramesFlag.get()?WebInspector.settings.timelineStackFramesToCapture.get():30;WebInspector.timelineManager.start(maxStackFrames,includeDomCounters,false,this._fireRecordingStarted.bind(this));},stopRecording:function() |
+{this._clientInitiatedRecording=true;this.reset();var maxStackFrames=WebInspector.settings.timelineLimitStackFramesFlag.get()?WebInspector.settings.timelineStackFramesToCapture.get():30;WebInspector.timelineManager.start(maxStackFrames,includeDomCounters,this._fireRecordingStarted.bind(this));},stopRecording:function() |
{if(!this._clientInitiatedRecording){function stopTimeline() |
{WebInspector.timelineManager.stop(this._fireRecordingStopped.bind(this));} |
-WebInspector.timelineManager.start(undefined,undefined,undefined,stopTimeline.bind(this));return;} |
+WebInspector.timelineManager.start(undefined,undefined,stopTimeline.bind(this));return;} |
this._clientInitiatedRecording=false;WebInspector.timelineManager.stop(this._fireRecordingStopped.bind(this));},get records() |
{return this._records;},_onRecordAdded:function(event) |
{if(this._collectionEnabled) |
@@ -186,7 +187,7 @@ |
if(this._recordIndex===this._records.length) |
data.push(data.pop()+"]");stream.write(data.join(separator),this._writeNextChunk.bind(this));}};WebInspector.TimelineOverviewPane=function(model) |
{WebInspector.View.call(this);this.element.id="timeline-overview-panel";this._windowStartTime=0;this._windowEndTime=Infinity;this._eventDividers=[];this._model=model;this._topPaneSidebarElement=document.createElement("div");this._topPaneSidebarElement.id="timeline-overview-sidebar";var overviewTreeElement=document.createElement("ol");overviewTreeElement.className="sidebar-tree";this._topPaneSidebarElement.appendChild(overviewTreeElement);this.element.appendChild(this._topPaneSidebarElement);var topPaneSidebarTree=new TreeOutline(overviewTreeElement);this._overviewItems={};this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Events]=new WebInspector.SidebarTreeElement("timeline-overview-sidebar-events",WebInspector.UIString("Events"));this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Frames]=new WebInspector.SidebarTreeElement("timeline-overview-sidebar-frames",WebInspector.UIString("Frames"));this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Memory]=new WebInspector.SidebarTreeElement("timeline-overview-sidebar-memory",WebInspector.UIString("Memory"));for(var mode in this._overviewItems){var item=this._overviewItems[mode];item.onselect=this.setMode.bind(this,mode);topPaneSidebarTree.appendChild(item);} |
-this._overviewGrid=new WebInspector.OverviewGrid("timeline");this.element.appendChild(this._overviewGrid.element);var separatorElement=document.createElement("div");separatorElement.id="timeline-overview-separator";this.element.appendChild(separatorElement);this._innerSetMode(WebInspector.TimelineOverviewPane.Mode.Events);var categories=WebInspector.TimelinePresentationModel.categories();for(var category in categories) |
+this._overviewGrid=new WebInspector.OverviewGrid("timeline");this.element.appendChild(this._overviewGrid.element);this._innerSetMode(WebInspector.TimelineOverviewPane.Mode.Events);var categories=WebInspector.TimelinePresentationModel.categories();for(var category in categories) |
categories[category].addEventListener(WebInspector.TimelineCategory.Events.VisibilityChanged,this._onCategoryVisibilityChanged,this);this._overviewCalculator=new WebInspector.TimelineOverviewCalculator();model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,this._onRecordAdded,this);model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared,this._reset,this);this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,this._onWindowChanged,this);} |
WebInspector.TimelineOverviewPane.Mode={Events:"Events",Frames:"Frames",Memory:"Memory"};WebInspector.TimelineOverviewPane.Events={ModeChanged:"ModeChanged",WindowChanged:"WindowChanged"};WebInspector.TimelineOverviewPane.prototype={wasShown:function() |
{this._update();},onResize:function() |
@@ -315,7 +316,7 @@ |
{if(WebInspector.TimelinePresentationModel._categories) |
return WebInspector.TimelinePresentationModel._categories;WebInspector.TimelinePresentationModel._categories={loading:new WebInspector.TimelineCategory("loading",WebInspector.UIString("Loading"),0,"#5A8BCC","#8EB6E9","#70A2E3"),scripting:new WebInspector.TimelineCategory("scripting",WebInspector.UIString("Scripting"),1,"#D8AA34","#F3D07A","#F1C453"),rendering:new WebInspector.TimelineCategory("rendering",WebInspector.UIString("Rendering"),2,"#8266CC","#AF9AEB","#9A7EE6"),painting:new WebInspector.TimelineCategory("painting",WebInspector.UIString("Painting"),2,"#5FA050","#8DC286","#71B363"),other:new WebInspector.TimelineCategory("other",WebInspector.UIString("Other"),-1,"#BBBBBB","#DDDDDD","#DDDDDD")};return WebInspector.TimelinePresentationModel._categories;};WebInspector.TimelinePresentationModel._initRecordStyles=function() |
{if(WebInspector.TimelinePresentationModel._recordStylesMap) |
-return WebInspector.TimelinePresentationModel._recordStylesMap;var recordTypes=WebInspector.TimelineModel.RecordType;var categories=WebInspector.TimelinePresentationModel.categories();var recordStyles={};recordStyles[recordTypes.Root]={title:"#root",category:categories["loading"]};recordStyles[recordTypes.Program]={title:WebInspector.UIString("Other"),category:categories["other"]};recordStyles[recordTypes.EventDispatch]={title:WebInspector.UIString("Event"),category:categories["scripting"]};recordStyles[recordTypes.BeginFrame]={title:WebInspector.UIString("Frame Start"),category:categories["rendering"]};recordStyles[recordTypes.ScheduleStyleRecalculation]={title:WebInspector.UIString("Schedule Style Recalculation"),category:categories["rendering"]};recordStyles[recordTypes.RecalculateStyles]={title:WebInspector.UIString("Recalculate Style"),category:categories["rendering"]};recordStyles[recordTypes.InvalidateLayout]={title:WebInspector.UIString("Invalidate Layout"),category:categories["rendering"]};recordStyles[recordTypes.Layout]={title:WebInspector.UIString("Layout"),category:categories["rendering"]};recordStyles[recordTypes.PaintSetup]={title:WebInspector.UIString("Paint Setup"),category:categories["painting"]};recordStyles[recordTypes.Paint]={title:WebInspector.UIString("Paint"),category:categories["painting"]};recordStyles[recordTypes.Rasterize]={title:WebInspector.UIString("Rasterize"),category:categories["painting"]};recordStyles[recordTypes.ScrollLayer]={title:WebInspector.UIString("Scroll"),category:categories["rendering"]};recordStyles[recordTypes.DecodeImage]={title:WebInspector.UIString("Image Decode"),category:categories["painting"]};recordStyles[recordTypes.ResizeImage]={title:WebInspector.UIString("Image Resize"),category:categories["painting"]};recordStyles[recordTypes.CompositeLayers]={title:WebInspector.UIString("Composite Layers"),category:categories["painting"]};recordStyles[recordTypes.ParseHTML]={title:WebInspector.UIString("Parse HTML"),category:categories["loading"]};recordStyles[recordTypes.TimerInstall]={title:WebInspector.UIString("Install Timer"),category:categories["scripting"]};recordStyles[recordTypes.TimerRemove]={title:WebInspector.UIString("Remove Timer"),category:categories["scripting"]};recordStyles[recordTypes.TimerFire]={title:WebInspector.UIString("Timer Fired"),category:categories["scripting"]};recordStyles[recordTypes.XHRReadyStateChange]={title:WebInspector.UIString("XHR Ready State Change"),category:categories["scripting"]};recordStyles[recordTypes.XHRLoad]={title:WebInspector.UIString("XHR Load"),category:categories["scripting"]};recordStyles[recordTypes.EvaluateScript]={title:WebInspector.UIString("Evaluate Script"),category:categories["scripting"]};recordStyles[recordTypes.ResourceSendRequest]={title:WebInspector.UIString("Send Request"),category:categories["loading"]};recordStyles[recordTypes.ResourceReceiveResponse]={title:WebInspector.UIString("Receive Response"),category:categories["loading"]};recordStyles[recordTypes.ResourceFinish]={title:WebInspector.UIString("Finish Loading"),category:categories["loading"]};recordStyles[recordTypes.FunctionCall]={title:WebInspector.UIString("Function Call"),category:categories["scripting"]};recordStyles[recordTypes.ResourceReceivedData]={title:WebInspector.UIString("Receive Data"),category:categories["loading"]};recordStyles[recordTypes.GCEvent]={title:WebInspector.UIString("GC Event"),category:categories["scripting"]};recordStyles[recordTypes.MarkDOMContent]={title:WebInspector.UIString("DOMContentLoaded event"),category:categories["scripting"]};recordStyles[recordTypes.MarkLoad]={title:WebInspector.UIString("Load event"),category:categories["scripting"]};recordStyles[recordTypes.TimeStamp]={title:WebInspector.UIString("Stamp"),category:categories["scripting"]};recordStyles[recordTypes.Time]={title:WebInspector.UIString("Time"),category:categories["scripting"]};recordStyles[recordTypes.TimeEnd]={title:WebInspector.UIString("Time End"),category:categories["scripting"]};recordStyles[recordTypes.ScheduleResourceRequest]={title:WebInspector.UIString("Schedule Request"),category:categories["loading"]};recordStyles[recordTypes.RequestAnimationFrame]={title:WebInspector.UIString("Request Animation Frame"),category:categories["scripting"]};recordStyles[recordTypes.CancelAnimationFrame]={title:WebInspector.UIString("Cancel Animation Frame"),category:categories["scripting"]};recordStyles[recordTypes.FireAnimationFrame]={title:WebInspector.UIString("Animation Frame Fired"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketCreate]={title:WebInspector.UIString("Create WebSocket"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketSendHandshakeRequest]={title:WebInspector.UIString("Send WebSocket Handshake"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketReceiveHandshakeResponse]={title:WebInspector.UIString("Receive WebSocket Handshake"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketDestroy]={title:WebInspector.UIString("Destroy WebSocket"),category:categories["scripting"]};WebInspector.TimelinePresentationModel._recordStylesMap=recordStyles;return recordStyles;} |
+return WebInspector.TimelinePresentationModel._recordStylesMap;var recordTypes=WebInspector.TimelineModel.RecordType;var categories=WebInspector.TimelinePresentationModel.categories();var recordStyles={};recordStyles[recordTypes.Root]={title:"#root",category:categories["loading"]};recordStyles[recordTypes.Program]={title:WebInspector.UIString("Other"),category:categories["other"]};recordStyles[recordTypes.EventDispatch]={title:WebInspector.UIString("Event"),category:categories["scripting"]};recordStyles[recordTypes.BeginFrame]={title:WebInspector.UIString("Frame Start"),category:categories["rendering"]};recordStyles[recordTypes.ScheduleStyleRecalculation]={title:WebInspector.UIString("Schedule Style Recalculation"),category:categories["rendering"]};recordStyles[recordTypes.RecalculateStyles]={title:WebInspector.UIString("Recalculate Style"),category:categories["rendering"]};recordStyles[recordTypes.InvalidateLayout]={title:WebInspector.UIString("Invalidate Layout"),category:categories["rendering"]};recordStyles[recordTypes.Layout]={title:WebInspector.UIString("Layout"),category:categories["rendering"]};recordStyles[recordTypes.AutosizeText]={title:WebInspector.UIString("Autosize Text"),category:categories["rendering"]};recordStyles[recordTypes.PaintSetup]={title:WebInspector.UIString("Paint Setup"),category:categories["painting"]};recordStyles[recordTypes.Paint]={title:WebInspector.UIString("Paint"),category:categories["painting"]};recordStyles[recordTypes.Rasterize]={title:WebInspector.UIString("Rasterize"),category:categories["painting"]};recordStyles[recordTypes.ScrollLayer]={title:WebInspector.UIString("Scroll"),category:categories["rendering"]};recordStyles[recordTypes.DecodeImage]={title:WebInspector.UIString("Image Decode"),category:categories["painting"]};recordStyles[recordTypes.ResizeImage]={title:WebInspector.UIString("Image Resize"),category:categories["painting"]};recordStyles[recordTypes.CompositeLayers]={title:WebInspector.UIString("Composite Layers"),category:categories["painting"]};recordStyles[recordTypes.ParseHTML]={title:WebInspector.UIString("Parse HTML"),category:categories["loading"]};recordStyles[recordTypes.TimerInstall]={title:WebInspector.UIString("Install Timer"),category:categories["scripting"]};recordStyles[recordTypes.TimerRemove]={title:WebInspector.UIString("Remove Timer"),category:categories["scripting"]};recordStyles[recordTypes.TimerFire]={title:WebInspector.UIString("Timer Fired"),category:categories["scripting"]};recordStyles[recordTypes.XHRReadyStateChange]={title:WebInspector.UIString("XHR Ready State Change"),category:categories["scripting"]};recordStyles[recordTypes.XHRLoad]={title:WebInspector.UIString("XHR Load"),category:categories["scripting"]};recordStyles[recordTypes.EvaluateScript]={title:WebInspector.UIString("Evaluate Script"),category:categories["scripting"]};recordStyles[recordTypes.ResourceSendRequest]={title:WebInspector.UIString("Send Request"),category:categories["loading"]};recordStyles[recordTypes.ResourceReceiveResponse]={title:WebInspector.UIString("Receive Response"),category:categories["loading"]};recordStyles[recordTypes.ResourceFinish]={title:WebInspector.UIString("Finish Loading"),category:categories["loading"]};recordStyles[recordTypes.FunctionCall]={title:WebInspector.UIString("Function Call"),category:categories["scripting"]};recordStyles[recordTypes.ResourceReceivedData]={title:WebInspector.UIString("Receive Data"),category:categories["loading"]};recordStyles[recordTypes.GCEvent]={title:WebInspector.UIString("GC Event"),category:categories["scripting"]};recordStyles[recordTypes.MarkDOMContent]={title:WebInspector.UIString("DOMContentLoaded event"),category:categories["scripting"]};recordStyles[recordTypes.MarkLoad]={title:WebInspector.UIString("Load event"),category:categories["scripting"]};recordStyles[recordTypes.TimeStamp]={title:WebInspector.UIString("Stamp"),category:categories["scripting"]};recordStyles[recordTypes.Time]={title:WebInspector.UIString("Time"),category:categories["scripting"]};recordStyles[recordTypes.TimeEnd]={title:WebInspector.UIString("Time End"),category:categories["scripting"]};recordStyles[recordTypes.ScheduleResourceRequest]={title:WebInspector.UIString("Schedule Request"),category:categories["loading"]};recordStyles[recordTypes.RequestAnimationFrame]={title:WebInspector.UIString("Request Animation Frame"),category:categories["scripting"]};recordStyles[recordTypes.CancelAnimationFrame]={title:WebInspector.UIString("Cancel Animation Frame"),category:categories["scripting"]};recordStyles[recordTypes.FireAnimationFrame]={title:WebInspector.UIString("Animation Frame Fired"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketCreate]={title:WebInspector.UIString("Create WebSocket"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketSendHandshakeRequest]={title:WebInspector.UIString("Send WebSocket Handshake"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketReceiveHandshakeResponse]={title:WebInspector.UIString("Receive WebSocket Handshake"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketDestroy]={title:WebInspector.UIString("Destroy WebSocket"),category:categories["scripting"]};WebInspector.TimelinePresentationModel._recordStylesMap=recordStyles;return recordStyles;} |
WebInspector.TimelinePresentationModel.recordStyle=function(record) |
{var recordStyles=WebInspector.TimelinePresentationModel._initRecordStyles();var result=recordStyles[record.type];if(!result){result={title:WebInspector.UIString("Unknown: %s",record.type),category:WebInspector.TimelinePresentationModel.categories()["other"]};recordStyles[record.type]=result;} |
return result;} |
@@ -353,9 +354,9 @@ |
{this._frames.push(frame);},addRecord:function(record) |
{if(this._minimumRecordTime===-1||record.startTime<this._minimumRecordTime) |
this._minimumRecordTime=WebInspector.TimelineModel.startTimeInSeconds(record);var records;if(record.type===WebInspector.TimelineModel.RecordType.Program) |
-records=record.children;else |
-records=[record];var formattedRecords=[];var recordsCount=records.length;for(var i=0;i<recordsCount;++i) |
-formattedRecords.push(this._innerAddRecord(records[i],this._rootRecord));return formattedRecords;},_innerAddRecord:function(record,parentRecord) |
+records=this._foldSyncTimeRecords(record.children||[]);else |
+records=[record];var result=Array(records.length);for(var i=0;i<records.length;++i) |
+result[i]=this._innerAddRecord(this._rootRecord,records[i]);return result;},_innerAddRecord:function(parentRecord,record) |
{const recordTypes=WebInspector.TimelineModel.RecordType;var isHiddenRecord=record.type in WebInspector.TimelinePresentationModel._hiddenRecords;var origin;var coalescingBucket;if(!isHiddenRecord){var newParentRecord=this._findParentRecord(record);if(newParentRecord){origin=parentRecord;parentRecord=newParentRecord;} |
if(parentRecord===this._rootRecord) |
coalescingBucket=record.thread?record.type:"mainThread";var coalescedRecord=this._findCoalescedParent(record,parentRecord,coalescingBucket);if(coalescedRecord){if(!origin) |
@@ -364,8 +365,9 @@ |
var formattedRecord=new WebInspector.TimelinePresentationModel.Record(this,record,parentRecord,origin,scriptDetails,isHiddenRecord);if(WebInspector.TimelinePresentationModel.isEventDivider(formattedRecord)) |
this._eventDividerRecords.push(formattedRecord);if(isHiddenRecord) |
return formattedRecord;formattedRecord.collapsed=parentRecord===this._rootRecord;if(coalescingBucket) |
-this._coalescingBuckets[coalescingBucket]=formattedRecord;var childrenCount=children?children.length:0;for(var i=0;i<childrenCount;++i) |
-this._innerAddRecord(children[i],formattedRecord);formattedRecord.calculateAggregatedStats();if(origin) |
+this._coalescingBuckets[coalescingBucket]=formattedRecord;if(children){children=this._foldSyncTimeRecords(children);for(var i=0;i<children.length;++i) |
+this._innerAddRecord(formattedRecord,children[i]);} |
+formattedRecord.calculateAggregatedStats();if(origin) |
this._updateAncestorStats(formattedRecord);if(parentRecord.coalesced&&parentRecord.startTime>formattedRecord.startTime) |
parentRecord._record.startTime=record.startTime;origin=formattedRecord.origin();if(!origin.isRoot()&&!origin.coalesced) |
origin.selfTime-=formattedRecord.endTime-formattedRecord.startTime;return formattedRecord;},_updateAncestorStats:function(record) |
@@ -382,10 +384,18 @@ |
return lastRecord.parent;return this._replaceWithCoalescedRecord(lastRecord);},_replaceWithCoalescedRecord:function(record) |
{var rawRecord={type:record._record.type,startTime:record._record.startTime,endTime:record._record.endTime,data:{}};if(record._record.thread) |
rawRecord.thread="aggregated";if(record.type===WebInspector.TimelineModel.RecordType.TimeStamp) |
-rawRecord.data.message=record.data.message;var coalescedRecord=new WebInspector.TimelinePresentationModel.Record(this,rawRecord,null,null,null,false);var parent=record.parent;coalescedRecord.coalesced=true;coalescedRecord.collapsed=true;coalescedRecord._children.push(record);record.parent=coalescedRecord;coalescedRecord.calculateAggregatedStats();if(record.hasWarning||record.childHasWarning) |
-coalescedRecord.childHasWarning=true;coalescedRecord.parent=parent;parent._children[parent._children.indexOf(record)]=coalescedRecord;return coalescedRecord;},_findParentRecord:function(record) |
+rawRecord.data.message=record.data.message;var coalescedRecord=new WebInspector.TimelinePresentationModel.Record(this,rawRecord,null,null,null,false);var parent=record.parent;coalescedRecord.coalesced=true;coalescedRecord.collapsed=true;coalescedRecord._children.push(record);record.parent=coalescedRecord;coalescedRecord.calculateAggregatedStats();if(record.hasWarnings()||record.childHasWarnings()) |
+coalescedRecord._childHasWarnings=true;coalescedRecord.parent=parent;parent._children[parent._children.indexOf(record)]=coalescedRecord;return coalescedRecord;},_foldSyncTimeRecords:function(records) |
+{var recordTypes=WebInspector.TimelineModel.RecordType;for(var i=0;i<records.length&&records[i].type!==recordTypes.Time;++i){} |
+if(i===records.length) |
+return records;var result=[];var stack=[];for(var i=0;i<records.length;++i){result.push(records[i]);if(records[i].type===recordTypes.Time){stack.push(result.length-1);continue;} |
+if(records[i].type!==recordTypes.TimeEnd) |
+continue;while(stack.length){var begin=stack.pop();if(result[begin].data.message!==records[i].data.message) |
+continue;var timeEndRecord=(result.pop());var children=result.splice(begin+1,result.length-begin);result[begin]=this._createSynchronousTimeRecord(result[begin],timeEndRecord,children);break;}} |
+return result;},_createSynchronousTimeRecord:function(beginRecord,endRecord,children) |
+{return{type:beginRecord.type,startTime:beginRecord.startTime,endTime:endRecord.startTime,stackTrace:beginRecord.stackTrace,children:children,data:{message:beginRecord.data.message,isSynchronous:true},};},_findParentRecord:function(record) |
{if(!this._glueRecords) |
-return null;var recordTypes=WebInspector.TimelineModel.RecordType;switch(record.type){case recordTypes.ResourceReceiveResponse:case recordTypes.ResourceFinish:case recordTypes.ResourceReceivedData:return this._sendRequestRecords[record.data["requestId"]];case recordTypes.ResourceSendRequest:return this._rootRecord;case recordTypes.TimerFire:return this._timerRecords[record.data["timerId"]];case recordTypes.ResourceSendRequest:return this._scheduledResourceRequests[record.data["url"]];case recordTypes.FireAnimationFrame:return this._requestAnimationFrameRecords[record.data["id"]];case recordTypes.Time:return this._rootRecord;case recordTypes.TimeEnd:return this._timeRecords[record.data["message"]];}},setGlueRecords:function(glue) |
+return null;var recordTypes=WebInspector.TimelineModel.RecordType;switch(record.type){case recordTypes.ResourceReceiveResponse:case recordTypes.ResourceFinish:case recordTypes.ResourceReceivedData:return this._sendRequestRecords[record.data["requestId"]];case recordTypes.ResourceSendRequest:return this._rootRecord;case recordTypes.TimerFire:return this._timerRecords[record.data["timerId"]];case recordTypes.ResourceSendRequest:return this._scheduledResourceRequests[record.data["url"]];case recordTypes.FireAnimationFrame:return this._requestAnimationFrameRecords[record.data["id"]];}},setGlueRecords:function(glue) |
{this._glueRecords=glue;},invalidateFilteredRecords:function() |
{delete this._filteredRecords;},filteredRecords:function() |
{if(this._filteredRecords) |
@@ -413,8 +423,8 @@ |
parentRecord.children.push(this);} |
if(origin) |
this._origin=origin;this._selfTime=this.endTime-this.startTime;this._lastChildEndTime=this.endTime;this._startTimeOffset=this.startTime-presentationModel._minimumRecordTime;if(record.data){if(record.data["url"]) |
-this.url=record.data["url"];if(record.data["layerRootNode"]) |
-this._relatedBackendNodeId=record.data["layerRootNode"];else if(record.data["elementId"]) |
+this.url=record.data["url"];if(record.data["rootNode"]) |
+this._relatedBackendNodeId=record.data["rootNode"];else if(record.data["elementId"]) |
this._relatedBackendNodeId=record.data["elementId"];} |
if(scriptDetails){this.scriptName=scriptDetails.scriptName;this.scriptLine=scriptDetails.scriptLine;} |
if(parentRecord&&parentRecord.callSiteStackTrace) |
@@ -423,16 +433,16 @@ |
break;case recordTypes.ResourceReceivedData:case recordTypes.ResourceFinish:var sendRequestRecord=presentationModel._sendRequestRecords[record.data["requestId"]];if(sendRequestRecord) |
this.url=sendRequestRecord.url;break;case recordTypes.TimerInstall:this.timeout=record.data["timeout"];this.singleShot=record.data["singleShot"];presentationModel._timerRecords[record.data["timerId"]]=this;break;case recordTypes.TimerFire:var timerInstalledRecord=presentationModel._timerRecords[record.data["timerId"]];if(timerInstalledRecord){this.callSiteStackTrace=timerInstalledRecord.stackTrace;this.timeout=timerInstalledRecord.timeout;this.singleShot=timerInstalledRecord.singleShot;} |
break;case recordTypes.RequestAnimationFrame:presentationModel._requestAnimationFrameRecords[record.data["id"]]=this;break;case recordTypes.FireAnimationFrame:var requestAnimationRecord=presentationModel._requestAnimationFrameRecords[record.data["id"]];if(requestAnimationRecord) |
-this.callSiteStackTrace=requestAnimationRecord.stackTrace;break;case recordTypes.Time:var message=record.data["message"];var oldReference=presentationModel._timeRecords[message];if(oldReference) |
+this.callSiteStackTrace=requestAnimationRecord.stackTrace;break;case recordTypes.Time:if(record.data.isSynchronous) |
+break;var message=record.data["message"];var oldReference=presentationModel._timeRecords[message];if(oldReference) |
break;presentationModel._timeRecords[message]=this;if(origin) |
-presentationModel._timeRecordStack.push(this);break;case recordTypes.TimeEnd:var message=record.data["message"];var timeRecord=presentationModel._timeRecords[message];delete presentationModel._timeRecords[message];if(timeRecord){this.timeRecord=timeRecord;timeRecord.timeEndRecord=this;var intervalDuration=this.startTime-timeRecord.startTime;this.intervalDuration=intervalDuration;timeRecord.intervalDuration=intervalDuration;if(!origin) |
-break;var recordStack=presentationModel._timeRecordStack;recordStack.splice(recordStack.indexOf(timeRecord),1);for(var index=recordStack.length;index;--index){var openRecord=recordStack[index-1];if(openRecord.startTime>timeRecord.startTime) |
-continue;WebInspector.TimelinePresentationModel.adoptRecord(openRecord,timeRecord);break;}} |
+presentationModel._timeRecordStack.push(this);break;case recordTypes.TimeEnd:var message=record.data["message"];var timeRecord=presentationModel._timeRecords[message];delete presentationModel._timeRecords[message];if(timeRecord){this.timeRecord=timeRecord;timeRecord.timeEndRecord=this;var intervalDuration=this.startTime-timeRecord.startTime;this.intervalDuration=intervalDuration;timeRecord.intervalDuration=intervalDuration;} |
break;case recordTypes.ScheduleStyleRecalculation:presentationModel._lastScheduleStyleRecalculation[this.frameId]=this;break;case recordTypes.RecalculateStyles:var scheduleStyleRecalculationRecord=presentationModel._lastScheduleStyleRecalculation[this.frameId];if(!scheduleStyleRecalculationRecord) |
break;this.callSiteStackTrace=scheduleStyleRecalculationRecord.stackTrace;break;case recordTypes.InvalidateLayout:var styleRecalcStack;if(!presentationModel._layoutInvalidateStack[this.frameId]){for(var outerRecord=parentRecord;outerRecord;outerRecord=record.parent){if(outerRecord.type===recordTypes.RecalculateStyles){styleRecalcStack=outerRecord.callSiteStackTrace;break;}}} |
presentationModel._layoutInvalidateStack[this.frameId]=styleRecalcStack||this.stackTrace;break;case recordTypes.Layout:var layoutInvalidateStack=presentationModel._layoutInvalidateStack[this.frameId];if(layoutInvalidateStack) |
this.callSiteStackTrace=layoutInvalidateStack;if(this.stackTrace) |
-this.setHasWarning();presentationModel._layoutInvalidateStack[this.frameId]=null;this.highlightQuad=record.data.root||WebInspector.TimelinePresentationModel.quadFromRectData(record.data);this._relatedBackendNodeId=record.data["rootNode"];break;case recordTypes.Paint:this.highlightQuad=record.data.clip||WebInspector.TimelinePresentationModel.quadFromRectData(record.data);break;case recordTypes.WebSocketCreate:this.webSocketURL=record.data["url"];if(typeof record.data["webSocketProtocol"]!=="undefined") |
+this.addWarning(WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."));presentationModel._layoutInvalidateStack[this.frameId]=null;this.highlightQuad=record.data.root||WebInspector.TimelinePresentationModel.quadFromRectData(record.data);this._relatedBackendNodeId=record.data["rootNode"];break;case recordTypes.AutosizeText:if(record.data.needsRelayout&&parentRecord.type===recordTypes.Layout) |
+parentRecord.addWarning(WebInspector.UIString("Layout required two passes due to text autosizing, consider setting viewport."));break;case recordTypes.Paint:this.highlightQuad=record.data.clip||WebInspector.TimelinePresentationModel.quadFromRectData(record.data);break;case recordTypes.WebSocketCreate:this.webSocketURL=record.data["url"];if(typeof record.data["webSocketProtocol"]!=="undefined") |
this.webSocketProtocol=record.data["webSocketProtocol"];presentationModel._webSocketCreateRecords[record.data["identifier"]]=this;break;case recordTypes.WebSocketSendHandshakeRequest:case recordTypes.WebSocketReceiveHandshakeResponse:case recordTypes.WebSocketDestroy:var webSocketCreateRecord=presentationModel._webSocketCreateRecords[record.data["identifier"]];if(webSocketCreateRecord){this.webSocketURL=webSocketCreateRecord.webSocketURL;if(typeof webSocketCreateRecord.webSocketProtocol!=="undefined") |
this.webSocketProtocol=webSocketCreateRecord.webSocketProtocol;} |
break;}} |
@@ -476,7 +486,7 @@ |
{var contentHelper=new WebInspector.PopoverContentHelper(this.title);var text=WebInspector.UIString("%s (at %s)",Number.secondsToString(this._lastChildEndTime-this.startTime,true),Number.secondsToString(this._startTimeOffset));contentHelper.appendTextRow(WebInspector.UIString("Duration"),text);if(this._children.length){if(!this.coalesced) |
contentHelper.appendTextRow(WebInspector.UIString("Self Time"),Number.secondsToString(this._selfTime,true));contentHelper.appendTextRow(WebInspector.UIString("CPU Time"),Number.secondsToString(this._cpuTime,true));contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"),WebInspector.TimelinePresentationModel._generateAggregatedInfo(this._aggregatedStats));} |
if(this.coalesced) |
-return contentHelper.contentTable();const recordTypes=WebInspector.TimelineModel.RecordType;var callSiteStackTraceLabel;var callStackLabel;switch(this.type){case recordTypes.GCEvent:contentHelper.appendTextRow(WebInspector.UIString("Collected"),Number.bytesToString(this.data["usedHeapSizeDelta"]));break;case recordTypes.TimerFire:callSiteStackTraceLabel=WebInspector.UIString("Timer installed");case recordTypes.TimerInstall:case recordTypes.TimerRemove:contentHelper.appendTextRow(WebInspector.UIString("Timer ID"),this.data["timerId"]);if(typeof this.timeout==="number"){contentHelper.appendTextRow(WebInspector.UIString("Timeout"),Number.secondsToString(this.timeout/1000));contentHelper.appendTextRow(WebInspector.UIString("Repeats"),!this.singleShot);} |
+return contentHelper.contentTable();const recordTypes=WebInspector.TimelineModel.RecordType;var callSiteStackTraceLabel;var callStackLabel;var relatedNodeLabel;switch(this.type){case recordTypes.GCEvent:contentHelper.appendTextRow(WebInspector.UIString("Collected"),Number.bytesToString(this.data["usedHeapSizeDelta"]));break;case recordTypes.TimerFire:callSiteStackTraceLabel=WebInspector.UIString("Timer installed");case recordTypes.TimerInstall:case recordTypes.TimerRemove:contentHelper.appendTextRow(WebInspector.UIString("Timer ID"),this.data["timerId"]);if(typeof this.timeout==="number"){contentHelper.appendTextRow(WebInspector.UIString("Timeout"),Number.secondsToString(this.timeout/1000));contentHelper.appendTextRow(WebInspector.UIString("Repeats"),!this.singleShot);} |
break;case recordTypes.FireAnimationFrame:callSiteStackTraceLabel=WebInspector.UIString("Animation frame requested");contentHelper.appendTextRow(WebInspector.UIString("Callback ID"),this.data["id"]);break;case recordTypes.FunctionCall:contentHelper.appendElementRow(WebInspector.UIString("Location"),this._linkifyScriptLocation());break;case recordTypes.ScheduleResourceRequest:case recordTypes.ResourceSendRequest:case recordTypes.ResourceReceiveResponse:case recordTypes.ResourceReceivedData:case recordTypes.ResourceFinish:contentHelper.appendElementRow(WebInspector.UIString("Resource"),WebInspector.linkifyResourceAsNode(this.url));if(this._imagePreviewElement) |
contentHelper.appendElementRow(WebInspector.UIString("Preview"),this._imagePreviewElement);if(this.data["requestMethod"]) |
contentHelper.appendTextRow(WebInspector.UIString("Request Method"),this.data["requestMethod"]);if(typeof this.data["statusCode"]==="number") |
@@ -486,28 +496,27 @@ |
contentHelper.appendElementRow(WebInspector.UIString("Script"),this._linkifyLocation(this.url,this.data["lineNumber"]));break;case recordTypes.Paint:var clip=this.data["clip"];if(clip){contentHelper.appendTextRow(WebInspector.UIString("Location"),WebInspector.UIString("(%d, %d)",clip[0],clip[1]));var clipWidth=WebInspector.TimelinePresentationModel.quadWidth(clip);var clipHeight=WebInspector.TimelinePresentationModel.quadHeight(clip);contentHelper.appendTextRow(WebInspector.UIString("Dimensions"),WebInspector.UIString("%d × %d",clipWidth,clipHeight));}else{if(typeof this.data["x"]!=="undefined"&&typeof this.data["y"]!=="undefined") |
contentHelper.appendTextRow(WebInspector.UIString("Location"),WebInspector.UIString("(%d, %d)",this.data["x"],this.data["y"]));if(typeof this.data["width"]!=="undefined"&&typeof this.data["height"]!=="undefined") |
contentHelper.appendTextRow(WebInspector.UIString("Dimensions"),WebInspector.UIString("%d\u2009\u00d7\u2009%d",this.data["width"],this.data["height"]));} |
-case recordTypes.PaintSetup:case recordTypes.Rasterize:case recordTypes.ScrollLayer:if(this._relatedNode) |
-contentHelper.appendElementRow(WebInspector.UIString("Layer root"),this._createNodeAnchor(this._relatedNode));break;case recordTypes.DecodeImage:case recordTypes.ResizeImage:if(this._relatedNode) |
-contentHelper.appendElementRow(WebInspector.UIString("Image element"),this._createNodeAnchor(this._relatedNode));if(this.url) |
+case recordTypes.PaintSetup:case recordTypes.Rasterize:case recordTypes.ScrollLayer:relatedNodeLabel=WebInspector.UIString("Layer root");break;case recordTypes.AutosizeText:relatedNodeLabel=WebInspector.UIString("Root node");break;case recordTypes.DecodeImage:case recordTypes.ResizeImage:relatedNodeLabel=WebInspector.UIString("Image element");if(this.url) |
contentHelper.appendElementRow(WebInspector.UIString("Image URL"),WebInspector.linkifyResourceAsNode(this.url));break;case recordTypes.RecalculateStyles:if(this.data["elementCount"]) |
contentHelper.appendTextRow(WebInspector.UIString("Elements affected"),this.data["elementCount"]);callStackLabel=WebInspector.UIString("Styles recalculation forced");break;case recordTypes.Layout:if(this.data["dirtyObjects"]) |
contentHelper.appendTextRow(WebInspector.UIString("Nodes that need layout"),this.data["dirtyObjects"]);if(this.data["totalObjects"]) |
contentHelper.appendTextRow(WebInspector.UIString("Layout tree size"),this.data["totalObjects"]);if(typeof this.data["partialLayout"]==="boolean"){contentHelper.appendTextRow(WebInspector.UIString("Layout scope"),this.data["partialLayout"]?WebInspector.UIString("Partial"):WebInspector.UIString("Whole document"));} |
-callSiteStackTraceLabel=WebInspector.UIString("Layout invalidated");if(this.stackTrace){callStackLabel=WebInspector.UIString("Layout forced");contentHelper.appendTextRow(WebInspector.UIString("Note"),WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."));} |
-if(this._relatedNode) |
-contentHelper.appendElementRow(WebInspector.UIString("Layout root"),this._createNodeAnchor(this._relatedNode));break;case recordTypes.Time:case recordTypes.TimeEnd:contentHelper.appendTextRow(WebInspector.UIString("Message"),this.data["message"]);if(typeof this.intervalDuration==="number") |
+callSiteStackTraceLabel=WebInspector.UIString("Layout invalidated");callStackLabel=WebInspector.UIString("Layout forced");relatedNodeLabel=WebInspector.UIString("Layout root");break;case recordTypes.Time:case recordTypes.TimeEnd:contentHelper.appendTextRow(WebInspector.UIString("Message"),this.data["message"]);if(typeof this.intervalDuration==="number") |
contentHelper.appendTextRow(WebInspector.UIString("Interval Duration"),Number.secondsToString(this.intervalDuration,true));break;case recordTypes.WebSocketCreate:case recordTypes.WebSocketSendHandshakeRequest:case recordTypes.WebSocketReceiveHandshakeResponse:case recordTypes.WebSocketDestroy:if(typeof this.webSocketURL!=="undefined") |
contentHelper.appendTextRow(WebInspector.UIString("URL"),this.webSocketURL);if(typeof this.webSocketProtocol!=="undefined") |
contentHelper.appendTextRow(WebInspector.UIString("WebSocket Protocol"),this.webSocketProtocol);if(typeof this.data["message"]!=="undefined") |
contentHelper.appendTextRow(WebInspector.UIString("Message"),this.data["message"]) |
break;default:if(this.detailsNode()) |
contentHelper.appendElementRow(WebInspector.UIString("Details"),this.detailsNode().childNodes[1].cloneNode());break;} |
-if(this.scriptName&&this.type!==recordTypes.FunctionCall) |
+if(this._relatedNode) |
+contentHelper.appendElementRow(relatedNodeLabel||WebInspector.UIString("Related node"),this._createNodeAnchor(this._relatedNode));if(this.scriptName&&this.type!==recordTypes.FunctionCall) |
contentHelper.appendElementRow(WebInspector.UIString("Function Call"),this._linkifyScriptLocation());if(this.usedHeapSize){if(this.usedHeapSizeDelta){var sign=this.usedHeapSizeDelta>0?"+":"-";contentHelper.appendTextRow(WebInspector.UIString("Used Heap Size"),WebInspector.UIString("%s (%s%s)",Number.bytesToString(this.usedHeapSize),sign,Number.bytesToString(Math.abs(this.usedHeapSizeDelta))));}else if(this.category===WebInspector.TimelinePresentationModel.categories().scripting) |
contentHelper.appendTextRow(WebInspector.UIString("Used Heap Size"),Number.bytesToString(this.usedHeapSize));} |
if(this.callSiteStackTrace) |
contentHelper.appendStackTrace(callSiteStackTraceLabel||WebInspector.UIString("Call Site stack"),this.callSiteStackTrace,this._linkifyCallFrame.bind(this));if(this.stackTrace) |
-contentHelper.appendStackTrace(callStackLabel||WebInspector.UIString("Call Stack"),this.stackTrace,this._linkifyCallFrame.bind(this));return contentHelper.contentTable();},_createNodeAnchor:function(node) |
+contentHelper.appendStackTrace(callStackLabel||WebInspector.UIString("Call Stack"),this.stackTrace,this._linkifyCallFrame.bind(this));if(this._warnings){var ul=document.createElement("ul");for(var i=0;i<this._warnings.length;++i) |
+ul.createChild("li").textContent=this._warnings[i];contentHelper.appendElementRow(WebInspector.UIString("Warning"),ul);} |
+return contentHelper.contentTable();},_createNodeAnchor:function(node) |
{var span=document.createElement("span");span.classList.add("node-link");span.addEventListener("click",onClick,false);WebInspector.DOMPresentationUtils.decorateNodeLabel(node,span);function onClick() |
{WebInspector.showPanel("elements").revealAndSelectNode(node.id);} |
return span;},_refreshDetails:function() |
@@ -534,9 +543,13 @@ |
this._aggregatedStats[category]=(this._aggregatedStats[category]||0)+child._aggregatedStats[category];} |
for(var category in this._aggregatedStats) |
this._cpuTime+=this._aggregatedStats[category];this._aggregatedStats[this.category.name]=(this._aggregatedStats[this.category.name]||0)+this._selfTime;},get aggregatedStats() |
-{return this._aggregatedStats;},setHasWarning:function() |
-{this.hasWarning=true;for(var parent=this.parent;parent&&!parent.childHasWarning;parent=parent.parent) |
-parent.childHasWarning=true;}} |
+{return this._aggregatedStats;},addWarning:function(message) |
+{if(this._warnings) |
+this._warnings.push(message);else |
+this._warnings=[message];for(var parent=this.parent;parent&&!parent._childHasWarnings;parent=parent.parent) |
+parent._childHasWarnings=true;},hasWarnings:function() |
+{return!!this._warnings;},childHasWarnings:function() |
+{return this._childHasWarnings;}} |
WebInspector.TimelinePresentationModel._generateAggregatedInfo=function(aggregatedStats) |
{var cell=document.createElement("span");cell.className="timeline-aggregated-info";for(var index in aggregatedStats){var label=document.createElement("div");label.className="timeline-aggregated-category timeline-"+index;cell.appendChild(label);var text=document.createElement("span");text.textContent=Number.secondsToString(aggregatedStats[index],true);cell.appendChild(text);} |
return cell;} |
@@ -551,12 +564,12 @@ |
WebInspector.TimelinePresentationModel.createFillStyleForCategory=function(context,width,height,category) |
{return WebInspector.TimelinePresentationModel.createFillStyle(context,width,height,category.fillColorStop0,category.fillColorStop1,category.borderColor);} |
WebInspector.TimelinePresentationModel.createStyleRuleForCategory=function(category) |
-{var selector=".timeline-category-"+category.name+" .timeline-graph-bar, "+".timeline-category-statusbar-item.timeline-category-"+category.name+" .timeline-category-checkbox, "+".popover .timeline-"+category.name+", "+".timeline-category-"+category.name+" .timeline-tree-icon" |
+{var selector=".timeline-category-"+category.name+" .timeline-graph-bar, "+".panel.timeline .timeline-filters-header .filter-checkbox-filter.filter-checkbox-filter-"+category.name+" .checkbox-filter-checkbox, "+".popover .timeline-"+category.name+", "+".timeline-category-"+category.name+" .timeline-tree-icon" |
return selector+" { background-image: -webkit-linear-gradient("+ |
category.fillColorStop0+", "+category.fillColorStop1+" 25%, "+category.fillColorStop1+" 25%, "+category.fillColorStop1+");"+" border-color: "+category.borderColor+"}";} |
WebInspector.TimelinePresentationModel.coalescingKeyForRecord=function(rawRecord) |
{var recordTypes=WebInspector.TimelineModel.RecordType;switch(rawRecord.type) |
-{case recordTypes.EventDispatch:return rawRecord.data["type"];case recordTypes.TimeStamp:return rawRecord.data["message"];default:return null;}} |
+{case recordTypes.EventDispatch:return rawRecord.data["type"];case recordTypes.Time:return rawRecord.data["message"];case recordTypes.TimeStamp:return rawRecord.data["message"];default:return null;}} |
WebInspector.TimelinePresentationModel.quadWidth=function(quad) |
{return Math.round(Math.sqrt(Math.pow(quad[0]-quad[2],2)+Math.pow(quad[1]-quad[3],2)));} |
WebInspector.TimelinePresentationModel.quadHeight=function(quad) |
@@ -593,29 +606,32 @@ |
this.average=totalDuration/this.frameCount;var variance=sumOfSquares/this.frameCount-this.average*this.average;this.stddev=Math.sqrt(variance);} |
WebInspector.TimelineFrame=function() |
{this.timeByCategory={};this.cpuTime=0;};WebInspector.TimelinePanel=function() |
-{WebInspector.Panel.call(this,"timeline");this.registerRequiredCSS("timelinePanel.css");this._model=new WebInspector.TimelineModel();this._presentationModel=new WebInspector.TimelinePresentationModel();this._overviewModeSetting=WebInspector.settings.createSetting("timelineOverviewMode",WebInspector.TimelineOverviewPane.Mode.Events);this._glueRecordsSetting=WebInspector.settings.createSetting("timelineGlueRecords",false);this._overviewPane=new WebInspector.TimelineOverviewPane(this._model);this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events.WindowChanged,this._invalidateAndScheduleRefresh.bind(this,false,true));this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events.ModeChanged,this._overviewModeChanged,this);this._overviewPane.show(this.element);this.element.addEventListener("contextmenu",this._contextMenu.bind(this),false);this.createSidebarViewWithTree();this._containerElement=this.splitView.element;this._containerElement.tabIndex=0;this._containerElement.id="timeline-container";this._containerElement.addEventListener("scroll",this._onScroll.bind(this),false);this._timelineMemorySplitter=this.element.createChild("div");this._timelineMemorySplitter.id="timeline-memory-splitter";WebInspector.installDragHandle(this._timelineMemorySplitter,this._startSplitterDragging.bind(this),this._splitterDragging.bind(this),this._endSplitterDragging.bind(this),"ns-resize");this._timelineMemorySplitter.addStyleClass("hidden");this._includeDomCounters=false;this._memoryStatistics=new WebInspector.DOMCountersGraph(this,this._model,this.splitView.sidebarWidth());this._includeDomCounters=true;WebInspector.settings.memoryCounterGraphsHeight=WebInspector.settings.createSetting("memoryCounterGraphsHeight",150);var itemsTreeElement=new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"),{},true);this.sidebarTree.appendChild(itemsTreeElement);this.sidebarTree.setFocusable(false);this._sidebarListElement=document.createElement("div");this.sidebarElement.appendChild(this._sidebarListElement);this._containerContentElement=this.splitView.mainElement;this._containerContentElement.id="resources-container-content";this._timelineGrid=new WebInspector.TimelineGrid();this._itemsGraphsElement=this._timelineGrid.itemsGraphsElement;this._itemsGraphsElement.id="timeline-graphs";this._containerContentElement.appendChild(this._timelineGrid.element);this._timelineGrid.gridHeaderElement.id="timeline-grid-header";this._memoryStatistics.setMainTimelineGrid(this._timelineGrid);this.element.appendChild(this._timelineGrid.gridHeaderElement);this._topGapElement=document.createElement("div");this._topGapElement.className="timeline-gap";this._itemsGraphsElement.appendChild(this._topGapElement);this._graphRowsElement=document.createElement("div");this._itemsGraphsElement.appendChild(this._graphRowsElement);this._bottomGapElement=document.createElement("div");this._bottomGapElement.className="timeline-gap";this._itemsGraphsElement.appendChild(this._bottomGapElement);this._expandElements=document.createElement("div");this._expandElements.id="orphan-expand-elements";this._itemsGraphsElement.appendChild(this._expandElements);this._calculator=new WebInspector.TimelineCalculator(this._model);this._createStatusBarItems();this._frameMode=false;this._boundariesAreValid=true;this._scrollTop=0;this._popoverHelper=new WebInspector.PopoverHelper(this.element,this._getPopoverAnchor.bind(this),this._showPopover.bind(this));this.element.addEventListener("mousemove",this._mouseMove.bind(this),false);this.element.addEventListener("mouseout",this._mouseOut.bind(this),false);this._durationFilter=new WebInspector.TimelineIsLongFilter();this._expandOffset=15;this._headerLineCount=1;this._adjustHeaderHeight();this._mainThreadTasks=([]);this._cpuBarsElement=this._timelineGrid.gridHeaderElement.createChild("div","timeline-cpu-bars");this._mainThreadMonitoringEnabled=WebInspector.settings.showCpuOnTimelineRuler.get();WebInspector.settings.showCpuOnTimelineRuler.addChangeListener(this._showCpuOnTimelineRulerChanged,this);this._createFileSelector();this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,this._onTimelineEventRecorded,this);this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared,this._onRecordsCleared,this);this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStarted,this._onRecordingStarted,this);this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped,this._onRecordingStopped,this);this._registerShortcuts();this._allRecordsCount=0;this._presentationModel.addFilter(new WebInspector.TimelineWindowFilter(this._overviewPane));this._presentationModel.addFilter(new WebInspector.TimelineCategoryFilter());this._presentationModel.addFilter(this._durationFilter);} |
-WebInspector.TimelinePanel.rowHeight=18;WebInspector.TimelinePanel.durationFilterPresetsMs=[0,1,15];WebInspector.TimelinePanel.prototype={_showCpuOnTimelineRulerChanged:function() |
+{WebInspector.Panel.call(this,"timeline");this.registerRequiredCSS("timelinePanel.css");this.registerRequiredCSS("filter.css");this.element.addStyleClass("vbox");this._model=new WebInspector.TimelineModel();this._presentationModel=new WebInspector.TimelinePresentationModel();this._overviewModeSetting=WebInspector.settings.createSetting("timelineOverviewMode",WebInspector.TimelineOverviewPane.Mode.Events);this._glueRecordsSetting=WebInspector.settings.createSetting("timelineGlueRecords",false);this._panelStatusBarElement=this.element.createChild("div","panel-status-bar");this._createFilters();this._overviewPane=new WebInspector.TimelineOverviewPane(this._model);this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events.WindowChanged,this._invalidateAndScheduleRefresh.bind(this,false,true));this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events.ModeChanged,this._overviewModeChanged,this);this._overviewPane.show(this.element);this.element.addEventListener("contextmenu",this._contextMenu.bind(this),false);this.createSidebarViewWithTree();this._containerElement=this.splitView.element;this._containerElement.tabIndex=0;this._containerElement.id="timeline-container";this._containerElement.removeStyleClass("fill");this._containerElement.addEventListener("scroll",this._onScroll.bind(this),false);this._timelineMemorySplitter=this.element.createChild("div","hidden");this._timelineMemorySplitter.id="timeline-memory-splitter";WebInspector.installDragHandle(this._timelineMemorySplitter,this._startSplitterDragging.bind(this),this._splitterDragging.bind(this),this._endSplitterDragging.bind(this),"ns-resize");this._includeDomCounters=false;this._memoryStatistics=new WebInspector.DOMCountersGraph(this,this._model,this.splitView.sidebarWidth());this._includeDomCounters=true;WebInspector.settings.memoryCounterGraphsHeight=WebInspector.settings.createSetting("memoryCounterGraphsHeight",150);var itemsTreeElement=new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"),{},true);this.sidebarTree.appendChild(itemsTreeElement);this.sidebarTree.setFocusable(false);this._sidebarListElement=document.createElement("div");this.sidebarElement.appendChild(this._sidebarListElement);this._containerContentElement=this.splitView.mainElement;this._containerContentElement.id="resources-container-content";this._timelineGrid=new WebInspector.TimelineGrid();this._itemsGraphsElement=this._timelineGrid.itemsGraphsElement;this._itemsGraphsElement.id="timeline-graphs";this._containerContentElement.appendChild(this._timelineGrid.element);this._timelineGrid.gridHeaderElement.id="timeline-grid-header";this._timelineGrid.gridHeaderElement.addStyleClass("fill");this._memoryStatistics.setMainTimelineGrid(this._timelineGrid);this._containerContentElement.appendChild(this._timelineGrid.gridHeaderElement);this._topGapElement=document.createElement("div");this._topGapElement.className="timeline-gap";this._itemsGraphsElement.appendChild(this._topGapElement);this._graphRowsElement=document.createElement("div");this._itemsGraphsElement.appendChild(this._graphRowsElement);this._bottomGapElement=document.createElement("div");this._bottomGapElement.className="timeline-gap";this._itemsGraphsElement.appendChild(this._bottomGapElement);this._expandElements=document.createElement("div");this._expandElements.id="orphan-expand-elements";this._itemsGraphsElement.appendChild(this._expandElements);this._calculator=new WebInspector.TimelineCalculator(this._model);this._createStatusBarItems();this._frameMode=false;this._boundariesAreValid=true;this._scrollTop=0;this._popoverHelper=new WebInspector.PopoverHelper(this.element,this._getPopoverAnchor.bind(this),this._showPopover.bind(this));this.element.addEventListener("mousemove",this._mouseMove.bind(this),false);this.element.addEventListener("mouseout",this._mouseOut.bind(this),false);this._durationFilter=new WebInspector.TimelineIsLongFilter();this._expandOffset=15;this._headerLineCount=1;this._adjustHeaderHeight();this._mainThreadTasks=([]);this._cpuBarsElement=this._timelineGrid.gridHeaderElement.createChild("div","timeline-cpu-bars");this._mainThreadMonitoringEnabled=WebInspector.settings.showCpuOnTimelineRuler.get();WebInspector.settings.showCpuOnTimelineRuler.addChangeListener(this._showCpuOnTimelineRulerChanged,this);this._createFileSelector();this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,this._onTimelineEventRecorded,this);this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared,this._onRecordsCleared,this);this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStarted,this._onRecordingStarted,this);this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped,this._onRecordingStopped,this);this._registerShortcuts();this._allRecordsCount=0;this._presentationModel.addFilter(new WebInspector.TimelineWindowFilter(this._overviewPane));this._presentationModel.addFilter(new WebInspector.TimelineCategoryFilter());this._presentationModel.addFilter(this._durationFilter);} |
+WebInspector.TimelinePanel.rowHeight=18;WebInspector.TimelinePanel.headerHeight=19;WebInspector.TimelinePanel.durationFilterPresetsMs=[0,1,15];WebInspector.TimelinePanel.prototype={_showCpuOnTimelineRulerChanged:function() |
{var mainThreadMonitoringEnabled=WebInspector.settings.showCpuOnTimelineRuler.get();if(this._mainThreadMonitoringEnabled!==mainThreadMonitoringEnabled){this._mainThreadMonitoringEnabled=mainThreadMonitoringEnabled;this._refreshMainThreadBars();}},_startSplitterDragging:function(event) |
-{this._dragOffset=this._timelineMemorySplitter.offsetTop+2-event.pageY;return true;},_splitterDragging:function(event) |
-{var top=event.pageY+this._dragOffset |
-this._setSplitterPosition(top);event.preventDefault();},_endSplitterDragging:function(event) |
-{delete this._dragOffset;this._memoryStatistics.show();WebInspector.settings.memoryCounterGraphsHeight.set(this.splitView.element.offsetHeight);},_setSplitterPosition:function(top) |
-{const overviewHeight=90;const sectionMinHeight=100;top=Number.constrain(top,overviewHeight+sectionMinHeight,this.element.offsetHeight-sectionMinHeight);this.splitView.element.style.height=(top-overviewHeight)+"px";this._timelineMemorySplitter.style.top=(top-2)+"px";this._memoryStatistics.setTopPosition(top);this._containerElementHeight=this._containerElement.clientHeight;this.onResize();},get calculator() |
-{return this._calculator;},get statusBarItems() |
-{return this._statusBarItems.select("element").concat([this._miscStatusBarItems]);},defaultFocusedElement:function() |
-{return this.element;},_createStatusBarItems:function() |
-{this._statusBarItems=([]);this.toggleTimelineButton=new WebInspector.StatusBarButton(WebInspector.UIString("Record"),"record-profile-status-bar-item");this.toggleTimelineButton.addEventListener("click",this._toggleTimelineButtonClicked,this);this._statusBarItems.push(this.toggleTimelineButton);this.clearButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear"),"clear-status-bar-item");this.clearButton.addEventListener("click",this._clearPanel,this);this._statusBarItems.push(this.clearButton);this.garbageCollectButton=new WebInspector.StatusBarButton(WebInspector.UIString("Collect Garbage"),"garbage-collect-status-bar-item");this.garbageCollectButton.addEventListener("click",this._garbageCollectButtonClicked,this);this._statusBarItems.push(this.garbageCollectButton);this._glueParentButton=new WebInspector.StatusBarButton(WebInspector.UIString("Glue asynchronous events to causes"),"glue-async-status-bar-item");this._glueParentButton.toggled=this._glueRecordsSetting.get();this._presentationModel.setGlueRecords(this._glueParentButton.toggled);this._glueParentButton.addEventListener("click",this._glueParentButtonClicked,this);this._statusBarItems.push(this._glueParentButton);this._durationFilterSelector=new WebInspector.StatusBarComboBox(this._durationFilterChanged.bind(this));for(var presetIndex=0;presetIndex<WebInspector.TimelinePanel.durationFilterPresetsMs.length;++presetIndex){var durationMs=WebInspector.TimelinePanel.durationFilterPresetsMs[presetIndex];var option=document.createElement("option");if(!durationMs){option.text=WebInspector.UIString("All");option.title=WebInspector.UIString("Show all records");}else{option.text=WebInspector.UIString("\u2265 %dms",durationMs);option.title=WebInspector.UIString("Hide records shorter than %dms",durationMs);} |
-option._durationMs=durationMs;this._durationFilterSelector.addOption(option);this._durationFilterSelector.element.title=this._durationFilterSelector.selectedOption().title;} |
-this._statusBarItems.push(this._durationFilterSelector);this._miscStatusBarItems=document.createElement("div");this._miscStatusBarItems.className="status-bar-items timeline-misc-status-bar-items";this._statusBarFilters=this._miscStatusBarItems.createChild("div","timeline-misc-status-bar-filters");var categories=WebInspector.TimelinePresentationModel.categories();for(var categoryName in categories){var category=categories[categoryName];if(category.overviewStripGroupIndex<0) |
-continue;this._statusBarFilters.appendChild(this._createTimelineCategoryStatusBarCheckbox(category));} |
-var statsContainer=this._statusBarFilters.createChild("div","timeline-records-stats-container");this.recordsCounter=statsContainer.createChild("div","timeline-records-stats");this.frameStatistics=statsContainer.createChild("div","timeline-records-stats hidden");function getAnchor() |
+{this._dragOffset=this.element.offsetHeight-this._timelineMemorySplitter.offsetTop-2+event.pageY;return true;},_splitterDragging:function(event) |
+{var height=this._dragOffset-event.pageY;this._setMemoryCountersHeight(height);this._resize(this.splitView.sidebarWidth());event.preventDefault();},_endSplitterDragging:function(event) |
+{delete this._dragOffset;this._memoryStatistics.show();WebInspector.settings.memoryCounterGraphsHeight.set(this._memoryStatistics.height());},_setMemoryCountersHeight:function(height) |
+{const overviewHeight=this._containerElement.offsetTop-20;const sectionMinHeight=20;height=Number.constrain(height,sectionMinHeight,this.element.offsetHeight-sectionMinHeight-overviewHeight);this._timelineMemorySplitter.style.bottom=(height-3)+"px";this._memoryStatistics.setHeight(height);},get calculator() |
+{return this._calculator;},defaultFocusedElement:function() |
+{return this.element;},_createFilters:function() |
+{this._filterBar=new WebInspector.FilterBar();this._filtersContainer=this.element.createChild("div","timeline-filters-header hidden");this._filtersContainer.appendChild(this._filterBar.filtersElement());this._filterBar.addEventListener(WebInspector.FilterBar.Events.FiltersToggled,this._onFiltersToggled,this);this._textFilter=new WebInspector.TextFilterUI();this._textFilter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._textFilterChanged,this);this._filterBar.addFilter(this._textFilter);var durationOptions=[];for(var presetIndex=0;presetIndex<WebInspector.TimelinePanel.durationFilterPresetsMs.length;++presetIndex){var durationMs=WebInspector.TimelinePanel.durationFilterPresetsMs[presetIndex];var durationOption={};if(!durationMs){durationOption.label=WebInspector.UIString("All");durationOption.title=WebInspector.UIString("Show all records");}else{durationOption.label=WebInspector.UIString("\u2265 %dms",durationMs);durationOption.title=WebInspector.UIString("Hide records shorter than %dms",durationMs);} |
+durationOption.value=durationMs;durationOptions.push(durationOption);} |
+this._durationComboBoxFilter=new WebInspector.ComboBoxFilterUI(durationOptions);this._durationComboBoxFilter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._durationFilterChanged,this);this._filterBar.addFilter(this._durationComboBoxFilter);this._categoryFilters={};var categoryTypes=[];var categories=WebInspector.TimelinePresentationModel.categories();for(var categoryName in categories){var category=categories[categoryName];if(category.overviewStripGroupIndex<0) |
+continue;var filter=new WebInspector.CheckboxFilterUI(category.name,category.title,false);filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._categoriesFilterChanged.bind(this,category.name),this);this._filterBar.addFilter(filter);this._categoryFilters[category.name]=filter;}},_createStatusBarItems:function() |
+{this._statusBarButtons=([]);this.toggleTimelineButton=new WebInspector.StatusBarButton(WebInspector.UIString("Record"),"record-profile-status-bar-item");this.toggleTimelineButton.addEventListener("click",this._toggleTimelineButtonClicked,this);this._statusBarButtons.push(this.toggleTimelineButton);this._panelStatusBarElement.appendChild(this.toggleTimelineButton.element);this.clearButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear"),"clear-status-bar-item");this.clearButton.addEventListener("click",this._clearPanel,this);this._statusBarButtons.push(this.clearButton);this._panelStatusBarElement.appendChild(this.clearButton.element);this._panelStatusBarElement.appendChild(this._filterBar.filterButton());this.garbageCollectButton=new WebInspector.StatusBarButton(WebInspector.UIString("Collect Garbage"),"garbage-collect-status-bar-item");this.garbageCollectButton.addEventListener("click",this._garbageCollectButtonClicked,this);this._statusBarButtons.push(this.garbageCollectButton);this._panelStatusBarElement.appendChild(this.garbageCollectButton.element);this._glueParentButton=new WebInspector.StatusBarButton(WebInspector.UIString("Glue asynchronous events to causes"),"glue-async-status-bar-item");this._glueParentButton.toggled=this._glueRecordsSetting.get();this._presentationModel.setGlueRecords(this._glueParentButton.toggled);this._glueParentButton.addEventListener("click",this._glueParentButtonClicked,this);this._statusBarButtons.push(this._glueParentButton);this._panelStatusBarElement.appendChild(this._glueParentButton.element);this._statusTextContainer=this._panelStatusBarElement.createChild("div");this.recordsCounter=new WebInspector.StatusBarText("");this._statusTextContainer.appendChild(this.recordsCounter.element);this.frameStatistics=this._statusTextContainer.createChild("div","timeline-frame-statistics status-bar-item status-bar-text hidden");function getAnchor() |
{return this.frameStatistics;} |
-this._frameStatisticsPopoverHelper=new WebInspector.PopoverHelper(this.frameStatistics,getAnchor.bind(this),this._showFrameStatistics.bind(this));},_createTimelineCategoryStatusBarCheckbox:function(category) |
-{var labelContainer=document.createElement("div");labelContainer.addStyleClass("timeline-category-statusbar-item");labelContainer.addStyleClass("timeline-category-"+category.name);labelContainer.addStyleClass("status-bar-item");var label=labelContainer.createChild("label");var checkBorder=label.createChild("div","timeline-category-checkbox");var checkElement=checkBorder.createChild("div","timeline-category-checkbox-check timeline-category-checkbox-checked");checkElement.type="checkbox";checkElement.checked=true;labelContainer.addEventListener("click",listener.bind(this),false);function listener(event) |
-{var checked=!checkElement.checked;checkElement.checked=checked;category.hidden=!checked;checkElement.enableStyleClass("timeline-category-checkbox-checked",checkElement.checked);this._invalidateAndScheduleRefresh(true,true);} |
-var typeElement=label.createChild("span","type");typeElement.textContent=category.title;return labelContainer;},_setOperationInProgress:function(indicator) |
-{this._operationInProgress=!!indicator;for(var i=0;i<this._statusBarItems.length;++i) |
-this._statusBarItems[i].setEnabled(!this._operationInProgress);this._glueParentButton.setEnabled(!this._operationInProgress&&!this._frameController);this._miscStatusBarItems.removeChildren();this._miscStatusBarItems.appendChild(indicator?indicator.element:this._statusBarFilters);},_registerShortcuts:function() |
+this._frameStatisticsPopoverHelper=new WebInspector.PopoverHelper(this.frameStatistics,getAnchor.bind(this),this._showFrameStatistics.bind(this));this._miscStatusBarItems=this._panelStatusBarElement.createChild("div","status-bar-item");},_textFilterChanged:function(event) |
+{var searchQuery=this._textFilter.value();this._presentationModel.setSearchFilter(null);delete this._searchFilter;function cleanRecord(record) |
+{delete record.clicked;} |
+WebInspector.TimelinePresentationModel.forAllRecords(this._presentationModel.rootRecord().children,cleanRecord);this.searchCanceled();if(searchQuery){this._searchFilter=new WebInspector.TimelineSearchFilter(createPlainTextSearchRegex(searchQuery,"i"));this._presentationModel.setSearchFilter(this._searchFilter);} |
+this._invalidateAndScheduleRefresh(true,true);},_durationFilterChanged:function() |
+{var duration=this._durationComboBoxFilter.value();var minimumRecordDuration=+duration/1000.0;this._durationFilter.setMinimumRecordDuration(minimumRecordDuration);this._invalidateAndScheduleRefresh(true,true);},_categoriesFilterChanged:function(name,event) |
+{var categories=WebInspector.TimelinePresentationModel.categories();categories[name].hidden=!this._categoryFilters[name].checked();this._invalidateAndScheduleRefresh(true,true);},_onFiltersToggled:function(event) |
+{var toggled=(event.data);this._filtersContainer.enableStyleClass("hidden",!toggled);this.onResize();},_setOperationInProgress:function(indicator) |
+{this._operationInProgress=!!indicator;for(var i=0;i<this._statusBarButtons.length;++i) |
+this._statusBarButtons[i].setEnabled(!this._operationInProgress);this._glueParentButton.setEnabled(!this._operationInProgress&&!this._frameController);this._statusTextContainer.enableStyleClass("hidden",!!indicator);this._miscStatusBarItems.removeChildren();if(indicator) |
+this._miscStatusBarItems.appendChild(indicator.element);},_registerShortcuts:function() |
{this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartStopRecording,this._toggleTimelineButtonClicked.bind(this));this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile,this._saveToFile.bind(this));this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.LoadFromFile,this._selectFileToLoad.bind(this));},_createFileSelector:function() |
{if(this._fileSelectorElement) |
this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=WebInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element.appendChild(this._fileSelectorElement);},_contextMenu:function(event) |
@@ -630,7 +646,7 @@ |
return null;if(this.toggleTimelineButton.toggled){this.toggleTimelineButton.toggled=false;this._model.stopRecording();} |
var progressIndicator=new WebInspector.ProgressIndicator();progressIndicator.addEventListener(WebInspector.ProgressIndicator.Events.Done,this._setOperationInProgress.bind(this,null));this._setOperationInProgress(progressIndicator);return progressIndicator;},_rootRecord:function() |
{return this._presentationModel.rootRecord();},_updateRecordsCounter:function(recordsInWindowCount) |
-{this.recordsCounter.textContent=WebInspector.UIString("%d of %d records shown",recordsInWindowCount,this._allRecordsCount);},_updateFrameStatistics:function(frames) |
+{this.recordsCounter.setText(WebInspector.UIString("%d of %d records shown",recordsInWindowCount,this._allRecordsCount));},_updateFrameStatistics:function(frames) |
{if(frames.length){this._lastFrameStatistics=new WebInspector.FrameStatistics(frames);var details=WebInspector.UIString("avg: %s, \u03c3: %s",Number.secondsToString(this._lastFrameStatistics.average,true),Number.secondsToString(this._lastFrameStatistics.stddev,true));}else |
this._lastFrameStatistics=null;this.frameStatistics.textContent=WebInspector.UIString("%d of %d frames shown",frames.length,this._presentationModel.frames().length);if(details){this.frameStatistics.appendChild(document.createTextNode(" ("));this.frameStatistics.createChild("span","timeline-frames-stats").textContent=details;this.frameStatistics.appendChild(document.createTextNode(")"));}},_showFrameStatistics:function(anchor,popover) |
{popover.show(WebInspector.TimelinePresentationModel.generatePopupContentForFrameStatistics(this._lastFrameStatistics),anchor);},_updateEventDividers:function() |
@@ -644,13 +660,12 @@ |
this._timelineGrid.addEventDividers(dividers);},_onFrameDoubleClicked:function(event) |
{var frameBar=event.target.enclosingNodeOrSelfWithClass("timeline-frame-strip");if(!frameBar) |
return;this._overviewPane.zoomToFrame(frameBar._frame);},_overviewModeChanged:function(event) |
-{var mode=event.data;var shouldShowMemory=mode===WebInspector.TimelineOverviewPane.Mode.Memory;var frameMode=mode===WebInspector.TimelineOverviewPane.Mode.Frames;this._overviewModeSetting.set(mode);if(frameMode!==this._frameMode){this._frameMode=frameMode;this._glueParentButton.setEnabled(!frameMode);this._presentationModel.setGlueRecords(this._glueParentButton.toggled&&!frameMode);this._repopulateRecords();if(frameMode){this.element.addStyleClass("timeline-frame-overview");this.recordsCounter.addStyleClass("hidden");this.frameStatistics.removeStyleClass("hidden");this._frameController=new WebInspector.TimelineFrameController(this._model,this._overviewPane,this._presentationModel);}else{this._frameController.dispose();this._frameController=null;this.element.removeStyleClass("timeline-frame-overview");this.recordsCounter.removeStyleClass("hidden");this.frameStatistics.addStyleClass("hidden");}} |
+{var mode=event.data;var shouldShowMemory=mode===WebInspector.TimelineOverviewPane.Mode.Memory;var frameMode=mode===WebInspector.TimelineOverviewPane.Mode.Frames;this._overviewModeSetting.set(mode);if(frameMode!==this._frameMode){this._frameMode=frameMode;this._glueParentButton.setEnabled(!frameMode);this._presentationModel.setGlueRecords(this._glueParentButton.toggled&&!frameMode);this._repopulateRecords();if(frameMode){this.element.addStyleClass("timeline-frame-overview");this.recordsCounter.element.addStyleClass("hidden");this.frameStatistics.removeStyleClass("hidden");this._frameController=new WebInspector.TimelineFrameController(this._model,this._overviewPane,this._presentationModel);}else{this._frameController.dispose();this._frameController=null;this.element.removeStyleClass("timeline-frame-overview");this.recordsCounter.element.removeStyleClass("hidden");this.frameStatistics.addStyleClass("hidden");}} |
if(shouldShowMemory===this._memoryStatistics.visible()) |
-return;if(!shouldShowMemory){this._timelineMemorySplitter.addStyleClass("hidden");this._memoryStatistics.hide();this.splitView.element.style.height="auto";this.splitView.element.style.bottom="0";this.onResize();}else{this._timelineMemorySplitter.removeStyleClass("hidden");this._memoryStatistics.show();this.splitView.element.style.bottom="auto";this._setSplitterPosition(WebInspector.settings.memoryCounterGraphsHeight.get());}},_toggleTimelineButtonClicked:function() |
+return;this._timelineMemorySplitter.enableStyleClass("hidden",!shouldShowMemory);if(!shouldShowMemory){this._memoryStatistics.hide();this._resize(this.splitView.sidebarWidth());}else{this._memoryStatistics.show();this._setMemoryCountersHeight(WebInspector.settings.memoryCounterGraphsHeight.get());this._resize(this.splitView.sidebarWidth());}},_toggleTimelineButtonClicked:function() |
{if(this._operationInProgress) |
return true;if(this.toggleTimelineButton.toggled){this._model.stopRecording();}else{this._model.startRecording(this._includeDomCounters);WebInspector.userMetrics.TimelineStarted.record();} |
-return true;},_durationFilterChanged:function() |
-{var option=this._durationFilterSelector.selectedOption();var minimumRecordDuration=+option._durationMs/1000.0;this._durationFilter.setMinimumRecordDuration(minimumRecordDuration);this._durationFilterSelector.element.title=option.title;this._invalidateAndScheduleRefresh(true,true);},_garbageCollectButtonClicked:function() |
+return true;},_garbageCollectButtonClicked:function() |
{HeapProfilerAgent.collectGarbage();},_glueParentButtonClicked:function() |
{var newValue=!this._glueParentButton.toggled;this._glueParentButton.toggled=newValue;this._presentationModel.setGlueRecords(newValue);this._glueRecordsSetting.set(newValue);this._repopulateRecords();},_repopulateRecords:function() |
{this._resetPanel();this._automaticallySizeWindow=false;var records=this._model.records;for(var i=0;i<records.length;++i) |
@@ -663,9 +678,10 @@ |
WebInspector.TimelinePresentationModel.forAllRecords(records,checkVisible);function isAdoptedRecord(record) |
{return record.parent!==presentationModel.rootRecord;} |
return hasVisibleRecords||records.some(isAdoptedRecord);},sidebarResized:function(event) |
-{var width=event.data;this._resize(width);this._overviewPane.sidebarResized(width);this._memoryStatistics.setSidebarWidth(width);this._timelineGrid.gridHeaderElement.style.left=width+"px";},onResize:function() |
-{this._resize(this.splitView.sidebarWidth());},_resize:function(sidebarWidth) |
-{this._closeRecordDetails();this._graphRowsElementWidth=this._graphRowsElement.offsetWidth;this._containerElementHeight=this._containerElement.clientHeight;this._scheduleRefresh(false,true);var lastItemElement=this._statusBarItems[this._statusBarItems.length-1].element;var minFloatingStatusBarItemsOffset=lastItemElement.totalOffsetLeft()+lastItemElement.offsetWidth;this._timelineGrid.gridHeaderElement.style.width=this._itemsGraphsElement.offsetWidth+"px";this._miscStatusBarItems.style.left=Math.max(minFloatingStatusBarItemsOffset,sidebarWidth)+"px";},_clearPanel:function() |
+{var width=event.data;this._resize(width);this._overviewPane.sidebarResized(width);this._memoryStatistics.setSidebarWidth(width);},onResize:function() |
+{if(this._memoryStatistics.visible()) |
+this._setMemoryCountersHeight(this._memoryStatistics.height());this._resize(this.splitView.sidebarWidth());},_resize:function(sidebarWidth) |
+{this._closeRecordDetails();this._graphRowsElementWidth=this._graphRowsElement.offsetWidth;this._containerElementHeight=this._containerElement.clientHeight;this._scheduleRefresh(false,true);},_clearPanel:function() |
{this._model.reset();},_onRecordsCleared:function() |
{this._resetPanel();this._invalidateAndScheduleRefresh(true,true);},_onRecordingStarted:function() |
{this.toggleTimelineButton.title=WebInspector.UIString("Stop");this.toggleTimelineButton.toggled=true;},_onRecordingStopped:function() |
@@ -698,8 +714,8 @@ |
continue;this._presentationModel.invalidateFilteredRecords();parent.collapsed=false;} |
var recordsInWindow=this._presentationModel.filteredRecords();var index=recordsInWindow.indexOf(recordToReveal);this._recordToHighlight=recordToReveal;var oldScrollTop=this._containerElement.scrollTop;this._containerElement.scrollTop=index*WebInspector.TimelinePanel.rowHeight;if(this._containerElement.scrollTop===oldScrollTop) |
this._refresh();},_refreshRecords:function() |
-{var recordsInWindow=this._presentationModel.filteredRecords();var visibleTop=this._scrollTop;var visibleBottom=visibleTop+this._containerElementHeight;const rowHeight=WebInspector.TimelinePanel.rowHeight;var startIndex=Math.max(0,Math.min(Math.floor(visibleTop/rowHeight)-this._headerLineCount,recordsInWindow.length-1));var endIndex=Math.min(recordsInWindow.length,Math.ceil(visibleBottom/rowHeight));var lastVisibleLine=Math.max(0,Math.floor(visibleBottom/rowHeight)-this._headerLineCount);if(this._automaticallySizeWindow&&recordsInWindow.length>lastVisibleLine){this._automaticallySizeWindow=false;var windowStartTime=startIndex?recordsInWindow[startIndex].startTime:this._model.minimumRecordTime();this._overviewPane.setWindowTimes(windowStartTime,recordsInWindow[Math.max(0,lastVisibleLine-1)].endTime);recordsInWindow=this._presentationModel.filteredRecords();endIndex=Math.min(recordsInWindow.length,lastVisibleLine);} |
-this._topGapElement.style.height=(startIndex*rowHeight)+"px";this.sidebarTreeElement.style.height=((startIndex+this._headerLineCount)*rowHeight)+"px";this._bottomGapElement.style.height=(recordsInWindow.length-endIndex)*rowHeight+"px";var listRowElement=this._sidebarListElement.firstChild;var width=this._graphRowsElementWidth;this._itemsGraphsElement.removeChild(this._graphRowsElement);var graphRowElement=this._graphRowsElement.firstChild;var scheduleRefreshCallback=this._invalidateAndScheduleRefresh.bind(this,true,true);this._itemsGraphsElement.removeChild(this._expandElements);this._expandElements.removeChildren();var highlightedRecord=this._recordToHighlight;delete this._recordToHighlight;var highlightedListRowElement;var highlightedGraphRowElement;for(var i=0;i<endIndex;++i){var record=recordsInWindow[i];var isEven=!(i%2);if(i<startIndex){var lastChildIndex=i+record.visibleChildrenCount;if(lastChildIndex>=startIndex&&lastChildIndex<endIndex){var expandElement=new WebInspector.TimelineExpandableElement(this._expandElements);var positions=this._calculator.computeBarGraphWindowPosition(record);expandElement._update(record,i,positions.left-this._expandOffset,positions.width);}}else{if(!listRowElement){listRowElement=new WebInspector.TimelineRecordListRow().element;this._sidebarListElement.appendChild(listRowElement);} |
+{var recordsInWindow=this._presentationModel.filteredRecords();var visibleTop=this._scrollTop;var visibleBottom=visibleTop+this._containerElementHeight;const rowHeight=WebInspector.TimelinePanel.rowHeight;const headerHeight=WebInspector.TimelinePanel.headerHeight;var startIndex=Math.max(0,Math.min(Math.floor(visibleTop/rowHeight)-this._headerLineCount,recordsInWindow.length-1));var endIndex=Math.min(recordsInWindow.length,Math.ceil(visibleBottom/rowHeight));var lastVisibleLine=Math.max(0,Math.floor(visibleBottom/rowHeight)-this._headerLineCount);if(this._automaticallySizeWindow&&recordsInWindow.length>lastVisibleLine){this._automaticallySizeWindow=false;var windowStartTime=startIndex?recordsInWindow[startIndex].startTime:this._model.minimumRecordTime();this._overviewPane.setWindowTimes(windowStartTime,recordsInWindow[Math.max(0,lastVisibleLine-1)].endTime);recordsInWindow=this._presentationModel.filteredRecords();endIndex=Math.min(recordsInWindow.length,lastVisibleLine);} |
+this._topGapElement.style.height=(startIndex*rowHeight)+"px";this.sidebarTreeElement.style.height=((startIndex+this._headerLineCount)*rowHeight)+"px";this._bottomGapElement.style.height=(recordsInWindow.length-endIndex)*rowHeight+"px";var rowsHeight=headerHeight+recordsInWindow.length*rowHeight;var totalHeight=Math.max(this._containerElementHeight,rowsHeight);this.splitView.firstElement().style.height=totalHeight+"px";this.splitView.secondElement().style.height=totalHeight+"px";this.splitView.resizerElement().style.height=totalHeight+"px";var listRowElement=this._sidebarListElement.firstChild;var width=this._graphRowsElementWidth;this._itemsGraphsElement.removeChild(this._graphRowsElement);var graphRowElement=this._graphRowsElement.firstChild;var scheduleRefreshCallback=this._invalidateAndScheduleRefresh.bind(this,true,true);this._itemsGraphsElement.removeChild(this._expandElements);this._expandElements.removeChildren();var highlightedRecord=this._recordToHighlight;delete this._recordToHighlight;var highlightedListRowElement;var highlightedGraphRowElement;for(var i=0;i<endIndex;++i){var record=recordsInWindow[i];var isEven=!(i%2);if(i<startIndex){var lastChildIndex=i+record.visibleChildrenCount;if(lastChildIndex>=startIndex&&lastChildIndex<endIndex){var expandElement=new WebInspector.TimelineExpandableElement(this._expandElements);var positions=this._calculator.computeBarGraphWindowPosition(record);expandElement._update(record,i,positions.left-this._expandOffset,positions.width);}}else{if(!listRowElement){listRowElement=new WebInspector.TimelineRecordListRow().element;this._sidebarListElement.appendChild(listRowElement);} |
if(!graphRowElement){graphRowElement=new WebInspector.TimelineRecordGraphRow(this._itemsGraphsElement,scheduleRefreshCallback).element;this._graphRowsElement.appendChild(graphRowElement);} |
if(highlightedRecord===record){highlightedListRowElement=listRowElement;highlightedGraphRowElement=graphRowElement;} |
listRowElement.row.update(record,isEven,visibleTop);graphRowElement.row.update(record,isEven,this._calculator,this._expandOffset,i);listRowElement=listRowElement.nextSibling;graphRowElement=graphRowElement.nextSibling;}} |
@@ -757,12 +773,7 @@ |
matches.push(record);return false;} |
WebInspector.TimelinePresentationModel.forAllRecords(presentationModel.rootRecord().children,processRecord);var matchesCount=matches.length;if(matchesCount){this._searchResults=matches;WebInspector.searchController.updateSearchMatchesCount(matchesCount,this);var selectedIndex=matches.indexOf(this._selectedSearchResult);if(shouldJump&&selectedIndex===-1) |
selectedIndex=0;this._selectSearchResult(selectedIndex);}else{WebInspector.searchController.updateSearchMatchesCount(0,this);delete this._selectedSearchResult;}},searchCanceled:function() |
-{this._clearHighlight();delete this._searchResults;delete this._selectedSearchResult;delete this._searchRegExp;},canFilter:function() |
-{return true;},performFilter:function(searchQuery) |
-{this._presentationModel.setSearchFilter(null);delete this._searchFilter;function cleanRecord(record) |
-{delete record.clicked;} |
-WebInspector.TimelinePresentationModel.forAllRecords(this._presentationModel.rootRecord().children,cleanRecord);this.searchCanceled();if(searchQuery){this._searchFilter=new WebInspector.TimelineSearchFilter(createPlainTextSearchRegex(searchQuery,"i"));this._presentationModel.setSearchFilter(this._searchFilter);} |
-this._invalidateAndScheduleRefresh(true,true);},performSearch:function(query,shouldJump) |
+{this._clearHighlight();delete this._searchResults;delete this._selectedSearchResult;delete this._searchRegExp;},performSearch:function(query,shouldJump) |
{this._searchRegExp=createPlainTextSearchRegex(query,"i");delete this._searchResults;this._updateSearchHighlight(true,shouldJump);},__proto__:WebInspector.Panel.prototype} |
WebInspector.TimelineCalculator=function(model) |
{this._model=model;} |
@@ -783,8 +794,8 @@ |
{this.element=document.createElement("div");this.element.row=this;this.element.style.cursor="pointer";var iconElement=document.createElement("span");iconElement.className="timeline-tree-icon";this.element.appendChild(iconElement);this._typeElement=document.createElement("span");this._typeElement.className="type";this.element.appendChild(this._typeElement);var separatorElement=document.createElement("span");separatorElement.className="separator";separatorElement.textContent=" ";this._dataElement=document.createElement("span");this._dataElement.className="data dimmed";this.element.appendChild(separatorElement);this.element.appendChild(this._dataElement);} |
WebInspector.TimelineRecordListRow.prototype={update:function(record,isEven,offset) |
{this._record=record;this._offset=offset;this.element.className="timeline-tree-item timeline-category-"+record.category.name;if(isEven) |
-this.element.addStyleClass("even");if(record.hasWarning) |
-this.element.addStyleClass("warning");else if(record.childHasWarning) |
+this.element.addStyleClass("even");if(record.hasWarnings()) |
+this.element.addStyleClass("warning");else if(record.childHasWarnings()) |
this.element.addStyleClass("child-warning");if(record.isBackground) |
this.element.addStyleClass("background");this._typeElement.textContent=record.title;if(this._dataElement.firstChild) |
this._dataElement.removeChildren();if(record.detailsNode()) |