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

Side by Side Diff: chrome_linux/resources/inspector/TimelinePanel.js

Issue 85333005: Update reference builds to Chrome 32.0.1700.19 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 7 years 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 WebInspector.MemoryStatistics=function(timelinePanel,model,sidebarWidth) 1 WebInspector.MemoryStatistics=function(timelinePanel,model,sidebarWidth)
2 {this._timelinePanel=timelinePanel;this._counters=[];model.addEventListener(WebI nspector.TimelineModel.Events.RecordAdded,this._onRecordAdded,this);model.addEve ntListener(WebInspector.TimelineModel.Events.RecordsCleared,this._onRecordsClear ed,this);this._containerAnchor=timelinePanel.element.lastChild;this._memorySideb arView=new WebInspector.SidebarView(WebInspector.SidebarView.SidebarPosition.Sta rt,undefined,sidebarWidth);this._memorySidebarView.sidebarElement.addStyleClass( "sidebar");this._memorySidebarView.element.id="memory-graphs-container";this._me morySidebarView.addEventListener(WebInspector.SidebarView.EventTypes.Resized,thi s._sidebarResized.bind(this));this._canvasContainer=this._memorySidebarView.main Element;this._canvasContainer.id="memory-graphs-canvas-container";this._createCu rrentValuesBar();this._canvas=this._canvasContainer.createChild("canvas");this._ canvas.id="memory-counters-graph";this._lastMarkerXPosition=0;this._canvas.addEv entListener("mouseover",this._onMouseOver.bind(this),true);this._canvas.addEvent Listener("mousemove",this._onMouseMove.bind(this),true);this._canvas.addEventLis tener("mouseout",this._onMouseOut.bind(this),true);this._canvas.addEventListener ("click",this._onClick.bind(this),true);this._timelineGrid=new WebInspector.Time lineGrid();this._canvasContainer.appendChild(this._timelineGrid.dividersElement) ;this._memorySidebarView.sidebarElement.createChild("div","sidebar-tree sidebar- tree-section").textContent=WebInspector.UIString("COUNTERS");this._counterUI=thi s._createCounterUIList();} 2 {this._timelinePanel=timelinePanel;this._counters=[];model.addEventListener(WebI nspector.TimelineModel.Events.RecordAdded,this._onRecordAdded,this);model.addEve ntListener(WebInspector.TimelineModel.Events.RecordsCleared,this._onRecordsClear ed,this);this._containerAnchor=timelinePanel.element.lastChild;this._memorySideb arView=new WebInspector.SidebarView(WebInspector.SidebarView.SidebarPosition.Sta rt,undefined,sidebarWidth);this._memorySidebarView.sidebarElement.addStyleClass( "sidebar");this._memorySidebarView.element.id="memory-graphs-container";this._me morySidebarView.addEventListener(WebInspector.SidebarView.EventTypes.Resized,thi s._sidebarResized.bind(this));this._canvasContainer=this._memorySidebarView.main Element;this._canvasContainer.id="memory-graphs-canvas-container";this._createCu rrentValuesBar();this._canvas=this._canvasContainer.createChild("canvas");this._ canvas.id="memory-counters-graph";this._lastMarkerXPosition=0;this._canvas.addEv entListener("mouseover",this._onMouseOver.bind(this),true);this._canvas.addEvent Listener("mousemove",this._onMouseMove.bind(this),true);this._canvas.addEventLis tener("mouseout",this._onMouseOut.bind(this),true);this._canvas.addEventListener ("click",this._onClick.bind(this),true);this._timelineGrid=new WebInspector.Time lineGrid();this._canvasContainer.appendChild(this._timelineGrid.dividersElement) ;this._memorySidebarView.sidebarElement.createChild("div","sidebar-tree sidebar- tree-section").textContent=WebInspector.UIString("COUNTERS");this._counterUI=thi s._createCounterUIList();}
3 WebInspector.MemoryStatistics.Counter=function(time) 3 WebInspector.MemoryStatistics.Counter=function(time)
4 {this.time=time;} 4 {this.time=time;}
5 WebInspector.SwatchCheckbox=function(title,color) 5 WebInspector.SwatchCheckbox=function(title,color)
6 {this.element=document.createElement("div");this._swatch=this.element.createChil d("div","swatch");this.element.createChild("span","title").textContent=title;thi s._color=color;this.checked=true;this.element.addEventListener("click",this._tog gleCheckbox.bind(this),true);} 6 {this.element=document.createElement("div");this._swatch=this.element.createChil d("div","swatch");this.element.createChild("span","title").textContent=title;thi s._color=color;this.checked=true;this.element.addEventListener("click",this._tog gleCheckbox.bind(this),true);}
7 WebInspector.SwatchCheckbox.Events={Changed:"Changed"} 7 WebInspector.SwatchCheckbox.Events={Changed:"Changed"}
8 WebInspector.SwatchCheckbox.prototype={get checked() 8 WebInspector.SwatchCheckbox.prototype={get checked()
9 {return this._checked;},set checked(v) 9 {return this._checked;},set checked(v)
10 {this._checked=v;if(this._checked) 10 {this._checked=v;if(this._checked)
11 this._swatch.style.backgroundColor=this._color;else 11 this._swatch.style.backgroundColor=this._color;else
12 this._swatch.style.backgroundColor="";},_toggleCheckbox:function(event) 12 this._swatch.style.backgroundColor="";},_toggleCheckbox:function(event)
13 {this.checked=!this.checked;this.dispatchEventToListeners(WebInspector.SwatchChe ckbox.Events.Changed);},__proto__:WebInspector.Object.prototype} 13 {this.checked=!this.checked;this.dispatchEventToListeners(WebInspector.SwatchChe ckbox.Events.Changed);},__proto__:WebInspector.Object.prototype}
14 WebInspector.CounterUIBase=function(memoryCountersPane,title,graphColor,valueGet ter) 14 WebInspector.CounterUIBase=function(memoryCountersPane,title,graphColor,valueGet ter)
15 {this._memoryCountersPane=memoryCountersPane;this.valueGetter=valueGetter;var co ntainer=memoryCountersPane._memorySidebarView.sidebarElement.createChild("div"," memory-counter-sidebar-info");var swatchColor=graphColor;this._swatch=new WebIns pector.SwatchCheckbox(WebInspector.UIString(title),swatchColor);this._swatch.add EventListener(WebInspector.SwatchCheckbox.Events.Changed,this._toggleCounterGrap h.bind(this));container.appendChild(this._swatch.element);this._value=null;this. graphColor=graphColor;this.strokeColor=graphColor;this.graphYValues=[];} 15 {this._memoryCountersPane=memoryCountersPane;this.valueGetter=valueGetter;var co ntainer=memoryCountersPane._memorySidebarView.sidebarElement.createChild("div"," memory-counter-sidebar-info");var swatchColor=graphColor;this._swatch=new WebIns pector.SwatchCheckbox(WebInspector.UIString(title),swatchColor);this._swatch.add EventListener(WebInspector.SwatchCheckbox.Events.Changed,this._toggleCounterGrap h.bind(this));container.appendChild(this._swatch.element);this._value=null;this. graphColor=graphColor;this.strokeColor=graphColor;this.graphYValues=[];}
16 WebInspector.CounterUIBase.prototype={_toggleCounterGraph:function(event) 16 WebInspector.CounterUIBase.prototype={_toggleCounterGraph:function(event)
17 {if(this._swatch.checked) 17 {if(this._swatch.checked)
18 this._value.removeStyleClass("hidden");else 18 this._value.removeStyleClass("hidden");else
19 this._value.addStyleClass("hidden");this._memoryCountersPane.refresh();},updateC urrentValue:function(countersEntry) 19 this._value.addStyleClass("hidden");this._memoryCountersPane.refresh();},updateC urrentValue:function(countersEntry)
20 {this._value.textContent=Number.bytesToString(this.valueGetter(countersEntry));} ,clearCurrentValueAndMarker:function(ctx) 20 {this._value.textContent=Number.bytesToString(this.valueGetter(countersEntry));} ,clearCurrentValueAndMarker:function(ctx)
21 {this._value.textContent="";},get visible() 21 {this._value.textContent="";},get visible()
22 {return this._swatch.checked;},} 22 {return this._swatch.checked;},}
23 WebInspector.MemoryStatistics.prototype={_createCurrentValuesBar:function() 23 WebInspector.MemoryStatistics.prototype={_createCurrentValuesBar:function()
24 {throw new Error("Not implemented");},_createCounterUIList:function() 24 {throw new Error("Not implemented");},_createCounterUIList:function()
25 {throw new Error("Not implemented");},_onRecordsCleared:function() 25 {throw new Error("Not implemented");},_onRecordsCleared:function()
26 {this._counters=[];},setMainTimelineGrid:function(timelineGrid) 26 {this._counters=[];},setMainTimelineGrid:function(timelineGrid)
27 {this._mainTimelineGrid=timelineGrid;},setTopPosition:function(top) 27 {this._mainTimelineGrid=timelineGrid;},height:function()
28 {this._memorySidebarView.element.style.top=top+"px";this._updateSize();},setSide barWidth:function(width) 28 {return this._memorySidebarView.element.offsetHeight;},setHeight:function(height )
29 {this._memorySidebarView.element.style.flexBasis=height+"px";this._updateSize(); },setSidebarWidth:function(width)
29 {if(this._ignoreSidebarResize) 30 {if(this._ignoreSidebarResize)
30 return;this._ignoreSidebarResize=true;this._memorySidebarView.setSidebarWidth(wi dth);this._ignoreSidebarResize=false;},_sidebarResized:function(event) 31 return;this._ignoreSidebarResize=true;this._memorySidebarView.setSidebarWidth(wi dth);this._ignoreSidebarResize=false;},_sidebarResized:function(event)
31 {if(this._ignoreSidebarResize) 32 {if(this._ignoreSidebarResize)
32 return;this._ignoreSidebarResize=true;this._timelinePanel.splitView.setSidebarWi dth(event.data);this._ignoreSidebarResize=false;},_canvasHeight:function() 33 return;this._ignoreSidebarResize=true;this._timelinePanel.splitView.setSidebarWi dth(event.data);this._ignoreSidebarResize=false;},_canvasHeight:function()
33 {throw new Error("Not implemented");},_updateSize:function() 34 {throw new Error("Not implemented");},_updateSize:function()
34 {var width=this._mainTimelineGrid.dividersElement.offsetWidth+1;this._canvasCont ainer.style.width=width+"px";var height=this._canvasHeight();this._canvas.width= width;this._canvas.height=height;},_onRecordAdded:function(event) 35 {var width=this._mainTimelineGrid.dividersElement.offsetWidth+1;this._canvasCont ainer.style.width=width+"px";var height=this._canvasHeight();this._canvas.width= width;this._canvas.height=height;},_onRecordAdded:function(event)
35 {throw new Error("Not implemented");},_draw:function() 36 {throw new Error("Not implemented");},_draw:function()
36 {this._calculateVisibleIndexes();this._calculateXValues();this._clear();this._se tVerticalClip(10,this._canvas.height-20);},_calculateVisibleIndexes:function() 37 {this._calculateVisibleIndexes();this._calculateXValues();this._clear();this._se tVerticalClip(10,this._canvas.height-20);},_calculateVisibleIndexes:function()
37 {var calculator=this._timelinePanel.calculator;var start=calculator.minimumBound ary()*1000;var end=calculator.maximumBoundary()*1000;function comparator(value,s ample) 38 {var calculator=this._timelinePanel.calculator;var start=calculator.minimumBound ary()*1000;var end=calculator.maximumBoundary()*1000;function comparator(value,s ample)
38 {return value-sample.time;} 39 {return value-sample.time;}
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 {var canvas=this._canvas;var ctx=canvas.getContext("2d");var width=canvas.width; var height=this._clippedHeight;var originY=this._originY;var valueGetter=counter UI.valueGetter;if(!this._counters.length) 109 {var canvas=this._canvas;var ctx=canvas.getContext("2d");var width=canvas.width; var height=this._clippedHeight;var originY=this._originY;var valueGetter=counter UI.valueGetter;if(!this._counters.length)
109 return;var maxValue;var minValue;for(var i=this._minimumIndex;i<=this._maximumIn dex;i++){var value=valueGetter(this._counters[i]);if(minValue===undefined||value <minValue) 110 return;var maxValue;var minValue;for(var i=this._minimumIndex;i<=this._maximumIn dex;i++){var value=valueGetter(this._counters[i]);if(minValue===undefined||value <minValue)
110 minValue=value;if(maxValue===undefined||value>maxValue) 111 minValue=value;if(maxValue===undefined||value>maxValue)
111 maxValue=value;} 112 maxValue=value;}
112 counterUI.setRange(minValue,maxValue);if(!counterUI.visible) 113 counterUI.setRange(minValue,maxValue);if(!counterUI.visible)
113 return;var yValues=counterUI.graphYValues;yValues.length=this._counters.length;v ar maxYRange=maxValue-minValue;var yFactor=maxYRange?height/(maxYRange):1;ctx.be ginPath();var currentY=originY+(height-(valueGetter(this._counters[this._minimum Index])-minValue)*yFactor);ctx.moveTo(0,currentY);for(var i=this._minimumIndex;i <=this._maximumIndex;i++){var x=this._counters[i].x;ctx.lineTo(x,currentY);curre ntY=originY+(height-(valueGetter(this._counters[i])-minValue)*yFactor);ctx.lineT o(x,currentY);yValues[i]=currentY;} 114 return;var yValues=counterUI.graphYValues;yValues.length=this._counters.length;v ar maxYRange=maxValue-minValue;var yFactor=maxYRange?height/(maxYRange):1;ctx.be ginPath();var currentY=originY+(height-(valueGetter(this._counters[this._minimum Index])-minValue)*yFactor);ctx.moveTo(0,currentY);for(var i=this._minimumIndex;i <=this._maximumIndex;i++){var x=this._counters[i].x;ctx.lineTo(x,currentY);curre ntY=originY+(height-(valueGetter(this._counters[i])-minValue)*yFactor);ctx.lineT o(x,currentY);yValues[i]=currentY;}
114 ctx.lineTo(width,currentY);ctx.lineWidth=1;ctx.strokeStyle=counterUI.graphColor; ctx.stroke();ctx.closePath();},_discardImageUnderMarker:function() 115 ctx.lineTo(width,currentY);ctx.lineWidth=1;ctx.strokeStyle=counterUI.graphColor; ctx.stroke();ctx.closePath();},_discardImageUnderMarker:function()
115 {for(var i=0;i<this._counterUI.length;i++) 116 {for(var i=0;i<this._counterUI.length;i++)
116 this._counterUI[i].discardImageUnderMarker();},__proto__:WebInspector.MemoryStat istics.prototype};WebInspector.TimelineModel=function() 117 this._counterUI[i].discardImageUnderMarker();},__proto__:WebInspector.MemoryStat istics.prototype};WebInspector.TimelineModel=function()
117 {this._records=[];this._stringPool=new StringPool();this._minimumRecordTime=-1;t his._maximumRecordTime=-1;WebInspector.timelineManager.addEventListener(WebInspe ctor.TimelineManager.EventTypes.TimelineEventRecorded,this._onRecordAdded,this); WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event Types.TimelineStarted,this._onStarted,this);WebInspector.timelineManager.addEven tListener(WebInspector.TimelineManager.EventTypes.TimelineStopped,this._onStoppe d,this);} 118 {this._records=[];this._stringPool=new StringPool();this._minimumRecordTime=-1;t his._maximumRecordTime=-1;WebInspector.timelineManager.addEventListener(WebInspe ctor.TimelineManager.EventTypes.TimelineEventRecorded,this._onRecordAdded,this); WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event Types.TimelineStarted,this._onStarted,this);WebInspector.timelineManager.addEven tListener(WebInspector.TimelineManager.EventTypes.TimelineStopped,this._onStoppe d,this);}
118 WebInspector.TimelineModel.TransferChunkLengthBytes=5000000;WebInspector.Timelin eModel.RecordType={Root:"Root",Program:"Program",EventDispatch:"EventDispatch",B eginFrame:"BeginFrame",ScheduleStyleRecalculation:"ScheduleStyleRecalculation",R ecalculateStyles:"RecalculateStyles",InvalidateLayout:"InvalidateLayout",Layout: "Layout",PaintSetup:"PaintSetup",Paint:"Paint",Rasterize:"Rasterize",ScrollLayer :"ScrollLayer",DecodeImage:"DecodeImage",ResizeImage:"ResizeImage",CompositeLaye rs:"CompositeLayers",ParseHTML:"ParseHTML",TimerInstall:"TimerInstall",TimerRemo ve:"TimerRemove",TimerFire:"TimerFire",XHRReadyStateChange:"XHRReadyStateChange" ,XHRLoad:"XHRLoad",EvaluateScript:"EvaluateScript",MarkLoad:"MarkLoad",MarkDOMCo ntent:"MarkDOMContent",TimeStamp:"TimeStamp",Time:"Time",TimeEnd:"TimeEnd",Sched uleResourceRequest:"ScheduleResourceRequest",ResourceSendRequest:"ResourceSendRe quest",ResourceReceiveResponse:"ResourceReceiveResponse",ResourceReceivedData:"R esourceReceivedData",ResourceFinish:"ResourceFinish",FunctionCall:"FunctionCall" ,GCEvent:"GCEvent",RequestAnimationFrame:"RequestAnimationFrame",CancelAnimation Frame:"CancelAnimationFrame",FireAnimationFrame:"FireAnimationFrame",WebSocketCr eate:"WebSocketCreate",WebSocketSendHandshakeRequest:"WebSocketSendHandshakeRequ est",WebSocketReceiveHandshakeResponse:"WebSocketReceiveHandshakeResponse",WebSo cketDestroy:"WebSocketDestroy",} 119 WebInspector.TimelineModel.TransferChunkLengthBytes=5000000;WebInspector.Timelin eModel.RecordType={Root:"Root",Program:"Program",EventDispatch:"EventDispatch",B eginFrame:"BeginFrame",ScheduleStyleRecalculation:"ScheduleStyleRecalculation",R ecalculateStyles:"RecalculateStyles",InvalidateLayout:"InvalidateLayout",Layout: "Layout",AutosizeText:"AutosizeText",PaintSetup:"PaintSetup",Paint:"Paint",Raste rize:"Rasterize",ScrollLayer:"ScrollLayer",DecodeImage:"DecodeImage",ResizeImage :"ResizeImage",CompositeLayers:"CompositeLayers",ParseHTML:"ParseHTML",TimerInst all:"TimerInstall",TimerRemove:"TimerRemove",TimerFire:"TimerFire",XHRReadyState Change:"XHRReadyStateChange",XHRLoad:"XHRLoad",EvaluateScript:"EvaluateScript",M arkLoad:"MarkLoad",MarkDOMContent:"MarkDOMContent",TimeStamp:"TimeStamp",Time:"T ime",TimeEnd:"TimeEnd",ScheduleResourceRequest:"ScheduleResourceRequest",Resourc eSendRequest:"ResourceSendRequest",ResourceReceiveResponse:"ResourceReceiveRespo nse",ResourceReceivedData:"ResourceReceivedData",ResourceFinish:"ResourceFinish" ,FunctionCall:"FunctionCall",GCEvent:"GCEvent",RequestAnimationFrame:"RequestAni mationFrame",CancelAnimationFrame:"CancelAnimationFrame",FireAnimationFrame:"Fir eAnimationFrame",WebSocketCreate:"WebSocketCreate",WebSocketSendHandshakeRequest :"WebSocketSendHandshakeRequest",WebSocketReceiveHandshakeResponse:"WebSocketRec eiveHandshakeResponse",WebSocketDestroy:"WebSocketDestroy",}
119 WebInspector.TimelineModel.Events={RecordAdded:"RecordAdded",RecordsCleared:"Rec ordsCleared",RecordingStarted:"RecordingStarted",RecordingStopped:"RecordingStop ped"} 120 WebInspector.TimelineModel.Events={RecordAdded:"RecordAdded",RecordsCleared:"Rec ordsCleared",RecordingStarted:"RecordingStarted",RecordingStopped:"RecordingStop ped"}
120 WebInspector.TimelineModel.startTimeInSeconds=function(record) 121 WebInspector.TimelineModel.startTimeInSeconds=function(record)
121 {return record.startTime/1000;} 122 {return record.startTime/1000;}
122 WebInspector.TimelineModel.endTimeInSeconds=function(record) 123 WebInspector.TimelineModel.endTimeInSeconds=function(record)
123 {return(typeof record.endTime==="undefined"?record.startTime:record.endTime)/100 0;} 124 {return(typeof record.endTime==="undefined"?record.startTime:record.endTime)/100 0;}
124 WebInspector.TimelineModel.durationInSeconds=function(record) 125 WebInspector.TimelineModel.durationInSeconds=function(record)
125 {return WebInspector.TimelineModel.endTimeInSeconds(record)-WebInspector.Timelin eModel.startTimeInSeconds(record);} 126 {return WebInspector.TimelineModel.endTimeInSeconds(record)-WebInspector.Timelin eModel.startTimeInSeconds(record);}
126 WebInspector.TimelineModel.aggregateTimeForRecord=function(total,rawRecord) 127 WebInspector.TimelineModel.aggregateTimeForRecord=function(total,rawRecord)
127 {var childrenTime=0;var children=rawRecord["children"]||[];for(var i=0;i<childre n.length;++i){WebInspector.TimelineModel.aggregateTimeForRecord(total,children[i ]);childrenTime+=WebInspector.TimelineModel.durationInSeconds(children[i]);} 128 {var childrenTime=0;var children=rawRecord["children"]||[];for(var i=0;i<childre n.length;++i){WebInspector.TimelineModel.aggregateTimeForRecord(total,children[i ]);childrenTime+=WebInspector.TimelineModel.durationInSeconds(children[i]);}
128 var categoryName=WebInspector.TimelinePresentationModel.recordStyle(rawRecord).c ategory.name;var ownTime=WebInspector.TimelineModel.durationInSeconds(rawRecord) -childrenTime;total[categoryName]=(total[categoryName]||0)+ownTime;} 129 var categoryName=WebInspector.TimelinePresentationModel.recordStyle(rawRecord).c ategory.name;var ownTime=WebInspector.TimelineModel.durationInSeconds(rawRecord) -childrenTime;total[categoryName]=(total[categoryName]||0)+ownTime;}
129 WebInspector.TimelineModel.aggregateTimeByCategory=function(total,addend) 130 WebInspector.TimelineModel.aggregateTimeByCategory=function(total,addend)
130 {for(var category in addend) 131 {for(var category in addend)
131 total[category]=(total[category]||0)+addend[category];} 132 total[category]=(total[category]||0)+addend[category];}
132 WebInspector.TimelineModel.prototype={startRecording:function(includeDomCounters ) 133 WebInspector.TimelineModel.prototype={startRecording:function(includeDomCounters )
133 {this._clientInitiatedRecording=true;this.reset();var maxStackFrames=WebInspecto r.settings.timelineLimitStackFramesFlag.get()?WebInspector.settings.timelineStac kFramesToCapture.get():30;WebInspector.timelineManager.start(maxStackFrames,incl udeDomCounters,false,this._fireRecordingStarted.bind(this));},stopRecording:func tion() 134 {this._clientInitiatedRecording=true;this.reset();var maxStackFrames=WebInspecto r.settings.timelineLimitStackFramesFlag.get()?WebInspector.settings.timelineStac kFramesToCapture.get():30;WebInspector.timelineManager.start(maxStackFrames,incl udeDomCounters,this._fireRecordingStarted.bind(this));},stopRecording:function()
134 {if(!this._clientInitiatedRecording){function stopTimeline() 135 {if(!this._clientInitiatedRecording){function stopTimeline()
135 {WebInspector.timelineManager.stop(this._fireRecordingStopped.bind(this));} 136 {WebInspector.timelineManager.stop(this._fireRecordingStopped.bind(this));}
136 WebInspector.timelineManager.start(undefined,undefined,undefined,stopTimeline.bi nd(this));return;} 137 WebInspector.timelineManager.start(undefined,undefined,stopTimeline.bind(this)); return;}
137 this._clientInitiatedRecording=false;WebInspector.timelineManager.stop(this._fir eRecordingStopped.bind(this));},get records() 138 this._clientInitiatedRecording=false;WebInspector.timelineManager.stop(this._fir eRecordingStopped.bind(this));},get records()
138 {return this._records;},_onRecordAdded:function(event) 139 {return this._records;},_onRecordAdded:function(event)
139 {if(this._collectionEnabled) 140 {if(this._collectionEnabled)
140 this._addRecord((event.data));},_onStarted:function(event) 141 this._addRecord((event.data));},_onStarted:function(event)
141 {if(event.data){this._fireRecordingStarted();}},_onStopped:function(event) 142 {if(event.data){this._fireRecordingStarted();}},_onStopped:function(event)
142 {if(event.data){this._fireRecordingStopped();}},_fireRecordingStarted:function() 143 {if(event.data){this._fireRecordingStopped();}},_fireRecordingStarted:function()
143 {this._collectionEnabled=true;this.dispatchEventToListeners(WebInspector.Timelin eModel.Events.RecordingStarted);},_fireRecordingStopped:function() 144 {this._collectionEnabled=true;this.dispatchEventToListeners(WebInspector.Timelin eModel.Events.RecordingStarted);},_fireRecordingStopped:function()
144 {this._collectionEnabled=false;this.dispatchEventToListeners(WebInspector.Timeli neModel.Events.RecordingStopped);},_addRecord:function(record) 145 {this._collectionEnabled=false;this.dispatchEventToListeners(WebInspector.Timeli neModel.Events.RecordingStopped);},_addRecord:function(record)
145 {this._stringPool.internObjectStrings(record);this._records.push(record);this._u pdateBoundaries(record);this.dispatchEventToListeners(WebInspector.TimelineModel .Events.RecordAdded,record);},loadFromFile:function(file,progress) 146 {this._stringPool.internObjectStrings(record);this._records.push(record);this._u pdateBoundaries(record);this.dispatchEventToListeners(WebInspector.TimelineModel .Events.RecordAdded,record);},loadFromFile:function(file,progress)
146 {var delegate=new WebInspector.TimelineModelLoadFromFileDelegate(this,progress); var fileReader=this._createFileReader(file,delegate);var loader=new WebInspector .TimelineModelLoader(this,fileReader,progress);fileReader.start(loader);},loadFr omURL:function(url,progress) 147 {var delegate=new WebInspector.TimelineModelLoadFromFileDelegate(this,progress); var fileReader=this._createFileReader(file,delegate);var loader=new WebInspector .TimelineModelLoader(this,fileReader,progress);fileReader.start(loader);},loadFr omURL:function(url,progress)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 {this._stream=stream;} 180 {this._stream=stream;}
180 WebInspector.TimelineSaver.prototype={save:function(records,version) 181 WebInspector.TimelineSaver.prototype={save:function(records,version)
181 {this._records=records;this._recordIndex=0;this._prologue="["+JSON.stringify(ver sion);this._writeNextChunk(this._stream);},_writeNextChunk:function(stream) 182 {this._records=records;this._recordIndex=0;this._prologue="["+JSON.stringify(ver sion);this._writeNextChunk(this._stream);},_writeNextChunk:function(stream)
182 {const separator=",\n";var data=[];var length=0;if(this._prologue){data.push(thi s._prologue);length+=this._prologue.length;delete this._prologue;}else{if(this._ recordIndex===this._records.length){stream.close();return;} 183 {const separator=",\n";var data=[];var length=0;if(this._prologue){data.push(thi s._prologue);length+=this._prologue.length;delete this._prologue;}else{if(this._ recordIndex===this._records.length){stream.close();return;}
183 data.push("");} 184 data.push("");}
184 while(this._recordIndex<this._records.length){var item=JSON.stringify(this._reco rds[this._recordIndex]);var itemLength=item.length+separator.length;if(length+it emLength>WebInspector.TimelineModel.TransferChunkLengthBytes) 185 while(this._recordIndex<this._records.length){var item=JSON.stringify(this._reco rds[this._recordIndex]);var itemLength=item.length+separator.length;if(length+it emLength>WebInspector.TimelineModel.TransferChunkLengthBytes)
185 break;length+=itemLength;data.push(item);++this._recordIndex;} 186 break;length+=itemLength;data.push(item);++this._recordIndex;}
186 if(this._recordIndex===this._records.length) 187 if(this._recordIndex===this._records.length)
187 data.push(data.pop()+"]");stream.write(data.join(separator),this._writeNextChunk .bind(this));}};WebInspector.TimelineOverviewPane=function(model) 188 data.push(data.pop()+"]");stream.write(data.join(separator),this._writeNextChunk .bind(this));}};WebInspector.TimelineOverviewPane=function(model)
188 {WebInspector.View.call(this);this.element.id="timeline-overview-panel";this._wi ndowStartTime=0;this._windowEndTime=Infinity;this._eventDividers=[];this._model= model;this._topPaneSidebarElement=document.createElement("div");this._topPaneSid ebarElement.id="timeline-overview-sidebar";var overviewTreeElement=document.crea teElement("ol");overviewTreeElement.className="sidebar-tree";this._topPaneSideba rElement.appendChild(overviewTreeElement);this.element.appendChild(this._topPane SidebarElement);var topPaneSidebarTree=new TreeOutline(overviewTreeElement);this ._overviewItems={};this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Ev ents]=new WebInspector.SidebarTreeElement("timeline-overview-sidebar-events",Web Inspector.UIString("Events"));this._overviewItems[WebInspector.TimelineOverviewP ane.Mode.Frames]=new WebInspector.SidebarTreeElement("timeline-overview-sidebar- frames",WebInspector.UIString("Frames"));this._overviewItems[WebInspector.Timeli neOverviewPane.Mode.Memory]=new WebInspector.SidebarTreeElement("timeline-overvi ew-sidebar-memory",WebInspector.UIString("Memory"));for(var mode in this._overvi ewItems){var item=this._overviewItems[mode];item.onselect=this.setMode.bind(this ,mode);topPaneSidebarTree.appendChild(item);} 189 {WebInspector.View.call(this);this.element.id="timeline-overview-panel";this._wi ndowStartTime=0;this._windowEndTime=Infinity;this._eventDividers=[];this._model= model;this._topPaneSidebarElement=document.createElement("div");this._topPaneSid ebarElement.id="timeline-overview-sidebar";var overviewTreeElement=document.crea teElement("ol");overviewTreeElement.className="sidebar-tree";this._topPaneSideba rElement.appendChild(overviewTreeElement);this.element.appendChild(this._topPane SidebarElement);var topPaneSidebarTree=new TreeOutline(overviewTreeElement);this ._overviewItems={};this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Ev ents]=new WebInspector.SidebarTreeElement("timeline-overview-sidebar-events",Web Inspector.UIString("Events"));this._overviewItems[WebInspector.TimelineOverviewP ane.Mode.Frames]=new WebInspector.SidebarTreeElement("timeline-overview-sidebar- frames",WebInspector.UIString("Frames"));this._overviewItems[WebInspector.Timeli neOverviewPane.Mode.Memory]=new WebInspector.SidebarTreeElement("timeline-overvi ew-sidebar-memory",WebInspector.UIString("Memory"));for(var mode in this._overvi ewItems){var item=this._overviewItems[mode];item.onselect=this.setMode.bind(this ,mode);topPaneSidebarTree.appendChild(item);}
189 this._overviewGrid=new WebInspector.OverviewGrid("timeline");this.element.append Child(this._overviewGrid.element);var separatorElement=document.createElement("d iv");separatorElement.id="timeline-overview-separator";this.element.appendChild( separatorElement);this._innerSetMode(WebInspector.TimelineOverviewPane.Mode.Even ts);var categories=WebInspector.TimelinePresentationModel.categories();for(var c ategory in categories) 190 this._overviewGrid=new WebInspector.OverviewGrid("timeline");this.element.append Child(this._overviewGrid.element);this._innerSetMode(WebInspector.TimelineOvervi ewPane.Mode.Events);var categories=WebInspector.TimelinePresentationModel.catego ries();for(var category in categories)
190 categories[category].addEventListener(WebInspector.TimelineCategory.Events.Visib ilityChanged,this._onCategoryVisibilityChanged,this);this._overviewCalculator=ne w WebInspector.TimelineOverviewCalculator();model.addEventListener(WebInspector. TimelineModel.Events.RecordAdded,this._onRecordAdded,this);model.addEventListene r(WebInspector.TimelineModel.Events.RecordsCleared,this._reset,this);this._overv iewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,this._on WindowChanged,this);} 191 categories[category].addEventListener(WebInspector.TimelineCategory.Events.Visib ilityChanged,this._onCategoryVisibilityChanged,this);this._overviewCalculator=ne w WebInspector.TimelineOverviewCalculator();model.addEventListener(WebInspector. TimelineModel.Events.RecordAdded,this._onRecordAdded,this);model.addEventListene r(WebInspector.TimelineModel.Events.RecordsCleared,this._reset,this);this._overv iewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,this._on WindowChanged,this);}
191 WebInspector.TimelineOverviewPane.Mode={Events:"Events",Frames:"Frames",Memory:" Memory"};WebInspector.TimelineOverviewPane.Events={ModeChanged:"ModeChanged",Win dowChanged:"WindowChanged"};WebInspector.TimelineOverviewPane.prototype={wasShow n:function() 192 WebInspector.TimelineOverviewPane.Mode={Events:"Events",Frames:"Frames",Memory:" Memory"};WebInspector.TimelineOverviewPane.Events={ModeChanged:"ModeChanged",Win dowChanged:"WindowChanged"};WebInspector.TimelineOverviewPane.prototype={wasShow n:function()
192 {this._update();},onResize:function() 193 {this._update();},onResize:function()
193 {this._update();},setMode:function(newMode) 194 {this._update();},setMode:function(newMode)
194 {if(this._currentMode===newMode) 195 {if(this._currentMode===newMode)
195 return;var windowTimes;if(this._overviewControl) 196 return;var windowTimes;if(this._overviewControl)
196 windowTimes=this._overviewControl.windowTimes(this.windowLeft(),this.windowRight ());this._innerSetMode(newMode);this.dispatchEventToListeners(WebInspector.Timel ineOverviewPane.Events.ModeChanged,this._currentMode);if(windowTimes&&windowTime s.startTime>=0) 197 windowTimes=this._overviewControl.windowTimes(this.windowLeft(),this.windowRight ());this._innerSetMode(newMode);this.dispatchEventToListeners(WebInspector.Timel ineOverviewPane.Events.ModeChanged,this._currentMode);if(windowTimes&&windowTime s.startTime>=0)
197 this.setWindowTimes(windowTimes.startTime,windowTimes.endTime);this._update();}, _innerSetMode:function(newMode) 198 this.setWindowTimes(windowTimes.startTime,windowTimes.endTime);this._update();}, _innerSetMode:function(newMode)
198 {var windowTimes;if(this._overviewControl) 199 {var windowTimes;if(this._overviewControl)
199 this._overviewControl.detach();this._currentMode=newMode;this._overviewControl=t his._createOverviewControl();this._overviewControl.show(this._overviewGrid.eleme nt);this._overviewItems[this._currentMode].revealAndSelect(false);},_createOverv iewControl:function() 200 this._overviewControl.detach();this._currentMode=newMode;this._overviewControl=t his._createOverviewControl();this._overviewControl.show(this._overviewGrid.eleme nt);this._overviewItems[this._currentMode].revealAndSelect(false);},_createOverv iewControl:function()
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 {return insertionIndexForObjectInListSortedByFunction(time,this._barTimes,compar ator);},__proto__:WebInspector.TimelineOverviewBase.prototype} 309 {return insertionIndexForObjectInListSortedByFunction(time,this._barTimes,compar ator);},__proto__:WebInspector.TimelineOverviewBase.prototype}
309 WebInspector.TimelineWindowFilter=function(pane) 310 WebInspector.TimelineWindowFilter=function(pane)
310 {this._pane=pane;} 311 {this._pane=pane;}
311 WebInspector.TimelineWindowFilter.prototype={accept:function(record) 312 WebInspector.TimelineWindowFilter.prototype={accept:function(record)
312 {return record.lastChildEndTime>=this._pane._windowStartTime&&record.startTime<= this._pane._windowEndTime;}};WebInspector.TimelinePresentationModel=function() 313 {return record.lastChildEndTime>=this._pane._windowStartTime&&record.startTime<= this._pane._windowEndTime;}};WebInspector.TimelinePresentationModel=function()
313 {this._linkifier=new WebInspector.Linkifier();this._glueRecords=false;this._filt ers=[];this.reset();} 314 {this._linkifier=new WebInspector.Linkifier();this._glueRecords=false;this._filt ers=[];this.reset();}
314 WebInspector.TimelinePresentationModel.categories=function() 315 WebInspector.TimelinePresentationModel.categories=function()
315 {if(WebInspector.TimelinePresentationModel._categories) 316 {if(WebInspector.TimelinePresentationModel._categories)
316 return WebInspector.TimelinePresentationModel._categories;WebInspector.TimelineP resentationModel._categories={loading:new WebInspector.TimelineCategory("loading ",WebInspector.UIString("Loading"),0,"#5A8BCC","#8EB6E9","#70A2E3"),scripting:ne w WebInspector.TimelineCategory("scripting",WebInspector.UIString("Scripting"),1 ,"#D8AA34","#F3D07A","#F1C453"),rendering:new WebInspector.TimelineCategory("ren dering",WebInspector.UIString("Rendering"),2,"#8266CC","#AF9AEB","#9A7EE6"),pain ting:new WebInspector.TimelineCategory("painting",WebInspector.UIString("Paintin g"),2,"#5FA050","#8DC286","#71B363"),other:new WebInspector.TimelineCategory("ot her",WebInspector.UIString("Other"),-1,"#BBBBBB","#DDDDDD","#DDDDDD")};return We bInspector.TimelinePresentationModel._categories;};WebInspector.TimelinePresenta tionModel._initRecordStyles=function() 317 return WebInspector.TimelinePresentationModel._categories;WebInspector.TimelineP resentationModel._categories={loading:new WebInspector.TimelineCategory("loading ",WebInspector.UIString("Loading"),0,"#5A8BCC","#8EB6E9","#70A2E3"),scripting:ne w WebInspector.TimelineCategory("scripting",WebInspector.UIString("Scripting"),1 ,"#D8AA34","#F3D07A","#F1C453"),rendering:new WebInspector.TimelineCategory("ren dering",WebInspector.UIString("Rendering"),2,"#8266CC","#AF9AEB","#9A7EE6"),pain ting:new WebInspector.TimelineCategory("painting",WebInspector.UIString("Paintin g"),2,"#5FA050","#8DC286","#71B363"),other:new WebInspector.TimelineCategory("ot her",WebInspector.UIString("Other"),-1,"#BBBBBB","#DDDDDD","#DDDDDD")};return We bInspector.TimelinePresentationModel._categories;};WebInspector.TimelinePresenta tionModel._initRecordStyles=function()
317 {if(WebInspector.TimelinePresentationModel._recordStylesMap) 318 {if(WebInspector.TimelinePresentationModel._recordStylesMap)
318 return WebInspector.TimelinePresentationModel._recordStylesMap;var recordTypes=W ebInspector.TimelineModel.RecordType;var categories=WebInspector.TimelinePresent ationModel.categories();var recordStyles={};recordStyles[recordTypes.Root]={titl e:"#root",category:categories["loading"]};recordStyles[recordTypes.Program]={tit le:WebInspector.UIString("Other"),category:categories["other"]};recordStyles[rec ordTypes.EventDispatch]={title:WebInspector.UIString("Event"),category:categorie s["scripting"]};recordStyles[recordTypes.BeginFrame]={title:WebInspector.UIStrin g("Frame Start"),category:categories["rendering"]};recordStyles[recordTypes.Sche duleStyleRecalculation]={title:WebInspector.UIString("Schedule Style Recalculati on"),category:categories["rendering"]};recordStyles[recordTypes.RecalculateStyle s]={title:WebInspector.UIString("Recalculate Style"),category:categories["render ing"]};recordStyles[recordTypes.InvalidateLayout]={title:WebInspector.UIString(" Invalidate Layout"),category:categories["rendering"]};recordStyles[recordTypes.L ayout]={title:WebInspector.UIString("Layout"),category:categories["rendering"]}; recordStyles[recordTypes.PaintSetup]={title:WebInspector.UIString("Paint Setup") ,category:categories["painting"]};recordStyles[recordTypes.Paint]={title:WebInsp ector.UIString("Paint"),category:categories["painting"]};recordStyles[recordType s.Rasterize]={title:WebInspector.UIString("Rasterize"),category:categories["pain ting"]};recordStyles[recordTypes.ScrollLayer]={title:WebInspector.UIString("Scro ll"),category:categories["rendering"]};recordStyles[recordTypes.DecodeImage]={ti tle:WebInspector.UIString("Image Decode"),category:categories["painting"]};recor dStyles[recordTypes.ResizeImage]={title:WebInspector.UIString("Image Resize"),ca tegory:categories["painting"]};recordStyles[recordTypes.CompositeLayers]={title: WebInspector.UIString("Composite Layers"),category:categories["painting"]};recor dStyles[recordTypes.ParseHTML]={title:WebInspector.UIString("Parse HTML"),catego ry:categories["loading"]};recordStyles[recordTypes.TimerInstall]={title:WebInspe ctor.UIString("Install Timer"),category:categories["scripting"]};recordStyles[re cordTypes.TimerRemove]={title:WebInspector.UIString("Remove Timer"),category:cat egories["scripting"]};recordStyles[recordTypes.TimerFire]={title:WebInspector.UI String("Timer Fired"),category:categories["scripting"]};recordStyles[recordTypes .XHRReadyStateChange]={title:WebInspector.UIString("XHR Ready State Change"),cat egory:categories["scripting"]};recordStyles[recordTypes.XHRLoad]={title:WebInspe ctor.UIString("XHR Load"),category:categories["scripting"]};recordStyles[recordT ypes.EvaluateScript]={title:WebInspector.UIString("Evaluate Script"),category:ca tegories["scripting"]};recordStyles[recordTypes.ResourceSendRequest]={title:WebI nspector.UIString("Send Request"),category:categories["loading"]};recordStyles[r ecordTypes.ResourceReceiveResponse]={title:WebInspector.UIString("Receive Respon se"),category:categories["loading"]};recordStyles[recordTypes.ResourceFinish]={t itle:WebInspector.UIString("Finish Loading"),category:categories["loading"]};rec ordStyles[recordTypes.FunctionCall]={title:WebInspector.UIString("Function Call" ),category:categories["scripting"]};recordStyles[recordTypes.ResourceReceivedDat a]={title:WebInspector.UIString("Receive Data"),category:categories["loading"]}; recordStyles[recordTypes.GCEvent]={title:WebInspector.UIString("GC Event"),categ ory:categories["scripting"]};recordStyles[recordTypes.MarkDOMContent]={title:Web Inspector.UIString("DOMContentLoaded event"),category:categories["scripting"]};r ecordStyles[recordTypes.MarkLoad]={title:WebInspector.UIString("Load event"),cat egory:categories["scripting"]};recordStyles[recordTypes.TimeStamp]={title:WebIns pector.UIString("Stamp"),category:categories["scripting"]};recordStyles[recordTy pes.Time]={title:WebInspector.UIString("Time"),category:categories["scripting"]} ;recordStyles[recordTypes.TimeEnd]={title:WebInspector.UIString("Time End"),cate gory:categories["scripting"]};recordStyles[recordTypes.ScheduleResourceRequest]= {title:WebInspector.UIString("Schedule Request"),category:categories["loading"]} ;recordStyles[recordTypes.RequestAnimationFrame]={title:WebInspector.UIString("R equest Animation Frame"),category:categories["scripting"]};recordStyles[recordTy pes.CancelAnimationFrame]={title:WebInspector.UIString("Cancel Animation Frame") ,category:categories["scripting"]};recordStyles[recordTypes.FireAnimationFrame]= {title:WebInspector.UIString("Animation Frame Fired"),category:categories["scrip ting"]};recordStyles[recordTypes.WebSocketCreate]={title:WebInspector.UIString(" Create WebSocket"),category:categories["scripting"]};recordStyles[recordTypes.We bSocketSendHandshakeRequest]={title:WebInspector.UIString("Send WebSocket Handsh ake"),category:categories["scripting"]};recordStyles[recordTypes.WebSocketReceiv eHandshakeResponse]={title:WebInspector.UIString("Receive WebSocket Handshake"), category:categories["scripting"]};recordStyles[recordTypes.WebSocketDestroy]={ti tle:WebInspector.UIString("Destroy WebSocket"),category:categories["scripting"]} ;WebInspector.TimelinePresentationModel._recordStylesMap=recordStyles;return rec ordStyles;} 319 return WebInspector.TimelinePresentationModel._recordStylesMap;var recordTypes=W ebInspector.TimelineModel.RecordType;var categories=WebInspector.TimelinePresent ationModel.categories();var recordStyles={};recordStyles[recordTypes.Root]={titl e:"#root",category:categories["loading"]};recordStyles[recordTypes.Program]={tit le:WebInspector.UIString("Other"),category:categories["other"]};recordStyles[rec ordTypes.EventDispatch]={title:WebInspector.UIString("Event"),category:categorie s["scripting"]};recordStyles[recordTypes.BeginFrame]={title:WebInspector.UIStrin g("Frame Start"),category:categories["rendering"]};recordStyles[recordTypes.Sche duleStyleRecalculation]={title:WebInspector.UIString("Schedule Style Recalculati on"),category:categories["rendering"]};recordStyles[recordTypes.RecalculateStyle s]={title:WebInspector.UIString("Recalculate Style"),category:categories["render ing"]};recordStyles[recordTypes.InvalidateLayout]={title:WebInspector.UIString(" Invalidate Layout"),category:categories["rendering"]};recordStyles[recordTypes.L ayout]={title:WebInspector.UIString("Layout"),category:categories["rendering"]}; recordStyles[recordTypes.AutosizeText]={title:WebInspector.UIString("Autosize Te xt"),category:categories["rendering"]};recordStyles[recordTypes.PaintSetup]={tit le:WebInspector.UIString("Paint Setup"),category:categories["painting"]};recordS tyles[recordTypes.Paint]={title:WebInspector.UIString("Paint"),category:categori es["painting"]};recordStyles[recordTypes.Rasterize]={title:WebInspector.UIString ("Rasterize"),category:categories["painting"]};recordStyles[recordTypes.ScrollLa yer]={title:WebInspector.UIString("Scroll"),category:categories["rendering"]};re cordStyles[recordTypes.DecodeImage]={title:WebInspector.UIString("Image Decode") ,category:categories["painting"]};recordStyles[recordTypes.ResizeImage]={title:W ebInspector.UIString("Image Resize"),category:categories["painting"]};recordStyl es[recordTypes.CompositeLayers]={title:WebInspector.UIString("Composite Layers") ,category:categories["painting"]};recordStyles[recordTypes.ParseHTML]={title:Web Inspector.UIString("Parse HTML"),category:categories["loading"]};recordStyles[re cordTypes.TimerInstall]={title:WebInspector.UIString("Install Timer"),category:c ategories["scripting"]};recordStyles[recordTypes.TimerRemove]={title:WebInspecto r.UIString("Remove Timer"),category:categories["scripting"]};recordStyles[record Types.TimerFire]={title:WebInspector.UIString("Timer Fired"),category:categories ["scripting"]};recordStyles[recordTypes.XHRReadyStateChange]={title:WebInspector .UIString("XHR Ready State Change"),category:categories["scripting"]};recordStyl es[recordTypes.XHRLoad]={title:WebInspector.UIString("XHR Load"),category:catego ries["scripting"]};recordStyles[recordTypes.EvaluateScript]={title:WebInspector. UIString("Evaluate Script"),category:categories["scripting"]};recordStyles[recor dTypes.ResourceSendRequest]={title:WebInspector.UIString("Send Request"),categor y:categories["loading"]};recordStyles[recordTypes.ResourceReceiveResponse]={titl e:WebInspector.UIString("Receive Response"),category:categories["loading"]};reco rdStyles[recordTypes.ResourceFinish]={title:WebInspector.UIString("Finish Loadin g"),category:categories["loading"]};recordStyles[recordTypes.FunctionCall]={titl e:WebInspector.UIString("Function Call"),category:categories["scripting"]};recor dStyles[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 even t"),category:categories["scripting"]};recordStyles[recordTypes.MarkLoad]={title: WebInspector.UIString("Load event"),category:categories["scripting"]};recordStyl es[recordTypes.TimeStamp]={title:WebInspector.UIString("Stamp"),category:categor ies["scripting"]};recordStyles[recordTypes.Time]={title:WebInspector.UIString("T ime"),category:categories["scripting"]};recordStyles[recordTypes.TimeEnd]={title :WebInspector.UIString("Time End"),category:categories["scripting"]};recordStyle s[recordTypes.ScheduleResourceRequest]={title:WebInspector.UIString("Schedule Re quest"),category:categories["loading"]};recordStyles[recordTypes.RequestAnimatio nFrame]={title:WebInspector.UIString("Request Animation Frame"),category:categor ies["scripting"]};recordStyles[recordTypes.CancelAnimationFrame]={title:WebInspe ctor.UIString("Cancel Animation Frame"),category:categories["scripting"]};record Styles[recordTypes.FireAnimationFrame]={title:WebInspector.UIString("Animation F rame Fired"),category:categories["scripting"]};recordStyles[recordTypes.WebSocke tCreate]={title:WebInspector.UIString("Create WebSocket"),category:categories["s cripting"]};recordStyles[recordTypes.WebSocketSendHandshakeRequest]={title:WebIn spector.UIString("Send WebSocket Handshake"),category:categories["scripting"]};r ecordStyles[recordTypes.WebSocketReceiveHandshakeResponse]={title:WebInspector.U IString("Receive WebSocket Handshake"),category:categories["scripting"]};recordS tyles[recordTypes.WebSocketDestroy]={title:WebInspector.UIString("Destroy WebSoc ket"),category:categories["scripting"]};WebInspector.TimelinePresentationModel._ recordStylesMap=recordStyles;return recordStyles;}
319 WebInspector.TimelinePresentationModel.recordStyle=function(record) 320 WebInspector.TimelinePresentationModel.recordStyle=function(record)
320 {var recordStyles=WebInspector.TimelinePresentationModel._initRecordStyles();var result=recordStyles[record.type];if(!result){result={title:WebInspector.UIStrin g("Unknown: %s",record.type),category:WebInspector.TimelinePresentationModel.cat egories()["other"]};recordStyles[record.type]=result;} 321 {var recordStyles=WebInspector.TimelinePresentationModel._initRecordStyles();var result=recordStyles[record.type];if(!result){result={title:WebInspector.UIStrin g("Unknown: %s",record.type),category:WebInspector.TimelinePresentationModel.cat egories()["other"]};recordStyles[record.type]=result;}
321 return result;} 322 return result;}
322 WebInspector.TimelinePresentationModel.categoryForRecord=function(record) 323 WebInspector.TimelinePresentationModel.categoryForRecord=function(record)
323 {return WebInspector.TimelinePresentationModel.recordStyle(record).category;} 324 {return WebInspector.TimelinePresentationModel.recordStyle(record).category;}
324 WebInspector.TimelinePresentationModel.isEventDivider=function(record) 325 WebInspector.TimelinePresentationModel.isEventDivider=function(record)
325 {var recordTypes=WebInspector.TimelineModel.RecordType;if(record.type===recordTy pes.TimeStamp) 326 {var recordTypes=WebInspector.TimelineModel.RecordType;if(record.type===recordTy pes.TimeStamp)
326 return true;if(record.type===recordTypes.MarkDOMContent||record.type===recordTyp es.MarkLoad){if(record.data&&((typeof record.data.isMainFrame)==="boolean")) 327 return true;if(record.type===recordTypes.MarkDOMContent||record.type===recordTyp es.MarkLoad){if(record.data&&((typeof record.data.isMainFrame)==="boolean"))
327 return record.data.isMainFrame;} 328 return record.data.isMainFrame;}
328 return false;} 329 return false;}
(...skipping 17 matching lines...) Expand all
346 WebInspector.TimelinePresentationModel._hiddenRecords={} 347 WebInspector.TimelinePresentationModel._hiddenRecords={}
347 WebInspector.TimelinePresentationModel._hiddenRecords[WebInspector.TimelineModel .RecordType.MarkDOMContent]=1;WebInspector.TimelinePresentationModel._hiddenReco rds[WebInspector.TimelineModel.RecordType.MarkLoad]=1;WebInspector.TimelinePrese ntationModel._hiddenRecords[WebInspector.TimelineModel.RecordType.ScheduleStyleR ecalculation]=1;WebInspector.TimelinePresentationModel._hiddenRecords[WebInspect or.TimelineModel.RecordType.InvalidateLayout]=1;WebInspector.TimelinePresentatio nModel.prototype={addFilter:function(filter) 348 WebInspector.TimelinePresentationModel._hiddenRecords[WebInspector.TimelineModel .RecordType.MarkDOMContent]=1;WebInspector.TimelinePresentationModel._hiddenReco rds[WebInspector.TimelineModel.RecordType.MarkLoad]=1;WebInspector.TimelinePrese ntationModel._hiddenRecords[WebInspector.TimelineModel.RecordType.ScheduleStyleR ecalculation]=1;WebInspector.TimelinePresentationModel._hiddenRecords[WebInspect or.TimelineModel.RecordType.InvalidateLayout]=1;WebInspector.TimelinePresentatio nModel.prototype={addFilter:function(filter)
348 {this._filters.push(filter);},setSearchFilter:function(filter) 349 {this._filters.push(filter);},setSearchFilter:function(filter)
349 {this._searchFilter=filter;},rootRecord:function() 350 {this._searchFilter=filter;},rootRecord:function()
350 {return this._rootRecord;},frames:function() 351 {return this._rootRecord;},frames:function()
351 {return this._frames;},reset:function() 352 {return this._frames;},reset:function()
352 {this._linkifier.reset();this._rootRecord=new WebInspector.TimelinePresentationM odel.Record(this,{type:WebInspector.TimelineModel.RecordType.Root},null,null,nul l,false);this._sendRequestRecords={};this._scheduledResourceRequests={};this._ti merRecords={};this._requestAnimationFrameRecords={};this._eventDividerRecords=[] ;this._timeRecords={};this._timeRecordStack=[];this._frames=[];this._minimumReco rdTime=-1;this._layoutInvalidateStack={};this._lastScheduleStyleRecalculation={} ;this._webSocketCreateRecords={};this._coalescingBuckets={};},addFrame:function( frame) 353 {this._linkifier.reset();this._rootRecord=new WebInspector.TimelinePresentationM odel.Record(this,{type:WebInspector.TimelineModel.RecordType.Root},null,null,nul l,false);this._sendRequestRecords={};this._scheduledResourceRequests={};this._ti merRecords={};this._requestAnimationFrameRecords={};this._eventDividerRecords=[] ;this._timeRecords={};this._timeRecordStack=[];this._frames=[];this._minimumReco rdTime=-1;this._layoutInvalidateStack={};this._lastScheduleStyleRecalculation={} ;this._webSocketCreateRecords={};this._coalescingBuckets={};},addFrame:function( frame)
353 {this._frames.push(frame);},addRecord:function(record) 354 {this._frames.push(frame);},addRecord:function(record)
354 {if(this._minimumRecordTime===-1||record.startTime<this._minimumRecordTime) 355 {if(this._minimumRecordTime===-1||record.startTime<this._minimumRecordTime)
355 this._minimumRecordTime=WebInspector.TimelineModel.startTimeInSeconds(record);va r records;if(record.type===WebInspector.TimelineModel.RecordType.Program) 356 this._minimumRecordTime=WebInspector.TimelineModel.startTimeInSeconds(record);va r records;if(record.type===WebInspector.TimelineModel.RecordType.Program)
356 records=record.children;else 357 records=this._foldSyncTimeRecords(record.children||[]);else
357 records=[record];var formattedRecords=[];var recordsCount=records.length;for(var i=0;i<recordsCount;++i) 358 records=[record];var result=Array(records.length);for(var i=0;i<records.length;+ +i)
358 formattedRecords.push(this._innerAddRecord(records[i],this._rootRecord));return formattedRecords;},_innerAddRecord:function(record,parentRecord) 359 result[i]=this._innerAddRecord(this._rootRecord,records[i]);return result;},_inn erAddRecord:function(parentRecord,record)
359 {const recordTypes=WebInspector.TimelineModel.RecordType;var isHiddenRecord=reco rd.type in WebInspector.TimelinePresentationModel._hiddenRecords;var origin;var coalescingBucket;if(!isHiddenRecord){var newParentRecord=this._findParentRecord( record);if(newParentRecord){origin=parentRecord;parentRecord=newParentRecord;} 360 {const recordTypes=WebInspector.TimelineModel.RecordType;var isHiddenRecord=reco rd.type in WebInspector.TimelinePresentationModel._hiddenRecords;var origin;var coalescingBucket;if(!isHiddenRecord){var newParentRecord=this._findParentRecord( record);if(newParentRecord){origin=parentRecord;parentRecord=newParentRecord;}
360 if(parentRecord===this._rootRecord) 361 if(parentRecord===this._rootRecord)
361 coalescingBucket=record.thread?record.type:"mainThread";var coalescedRecord=this ._findCoalescedParent(record,parentRecord,coalescingBucket);if(coalescedRecord){ if(!origin) 362 coalescingBucket=record.thread?record.type:"mainThread";var coalescedRecord=this ._findCoalescedParent(record,parentRecord,coalescingBucket);if(coalescedRecord){ if(!origin)
362 origin=parentRecord;parentRecord=coalescedRecord;}} 363 origin=parentRecord;parentRecord=coalescedRecord;}}
363 var children=record.children;var scriptDetails;if(record.data&&record.data["scri ptName"]){scriptDetails={scriptName:record.data["scriptName"],scriptLine:record. data["scriptLine"]}};if((record.type===recordTypes.TimerFire||record.type===reco rdTypes.FireAnimationFrame)&&children&&children.length){var childRecord=children [0];if(childRecord.type===recordTypes.FunctionCall){scriptDetails={scriptName:ch ildRecord.data["scriptName"],scriptLine:childRecord.data["scriptLine"]};children =childRecord.children.concat(children.slice(1));}} 364 var children=record.children;var scriptDetails;if(record.data&&record.data["scri ptName"]){scriptDetails={scriptName:record.data["scriptName"],scriptLine:record. data["scriptLine"]}};if((record.type===recordTypes.TimerFire||record.type===reco rdTypes.FireAnimationFrame)&&children&&children.length){var childRecord=children [0];if(childRecord.type===recordTypes.FunctionCall){scriptDetails={scriptName:ch ildRecord.data["scriptName"],scriptLine:childRecord.data["scriptLine"]};children =childRecord.children.concat(children.slice(1));}}
364 var formattedRecord=new WebInspector.TimelinePresentationModel.Record(this,recor d,parentRecord,origin,scriptDetails,isHiddenRecord);if(WebInspector.TimelinePres entationModel.isEventDivider(formattedRecord)) 365 var formattedRecord=new WebInspector.TimelinePresentationModel.Record(this,recor d,parentRecord,origin,scriptDetails,isHiddenRecord);if(WebInspector.TimelinePres entationModel.isEventDivider(formattedRecord))
365 this._eventDividerRecords.push(formattedRecord);if(isHiddenRecord) 366 this._eventDividerRecords.push(formattedRecord);if(isHiddenRecord)
366 return formattedRecord;formattedRecord.collapsed=parentRecord===this._rootRecord ;if(coalescingBucket) 367 return formattedRecord;formattedRecord.collapsed=parentRecord===this._rootRecord ;if(coalescingBucket)
367 this._coalescingBuckets[coalescingBucket]=formattedRecord;var childrenCount=chil dren?children.length:0;for(var i=0;i<childrenCount;++i) 368 this._coalescingBuckets[coalescingBucket]=formattedRecord;if(children){children= this._foldSyncTimeRecords(children);for(var i=0;i<children.length;++i)
368 this._innerAddRecord(children[i],formattedRecord);formattedRecord.calculateAggre gatedStats();if(origin) 369 this._innerAddRecord(formattedRecord,children[i]);}
370 formattedRecord.calculateAggregatedStats();if(origin)
369 this._updateAncestorStats(formattedRecord);if(parentRecord.coalesced&&parentReco rd.startTime>formattedRecord.startTime) 371 this._updateAncestorStats(formattedRecord);if(parentRecord.coalesced&&parentReco rd.startTime>formattedRecord.startTime)
370 parentRecord._record.startTime=record.startTime;origin=formattedRecord.origin(); if(!origin.isRoot()&&!origin.coalesced) 372 parentRecord._record.startTime=record.startTime;origin=formattedRecord.origin(); if(!origin.isRoot()&&!origin.coalesced)
371 origin.selfTime-=formattedRecord.endTime-formattedRecord.startTime;return format tedRecord;},_updateAncestorStats:function(record) 373 origin.selfTime-=formattedRecord.endTime-formattedRecord.startTime;return format tedRecord;},_updateAncestorStats:function(record)
372 {var lastChildEndTime=record.lastChildEndTime;var aggregatedStats=record.aggrega tedStats;for(var currentRecord=record.parent;currentRecord&&!currentRecord.isRoo t();currentRecord=currentRecord.parent){currentRecord._cpuTime+=record._cpuTime; if(currentRecord.lastChildEndTime<lastChildEndTime) 374 {var lastChildEndTime=record.lastChildEndTime;var aggregatedStats=record.aggrega tedStats;for(var currentRecord=record.parent;currentRecord&&!currentRecord.isRoo t();currentRecord=currentRecord.parent){currentRecord._cpuTime+=record._cpuTime; if(currentRecord.lastChildEndTime<lastChildEndTime)
373 currentRecord.lastChildEndTime=lastChildEndTime;for(var category in aggregatedSt ats) 375 currentRecord.lastChildEndTime=lastChildEndTime;for(var category in aggregatedSt ats)
374 currentRecord.aggregatedStats[category]+=aggregatedStats[category];}},_findCoale scedParent:function(record,newParent,bucket) 376 currentRecord.aggregatedStats[category]+=aggregatedStats[category];}},_findCoale scedParent:function(record,newParent,bucket)
375 {const coalescingThresholdSeconds=0.005;var lastRecord=bucket?this._coalescingBu ckets[bucket]:newParent.children.peekLast();if(lastRecord&&lastRecord.coalesced) 377 {const coalescingThresholdSeconds=0.005;var lastRecord=bucket?this._coalescingBu ckets[bucket]:newParent.children.peekLast();if(lastRecord&&lastRecord.coalesced)
376 lastRecord=lastRecord.children.peekLast();var startTime=WebInspector.TimelineMod el.startTimeInSeconds(record);var endTime=WebInspector.TimelineModel.endTimeInSe conds(record);if(!lastRecord) 378 lastRecord=lastRecord.children.peekLast();var startTime=WebInspector.TimelineMod el.startTimeInSeconds(record);var endTime=WebInspector.TimelineModel.endTimeInSe conds(record);if(!lastRecord)
377 return null;if(lastRecord.type!==record.type) 379 return null;if(lastRecord.type!==record.type)
378 return null;if(lastRecord.endTime+coalescingThresholdSeconds<startTime) 380 return null;if(lastRecord.endTime+coalescingThresholdSeconds<startTime)
379 return null;if(endTime+coalescingThresholdSeconds<lastRecord.startTime) 381 return null;if(endTime+coalescingThresholdSeconds<lastRecord.startTime)
380 return null;if(WebInspector.TimelinePresentationModel.coalescingKeyForRecord(rec ord)!==WebInspector.TimelinePresentationModel.coalescingKeyForRecord(lastRecord. _record)) 382 return null;if(WebInspector.TimelinePresentationModel.coalescingKeyForRecord(rec ord)!==WebInspector.TimelinePresentationModel.coalescingKeyForRecord(lastRecord. _record))
381 return null;if(lastRecord.parent.coalesced) 383 return null;if(lastRecord.parent.coalesced)
382 return lastRecord.parent;return this._replaceWithCoalescedRecord(lastRecord);},_ replaceWithCoalescedRecord:function(record) 384 return lastRecord.parent;return this._replaceWithCoalescedRecord(lastRecord);},_ replaceWithCoalescedRecord:function(record)
383 {var rawRecord={type:record._record.type,startTime:record._record.startTime,endT ime:record._record.endTime,data:{}};if(record._record.thread) 385 {var rawRecord={type:record._record.type,startTime:record._record.startTime,endT ime:record._record.endTime,data:{}};if(record._record.thread)
384 rawRecord.thread="aggregated";if(record.type===WebInspector.TimelineModel.Record Type.TimeStamp) 386 rawRecord.thread="aggregated";if(record.type===WebInspector.TimelineModel.Record Type.TimeStamp)
385 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;coa lescedRecord._children.push(record);record.parent=coalescedRecord;coalescedRecor d.calculateAggregatedStats();if(record.hasWarning||record.childHasWarning) 387 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;coa lescedRecord._children.push(record);record.parent=coalescedRecord;coalescedRecor d.calculateAggregatedStats();if(record.hasWarnings()||record.childHasWarnings())
386 coalescedRecord.childHasWarning=true;coalescedRecord.parent=parent;parent._child ren[parent._children.indexOf(record)]=coalescedRecord;return coalescedRecord;},_ findParentRecord:function(record) 388 coalescedRecord._childHasWarnings=true;coalescedRecord.parent=parent;parent._chi ldren[parent._children.indexOf(record)]=coalescedRecord;return coalescedRecord;} ,_foldSyncTimeRecords:function(records)
389 {var recordTypes=WebInspector.TimelineModel.RecordType;for(var i=0;i<records.len gth&&records[i].type!==recordTypes.Time;++i){}
390 if(i===records.length)
391 return records;var result=[];var stack=[];for(var i=0;i<records.length;++i){resu lt.push(records[i]);if(records[i].type===recordTypes.Time){stack.push(result.len gth-1);continue;}
392 if(records[i].type!==recordTypes.TimeEnd)
393 continue;while(stack.length){var begin=stack.pop();if(result[begin].data.message !==records[i].data.message)
394 continue;var timeEndRecord=(result.pop());var children=result.splice(begin+1,res ult.length-begin);result[begin]=this._createSynchronousTimeRecord(result[begin], timeEndRecord,children);break;}}
395 return result;},_createSynchronousTimeRecord:function(beginRecord,endRecord,chil dren)
396 {return{type:beginRecord.type,startTime:beginRecord.startTime,endTime:endRecord. startTime,stackTrace:beginRecord.stackTrace,children:children,data:{message:begi nRecord.data.message,isSynchronous:true},};},_findParentRecord:function(record)
387 {if(!this._glueRecords) 397 {if(!this._glueRecords)
388 return null;var recordTypes=WebInspector.TimelineModel.RecordType;switch(record. type){case recordTypes.ResourceReceiveResponse:case recordTypes.ResourceFinish:c ase recordTypes.ResourceReceivedData:return this._sendRequestRecords[record.data ["requestId"]];case recordTypes.ResourceSendRequest:return this._rootRecord;case recordTypes.TimerFire:return this._timerRecords[record.data["timerId"]];case re cordTypes.ResourceSendRequest:return this._scheduledResourceRequests[record.data ["url"]];case recordTypes.FireAnimationFrame:return this._requestAnimationFrameR ecords[record.data["id"]];case recordTypes.Time:return this._rootRecord;case rec ordTypes.TimeEnd:return this._timeRecords[record.data["message"]];}},setGlueReco rds:function(glue) 398 return null;var recordTypes=WebInspector.TimelineModel.RecordType;switch(record. type){case recordTypes.ResourceReceiveResponse:case recordTypes.ResourceFinish:c ase recordTypes.ResourceReceivedData:return this._sendRequestRecords[record.data ["requestId"]];case recordTypes.ResourceSendRequest:return this._rootRecord;case recordTypes.TimerFire:return this._timerRecords[record.data["timerId"]];case re cordTypes.ResourceSendRequest:return this._scheduledResourceRequests[record.data ["url"]];case recordTypes.FireAnimationFrame:return this._requestAnimationFrameR ecords[record.data["id"]];}},setGlueRecords:function(glue)
389 {this._glueRecords=glue;},invalidateFilteredRecords:function() 399 {this._glueRecords=glue;},invalidateFilteredRecords:function()
390 {delete this._filteredRecords;},filteredRecords:function() 400 {delete this._filteredRecords;},filteredRecords:function()
391 {if(this._filteredRecords) 401 {if(this._filteredRecords)
392 return this._filteredRecords;var recordsInWindow=[];var stack=[{children:this._r ootRecord.children,index:0,parentIsCollapsed:false,parentRecord:{}}];var reveale dDepth=0;function revealRecordsInStack(){for(var depth=revealedDepth+1;depth<sta ck.length;++depth){if(stack[depth-1].parentIsCollapsed){stack[depth].parentRecor d.parent._expandable=true;return;} 402 return this._filteredRecords;var recordsInWindow=[];var stack=[{children:this._r ootRecord.children,index:0,parentIsCollapsed:false,parentRecord:{}}];var reveale dDepth=0;function revealRecordsInStack(){for(var depth=revealedDepth+1;depth<sta ck.length;++depth){if(stack[depth-1].parentIsCollapsed){stack[depth].parentRecor d.parent._expandable=true;return;}
393 stack[depth-1].parentRecord.collapsed=false;recordsInWindow.push(stack[depth].pa rentRecord);stack[depth].windowLengthBeforeChildrenTraversal=recordsInWindow.len gth;stack[depth].parentIsRevealed=true;revealedDepth=depth;}} 403 stack[depth-1].parentRecord.collapsed=false;recordsInWindow.push(stack[depth].pa rentRecord);stack[depth].windowLengthBeforeChildrenTraversal=recordsInWindow.len gth;stack[depth].parentIsRevealed=true;revealedDepth=depth;}}
394 while(stack.length){var entry=stack[stack.length-1];var records=entry.children;i f(records&&entry.index<records.length){var record=records[entry.index];++entry.i ndex;if(this.isVisible(record)){record.parent._expandable=true;if(this._searchFi lter) 404 while(stack.length){var entry=stack[stack.length-1];var records=entry.children;i f(records&&entry.index<records.length){var record=records[entry.index];++entry.i ndex;if(this.isVisible(record)){record.parent._expandable=true;if(this._searchFi lter)
395 revealRecordsInStack();if(!entry.parentIsCollapsed){recordsInWindow.push(record) ;revealedDepth=stack.length;entry.parentRecord.collapsed=false;}} 405 revealRecordsInStack();if(!entry.parentIsCollapsed){recordsInWindow.push(record) ;revealedDepth=stack.length;entry.parentRecord.collapsed=false;}}
396 record._expandable=false;stack.push({children:record.children,index:0,parentIsCo llapsed:(entry.parentIsCollapsed||(record.collapsed&&(!this._searchFilter||recor d.clicked))),parentRecord:record,windowLengthBeforeChildrenTraversal:recordsInWi ndow.length});}else{stack.pop();revealedDepth=Math.min(revealedDepth,stack.lengt h-1);entry.parentRecord._visibleChildrenCount=recordsInWindow.length-entry.windo wLengthBeforeChildrenTraversal;}} 406 record._expandable=false;stack.push({children:record.children,index:0,parentIsCo llapsed:(entry.parentIsCollapsed||(record.collapsed&&(!this._searchFilter||recor d.clicked))),parentRecord:record,windowLengthBeforeChildrenTraversal:recordsInWi ndow.length});}else{stack.pop();revealedDepth=Math.min(revealedDepth,stack.lengt h-1);entry.parentRecord._visibleChildrenCount=recordsInWindow.length-entry.windo wLengthBeforeChildrenTraversal;}}
397 this._filteredRecords=recordsInWindow;return recordsInWindow;},filteredFrames:fu nction(startTime,endTime) 407 this._filteredRecords=recordsInWindow;return recordsInWindow;},filteredFrames:fu nction(startTime,endTime)
398 {function compareStartTime(value,object) 408 {function compareStartTime(value,object)
399 {return value-object.startTime;} 409 {return value-object.startTime;}
400 function compareEndTime(value,object) 410 function compareEndTime(value,object)
401 {return value-object.endTime;} 411 {return value-object.endTime;}
402 var firstFrame=insertionIndexForObjectInListSortedByFunction(startTime,this._fra mes,compareStartTime);var lastFrame=insertionIndexForObjectInListSortedByFunctio n(endTime,this._frames,compareEndTime);while(lastFrame<this._frames.length&&this ._frames[lastFrame].endTime<=endTime) 412 var firstFrame=insertionIndexForObjectInListSortedByFunction(startTime,this._fra mes,compareStartTime);var lastFrame=insertionIndexForObjectInListSortedByFunctio n(endTime,this._frames,compareEndTime);while(lastFrame<this._frames.length&&this ._frames[lastFrame].endTime<=endTime)
403 ++lastFrame;return this._frames.slice(firstFrame,lastFrame);},eventDividerRecord s:function() 413 ++lastFrame;return this._frames.slice(firstFrame,lastFrame);},eventDividerRecord s:function()
404 {return this._eventDividerRecords;},isVisible:function(record) 414 {return this._eventDividerRecords;},isVisible:function(record)
405 {for(var i=0;i<this._filters.length;++i){if(!this._filters[i].accept(record)) 415 {for(var i=0;i<this._filters.length;++i){if(!this._filters[i].accept(record))
406 return false;} 416 return false;}
407 return!this._searchFilter||this._searchFilter.accept(record);},generateMainThrea dBarPopupContent:function(info) 417 return!this._searchFilter||this._searchFilter.accept(record);},generateMainThrea dBarPopupContent:function(info)
408 {var firstTaskIndex=info.firstTaskIndex;var lastTaskIndex=info.lastTaskIndex;var tasks=info.tasks;var messageCount=lastTaskIndex-firstTaskIndex+1;var cpuTime=0; for(var i=firstTaskIndex;i<=lastTaskIndex;++i){var task=tasks[i];cpuTime+=task.e ndTime-task.startTime;} 418 {var firstTaskIndex=info.firstTaskIndex;var lastTaskIndex=info.lastTaskIndex;var tasks=info.tasks;var messageCount=lastTaskIndex-firstTaskIndex+1;var cpuTime=0; for(var i=firstTaskIndex;i<=lastTaskIndex;++i){var task=tasks[i];cpuTime+=task.e ndTime-task.startTime;}
409 var startTime=tasks[firstTaskIndex].startTime;var endTime=tasks[lastTaskIndex].e ndTime;var duration=endTime-startTime;var offset=this._minimumRecordTime;var con tentHelper=new WebInspector.PopoverContentHelper(WebInspector.UIString("CPU"));v ar durationText=WebInspector.UIString("%s (at %s)",Number.secondsToString(durati on,true),Number.secondsToString(startTime-offset,true));contentHelper.appendText Row(WebInspector.UIString("Duration"),durationText);contentHelper.appendTextRow( WebInspector.UIString("CPU time"),Number.secondsToString(cpuTime,true));contentH elper.appendTextRow(WebInspector.UIString("Message Count"),messageCount);return contentHelper.contentTable();},__proto__:WebInspector.Object.prototype} 419 var startTime=tasks[firstTaskIndex].startTime;var endTime=tasks[lastTaskIndex].e ndTime;var duration=endTime-startTime;var offset=this._minimumRecordTime;var con tentHelper=new WebInspector.PopoverContentHelper(WebInspector.UIString("CPU"));v ar durationText=WebInspector.UIString("%s (at %s)",Number.secondsToString(durati on,true),Number.secondsToString(startTime-offset,true));contentHelper.appendText Row(WebInspector.UIString("Duration"),durationText);contentHelper.appendTextRow( WebInspector.UIString("CPU time"),Number.secondsToString(cpuTime,true));contentH elper.appendTextRow(WebInspector.UIString("Message Count"),messageCount);return contentHelper.contentTable();},__proto__:WebInspector.Object.prototype}
410 WebInspector.TimelinePresentationModel.Record=function(presentationModel,record, parentRecord,origin,scriptDetails,hidden) 420 WebInspector.TimelinePresentationModel.Record=function(presentationModel,record, parentRecord,origin,scriptDetails,hidden)
411 {this._linkifier=presentationModel._linkifier;this._aggregatedStats={};this._rec ord=record;this._children=[];if(!hidden&&parentRecord){this.parent=parentRecord; if(this.isBackground) 421 {this._linkifier=presentationModel._linkifier;this._aggregatedStats={};this._rec ord=record;this._children=[];if(!hidden&&parentRecord){this.parent=parentRecord; if(this.isBackground)
412 WebInspector.TimelinePresentationModel.insertRetrospectiveRecord(parentRecord,th is);else 422 WebInspector.TimelinePresentationModel.insertRetrospectiveRecord(parentRecord,th is);else
413 parentRecord.children.push(this);} 423 parentRecord.children.push(this);}
414 if(origin) 424 if(origin)
415 this._origin=origin;this._selfTime=this.endTime-this.startTime;this._lastChildEn dTime=this.endTime;this._startTimeOffset=this.startTime-presentationModel._minim umRecordTime;if(record.data){if(record.data["url"]) 425 this._origin=origin;this._selfTime=this.endTime-this.startTime;this._lastChildEn dTime=this.endTime;this._startTimeOffset=this.startTime-presentationModel._minim umRecordTime;if(record.data){if(record.data["url"])
416 this.url=record.data["url"];if(record.data["layerRootNode"]) 426 this.url=record.data["url"];if(record.data["rootNode"])
417 this._relatedBackendNodeId=record.data["layerRootNode"];else if(record.data["ele mentId"]) 427 this._relatedBackendNodeId=record.data["rootNode"];else if(record.data["elementI d"])
418 this._relatedBackendNodeId=record.data["elementId"];} 428 this._relatedBackendNodeId=record.data["elementId"];}
419 if(scriptDetails){this.scriptName=scriptDetails.scriptName;this.scriptLine=scrip tDetails.scriptLine;} 429 if(scriptDetails){this.scriptName=scriptDetails.scriptName;this.scriptLine=scrip tDetails.scriptLine;}
420 if(parentRecord&&parentRecord.callSiteStackTrace) 430 if(parentRecord&&parentRecord.callSiteStackTrace)
421 this.callSiteStackTrace=parentRecord.callSiteStackTrace;var recordTypes=WebInspe ctor.TimelineModel.RecordType;switch(record.type){case recordTypes.ResourceSendR equest:presentationModel._sendRequestRecords[record.data["requestId"]]=this;brea k;case recordTypes.ScheduleResourceRequest:presentationModel._scheduledResourceR equests[record.data["url"]]=this;break;case recordTypes.ResourceReceiveResponse: var sendRequestRecord=presentationModel._sendRequestRecords[record.data["request Id"]];if(sendRequestRecord){this.url=sendRequestRecord.url;sendRequestRecord._re freshDetails();if(sendRequestRecord.parent!==presentationModel._rootRecord&&send RequestRecord.parent.type===recordTypes.ScheduleResourceRequest) 431 this.callSiteStackTrace=parentRecord.callSiteStackTrace;var recordTypes=WebInspe ctor.TimelineModel.RecordType;switch(record.type){case recordTypes.ResourceSendR equest:presentationModel._sendRequestRecords[record.data["requestId"]]=this;brea k;case recordTypes.ScheduleResourceRequest:presentationModel._scheduledResourceR equests[record.data["url"]]=this;break;case recordTypes.ResourceReceiveResponse: var sendRequestRecord=presentationModel._sendRequestRecords[record.data["request Id"]];if(sendRequestRecord){this.url=sendRequestRecord.url;sendRequestRecord._re freshDetails();if(sendRequestRecord.parent!==presentationModel._rootRecord&&send RequestRecord.parent.type===recordTypes.ScheduleResourceRequest)
422 sendRequestRecord.parent._refreshDetails();} 432 sendRequestRecord.parent._refreshDetails();}
423 break;case recordTypes.ResourceReceivedData:case recordTypes.ResourceFinish:var sendRequestRecord=presentationModel._sendRequestRecords[record.data["requestId"] ];if(sendRequestRecord) 433 break;case recordTypes.ResourceReceivedData:case recordTypes.ResourceFinish:var sendRequestRecord=presentationModel._sendRequestRecords[record.data["requestId"] ];if(sendRequestRecord)
424 this.url=sendRequestRecord.url;break;case recordTypes.TimerInstall:this.timeout= record.data["timeout"];this.singleShot=record.data["singleShot"];presentationMod el._timerRecords[record.data["timerId"]]=this;break;case recordTypes.TimerFire:v ar timerInstalledRecord=presentationModel._timerRecords[record.data["timerId"]]; if(timerInstalledRecord){this.callSiteStackTrace=timerInstalledRecord.stackTrace ;this.timeout=timerInstalledRecord.timeout;this.singleShot=timerInstalledRecord. singleShot;} 434 this.url=sendRequestRecord.url;break;case recordTypes.TimerInstall:this.timeout= record.data["timeout"];this.singleShot=record.data["singleShot"];presentationMod el._timerRecords[record.data["timerId"]]=this;break;case recordTypes.TimerFire:v ar timerInstalledRecord=presentationModel._timerRecords[record.data["timerId"]]; if(timerInstalledRecord){this.callSiteStackTrace=timerInstalledRecord.stackTrace ;this.timeout=timerInstalledRecord.timeout;this.singleShot=timerInstalledRecord. singleShot;}
425 break;case recordTypes.RequestAnimationFrame:presentationModel._requestAnimation FrameRecords[record.data["id"]]=this;break;case recordTypes.FireAnimationFrame:v ar requestAnimationRecord=presentationModel._requestAnimationFrameRecords[record .data["id"]];if(requestAnimationRecord) 435 break;case recordTypes.RequestAnimationFrame:presentationModel._requestAnimation FrameRecords[record.data["id"]]=this;break;case recordTypes.FireAnimationFrame:v ar requestAnimationRecord=presentationModel._requestAnimationFrameRecords[record .data["id"]];if(requestAnimationRecord)
426 this.callSiteStackTrace=requestAnimationRecord.stackTrace;break;case recordTypes .Time:var message=record.data["message"];var oldReference=presentationModel._tim eRecords[message];if(oldReference) 436 this.callSiteStackTrace=requestAnimationRecord.stackTrace;break;case recordTypes .Time:if(record.data.isSynchronous)
437 break;var message=record.data["message"];var oldReference=presentationModel._tim eRecords[message];if(oldReference)
427 break;presentationModel._timeRecords[message]=this;if(origin) 438 break;presentationModel._timeRecords[message]=this;if(origin)
428 presentationModel._timeRecordStack.push(this);break;case recordTypes.TimeEnd:var message=record.data["message"];var timeRecord=presentationModel._timeRecords[me ssage];delete presentationModel._timeRecords[message];if(timeRecord){this.timeRe cord=timeRecord;timeRecord.timeEndRecord=this;var intervalDuration=this.startTim e-timeRecord.startTime;this.intervalDuration=intervalDuration;timeRecord.interva lDuration=intervalDuration;if(!origin) 439 presentationModel._timeRecordStack.push(this);break;case recordTypes.TimeEnd:var message=record.data["message"];var timeRecord=presentationModel._timeRecords[me ssage];delete presentationModel._timeRecords[message];if(timeRecord){this.timeRe cord=timeRecord;timeRecord.timeEndRecord=this;var intervalDuration=this.startTim e-timeRecord.startTime;this.intervalDuration=intervalDuration;timeRecord.interva lDuration=intervalDuration;}
429 break;var recordStack=presentationModel._timeRecordStack;recordStack.splice(reco rdStack.indexOf(timeRecord),1);for(var index=recordStack.length;index;--index){v ar openRecord=recordStack[index-1];if(openRecord.startTime>timeRecord.startTime)
430 continue;WebInspector.TimelinePresentationModel.adoptRecord(openRecord,timeRecor d);break;}}
431 break;case recordTypes.ScheduleStyleRecalculation:presentationModel._lastSchedul eStyleRecalculation[this.frameId]=this;break;case recordTypes.RecalculateStyles: var scheduleStyleRecalculationRecord=presentationModel._lastScheduleStyleRecalcu lation[this.frameId];if(!scheduleStyleRecalculationRecord) 440 break;case recordTypes.ScheduleStyleRecalculation:presentationModel._lastSchedul eStyleRecalculation[this.frameId]=this;break;case recordTypes.RecalculateStyles: var scheduleStyleRecalculationRecord=presentationModel._lastScheduleStyleRecalcu lation[this.frameId];if(!scheduleStyleRecalculationRecord)
432 break;this.callSiteStackTrace=scheduleStyleRecalculationRecord.stackTrace;break; case recordTypes.InvalidateLayout:var styleRecalcStack;if(!presentationModel._la youtInvalidateStack[this.frameId]){for(var outerRecord=parentRecord;outerRecord; outerRecord=record.parent){if(outerRecord.type===recordTypes.RecalculateStyles){ styleRecalcStack=outerRecord.callSiteStackTrace;break;}}} 441 break;this.callSiteStackTrace=scheduleStyleRecalculationRecord.stackTrace;break; case recordTypes.InvalidateLayout:var styleRecalcStack;if(!presentationModel._la youtInvalidateStack[this.frameId]){for(var outerRecord=parentRecord;outerRecord; outerRecord=record.parent){if(outerRecord.type===recordTypes.RecalculateStyles){ styleRecalcStack=outerRecord.callSiteStackTrace;break;}}}
433 presentationModel._layoutInvalidateStack[this.frameId]=styleRecalcStack||this.st ackTrace;break;case recordTypes.Layout:var layoutInvalidateStack=presentationMod el._layoutInvalidateStack[this.frameId];if(layoutInvalidateStack) 442 presentationModel._layoutInvalidateStack[this.frameId]=styleRecalcStack||this.st ackTrace;break;case recordTypes.Layout:var layoutInvalidateStack=presentationMod el._layoutInvalidateStack[this.frameId];if(layoutInvalidateStack)
434 this.callSiteStackTrace=layoutInvalidateStack;if(this.stackTrace) 443 this.callSiteStackTrace=layoutInvalidateStack;if(this.stackTrace)
435 this.setHasWarning();presentationModel._layoutInvalidateStack[this.frameId]=null ;this.highlightQuad=record.data.root||WebInspector.TimelinePresentationModel.qua dFromRectData(record.data);this._relatedBackendNodeId=record.data["rootNode"];br eak;case recordTypes.Paint:this.highlightQuad=record.data.clip||WebInspector.Tim elinePresentationModel.quadFromRectData(record.data);break;case recordTypes.WebS ocketCreate:this.webSocketURL=record.data["url"];if(typeof record.data["webSocke tProtocol"]!=="undefined") 444 this.addWarning(WebInspector.UIString("Forced synchronous layout is a possible p erformance bottleneck."));presentationModel._layoutInvalidateStack[this.frameId] =null;this.highlightQuad=record.data.root||WebInspector.TimelinePresentationMode l.quadFromRectData(record.data);this._relatedBackendNodeId=record.data["rootNode "];break;case recordTypes.AutosizeText:if(record.data.needsRelayout&&parentRecor d.type===recordTypes.Layout)
445 parentRecord.addWarning(WebInspector.UIString("Layout required two passes due to text autosizing, consider setting viewport."));break;case recordTypes.Paint:thi s.highlightQuad=record.data.clip||WebInspector.TimelinePresentationModel.quadFro mRectData(record.data);break;case recordTypes.WebSocketCreate:this.webSocketURL= record.data["url"];if(typeof record.data["webSocketProtocol"]!=="undefined")
436 this.webSocketProtocol=record.data["webSocketProtocol"];presentationModel._webSo cketCreateRecords[record.data["identifier"]]=this;break;case recordTypes.WebSock etSendHandshakeRequest:case recordTypes.WebSocketReceiveHandshakeResponse:case r ecordTypes.WebSocketDestroy:var webSocketCreateRecord=presentationModel._webSock etCreateRecords[record.data["identifier"]];if(webSocketCreateRecord){this.webSoc ketURL=webSocketCreateRecord.webSocketURL;if(typeof webSocketCreateRecord.webSoc ketProtocol!=="undefined") 446 this.webSocketProtocol=record.data["webSocketProtocol"];presentationModel._webSo cketCreateRecords[record.data["identifier"]]=this;break;case recordTypes.WebSock etSendHandshakeRequest:case recordTypes.WebSocketReceiveHandshakeResponse:case r ecordTypes.WebSocketDestroy:var webSocketCreateRecord=presentationModel._webSock etCreateRecords[record.data["identifier"]];if(webSocketCreateRecord){this.webSoc ketURL=webSocketCreateRecord.webSocketURL;if(typeof webSocketCreateRecord.webSoc ketProtocol!=="undefined")
437 this.webSocketProtocol=webSocketCreateRecord.webSocketProtocol;} 447 this.webSocketProtocol=webSocketCreateRecord.webSocketProtocol;}
438 break;}} 448 break;}}
439 WebInspector.TimelinePresentationModel.adoptRecord=function(newParent,record) 449 WebInspector.TimelinePresentationModel.adoptRecord=function(newParent,record)
440 {record.parent.children.splice(record.parent.children.indexOf(record));WebInspec tor.TimelinePresentationModel.insertRetrospectiveRecord(newParent,record);record .parent=newParent;} 450 {record.parent.children.splice(record.parent.children.indexOf(record));WebInspec tor.TimelinePresentationModel.insertRetrospectiveRecord(newParent,record);record .parent=newParent;}
441 WebInspector.TimelinePresentationModel.insertRetrospectiveRecord=function(parent ,record) 451 WebInspector.TimelinePresentationModel.insertRetrospectiveRecord=function(parent ,record)
442 {function compareStartTime(value,record) 452 {function compareStartTime(value,record)
443 {return value<record.startTime?-1:1;} 453 {return value<record.startTime?-1:1;}
444 parent.children.splice(insertionIndexForObjectInListSortedByFunction(record.star tTime,parent.children,compareStartTime),0,record);} 454 parent.children.splice(insertionIndexForObjectInListSortedByFunction(record.star tTime,parent.children,compareStartTime),0,record);}
445 WebInspector.TimelinePresentationModel.Record.prototype={get lastChildEndTime() 455 WebInspector.TimelinePresentationModel.Record.prototype={get lastChildEndTime()
(...skipping 23 matching lines...) Expand all
469 {var barrier=new CallbackBarrier();if(WebInspector.TimelinePresentationModel.nee dsPreviewElement(this.type)&&!this._imagePreviewElement) 479 {var barrier=new CallbackBarrier();if(WebInspector.TimelinePresentationModel.nee dsPreviewElement(this.type)&&!this._imagePreviewElement)
470 WebInspector.DOMPresentationUtils.buildImagePreviewContents(this.url,false,barri er.createCallback(this._setImagePreviewElement.bind(this)));if(this._relatedBack endNodeId&&!this._relatedNode) 480 WebInspector.DOMPresentationUtils.buildImagePreviewContents(this.url,false,barri er.createCallback(this._setImagePreviewElement.bind(this)));if(this._relatedBack endNodeId&&!this._relatedNode)
471 WebInspector.domAgent.pushNodeByBackendIdToFrontend(this._relatedBackendNodeId,b arrier.createCallback(this._setRelatedNode.bind(this)));barrier.callWhenDone(cal lbackWrapper.bind(this));function callbackWrapper() 481 WebInspector.domAgent.pushNodeByBackendIdToFrontend(this._relatedBackendNodeId,b arrier.createCallback(this._setRelatedNode.bind(this)));barrier.callWhenDone(cal lbackWrapper.bind(this));function callbackWrapper()
472 {callback(this._generatePopupContentSynchronously());}},_setImagePreviewElement: function(element) 482 {callback(this._generatePopupContentSynchronously());}},_setImagePreviewElement: function(element)
473 {this._imagePreviewElement=element;},_setRelatedNode:function(nodeId) 483 {this._imagePreviewElement=element;},_setRelatedNode:function(nodeId)
474 {if(typeof nodeId==="number") 484 {if(typeof nodeId==="number")
475 this._relatedNode=WebInspector.domAgent.nodeForId(nodeId);},_generatePopupConten tSynchronously:function() 485 this._relatedNode=WebInspector.domAgent.nodeForId(nodeId);},_generatePopupConten tSynchronously:function()
476 {var contentHelper=new WebInspector.PopoverContentHelper(this.title);var text=We bInspector.UIString("%s (at %s)",Number.secondsToString(this._lastChildEndTime-t his.startTime,true),Number.secondsToString(this._startTimeOffset));contentHelper .appendTextRow(WebInspector.UIString("Duration"),text);if(this._children.length) {if(!this.coalesced) 486 {var contentHelper=new WebInspector.PopoverContentHelper(this.title);var text=We bInspector.UIString("%s (at %s)",Number.secondsToString(this._lastChildEndTime-t his.startTime,true),Number.secondsToString(this._startTimeOffset));contentHelper .appendTextRow(WebInspector.UIString("Duration"),text);if(this._children.length) {if(!this.coalesced)
477 contentHelper.appendTextRow(WebInspector.UIString("Self Time"),Number.secondsToS tring(this._selfTime,true));contentHelper.appendTextRow(WebInspector.UIString("C PU Time"),Number.secondsToString(this._cpuTime,true));contentHelper.appendElemen tRow(WebInspector.UIString("Aggregated Time"),WebInspector.TimelinePresentationM odel._generateAggregatedInfo(this._aggregatedStats));} 487 contentHelper.appendTextRow(WebInspector.UIString("Self Time"),Number.secondsToS tring(this._selfTime,true));contentHelper.appendTextRow(WebInspector.UIString("C PU Time"),Number.secondsToString(this._cpuTime,true));contentHelper.appendElemen tRow(WebInspector.UIString("Aggregated Time"),WebInspector.TimelinePresentationM odel._generateAggregatedInfo(this._aggregatedStats));}
478 if(this.coalesced) 488 if(this.coalesced)
479 return contentHelper.contentTable();const recordTypes=WebInspector.TimelineModel .RecordType;var callSiteStackTraceLabel;var callStackLabel;switch(this.type){cas e recordTypes.GCEvent:contentHelper.appendTextRow(WebInspector.UIString("Collect ed"),Number.bytesToString(this.data["usedHeapSizeDelta"]));break;case recordType s.TimerFire:callSiteStackTraceLabel=WebInspector.UIString("Timer installed");cas e recordTypes.TimerInstall:case recordTypes.TimerRemove:contentHelper.appendText Row(WebInspector.UIString("Timer ID"),this.data["timerId"]);if(typeof this.timeo ut==="number"){contentHelper.appendTextRow(WebInspector.UIString("Timeout"),Numb er.secondsToString(this.timeout/1000));contentHelper.appendTextRow(WebInspector. UIString("Repeats"),!this.singleShot);} 489 return contentHelper.contentTable();const recordTypes=WebInspector.TimelineModel .RecordType;var callSiteStackTraceLabel;var callStackLabel;var relatedNodeLabel; switch(this.type){case recordTypes.GCEvent:contentHelper.appendTextRow(WebInspec tor.UIString("Collected"),Number.bytesToString(this.data["usedHeapSizeDelta"])); break;case recordTypes.TimerFire:callSiteStackTraceLabel=WebInspector.UIString(" Timer installed");case recordTypes.TimerInstall:case recordTypes.TimerRemove:con tentHelper.appendTextRow(WebInspector.UIString("Timer ID"),this.data["timerId"]) ;if(typeof this.timeout==="number"){contentHelper.appendTextRow(WebInspector.UIS tring("Timeout"),Number.secondsToString(this.timeout/1000));contentHelper.append TextRow(WebInspector.UIString("Repeats"),!this.singleShot);}
480 break;case recordTypes.FireAnimationFrame:callSiteStackTraceLabel=WebInspector.U IString("Animation frame requested");contentHelper.appendTextRow(WebInspector.UI String("Callback ID"),this.data["id"]);break;case recordTypes.FunctionCall:conte ntHelper.appendElementRow(WebInspector.UIString("Location"),this._linkifyScriptL ocation());break;case recordTypes.ScheduleResourceRequest:case recordTypes.Resou rceSendRequest:case recordTypes.ResourceReceiveResponse:case recordTypes.Resourc eReceivedData:case recordTypes.ResourceFinish:contentHelper.appendElementRow(Web Inspector.UIString("Resource"),WebInspector.linkifyResourceAsNode(this.url));if( this._imagePreviewElement) 490 break;case recordTypes.FireAnimationFrame:callSiteStackTraceLabel=WebInspector.U IString("Animation frame requested");contentHelper.appendTextRow(WebInspector.UI String("Callback ID"),this.data["id"]);break;case recordTypes.FunctionCall:conte ntHelper.appendElementRow(WebInspector.UIString("Location"),this._linkifyScriptL ocation());break;case recordTypes.ScheduleResourceRequest:case recordTypes.Resou rceSendRequest:case recordTypes.ResourceReceiveResponse:case recordTypes.Resourc eReceivedData:case recordTypes.ResourceFinish:contentHelper.appendElementRow(Web Inspector.UIString("Resource"),WebInspector.linkifyResourceAsNode(this.url));if( this._imagePreviewElement)
481 contentHelper.appendElementRow(WebInspector.UIString("Preview"),this._imagePrevi ewElement);if(this.data["requestMethod"]) 491 contentHelper.appendElementRow(WebInspector.UIString("Preview"),this._imagePrevi ewElement);if(this.data["requestMethod"])
482 contentHelper.appendTextRow(WebInspector.UIString("Request Method"),this.data["r equestMethod"]);if(typeof this.data["statusCode"]==="number") 492 contentHelper.appendTextRow(WebInspector.UIString("Request Method"),this.data["r equestMethod"]);if(typeof this.data["statusCode"]==="number")
483 contentHelper.appendTextRow(WebInspector.UIString("Status Code"),this.data["stat usCode"]);if(this.data["mimeType"]) 493 contentHelper.appendTextRow(WebInspector.UIString("Status Code"),this.data["stat usCode"]);if(this.data["mimeType"])
484 contentHelper.appendTextRow(WebInspector.UIString("MIME Type"),this.data["mimeTy pe"]);if(this.data["encodedDataLength"]) 494 contentHelper.appendTextRow(WebInspector.UIString("MIME Type"),this.data["mimeTy pe"]);if(this.data["encodedDataLength"])
485 contentHelper.appendTextRow(WebInspector.UIString("Encoded Data Length"),WebInsp ector.UIString("%d Bytes",this.data["encodedDataLength"]));break;case recordType s.EvaluateScript:if(this.data&&this.url) 495 contentHelper.appendTextRow(WebInspector.UIString("Encoded Data Length"),WebInsp ector.UIString("%d Bytes",this.data["encodedDataLength"]));break;case recordType s.EvaluateScript:if(this.data&&this.url)
486 contentHelper.appendElementRow(WebInspector.UIString("Script"),this._linkifyLoca tion(this.url,this.data["lineNumber"]));break;case recordTypes.Paint:var clip=th is.data["clip"];if(clip){contentHelper.appendTextRow(WebInspector.UIString("Loca tion"),WebInspector.UIString("(%d, %d)",clip[0],clip[1]));var clipWidth=WebInspe ctor.TimelinePresentationModel.quadWidth(clip);var clipHeight=WebInspector.Timel inePresentationModel.quadHeight(clip);contentHelper.appendTextRow(WebInspector.U IString("Dimensions"),WebInspector.UIString("%d × %d",clipWidth,clipHeight));}el se{if(typeof this.data["x"]!=="undefined"&&typeof this.data["y"]!=="undefined") 496 contentHelper.appendElementRow(WebInspector.UIString("Script"),this._linkifyLoca tion(this.url,this.data["lineNumber"]));break;case recordTypes.Paint:var clip=th is.data["clip"];if(clip){contentHelper.appendTextRow(WebInspector.UIString("Loca tion"),WebInspector.UIString("(%d, %d)",clip[0],clip[1]));var clipWidth=WebInspe ctor.TimelinePresentationModel.quadWidth(clip);var clipHeight=WebInspector.Timel inePresentationModel.quadHeight(clip);contentHelper.appendTextRow(WebInspector.U IString("Dimensions"),WebInspector.UIString("%d × %d",clipWidth,clipHeight));}el se{if(typeof this.data["x"]!=="undefined"&&typeof this.data["y"]!=="undefined")
487 contentHelper.appendTextRow(WebInspector.UIString("Location"),WebInspector.UIStr ing("(%d, %d)",this.data["x"],this.data["y"]));if(typeof this.data["width"]!=="u ndefined"&&typeof this.data["height"]!=="undefined") 497 contentHelper.appendTextRow(WebInspector.UIString("Location"),WebInspector.UIStr ing("(%d, %d)",this.data["x"],this.data["y"]));if(typeof this.data["width"]!=="u ndefined"&&typeof this.data["height"]!=="undefined")
488 contentHelper.appendTextRow(WebInspector.UIString("Dimensions"),WebInspector.UIS tring("%d\u2009\u00d7\u2009%d",this.data["width"],this.data["height"]));} 498 contentHelper.appendTextRow(WebInspector.UIString("Dimensions"),WebInspector.UIS tring("%d\u2009\u00d7\u2009%d",this.data["width"],this.data["height"]));}
489 case recordTypes.PaintSetup:case recordTypes.Rasterize:case recordTypes.ScrollLa yer:if(this._relatedNode) 499 case recordTypes.PaintSetup:case recordTypes.Rasterize:case recordTypes.ScrollLa yer:relatedNodeLabel=WebInspector.UIString("Layer root");break;case recordTypes. AutosizeText:relatedNodeLabel=WebInspector.UIString("Root node");break;case reco rdTypes.DecodeImage:case recordTypes.ResizeImage:relatedNodeLabel=WebInspector.U IString("Image element");if(this.url)
490 contentHelper.appendElementRow(WebInspector.UIString("Layer root"),this._createN odeAnchor(this._relatedNode));break;case recordTypes.DecodeImage:case recordType s.ResizeImage:if(this._relatedNode)
491 contentHelper.appendElementRow(WebInspector.UIString("Image element"),this._crea teNodeAnchor(this._relatedNode));if(this.url)
492 contentHelper.appendElementRow(WebInspector.UIString("Image URL"),WebInspector.l inkifyResourceAsNode(this.url));break;case recordTypes.RecalculateStyles:if(this .data["elementCount"]) 500 contentHelper.appendElementRow(WebInspector.UIString("Image URL"),WebInspector.l inkifyResourceAsNode(this.url));break;case recordTypes.RecalculateStyles:if(this .data["elementCount"])
493 contentHelper.appendTextRow(WebInspector.UIString("Elements affected"),this.data ["elementCount"]);callStackLabel=WebInspector.UIString("Styles recalculation for ced");break;case recordTypes.Layout:if(this.data["dirtyObjects"]) 501 contentHelper.appendTextRow(WebInspector.UIString("Elements affected"),this.data ["elementCount"]);callStackLabel=WebInspector.UIString("Styles recalculation for ced");break;case recordTypes.Layout:if(this.data["dirtyObjects"])
494 contentHelper.appendTextRow(WebInspector.UIString("Nodes that need layout"),this .data["dirtyObjects"]);if(this.data["totalObjects"]) 502 contentHelper.appendTextRow(WebInspector.UIString("Nodes that need layout"),this .data["dirtyObjects"]);if(this.data["totalObjects"])
495 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"));} 503 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"));}
496 callSiteStackTraceLabel=WebInspector.UIString("Layout invalidated");if(this.stac kTrace){callStackLabel=WebInspector.UIString("Layout forced");contentHelper.appe ndTextRow(WebInspector.UIString("Note"),WebInspector.UIString("Forced synchronou s layout is a possible performance bottleneck."));} 504 callSiteStackTraceLabel=WebInspector.UIString("Layout invalidated");callStackLab el=WebInspector.UIString("Layout forced");relatedNodeLabel=WebInspector.UIString ("Layout root");break;case recordTypes.Time:case recordTypes.TimeEnd:contentHelp er.appendTextRow(WebInspector.UIString("Message"),this.data["message"]);if(typeo f this.intervalDuration==="number")
497 if(this._relatedNode)
498 contentHelper.appendElementRow(WebInspector.UIString("Layout root"),this._create NodeAnchor(this._relatedNode));break;case recordTypes.Time:case recordTypes.Time End:contentHelper.appendTextRow(WebInspector.UIString("Message"),this.data["mess age"]);if(typeof this.intervalDuration==="number")
499 contentHelper.appendTextRow(WebInspector.UIString("Interval Duration"),Number.se condsToString(this.intervalDuration,true));break;case recordTypes.WebSocketCreat e:case recordTypes.WebSocketSendHandshakeRequest:case recordTypes.WebSocketRecei veHandshakeResponse:case recordTypes.WebSocketDestroy:if(typeof this.webSocketUR L!=="undefined") 505 contentHelper.appendTextRow(WebInspector.UIString("Interval Duration"),Number.se condsToString(this.intervalDuration,true));break;case recordTypes.WebSocketCreat e:case recordTypes.WebSocketSendHandshakeRequest:case recordTypes.WebSocketRecei veHandshakeResponse:case recordTypes.WebSocketDestroy:if(typeof this.webSocketUR L!=="undefined")
500 contentHelper.appendTextRow(WebInspector.UIString("URL"),this.webSocketURL);if(t ypeof this.webSocketProtocol!=="undefined") 506 contentHelper.appendTextRow(WebInspector.UIString("URL"),this.webSocketURL);if(t ypeof this.webSocketProtocol!=="undefined")
501 contentHelper.appendTextRow(WebInspector.UIString("WebSocket Protocol"),this.web SocketProtocol);if(typeof this.data["message"]!=="undefined") 507 contentHelper.appendTextRow(WebInspector.UIString("WebSocket Protocol"),this.web SocketProtocol);if(typeof this.data["message"]!=="undefined")
502 contentHelper.appendTextRow(WebInspector.UIString("Message"),this.data["message" ]) 508 contentHelper.appendTextRow(WebInspector.UIString("Message"),this.data["message" ])
503 break;default:if(this.detailsNode()) 509 break;default:if(this.detailsNode())
504 contentHelper.appendElementRow(WebInspector.UIString("Details"),this.detailsNode ().childNodes[1].cloneNode());break;} 510 contentHelper.appendElementRow(WebInspector.UIString("Details"),this.detailsNode ().childNodes[1].cloneNode());break;}
505 if(this.scriptName&&this.type!==recordTypes.FunctionCall) 511 if(this._relatedNode)
512 contentHelper.appendElementRow(relatedNodeLabel||WebInspector.UIString("Related node"),this._createNodeAnchor(this._relatedNode));if(this.scriptName&&this.type! ==recordTypes.FunctionCall)
506 contentHelper.appendElementRow(WebInspector.UIString("Function Call"),this._link ifyScriptLocation());if(this.usedHeapSize){if(this.usedHeapSizeDelta){var sign=t his.usedHeapSizeDelta>0?"+":"-";contentHelper.appendTextRow(WebInspector.UIStrin g("Used Heap Size"),WebInspector.UIString("%s (%s%s)",Number.bytesToString(this. usedHeapSize),sign,Number.bytesToString(Math.abs(this.usedHeapSizeDelta))));}els e if(this.category===WebInspector.TimelinePresentationModel.categories().scripti ng) 513 contentHelper.appendElementRow(WebInspector.UIString("Function Call"),this._link ifyScriptLocation());if(this.usedHeapSize){if(this.usedHeapSizeDelta){var sign=t his.usedHeapSizeDelta>0?"+":"-";contentHelper.appendTextRow(WebInspector.UIStrin g("Used Heap Size"),WebInspector.UIString("%s (%s%s)",Number.bytesToString(this. usedHeapSize),sign,Number.bytesToString(Math.abs(this.usedHeapSizeDelta))));}els e if(this.category===WebInspector.TimelinePresentationModel.categories().scripti ng)
507 contentHelper.appendTextRow(WebInspector.UIString("Used Heap Size"),Number.bytes ToString(this.usedHeapSize));} 514 contentHelper.appendTextRow(WebInspector.UIString("Used Heap Size"),Number.bytes ToString(this.usedHeapSize));}
508 if(this.callSiteStackTrace) 515 if(this.callSiteStackTrace)
509 contentHelper.appendStackTrace(callSiteStackTraceLabel||WebInspector.UIString("C all Site stack"),this.callSiteStackTrace,this._linkifyCallFrame.bind(this));if(t his.stackTrace) 516 contentHelper.appendStackTrace(callSiteStackTraceLabel||WebInspector.UIString("C all Site stack"),this.callSiteStackTrace,this._linkifyCallFrame.bind(this));if(t his.stackTrace)
510 contentHelper.appendStackTrace(callStackLabel||WebInspector.UIString("Call Stack "),this.stackTrace,this._linkifyCallFrame.bind(this));return contentHelper.conte ntTable();},_createNodeAnchor:function(node) 517 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)
518 ul.createChild("li").textContent=this._warnings[i];contentHelper.appendElementRo w(WebInspector.UIString("Warning"),ul);}
519 return contentHelper.contentTable();},_createNodeAnchor:function(node)
511 {var span=document.createElement("span");span.classList.add("node-link");span.ad dEventListener("click",onClick,false);WebInspector.DOMPresentationUtils.decorate NodeLabel(node,span);function onClick() 520 {var span=document.createElement("span");span.classList.add("node-link");span.ad dEventListener("click",onClick,false);WebInspector.DOMPresentationUtils.decorate NodeLabel(node,span);function onClick()
512 {WebInspector.showPanel("elements").revealAndSelectNode(node.id);} 521 {WebInspector.showPanel("elements").revealAndSelectNode(node.id);}
513 return span;},_refreshDetails:function() 522 return span;},_refreshDetails:function()
514 {delete this._detailsNode;},detailsNode:function() 523 {delete this._detailsNode;},detailsNode:function()
515 {if(typeof this._detailsNode==="undefined"){this._detailsNode=this._getRecordDet ails();if(this._detailsNode&&!this.coalesced){this._detailsNode.insertBefore(doc ument.createTextNode("("),this._detailsNode.firstChild);this._detailsNode.append Child(document.createTextNode(")"));}} 524 {if(typeof this._detailsNode==="undefined"){this._detailsNode=this._getRecordDet ails();if(this._detailsNode&&!this.coalesced){this._detailsNode.insertBefore(doc ument.createTextNode("("),this._detailsNode.firstChild);this._detailsNode.append Child(document.createTextNode(")"));}}
516 return this._detailsNode;},_createSpanWithText:function(textContent) 525 return this._detailsNode;},_createSpanWithText:function(textContent)
517 {var node=document.createElement("span");node.textContent=textContent;return nod e;},_getRecordDetails:function() 526 {var node=document.createElement("span");node.textContent=textContent;return nod e;},_getRecordDetails:function()
518 {var details;if(this.coalesced) 527 {var details;if(this.coalesced)
519 return this._createSpanWithText(WebInspector.UIString("× %d",this.children.lengt h));switch(this.type){case WebInspector.TimelineModel.RecordType.GCEvent:details =WebInspector.UIString("%s collected",Number.bytesToString(this.data["usedHeapSi zeDelta"]));break;case WebInspector.TimelineModel.RecordType.TimerFire:details=t his._linkifyScriptLocation(this.data["timerId"]);break;case WebInspector.Timelin eModel.RecordType.FunctionCall:details=this._linkifyScriptLocation();break;case WebInspector.TimelineModel.RecordType.FireAnimationFrame:details=this._linkifySc riptLocation(this.data["id"]);break;case WebInspector.TimelineModel.RecordType.E ventDispatch:details=this.data?this.data["type"]:null;break;case WebInspector.Ti melineModel.RecordType.Paint:var width=this.data.clip?WebInspector.TimelinePrese ntationModel.quadWidth(this.data.clip):this.data.width;var height=this.data.clip ?WebInspector.TimelinePresentationModel.quadHeight(this.data.clip):this.data.hei ght;if(width&&height) 528 return this._createSpanWithText(WebInspector.UIString("× %d",this.children.lengt h));switch(this.type){case WebInspector.TimelineModel.RecordType.GCEvent:details =WebInspector.UIString("%s collected",Number.bytesToString(this.data["usedHeapSi zeDelta"]));break;case WebInspector.TimelineModel.RecordType.TimerFire:details=t his._linkifyScriptLocation(this.data["timerId"]);break;case WebInspector.Timelin eModel.RecordType.FunctionCall:details=this._linkifyScriptLocation();break;case WebInspector.TimelineModel.RecordType.FireAnimationFrame:details=this._linkifySc riptLocation(this.data["id"]);break;case WebInspector.TimelineModel.RecordType.E ventDispatch:details=this.data?this.data["type"]:null;break;case WebInspector.Ti melineModel.RecordType.Paint:var width=this.data.clip?WebInspector.TimelinePrese ntationModel.quadWidth(this.data.clip):this.data.width;var height=this.data.clip ?WebInspector.TimelinePresentationModel.quadHeight(this.data.clip):this.data.hei ght;if(width&&height)
520 details=WebInspector.UIString("%d\u2009\u00d7\u2009%d",width,height);break;case WebInspector.TimelineModel.RecordType.TimerInstall:case WebInspector.TimelineMod el.RecordType.TimerRemove:details=this._linkifyTopCallFrame(this.data["timerId"] );break;case WebInspector.TimelineModel.RecordType.RequestAnimationFrame:case We bInspector.TimelineModel.RecordType.CancelAnimationFrame:details=this._linkifyTo pCallFrame(this.data["id"]);break;case WebInspector.TimelineModel.RecordType.Par seHTML:case WebInspector.TimelineModel.RecordType.RecalculateStyles:details=this ._linkifyTopCallFrame();break;case WebInspector.TimelineModel.RecordType.Evaluat eScript:details=this.url?this._linkifyLocation(this.url,this.data["lineNumber"], 0):null;break;case WebInspector.TimelineModel.RecordType.XHRReadyStateChange:cas e WebInspector.TimelineModel.RecordType.XHRLoad:case WebInspector.TimelineModel. RecordType.ScheduleResourceRequest:case WebInspector.TimelineModel.RecordType.Re sourceSendRequest:case WebInspector.TimelineModel.RecordType.ResourceReceivedDat a:case WebInspector.TimelineModel.RecordType.ResourceReceiveResponse:case WebIns pector.TimelineModel.RecordType.ResourceFinish:case WebInspector.TimelineModel.R ecordType.DecodeImage:case WebInspector.TimelineModel.RecordType.ResizeImage:det ails=WebInspector.displayNameForURL(this.url);break;case WebInspector.TimelineMo del.RecordType.Time:case WebInspector.TimelineModel.RecordType.TimeEnd:details=t his.data["message"];break;default:details=this._linkifyScriptLocation()||this._l inkifyTopCallFrame()||null;break;} 529 details=WebInspector.UIString("%d\u2009\u00d7\u2009%d",width,height);break;case WebInspector.TimelineModel.RecordType.TimerInstall:case WebInspector.TimelineMod el.RecordType.TimerRemove:details=this._linkifyTopCallFrame(this.data["timerId"] );break;case WebInspector.TimelineModel.RecordType.RequestAnimationFrame:case We bInspector.TimelineModel.RecordType.CancelAnimationFrame:details=this._linkifyTo pCallFrame(this.data["id"]);break;case WebInspector.TimelineModel.RecordType.Par seHTML:case WebInspector.TimelineModel.RecordType.RecalculateStyles:details=this ._linkifyTopCallFrame();break;case WebInspector.TimelineModel.RecordType.Evaluat eScript:details=this.url?this._linkifyLocation(this.url,this.data["lineNumber"], 0):null;break;case WebInspector.TimelineModel.RecordType.XHRReadyStateChange:cas e WebInspector.TimelineModel.RecordType.XHRLoad:case WebInspector.TimelineModel. RecordType.ScheduleResourceRequest:case WebInspector.TimelineModel.RecordType.Re sourceSendRequest:case WebInspector.TimelineModel.RecordType.ResourceReceivedDat a:case WebInspector.TimelineModel.RecordType.ResourceReceiveResponse:case WebIns pector.TimelineModel.RecordType.ResourceFinish:case WebInspector.TimelineModel.R ecordType.DecodeImage:case WebInspector.TimelineModel.RecordType.ResizeImage:det ails=WebInspector.displayNameForURL(this.url);break;case WebInspector.TimelineMo del.RecordType.Time:case WebInspector.TimelineModel.RecordType.TimeEnd:details=t his.data["message"];break;default:details=this._linkifyScriptLocation()||this._l inkifyTopCallFrame()||null;break;}
521 if(details){if(details instanceof Node) 530 if(details){if(details instanceof Node)
522 details.tabIndex=-1;else 531 details.tabIndex=-1;else
523 return this._createSpanWithText(""+details);} 532 return this._createSpanWithText(""+details);}
524 return details||null;},_linkifyLocation:function(url,lineNumber,columnNumber) 533 return details||null;},_linkifyLocation:function(url,lineNumber,columnNumber)
525 {columnNumber=columnNumber?columnNumber-1:0;return this._linkifier.linkifyLocati on(url,lineNumber-1,columnNumber,"timeline-details");},_linkifyCallFrame:functio n(callFrame) 534 {columnNumber=columnNumber?columnNumber-1:0;return this._linkifier.linkifyLocati on(url,lineNumber-1,columnNumber,"timeline-details");},_linkifyCallFrame:functio n(callFrame)
526 {return this._linkifyLocation(callFrame.url,callFrame.lineNumber,callFrame.colum nNumber);},_linkifyTopCallFrame:function(defaultValue) 535 {return this._linkifyLocation(callFrame.url,callFrame.lineNumber,callFrame.colum nNumber);},_linkifyTopCallFrame:function(defaultValue)
527 {if(this.stackTrace) 536 {if(this.stackTrace)
528 return this._linkifyCallFrame(this.stackTrace[0]);if(this.callSiteStackTrace) 537 return this._linkifyCallFrame(this.stackTrace[0]);if(this.callSiteStackTrace)
529 return this._linkifyCallFrame(this.callSiteStackTrace[0]);return defaultValue;}, _linkifyScriptLocation:function(defaultValue) 538 return this._linkifyCallFrame(this.callSiteStackTrace[0]);return defaultValue;}, _linkifyScriptLocation:function(defaultValue)
530 {if(this.scriptName) 539 {if(this.scriptName)
531 return this._linkifyLocation(this.scriptName,this.scriptLine,0);else 540 return this._linkifyLocation(this.scriptName,this.scriptLine,0);else
532 return defaultValue?""+defaultValue:null;},calculateAggregatedStats:function() 541 return defaultValue?""+defaultValue:null;},calculateAggregatedStats:function()
533 {this._aggregatedStats={};this._cpuTime=this._selfTime;for(var index=this._child ren.length;index;--index){var child=this._children[index-1];for(var category in child._aggregatedStats) 542 {this._aggregatedStats={};this._cpuTime=this._selfTime;for(var index=this._child ren.length;index;--index){var child=this._children[index-1];for(var category in child._aggregatedStats)
534 this._aggregatedStats[category]=(this._aggregatedStats[category]||0)+child._aggr egatedStats[category];} 543 this._aggregatedStats[category]=(this._aggregatedStats[category]||0)+child._aggr egatedStats[category];}
535 for(var category in this._aggregatedStats) 544 for(var category in this._aggregatedStats)
536 this._cpuTime+=this._aggregatedStats[category];this._aggregatedStats[this.catego ry.name]=(this._aggregatedStats[this.category.name]||0)+this._selfTime;},get agg regatedStats() 545 this._cpuTime+=this._aggregatedStats[category];this._aggregatedStats[this.catego ry.name]=(this._aggregatedStats[this.category.name]||0)+this._selfTime;},get agg regatedStats()
537 {return this._aggregatedStats;},setHasWarning:function() 546 {return this._aggregatedStats;},addWarning:function(message)
538 {this.hasWarning=true;for(var parent=this.parent;parent&&!parent.childHasWarning ;parent=parent.parent) 547 {if(this._warnings)
539 parent.childHasWarning=true;}} 548 this._warnings.push(message);else
549 this._warnings=[message];for(var parent=this.parent;parent&&!parent._childHasWar nings;parent=parent.parent)
550 parent._childHasWarnings=true;},hasWarnings:function()
551 {return!!this._warnings;},childHasWarnings:function()
552 {return this._childHasWarnings;}}
540 WebInspector.TimelinePresentationModel._generateAggregatedInfo=function(aggregat edStats) 553 WebInspector.TimelinePresentationModel._generateAggregatedInfo=function(aggregat edStats)
541 {var cell=document.createElement("span");cell.className="timeline-aggregated-inf o";for(var index in aggregatedStats){var label=document.createElement("div");lab el.className="timeline-aggregated-category timeline-"+index;cell.appendChild(lab el);var text=document.createElement("span");text.textContent=Number.secondsToStr ing(aggregatedStats[index],true);cell.appendChild(text);} 554 {var cell=document.createElement("span");cell.className="timeline-aggregated-inf o";for(var index in aggregatedStats){var label=document.createElement("div");lab el.className="timeline-aggregated-category timeline-"+index;cell.appendChild(lab el);var text=document.createElement("span");text.textContent=Number.secondsToStr ing(aggregatedStats[index],true);cell.appendChild(text);}
542 return cell;} 555 return cell;}
543 WebInspector.TimelinePresentationModel.generatePopupContentForFrame=function(fra me) 556 WebInspector.TimelinePresentationModel.generatePopupContentForFrame=function(fra me)
544 {var contentHelper=new WebInspector.PopoverContentHelper(WebInspector.UIString(" Frame"));var durationInSeconds=frame.endTime-frame.startTime;var durationText=We bInspector.UIString("%s (at %s)",Number.secondsToString(frame.endTime-frame.star tTime,true),Number.secondsToString(frame.startTimeOffset,true));contentHelper.ap pendTextRow(WebInspector.UIString("Duration"),durationText);contentHelper.append TextRow(WebInspector.UIString("FPS"),Math.floor(1/durationInSeconds));contentHel per.appendTextRow(WebInspector.UIString("CPU time"),Number.secondsToString(frame .cpuTime,true));contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"),WebInspector.TimelinePresentationModel._generateAggregatedInfo(frame.tim eByCategory));return contentHelper.contentTable();} 557 {var contentHelper=new WebInspector.PopoverContentHelper(WebInspector.UIString(" Frame"));var durationInSeconds=frame.endTime-frame.startTime;var durationText=We bInspector.UIString("%s (at %s)",Number.secondsToString(frame.endTime-frame.star tTime,true),Number.secondsToString(frame.startTimeOffset,true));contentHelper.ap pendTextRow(WebInspector.UIString("Duration"),durationText);contentHelper.append TextRow(WebInspector.UIString("FPS"),Math.floor(1/durationInSeconds));contentHel per.appendTextRow(WebInspector.UIString("CPU time"),Number.secondsToString(frame .cpuTime,true));contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"),WebInspector.TimelinePresentationModel._generateAggregatedInfo(frame.tim eByCategory));return contentHelper.contentTable();}
545 WebInspector.TimelinePresentationModel.generatePopupContentForFrameStatistics=fu nction(statistics) 558 WebInspector.TimelinePresentationModel.generatePopupContentForFrameStatistics=fu nction(statistics)
546 {function formatTimeAndFPS(time) 559 {function formatTimeAndFPS(time)
547 {return WebInspector.UIString("%s (%.0f FPS)",Number.secondsToString(time,true), 1/time);} 560 {return WebInspector.UIString("%s (%.0f FPS)",Number.secondsToString(time,true), 1/time);}
548 var contentHelper=new WebInspector.PopoverContentHelper(WebInspector.UIString("S elected Range"));contentHelper.appendTextRow(WebInspector.UIString("Selected ran ge"),WebInspector.UIString("%s\u2013%s (%d frames)",Number.secondsToString(stati stics.startOffset,true),Number.secondsToString(statistics.endOffset,true),statis tics.frameCount));contentHelper.appendTextRow(WebInspector.UIString("Minimum Tim e"),formatTimeAndFPS(statistics.minDuration));contentHelper.appendTextRow(WebIns pector.UIString("Average Time"),formatTimeAndFPS(statistics.average));contentHel per.appendTextRow(WebInspector.UIString("Maximum Time"),formatTimeAndFPS(statist ics.maxDuration));contentHelper.appendTextRow(WebInspector.UIString("Standard De viation"),Number.secondsToString(statistics.stddev,true));contentHelper.appendEl ementRow(WebInspector.UIString("Time by category"),WebInspector.TimelinePresenta tionModel._generateAggregatedInfo(statistics.timeByCategory));return contentHelp er.contentTable();} 561 var contentHelper=new WebInspector.PopoverContentHelper(WebInspector.UIString("S elected Range"));contentHelper.appendTextRow(WebInspector.UIString("Selected ran ge"),WebInspector.UIString("%s\u2013%s (%d frames)",Number.secondsToString(stati stics.startOffset,true),Number.secondsToString(statistics.endOffset,true),statis tics.frameCount));contentHelper.appendTextRow(WebInspector.UIString("Minimum Tim e"),formatTimeAndFPS(statistics.minDuration));contentHelper.appendTextRow(WebIns pector.UIString("Average Time"),formatTimeAndFPS(statistics.average));contentHel per.appendTextRow(WebInspector.UIString("Maximum Time"),formatTimeAndFPS(statist ics.maxDuration));contentHelper.appendTextRow(WebInspector.UIString("Standard De viation"),Number.secondsToString(statistics.stddev,true));contentHelper.appendEl ementRow(WebInspector.UIString("Time by category"),WebInspector.TimelinePresenta tionModel._generateAggregatedInfo(statistics.timeByCategory));return contentHelp er.contentTable();}
549 WebInspector.TimelinePresentationModel.createFillStyle=function(context,width,he ight,color0,color1,color2) 562 WebInspector.TimelinePresentationModel.createFillStyle=function(context,width,he ight,color0,color1,color2)
550 {var gradient=context.createLinearGradient(0,0,width,height);gradient.addColorSt op(0,color0);gradient.addColorStop(0.25,color1);gradient.addColorStop(0.75,color 1);gradient.addColorStop(1,color2);return gradient;} 563 {var gradient=context.createLinearGradient(0,0,width,height);gradient.addColorSt op(0,color0);gradient.addColorStop(0.25,color1);gradient.addColorStop(0.75,color 1);gradient.addColorStop(1,color2);return gradient;}
551 WebInspector.TimelinePresentationModel.createFillStyleForCategory=function(conte xt,width,height,category) 564 WebInspector.TimelinePresentationModel.createFillStyleForCategory=function(conte xt,width,height,category)
552 {return WebInspector.TimelinePresentationModel.createFillStyle(context,width,hei ght,category.fillColorStop0,category.fillColorStop1,category.borderColor);} 565 {return WebInspector.TimelinePresentationModel.createFillStyle(context,width,hei ght,category.fillColorStop0,category.fillColorStop1,category.borderColor);}
553 WebInspector.TimelinePresentationModel.createStyleRuleForCategory=function(categ ory) 566 WebInspector.TimelinePresentationModel.createStyleRuleForCategory=function(categ ory)
554 {var selector=".timeline-category-"+category.name+" .timeline-graph-bar, "+".tim eline-category-statusbar-item.timeline-category-"+category.name+" .timeline-cate gory-checkbox, "+".popover .timeline-"+category.name+", "+".timeline-category-"+ category.name+" .timeline-tree-icon" 567 {var selector=".timeline-category-"+category.name+" .timeline-graph-bar, "+".pan el.timeline .timeline-filters-header .filter-checkbox-filter.filter-checkbox-fil ter-"+category.name+" .checkbox-filter-checkbox, "+".popover .timeline-"+categor y.name+", "+".timeline-category-"+category.name+" .timeline-tree-icon"
555 return selector+" { background-image: -webkit-linear-gradient("+ 568 return selector+" { background-image: -webkit-linear-gradient("+
556 category.fillColorStop0+", "+category.fillColorStop1+" 25%, "+category.fillColor Stop1+" 25%, "+category.fillColorStop1+");"+" border-color: "+category.borderCol or+"}";} 569 category.fillColorStop0+", "+category.fillColorStop1+" 25%, "+category.fillColor Stop1+" 25%, "+category.fillColorStop1+");"+" border-color: "+category.borderCol or+"}";}
557 WebInspector.TimelinePresentationModel.coalescingKeyForRecord=function(rawRecord ) 570 WebInspector.TimelinePresentationModel.coalescingKeyForRecord=function(rawRecord )
558 {var recordTypes=WebInspector.TimelineModel.RecordType;switch(rawRecord.type) 571 {var recordTypes=WebInspector.TimelineModel.RecordType;switch(rawRecord.type)
559 {case recordTypes.EventDispatch:return rawRecord.data["type"];case recordTypes.T imeStamp:return rawRecord.data["message"];default:return null;}} 572 {case recordTypes.EventDispatch:return rawRecord.data["type"];case recordTypes.T ime:return rawRecord.data["message"];case recordTypes.TimeStamp:return rawRecord .data["message"];default:return null;}}
560 WebInspector.TimelinePresentationModel.quadWidth=function(quad) 573 WebInspector.TimelinePresentationModel.quadWidth=function(quad)
561 {return Math.round(Math.sqrt(Math.pow(quad[0]-quad[2],2)+Math.pow(quad[1]-quad[3 ],2)));} 574 {return Math.round(Math.sqrt(Math.pow(quad[0]-quad[2],2)+Math.pow(quad[1]-quad[3 ],2)));}
562 WebInspector.TimelinePresentationModel.quadHeight=function(quad) 575 WebInspector.TimelinePresentationModel.quadHeight=function(quad)
563 {return Math.round(Math.sqrt(Math.pow(quad[0]-quad[6],2)+Math.pow(quad[1]-quad[7 ],2)));} 576 {return Math.round(Math.sqrt(Math.pow(quad[0]-quad[6],2)+Math.pow(quad[1]-quad[7 ],2)));}
564 WebInspector.TimelinePresentationModel.quadFromRectData=function(data) 577 WebInspector.TimelinePresentationModel.quadFromRectData=function(data)
565 {if(typeof data["x"]==="undefined"||typeof data["y"]==="undefined") 578 {if(typeof data["x"]==="undefined"||typeof data["y"]==="undefined")
566 return null;var x0=data["x"];var x1=data["x"]+data["width"];var y0=data["y"];var y1=data["y"]+data["height"];return[x0,y0,x1,y0,x1,y1,x0,y1];} 579 return null;var x0=data["x"];var x1=data["x"]+data["width"];var y0=data["y"];var y1=data["y"]+data["height"];return[x0,y0,x1,y0,x1,y1,x0,y1];}
567 WebInspector.TimelinePresentationModel.Filter=function() 580 WebInspector.TimelinePresentationModel.Filter=function()
568 {} 581 {}
569 WebInspector.TimelinePresentationModel.Filter.prototype={accept:function(record) {return false;}} 582 WebInspector.TimelinePresentationModel.Filter.prototype={accept:function(record) {return false;}}
(...skipping 16 matching lines...) Expand all
586 this._lastFrame=this._createFrame(record,programTimeCarryover);if(!record.thread ) 599 this._lastFrame=this._createFrame(record,programTimeCarryover);if(!record.thread )
587 WebInspector.TimelineModel.aggregateTimeForRecord(this._lastFrame.timeByCategory ,record);var duration=WebInspector.TimelineModel.durationInSeconds(record);this. _lastFrame.cpuTime+=duration;this._lastFrame.timeByCategory["other"]-=duration;} },_flushFrame:function(record,programTimeCarryover) 600 WebInspector.TimelineModel.aggregateTimeForRecord(this._lastFrame.timeByCategory ,record);var duration=WebInspector.TimelineModel.durationInSeconds(record);this. _lastFrame.cpuTime+=duration;this._lastFrame.timeByCategory["other"]-=duration;} },_flushFrame:function(record,programTimeCarryover)
588 {this._lastFrame.endTime=WebInspector.TimelineModel.startTimeInSeconds(record);t his._lastFrame.duration=this._lastFrame.endTime-this._lastFrame.startTime;this._ lastFrame.timeByCategory["other"]-=programTimeCarryover;this._lastFrame.cpuTime+ =this._lastFrame.timeByCategory["other"];this._overviewPane.addFrame(this._lastF rame);this._presentationModel.addFrame(this._lastFrame);this._lastFrame=this._cr eateFrame(record,programTimeCarryover);},_createFrame:function(record,programTim eCarryover) 601 {this._lastFrame.endTime=WebInspector.TimelineModel.startTimeInSeconds(record);t his._lastFrame.duration=this._lastFrame.endTime-this._lastFrame.startTime;this._ lastFrame.timeByCategory["other"]-=programTimeCarryover;this._lastFrame.cpuTime+ =this._lastFrame.timeByCategory["other"];this._overviewPane.addFrame(this._lastF rame);this._presentationModel.addFrame(this._lastFrame);this._lastFrame=this._cr eateFrame(record,programTimeCarryover);},_createFrame:function(record,programTim eCarryover)
589 {var frame=new WebInspector.TimelineFrame();frame.startTime=WebInspector.Timelin eModel.startTimeInSeconds(record);frame.startTimeOffset=this._model.recordOffset InSeconds(record);frame.timeByCategory["other"]=programTimeCarryover;return fram e;},dispose:function() 602 {var frame=new WebInspector.TimelineFrame();frame.startTime=WebInspector.Timelin eModel.startTimeInSeconds(record);frame.startTimeOffset=this._model.recordOffset InSeconds(record);frame.timeByCategory["other"]=programTimeCarryover;return fram e;},dispose:function()
590 {this._model.removeEventListener(WebInspector.TimelineModel.Events.RecordAdded,t his._onRecordAdded,this);this._model.removeEventListener(WebInspector.TimelineMo del.Events.RecordsCleared,this._onRecordsCleared,this);}} 603 {this._model.removeEventListener(WebInspector.TimelineModel.Events.RecordAdded,t his._onRecordAdded,this);this._model.removeEventListener(WebInspector.TimelineMo del.Events.RecordsCleared,this._onRecordsCleared,this);}}
591 WebInspector.FrameStatistics=function(frames) 604 WebInspector.FrameStatistics=function(frames)
592 {this.frameCount=frames.length;this.minDuration=Infinity;this.maxDuration=0;this .timeByCategory={};this.startOffset=frames[0].startTimeOffset;var lastFrame=fram es[this.frameCount-1];this.endOffset=lastFrame.startTimeOffset+lastFrame.duratio n;var totalDuration=0;var sumOfSquares=0;for(var i=0;i<this.frameCount;++i){var duration=frames[i].duration;totalDuration+=duration;sumOfSquares+=duration*durat ion;this.minDuration=Math.min(this.minDuration,duration);this.maxDuration=Math.m ax(this.maxDuration,duration);WebInspector.TimelineModel.aggregateTimeByCategory (this.timeByCategory,frames[i].timeByCategory);} 605 {this.frameCount=frames.length;this.minDuration=Infinity;this.maxDuration=0;this .timeByCategory={};this.startOffset=frames[0].startTimeOffset;var lastFrame=fram es[this.frameCount-1];this.endOffset=lastFrame.startTimeOffset+lastFrame.duratio n;var totalDuration=0;var sumOfSquares=0;for(var i=0;i<this.frameCount;++i){var duration=frames[i].duration;totalDuration+=duration;sumOfSquares+=duration*durat ion;this.minDuration=Math.min(this.minDuration,duration);this.maxDuration=Math.m ax(this.maxDuration,duration);WebInspector.TimelineModel.aggregateTimeByCategory (this.timeByCategory,frames[i].timeByCategory);}
593 this.average=totalDuration/this.frameCount;var variance=sumOfSquares/this.frameC ount-this.average*this.average;this.stddev=Math.sqrt(variance);} 606 this.average=totalDuration/this.frameCount;var variance=sumOfSquares/this.frameC ount-this.average*this.average;this.stddev=Math.sqrt(variance);}
594 WebInspector.TimelineFrame=function() 607 WebInspector.TimelineFrame=function()
595 {this.timeByCategory={};this.cpuTime=0;};WebInspector.TimelinePanel=function() 608 {this.timeByCategory={};this.cpuTime=0;};WebInspector.TimelinePanel=function()
596 {WebInspector.Panel.call(this,"timeline");this.registerRequiredCSS("timelinePane l.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("time lineGlueRecords",false);this._overviewPane=new WebInspector.TimelineOverviewPane (this._model);this._overviewPane.addEventListener(WebInspector.TimelineOverviewP ane.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),fal se);this._timelineMemorySplitter=this.element.createChild("div");this._timelineM emorySplitter.id="timeline-memory-splitter";WebInspector.installDragHandle(this. _timelineMemorySplitter,this._startSplitterDragging.bind(this),this._splitterDra gging.bind(this),this._endSplitterDragging.bind(this),"ns-resize");this._timelin eMemorySplitter.addStyleClass("hidden");this._includeDomCounters=false;this._mem oryStatistics=new WebInspector.DOMCountersGraph(this,this._model,this.splitView. sidebarWidth());this._includeDomCounters=true;WebInspector.settings.memoryCounte rGraphsHeight=WebInspector.settings.createSetting("memoryCounterGraphsHeight",15 0);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._containe rContentElement=this.splitView.mainElement;this._containerContentElement.id="res ources-container-content";this._timelineGrid=new WebInspector.TimelineGrid();thi s._itemsGraphsElement=this._timelineGrid.itemsGraphsElement;this._itemsGraphsEle ment.id="timeline-graphs";this._containerContentElement.appendChild(this._timeli neGrid.element);this._timelineGrid.gridHeaderElement.id="timeline-grid-header";t his._memoryStatistics.setMainTimelineGrid(this._timelineGrid);this.element.appen dChild(this._timelineGrid.gridHeaderElement);this._topGapElement=document.create Element("div");this._topGapElement.className="timeline-gap";this._itemsGraphsEle ment.appendChild(this._topGapElement);this._graphRowsElement=document.createElem ent("div");this._itemsGraphsElement.appendChild(this._graphRowsElement);this._bo ttomGapElement=document.createElement("div");this._bottomGapElement.className="t imeline-gap";this._itemsGraphsElement.appendChild(this._bottomGapElement);this._ expandElements=document.createElement("div");this._expandElements.id="orphan-exp and-elements";this._itemsGraphsElement.appendChild(this._expandElements);this._c alculator=new WebInspector.TimelineCalculator(this._model);this._createStatusBar Items();this._frameMode=false;this._boundariesAreValid=true;this._scrollTop=0;th is._popoverHelper=new WebInspector.PopoverHelper(this.element,this._getPopoverAn chor.bind(this),this._showPopover.bind(this));this.element.addEventListener("mou semove",this._mouseMove.bind(this),false);this.element.addEventListener("mouseou t",this._mouseOut.bind(this),false);this._durationFilter=new WebInspector.Timeli neIsLongFilter();this._expandOffset=15;this._headerLineCount=1;this._adjustHeade rHeight();this._mainThreadTasks=([]);this._cpuBarsElement=this._timelineGrid.gri dHeaderElement.createChild("div","timeline-cpu-bars");this._mainThreadMonitoring Enabled=WebInspector.settings.showCpuOnTimelineRuler.get();WebInspector.settings .showCpuOnTimelineRuler.addChangeListener(this._showCpuOnTimelineRulerChanged,th is);this._createFileSelector();this._model.addEventListener(WebInspector.Timelin eModel.Events.RecordAdded,this._onTimelineEventRecorded,this);this._model.addEve ntListener(WebInspector.TimelineModel.Events.RecordsCleared,this._onRecordsClear ed,this);this._model.addEventListener(WebInspector.TimelineModel.Events.Recordin gStarted,this._onRecordingStarted,this);this._model.addEventListener(WebInspecto r.TimelineModel.Events.RecordingStopped,this._onRecordingStopped,this);this._reg isterShortcuts();this._allRecordsCount=0;this._presentationModel.addFilter(new W ebInspector.TimelineWindowFilter(this._overviewPane));this._presentationModel.ad dFilter(new WebInspector.TimelineCategoryFilter());this._presentationModel.addFi lter(this._durationFilter);} 609 {WebInspector.Panel.call(this,"timeline");this.registerRequiredCSS("timelinePane l.css");this.registerRequiredCSS("filter.css");this.element.addStyleClass("vbox" );this._model=new WebInspector.TimelineModel();this._presentationModel=new WebIn spector.TimelinePresentationModel();this._overviewModeSetting=WebInspector.setti ngs.createSetting("timelineOverviewMode",WebInspector.TimelineOverviewPane.Mode. Events);this._glueRecordsSetting=WebInspector.settings.createSetting("timelineGl ueRecords",false);this._panelStatusBarElement=this.element.createChild("div","pa nel-status-bar");this._createFilters();this._overviewPane=new WebInspector.Timel ineOverviewPane(this._model);this._overviewPane.addEventListener(WebInspector.Ti melineOverviewPane.Events.WindowChanged,this._invalidateAndScheduleRefresh.bind( this,false,true));this._overviewPane.addEventListener(WebInspector.TimelineOverv iewPane.Events.ModeChanged,this._overviewModeChanged,this);this._overviewPane.sh ow(this.element);this.element.addEventListener("contextmenu",this._contextMenu.b ind(this),false);this.createSidebarViewWithTree();this._containerElement=this.sp litView.element;this._containerElement.tabIndex=0;this._containerElement.id="tim eline-container";this._containerElement.removeStyleClass("fill");this._container Element.addEventListener("scroll",this._onScroll.bind(this),false);this._timelin eMemorySplitter=this.element.createChild("div","hidden");this._timelineMemorySpl itter.id="timeline-memory-splitter";WebInspector.installDragHandle(this._timelin eMemorySplitter,this._startSplitterDragging.bind(this),this._splitterDragging.bi nd(this),this._endSplitterDragging.bind(this),"ns-resize");this._includeDomCount ers=false;this._memoryStatistics=new WebInspector.DOMCountersGraph(this,this._mo del,this.splitView.sidebarWidth());this._includeDomCounters=true;WebInspector.se ttings.memoryCounterGraphsHeight=WebInspector.settings.createSetting("memoryCoun terGraphsHeight",150);var itemsTreeElement=new WebInspector.SidebarSectionTreeEl ement(WebInspector.UIString("RECORDS"),{},true);this.sidebarTree.appendChild(ite msTreeElement);this.sidebarTree.setFocusable(false);this._sidebarListElement=doc ument.createElement("div");this.sidebarElement.appendChild(this._sidebarListElem ent);this._containerContentElement=this.splitView.mainElement;this._containerCon tentElement.id="resources-container-content";this._timelineGrid=new WebInspector .TimelineGrid();this._itemsGraphsElement=this._timelineGrid.itemsGraphsElement;t his._itemsGraphsElement.id="timeline-graphs";this._containerContentElement.appen dChild(this._timelineGrid.element);this._timelineGrid.gridHeaderElement.id="time line-grid-header";this._timelineGrid.gridHeaderElement.addStyleClass("fill");thi s._memoryStatistics.setMainTimelineGrid(this._timelineGrid);this._containerConte ntElement.appendChild(this._timelineGrid.gridHeaderElement);this._topGapElement= document.createElement("div");this._topGapElement.className="timeline-gap";this. _itemsGraphsElement.appendChild(this._topGapElement);this._graphRowsElement=docu ment.createElement("div");this._itemsGraphsElement.appendChild(this._graphRowsEl ement);this._bottomGapElement=document.createElement("div");this._bottomGapEleme nt.className="timeline-gap";this._itemsGraphsElement.appendChild(this._bottomGap Element);this._expandElements=document.createElement("div");this._expandElements .id="orphan-expand-elements";this._itemsGraphsElement.appendChild(this._expandEl ements);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,thi s._getPopoverAnchor.bind(this),this._showPopover.bind(this));this.element.addEve ntListener("mousemove",this._mouseMove.bind(this),false);this.element.addEventLi stener("mouseout",this._mouseOut.bind(this),false);this._durationFilter=new WebI nspector.TimelineIsLongFilter();this._expandOffset=15;this._headerLineCount=1;th is._adjustHeaderHeight();this._mainThreadTasks=([]);this._cpuBarsElement=this._t imelineGrid.gridHeaderElement.createChild("div","timeline-cpu-bars");this._mainT hreadMonitoringEnabled=WebInspector.settings.showCpuOnTimelineRuler.get();WebIns pector.settings.showCpuOnTimelineRuler.addChangeListener(this._showCpuOnTimeline RulerChanged,this);this._createFileSelector();this._model.addEventListener(WebIn spector.TimelineModel.Events.RecordAdded,this._onTimelineEventRecorded,this);thi s._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared,this. _onRecordsCleared,this);this._model.addEventListener(WebInspector.TimelineModel. Events.RecordingStarted,this._onRecordingStarted,this);this._model.addEventListe ner(WebInspector.TimelineModel.Events.RecordingStopped,this._onRecordingStopped, this);this._registerShortcuts();this._allRecordsCount=0;this._presentationModel. addFilter(new WebInspector.TimelineWindowFilter(this._overviewPane));this._prese ntationModel.addFilter(new WebInspector.TimelineCategoryFilter());this._presenta tionModel.addFilter(this._durationFilter);}
597 WebInspector.TimelinePanel.rowHeight=18;WebInspector.TimelinePanel.durationFilte rPresetsMs=[0,1,15];WebInspector.TimelinePanel.prototype={_showCpuOnTimelineRule rChanged:function() 610 WebInspector.TimelinePanel.rowHeight=18;WebInspector.TimelinePanel.headerHeight= 19;WebInspector.TimelinePanel.durationFilterPresetsMs=[0,1,15];WebInspector.Time linePanel.prototype={_showCpuOnTimelineRulerChanged:function()
598 {var mainThreadMonitoringEnabled=WebInspector.settings.showCpuOnTimelineRuler.ge t();if(this._mainThreadMonitoringEnabled!==mainThreadMonitoringEnabled){this._ma inThreadMonitoringEnabled=mainThreadMonitoringEnabled;this._refreshMainThreadBar s();}},_startSplitterDragging:function(event) 611 {var mainThreadMonitoringEnabled=WebInspector.settings.showCpuOnTimelineRuler.ge t();if(this._mainThreadMonitoringEnabled!==mainThreadMonitoringEnabled){this._ma inThreadMonitoringEnabled=mainThreadMonitoringEnabled;this._refreshMainThreadBar s();}},_startSplitterDragging:function(event)
599 {this._dragOffset=this._timelineMemorySplitter.offsetTop+2-event.pageY;return tr ue;},_splitterDragging:function(event) 612 {this._dragOffset=this.element.offsetHeight-this._timelineMemorySplitter.offsetT op-2+event.pageY;return true;},_splitterDragging:function(event)
600 {var top=event.pageY+this._dragOffset 613 {var height=this._dragOffset-event.pageY;this._setMemoryCountersHeight(height);t his._resize(this.splitView.sidebarWidth());event.preventDefault();},_endSplitter Dragging:function(event)
601 this._setSplitterPosition(top);event.preventDefault();},_endSplitterDragging:fun ction(event) 614 {delete this._dragOffset;this._memoryStatistics.show();WebInspector.settings.mem oryCounterGraphsHeight.set(this._memoryStatistics.height());},_setMemoryCounters Height:function(height)
602 {delete this._dragOffset;this._memoryStatistics.show();WebInspector.settings.mem oryCounterGraphsHeight.set(this.splitView.element.offsetHeight);},_setSplitterPo sition:function(top) 615 {const overviewHeight=this._containerElement.offsetTop-20;const sectionMinHeight =20;height=Number.constrain(height,sectionMinHeight,this.element.offsetHeight-se ctionMinHeight-overviewHeight);this._timelineMemorySplitter.style.bottom=(height -3)+"px";this._memoryStatistics.setHeight(height);},get calculator()
603 {const overviewHeight=90;const sectionMinHeight=100;top=Number.constrain(top,ove rviewHeight+sectionMinHeight,this.element.offsetHeight-sectionMinHeight);this.sp litView.element.style.height=(top-overviewHeight)+"px";this._timelineMemorySplit ter.style.top=(top-2)+"px";this._memoryStatistics.setTopPosition(top);this._cont ainerElementHeight=this._containerElement.clientHeight;this.onResize();},get cal culator() 616 {return this._calculator;},defaultFocusedElement:function()
604 {return this._calculator;},get statusBarItems() 617 {return this.element;},_createFilters:function()
605 {return this._statusBarItems.select("element").concat([this._miscStatusBarItems] );},defaultFocusedElement:function() 618 {this._filterBar=new WebInspector.FilterBar();this._filtersContainer=this.elemen t.createChild("div","timeline-filters-header hidden");this._filtersContainer.app endChild(this._filterBar.filtersElement());this._filterBar.addEventListener(WebI nspector.FilterBar.Events.FiltersToggled,this._onFiltersToggled,this);this._text Filter=new WebInspector.TextFilterUI();this._textFilter.addEventListener(WebInsp ector.FilterUI.Events.FilterChanged,this._textFilterChanged,this);this._filterBa r.addFilter(this._textFilter);var durationOptions=[];for(var presetIndex=0;prese tIndex<WebInspector.TimelinePanel.durationFilterPresetsMs.length;++presetIndex){ var durationMs=WebInspector.TimelinePanel.durationFilterPresetsMs[presetIndex];v ar durationOption={};if(!durationMs){durationOption.label=WebInspector.UIString( "All");durationOption.title=WebInspector.UIString("Show all records");}else{dura tionOption.label=WebInspector.UIString("\u2265 %dms",durationMs);durationOption. title=WebInspector.UIString("Hide records shorter than %dms",durationMs);}
606 {return this.element;},_createStatusBarItems:function() 619 durationOption.value=durationMs;durationOptions.push(durationOption);}
607 {this._statusBarItems=([]);this.toggleTimelineButton=new WebInspector.StatusBarB utton(WebInspector.UIString("Record"),"record-profile-status-bar-item");this.tog gleTimelineButton.addEventListener("click",this._toggleTimelineButtonClicked,thi s);this._statusBarItems.push(this.toggleTimelineButton);this.clearButton=new Web Inspector.StatusBarButton(WebInspector.UIString("Clear"),"clear-status-bar-item" );this.clearButton.addEventListener("click",this._clearPanel,this);this._statusB arItems.push(this.clearButton);this.garbageCollectButton=new WebInspector.Status BarButton(WebInspector.UIString("Collect Garbage"),"garbage-collect-status-bar-i tem");this.garbageCollectButton.addEventListener("click",this._garbageCollectBut tonClicked,this);this._statusBarItems.push(this.garbageCollectButton);this._glue ParentButton=new WebInspector.StatusBarButton(WebInspector.UIString("Glue asynch ronous events to causes"),"glue-async-status-bar-item");this._glueParentButton.t oggled=this._glueRecordsSetting.get();this._presentationModel.setGlueRecords(thi s._glueParentButton.toggled);this._glueParentButton.addEventListener("click",thi s._glueParentButtonClicked,this);this._statusBarItems.push(this._glueParentButto n);this._durationFilterSelector=new WebInspector.StatusBarComboBox(this._duratio nFilterChanged.bind(this));for(var presetIndex=0;presetIndex<WebInspector.Timeli nePanel.durationFilterPresetsMs.length;++presetIndex){var durationMs=WebInspecto r.TimelinePanel.durationFilterPresetsMs[presetIndex];var option=document.createE lement("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 reco rds shorter than %dms",durationMs);} 620 this._durationComboBoxFilter=new WebInspector.ComboBoxFilterUI(durationOptions); this._durationComboBoxFilter.addEventListener(WebInspector.FilterUI.Events.Filte rChanged,this._durationFilterChanged,this);this._filterBar.addFilter(this._durat ionComboBoxFilter);this._categoryFilters={};var categoryTypes=[];var categories= WebInspector.TimelinePresentationModel.categories();for(var categoryName in cate gories){var category=categories[categoryName];if(category.overviewStripGroupInde x<0)
608 option._durationMs=durationMs;this._durationFilterSelector.addOption(option);thi s._durationFilterSelector.element.title=this._durationFilterSelector.selectedOpt ion().title;} 621 continue;var filter=new WebInspector.CheckboxFilterUI(category.name,category.tit le,false);filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,thi s._categoriesFilterChanged.bind(this,category.name),this);this._filterBar.addFil ter(filter);this._categoryFilters[category.name]=filter;}},_createStatusBarItems :function()
609 this._statusBarItems.push(this._durationFilterSelector);this._miscStatusBarItems =document.createElement("div");this._miscStatusBarItems.className="status-bar-it ems timeline-misc-status-bar-items";this._statusBarFilters=this._miscStatusBarIt ems.createChild("div","timeline-misc-status-bar-filters");var categories=WebInsp ector.TimelinePresentationModel.categories();for(var categoryName in categories) {var category=categories[categoryName];if(category.overviewStripGroupIndex<0) 622 {this._statusBarButtons=([]);this.toggleTimelineButton=new WebInspector.StatusBa rButton(WebInspector.UIString("Record"),"record-profile-status-bar-item");this.t oggleTimelineButton.addEventListener("click",this._toggleTimelineButtonClicked,t his);this._statusBarButtons.push(this.toggleTimelineButton);this._panelStatusBar Element.appendChild(this.toggleTimelineButton.element);this.clearButton=new WebI nspector.StatusBarButton(WebInspector.UIString("Clear"),"clear-status-bar-item") ;this.clearButton.addEventListener("click",this._clearPanel,this);this._statusBa rButtons.push(this.clearButton);this._panelStatusBarElement.appendChild(this.cle arButton.element);this._panelStatusBarElement.appendChild(this._filterBar.filter Button());this.garbageCollectButton=new WebInspector.StatusBarButton(WebInspecto r.UIString("Collect Garbage"),"garbage-collect-status-bar-item");this.garbageCol lectButton.addEventListener("click",this._garbageCollectButtonClicked,this);this ._statusBarButtons.push(this.garbageCollectButton);this._panelStatusBarElement.a ppendChild(this.garbageCollectButton.element);this._glueParentButton=new WebInsp ector.StatusBarButton(WebInspector.UIString("Glue asynchronous events to causes" ),"glue-async-status-bar-item");this._glueParentButton.toggled=this._glueRecords Setting.get();this._presentationModel.setGlueRecords(this._glueParentButton.togg led);this._glueParentButton.addEventListener("click",this._glueParentButtonClick ed,this);this._statusBarButtons.push(this._glueParentButton);this._panelStatusBa rElement.appendChild(this._glueParentButton.element);this._statusTextContainer=t his._panelStatusBarElement.createChild("div");this.recordsCounter=new WebInspect or.StatusBarText("");this._statusTextContainer.appendChild(this.recordsCounter.e lement);this.frameStatistics=this._statusTextContainer.createChild("div","timeli ne-frame-statistics status-bar-item status-bar-text hidden");function getAnchor( )
610 continue;this._statusBarFilters.appendChild(this._createTimelineCategoryStatusBa rCheckbox(category));}
611 var statsContainer=this._statusBarFilters.createChild("div","timeline-records-st ats-container");this.recordsCounter=statsContainer.createChild("div","timeline-r ecords-stats");this.frameStatistics=statsContainer.createChild("div","timeline-r ecords-stats hidden");function getAnchor()
612 {return this.frameStatistics;} 623 {return this.frameStatistics;}
613 this._frameStatisticsPopoverHelper=new WebInspector.PopoverHelper(this.frameStat istics,getAnchor.bind(this),this._showFrameStatistics.bind(this));},_createTimel ineCategoryStatusBarCheckbox:function(category) 624 this._frameStatisticsPopoverHelper=new WebInspector.PopoverHelper(this.frameStat istics,getAnchor.bind(this),this._showFrameStatistics.bind(this));this._miscStat usBarItems=this._panelStatusBarElement.createChild("div","status-bar-item");},_t extFilterChanged:function(event)
614 {var labelContainer=document.createElement("div");labelContainer.addStyleClass(" timeline-category-statusbar-item");labelContainer.addStyleClass("timeline-catego ry-"+category.name);labelContainer.addStyleClass("status-bar-item");var label=la belContainer.createChild("label");var checkBorder=label.createChild("div","timel ine-category-checkbox");var checkElement=checkBorder.createChild("div","timeline -category-checkbox-check timeline-category-checkbox-checked");checkElement.type= "checkbox";checkElement.checked=true;labelContainer.addEventListener("click",lis tener.bind(this),false);function listener(event) 625 {var searchQuery=this._textFilter.value();this._presentationModel.setSearchFilte r(null);delete this._searchFilter;function cleanRecord(record)
615 {var checked=!checkElement.checked;checkElement.checked=checked;category.hidden= !checked;checkElement.enableStyleClass("timeline-category-checkbox-checked",chec kElement.checked);this._invalidateAndScheduleRefresh(true,true);} 626 {delete record.clicked;}
616 var typeElement=label.createChild("span","type");typeElement.textContent=categor y.title;return labelContainer;},_setOperationInProgress:function(indicator) 627 WebInspector.TimelinePresentationModel.forAllRecords(this._presentationModel.roo tRecord().children,cleanRecord);this.searchCanceled();if(searchQuery){this._sear chFilter=new WebInspector.TimelineSearchFilter(createPlainTextSearchRegex(search Query,"i"));this._presentationModel.setSearchFilter(this._searchFilter);}
617 {this._operationInProgress=!!indicator;for(var i=0;i<this._statusBarItems.length ;++i) 628 this._invalidateAndScheduleRefresh(true,true);},_durationFilterChanged:function( )
618 this._statusBarItems[i].setEnabled(!this._operationInProgress);this._glueParentB utton.setEnabled(!this._operationInProgress&&!this._frameController);this._miscS tatusBarItems.removeChildren();this._miscStatusBarItems.appendChild(indicator?in dicator.element:this._statusBarFilters);},_registerShortcuts:function() 629 {var duration=this._durationComboBoxFilter.value();var minimumRecordDuration=+du ration/1000.0;this._durationFilter.setMinimumRecordDuration(minimumRecordDuratio n);this._invalidateAndScheduleRefresh(true,true);},_categoriesFilterChanged:func tion(name,event)
630 {var categories=WebInspector.TimelinePresentationModel.categories();categories[n ame].hidden=!this._categoryFilters[name].checked();this._invalidateAndScheduleRe fresh(true,true);},_onFiltersToggled:function(event)
631 {var toggled=(event.data);this._filtersContainer.enableStyleClass("hidden",!togg led);this.onResize();},_setOperationInProgress:function(indicator)
632 {this._operationInProgress=!!indicator;for(var i=0;i<this._statusBarButtons.leng th;++i)
633 this._statusBarButtons[i].setEnabled(!this._operationInProgress);this._glueParen tButton.setEnabled(!this._operationInProgress&&!this._frameController);this._sta tusTextContainer.enableStyleClass("hidden",!!indicator);this._miscStatusBarItems .removeChildren();if(indicator)
634 this._miscStatusBarItems.appendChild(indicator.element);},_registerShortcuts:fun ction()
619 {this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartS topRecording,this._toggleTimelineButtonClicked.bind(this));this.registerShortcut s(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile,this._saveToFile. bind(this));this.registerShortcuts(WebInspector.TimelinePanelDescriptor.Shortcut Keys.LoadFromFile,this._selectFileToLoad.bind(this));},_createFileSelector:funct ion() 635 {this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartS topRecording,this._toggleTimelineButtonClicked.bind(this));this.registerShortcut s(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile,this._saveToFile. bind(this));this.registerShortcuts(WebInspector.TimelinePanelDescriptor.Shortcut Keys.LoadFromFile,this._selectFileToLoad.bind(this));},_createFileSelector:funct ion()
620 {if(this._fileSelectorElement) 636 {if(this._fileSelectorElement)
621 this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=We bInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element .appendChild(this._fileSelectorElement);},_contextMenu:function(event) 637 this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=We bInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element .appendChild(this._fileSelectorElement);},_contextMenu:function(event)
622 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebI nspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Save Timeline data\u202 6":"Save Timeline Data\u2026"),this._saveToFile.bind(this),this._operationInProg ress);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenu Titles()?"Load Timeline data\u2026":"Load Timeline Data\u2026"),this._selectFile ToLoad.bind(this),this._operationInProgress);contextMenu.show();},_saveToFile:fu nction(event) 638 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebI nspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Save Timeline data\u202 6":"Save Timeline Data\u2026"),this._saveToFile.bind(this),this._operationInProg ress);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenu Titles()?"Load Timeline data\u2026":"Load Timeline Data\u2026"),this._selectFile ToLoad.bind(this),this._operationInProgress);contextMenu.show();},_saveToFile:fu nction(event)
623 {if(this._operationInProgress) 639 {if(this._operationInProgress)
624 return true;this._model.saveToFile();return true;},_selectFileToLoad:function(ev ent){this._fileSelectorElement.click();return true;},_loadFromFile:function(file ) 640 return true;this._model.saveToFile();return true;},_selectFileToLoad:function(ev ent){this._fileSelectorElement.click();return true;},_loadFromFile:function(file )
625 {var progressIndicator=this._prepareToLoadTimeline();if(!progressIndicator) 641 {var progressIndicator=this._prepareToLoadTimeline();if(!progressIndicator)
626 return;this._model.loadFromFile(file,progressIndicator);this._createFileSelector ();},loadFromURL:function(url) 642 return;this._model.loadFromFile(file,progressIndicator);this._createFileSelector ();},loadFromURL:function(url)
627 {var progressIndicator=this._prepareToLoadTimeline();if(!progressIndicator) 643 {var progressIndicator=this._prepareToLoadTimeline();if(!progressIndicator)
628 return;this._model.loadFromURL(url,progressIndicator);},_prepareToLoadTimeline:f unction() 644 return;this._model.loadFromURL(url,progressIndicator);},_prepareToLoadTimeline:f unction()
629 {if(this._operationInProgress) 645 {if(this._operationInProgress)
630 return null;if(this.toggleTimelineButton.toggled){this.toggleTimelineButton.togg led=false;this._model.stopRecording();} 646 return null;if(this.toggleTimelineButton.toggled){this.toggleTimelineButton.togg led=false;this._model.stopRecording();}
631 var progressIndicator=new WebInspector.ProgressIndicator();progressIndicator.add EventListener(WebInspector.ProgressIndicator.Events.Done,this._setOperationInPro gress.bind(this,null));this._setOperationInProgress(progressIndicator);return pr ogressIndicator;},_rootRecord:function() 647 var progressIndicator=new WebInspector.ProgressIndicator();progressIndicator.add EventListener(WebInspector.ProgressIndicator.Events.Done,this._setOperationInPro gress.bind(this,null));this._setOperationInProgress(progressIndicator);return pr ogressIndicator;},_rootRecord:function()
632 {return this._presentationModel.rootRecord();},_updateRecordsCounter:function(re cordsInWindowCount) 648 {return this._presentationModel.rootRecord();},_updateRecordsCounter:function(re cordsInWindowCount)
633 {this.recordsCounter.textContent=WebInspector.UIString("%d of %d records shown", recordsInWindowCount,this._allRecordsCount);},_updateFrameStatistics:function(fr ames) 649 {this.recordsCounter.setText(WebInspector.UIString("%d of %d records shown",reco rdsInWindowCount,this._allRecordsCount));},_updateFrameStatistics:function(frame s)
634 {if(frames.length){this._lastFrameStatistics=new WebInspector.FrameStatistics(fr ames);var details=WebInspector.UIString("avg: %s, \u03c3: %s",Number.secondsToSt ring(this._lastFrameStatistics.average,true),Number.secondsToString(this._lastFr ameStatistics.stddev,true));}else 650 {if(frames.length){this._lastFrameStatistics=new WebInspector.FrameStatistics(fr ames);var details=WebInspector.UIString("avg: %s, \u03c3: %s",Number.secondsToSt ring(this._lastFrameStatistics.average,true),Number.secondsToString(this._lastFr ameStatistics.stddev,true));}else
635 this._lastFrameStatistics=null;this.frameStatistics.textContent=WebInspector.UIS tring("%d of %d frames shown",frames.length,this._presentationModel.frames().len gth);if(details){this.frameStatistics.appendChild(document.createTextNode(" (")) ;this.frameStatistics.createChild("span","timeline-frames-stats").textContent=de tails;this.frameStatistics.appendChild(document.createTextNode(")"));}},_showFra meStatistics:function(anchor,popover) 651 this._lastFrameStatistics=null;this.frameStatistics.textContent=WebInspector.UIS tring("%d of %d frames shown",frames.length,this._presentationModel.frames().len gth);if(details){this.frameStatistics.appendChild(document.createTextNode(" (")) ;this.frameStatistics.createChild("span","timeline-frames-stats").textContent=de tails;this.frameStatistics.appendChild(document.createTextNode(")"));}},_showFra meStatistics:function(anchor,popover)
636 {popover.show(WebInspector.TimelinePresentationModel.generatePopupContentForFram eStatistics(this._lastFrameStatistics),anchor);},_updateEventDividers:function() 652 {popover.show(WebInspector.TimelinePresentationModel.generatePopupContentForFram eStatistics(this._lastFrameStatistics),anchor);},_updateEventDividers:function()
637 {this._timelineGrid.removeEventDividers();var clientWidth=this._graphRowsElement Width;var dividers=[];var eventDividerRecords=this._presentationModel.eventDivid erRecords();for(var i=0;i<eventDividerRecords.length;++i){var record=eventDivide rRecords[i];var positions=this._calculator.computeBarGraphWindowPosition(record) ;var dividerPosition=Math.round(positions.left);if(dividerPosition<0||dividerPos ition>=clientWidth||dividers[dividerPosition]) 653 {this._timelineGrid.removeEventDividers();var clientWidth=this._graphRowsElement Width;var dividers=[];var eventDividerRecords=this._presentationModel.eventDivid erRecords();for(var i=0;i<eventDividerRecords.length;++i){var record=eventDivide rRecords[i];var positions=this._calculator.computeBarGraphWindowPosition(record) ;var dividerPosition=Math.round(positions.left);if(dividerPosition<0||dividerPos ition>=clientWidth||dividers[dividerPosition])
638 continue;var divider=WebInspector.TimelinePresentationModel.createEventDivider(r ecord.type,record.title);divider.style.left=dividerPosition+"px";dividers[divide rPosition]=divider;} 654 continue;var divider=WebInspector.TimelinePresentationModel.createEventDivider(r ecord.type,record.title);divider.style.left=dividerPosition+"px";dividers[divide rPosition]=divider;}
639 this._timelineGrid.addEventDividers(dividers);},_updateFrameBars:function(frames ) 655 this._timelineGrid.addEventDividers(dividers);},_updateFrameBars:function(frames )
640 {var clientWidth=this._graphRowsElementWidth;if(this._frameContainer) 656 {var clientWidth=this._graphRowsElementWidth;if(this._frameContainer)
641 this._frameContainer.removeChildren();else{const frameContainerBorderWidth=1;thi s._frameContainer=document.createElement("div");this._frameContainer.addStyleCla ss("fill");this._frameContainer.addStyleClass("timeline-frame-container");this._ frameContainer.style.height=this._headerLineCount*WebInspector.TimelinePanel.row Height+frameContainerBorderWidth+"px";this._frameContainer.addEventListener("dbl click",this._onFrameDoubleClicked.bind(this),false);} 657 this._frameContainer.removeChildren();else{const frameContainerBorderWidth=1;thi s._frameContainer=document.createElement("div");this._frameContainer.addStyleCla ss("fill");this._frameContainer.addStyleClass("timeline-frame-container");this._ frameContainer.style.height=this._headerLineCount*WebInspector.TimelinePanel.row Height+frameContainerBorderWidth+"px";this._frameContainer.addEventListener("dbl click",this._onFrameDoubleClicked.bind(this),false);}
642 var dividers=[this._frameContainer];for(var i=0;i<frames.length;++i){var frame=f rames[i];var frameStart=this._calculator.computePosition(frame.startTime);var fr ameEnd=this._calculator.computePosition(frame.endTime);var frameStrip=document.c reateElement("div");frameStrip.className="timeline-frame-strip";var actualStart= Math.max(frameStart,0);var width=frameEnd-actualStart;frameStrip.style.left=actu alStart+"px";frameStrip.style.width=width+"px";frameStrip._frame=frame;const min WidthForFrameInfo=60;if(width>minWidthForFrameInfo) 658 var dividers=[this._frameContainer];for(var i=0;i<frames.length;++i){var frame=f rames[i];var frameStart=this._calculator.computePosition(frame.startTime);var fr ameEnd=this._calculator.computePosition(frame.endTime);var frameStrip=document.c reateElement("div");frameStrip.className="timeline-frame-strip";var actualStart= Math.max(frameStart,0);var width=frameEnd-actualStart;frameStrip.style.left=actu alStart+"px";frameStrip.style.width=width+"px";frameStrip._frame=frame;const min WidthForFrameInfo=60;if(width>minWidthForFrameInfo)
643 frameStrip.textContent=Number.secondsToString(frame.endTime-frame.startTime,true );this._frameContainer.appendChild(frameStrip);if(actualStart>0){var frameMarker =WebInspector.TimelinePresentationModel.createEventDivider(WebInspector.Timeline Model.RecordType.BeginFrame);frameMarker.style.left=frameStart+"px";dividers.pus h(frameMarker);}} 659 frameStrip.textContent=Number.secondsToString(frame.endTime-frame.startTime,true );this._frameContainer.appendChild(frameStrip);if(actualStart>0){var frameMarker =WebInspector.TimelinePresentationModel.createEventDivider(WebInspector.Timeline Model.RecordType.BeginFrame);frameMarker.style.left=frameStart+"px";dividers.pus h(frameMarker);}}
644 this._timelineGrid.addEventDividers(dividers);},_onFrameDoubleClicked:function(e vent) 660 this._timelineGrid.addEventDividers(dividers);},_onFrameDoubleClicked:function(e vent)
645 {var frameBar=event.target.enclosingNodeOrSelfWithClass("timeline-frame-strip"); if(!frameBar) 661 {var frameBar=event.target.enclosingNodeOrSelfWithClass("timeline-frame-strip"); if(!frameBar)
646 return;this._overviewPane.zoomToFrame(frameBar._frame);},_overviewModeChanged:fu nction(event) 662 return;this._overviewPane.zoomToFrame(frameBar._frame);},_overviewModeChanged:fu nction(event)
647 {var mode=event.data;var shouldShowMemory=mode===WebInspector.TimelineOverviewPa ne.Mode.Memory;var frameMode=mode===WebInspector.TimelineOverviewPane.Mode.Frame s;this._overviewModeSetting.set(mode);if(frameMode!==this._frameMode){this._fram eMode=frameMode;this._glueParentButton.setEnabled(!frameMode);this._presentation Model.setGlueRecords(this._glueParentButton.toggled&&!frameMode);this._repopulat eRecords();if(frameMode){this.element.addStyleClass("timeline-frame-overview");t his.recordsCounter.addStyleClass("hidden");this.frameStatistics.removeStyleClass ("hidden");this._frameController=new WebInspector.TimelineFrameController(this._ model,this._overviewPane,this._presentationModel);}else{this._frameController.di spose();this._frameController=null;this.element.removeStyleClass("timeline-frame -overview");this.recordsCounter.removeStyleClass("hidden");this.frameStatistics. addStyleClass("hidden");}} 663 {var mode=event.data;var shouldShowMemory=mode===WebInspector.TimelineOverviewPa ne.Mode.Memory;var frameMode=mode===WebInspector.TimelineOverviewPane.Mode.Frame s;this._overviewModeSetting.set(mode);if(frameMode!==this._frameMode){this._fram eMode=frameMode;this._glueParentButton.setEnabled(!frameMode);this._presentation Model.setGlueRecords(this._glueParentButton.toggled&&!frameMode);this._repopulat eRecords();if(frameMode){this.element.addStyleClass("timeline-frame-overview");t his.recordsCounter.element.addStyleClass("hidden");this.frameStatistics.removeSt yleClass("hidden");this._frameController=new WebInspector.TimelineFrameControlle r(this._model,this._overviewPane,this._presentationModel);}else{this._frameContr oller.dispose();this._frameController=null;this.element.removeStyleClass("timeli ne-frame-overview");this.recordsCounter.element.removeStyleClass("hidden");this. frameStatistics.addStyleClass("hidden");}}
648 if(shouldShowMemory===this._memoryStatistics.visible()) 664 if(shouldShowMemory===this._memoryStatistics.visible())
649 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._timelineMemorySpl itter.removeStyleClass("hidden");this._memoryStatistics.show();this.splitView.el ement.style.bottom="auto";this._setSplitterPosition(WebInspector.settings.memory CounterGraphsHeight.get());}},_toggleTimelineButtonClicked:function() 665 return;this._timelineMemorySplitter.enableStyleClass("hidden",!shouldShowMemory) ;if(!shouldShowMemory){this._memoryStatistics.hide();this._resize(this.splitView .sidebarWidth());}else{this._memoryStatistics.show();this._setMemoryCountersHeig ht(WebInspector.settings.memoryCounterGraphsHeight.get());this._resize(this.spli tView.sidebarWidth());}},_toggleTimelineButtonClicked:function()
650 {if(this._operationInProgress) 666 {if(this._operationInProgress)
651 return true;if(this.toggleTimelineButton.toggled){this._model.stopRecording();}e lse{this._model.startRecording(this._includeDomCounters);WebInspector.userMetric s.TimelineStarted.record();} 667 return true;if(this.toggleTimelineButton.toggled){this._model.stopRecording();}e lse{this._model.startRecording(this._includeDomCounters);WebInspector.userMetric s.TimelineStarted.record();}
652 return true;},_durationFilterChanged:function() 668 return true;},_garbageCollectButtonClicked:function()
653 {var option=this._durationFilterSelector.selectedOption();var minimumRecordDurat ion=+option._durationMs/1000.0;this._durationFilter.setMinimumRecordDuration(min imumRecordDuration);this._durationFilterSelector.element.title=option.title;this ._invalidateAndScheduleRefresh(true,true);},_garbageCollectButtonClicked:functio n()
654 {HeapProfilerAgent.collectGarbage();},_glueParentButtonClicked:function() 669 {HeapProfilerAgent.collectGarbage();},_glueParentButtonClicked:function()
655 {var newValue=!this._glueParentButton.toggled;this._glueParentButton.toggled=new Value;this._presentationModel.setGlueRecords(newValue);this._glueRecordsSetting. set(newValue);this._repopulateRecords();},_repopulateRecords:function() 670 {var newValue=!this._glueParentButton.toggled;this._glueParentButton.toggled=new Value;this._presentationModel.setGlueRecords(newValue);this._glueRecordsSetting. set(newValue);this._repopulateRecords();},_repopulateRecords:function()
656 {this._resetPanel();this._automaticallySizeWindow=false;var records=this._model. records;for(var i=0;i<records.length;++i) 671 {this._resetPanel();this._automaticallySizeWindow=false;var records=this._model. records;for(var i=0;i<records.length;++i)
657 this._innerAddRecordToTimeline(records[i]);this._invalidateAndScheduleRefresh(fa lse,false);},_onTimelineEventRecorded:function(event) 672 this._innerAddRecordToTimeline(records[i]);this._invalidateAndScheduleRefresh(fa lse,false);},_onTimelineEventRecorded:function(event)
658 {if(this._innerAddRecordToTimeline((event.data))) 673 {if(this._innerAddRecordToTimeline((event.data)))
659 this._invalidateAndScheduleRefresh(false,false);},_innerAddRecordToTimeline:func tion(record) 674 this._invalidateAndScheduleRefresh(false,false);},_innerAddRecordToTimeline:func tion(record)
660 {if(record.type===WebInspector.TimelineModel.RecordType.Program){this._mainThrea dTasks.push({startTime:WebInspector.TimelineModel.startTimeInSeconds(record),end Time:WebInspector.TimelineModel.endTimeInSeconds(record)});} 675 {if(record.type===WebInspector.TimelineModel.RecordType.Program){this._mainThrea dTasks.push({startTime:WebInspector.TimelineModel.startTimeInSeconds(record),end Time:WebInspector.TimelineModel.endTimeInSeconds(record)});}
661 var records=this._presentationModel.addRecord(record);this._allRecordsCount+=rec ords.length;var hasVisibleRecords=false;var presentationModel=this._presentation Model;function checkVisible(record) 676 var records=this._presentationModel.addRecord(record);this._allRecordsCount+=rec ords.length;var hasVisibleRecords=false;var presentationModel=this._presentation Model;function checkVisible(record)
662 {hasVisibleRecords|=presentationModel.isVisible(record);} 677 {hasVisibleRecords|=presentationModel.isVisible(record);}
663 WebInspector.TimelinePresentationModel.forAllRecords(records,checkVisible);funct ion isAdoptedRecord(record) 678 WebInspector.TimelinePresentationModel.forAllRecords(records,checkVisible);funct ion isAdoptedRecord(record)
664 {return record.parent!==presentationModel.rootRecord;} 679 {return record.parent!==presentationModel.rootRecord;}
665 return hasVisibleRecords||records.some(isAdoptedRecord);},sidebarResized:functio n(event) 680 return hasVisibleRecords||records.some(isAdoptedRecord);},sidebarResized:functio n(event)
666 {var width=event.data;this._resize(width);this._overviewPane.sidebarResized(widt h);this._memoryStatistics.setSidebarWidth(width);this._timelineGrid.gridHeaderEl ement.style.left=width+"px";},onResize:function() 681 {var width=event.data;this._resize(width);this._overviewPane.sidebarResized(widt h);this._memoryStatistics.setSidebarWidth(width);},onResize:function()
667 {this._resize(this.splitView.sidebarWidth());},_resize:function(sidebarWidth) 682 {if(this._memoryStatistics.visible())
668 {this._closeRecordDetails();this._graphRowsElementWidth=this._graphRowsElement.o ffsetWidth;this._containerElementHeight=this._containerElement.clientHeight;this ._scheduleRefresh(false,true);var lastItemElement=this._statusBarItems[this._sta tusBarItems.length-1].element;var minFloatingStatusBarItemsOffset=lastItemElemen t.totalOffsetLeft()+lastItemElement.offsetWidth;this._timelineGrid.gridHeaderEle ment.style.width=this._itemsGraphsElement.offsetWidth+"px";this._miscStatusBarIt ems.style.left=Math.max(minFloatingStatusBarItemsOffset,sidebarWidth)+"px";},_cl earPanel:function() 683 this._setMemoryCountersHeight(this._memoryStatistics.height());this._resize(this .splitView.sidebarWidth());},_resize:function(sidebarWidth)
684 {this._closeRecordDetails();this._graphRowsElementWidth=this._graphRowsElement.o ffsetWidth;this._containerElementHeight=this._containerElement.clientHeight;this ._scheduleRefresh(false,true);},_clearPanel:function()
669 {this._model.reset();},_onRecordsCleared:function() 685 {this._model.reset();},_onRecordsCleared:function()
670 {this._resetPanel();this._invalidateAndScheduleRefresh(true,true);},_onRecording Started:function() 686 {this._resetPanel();this._invalidateAndScheduleRefresh(true,true);},_onRecording Started:function()
671 {this.toggleTimelineButton.title=WebInspector.UIString("Stop");this.toggleTimeli neButton.toggled=true;},_onRecordingStopped:function() 687 {this.toggleTimelineButton.title=WebInspector.UIString("Stop");this.toggleTimeli neButton.toggled=true;},_onRecordingStopped:function()
672 {this.toggleTimelineButton.title=WebInspector.UIString("Record");this.toggleTime lineButton.toggled=false;},_resetPanel:function() 688 {this.toggleTimelineButton.title=WebInspector.UIString("Record");this.toggleTime lineButton.toggled=false;},_resetPanel:function()
673 {this._presentationModel.reset();this._boundariesAreValid=false;this._adjustScro llPosition(0);this._closeRecordDetails();this._allRecordsCount=0;this._automatic allySizeWindow=true;this._mainThreadTasks=[];},elementsToRestoreScrollPositionsF or:function() 689 {this._presentationModel.reset();this._boundariesAreValid=false;this._adjustScro llPosition(0);this._closeRecordDetails();this._allRecordsCount=0;this._automatic allySizeWindow=true;this._mainThreadTasks=[];},elementsToRestoreScrollPositionsF or:function()
674 {return[this._containerElement];},wasShown:function() 690 {return[this._containerElement];},wasShown:function()
675 {WebInspector.Panel.prototype.wasShown.call(this);if(!WebInspector.TimelinePanel ._categoryStylesInitialized){WebInspector.TimelinePanel._categoryStylesInitializ ed=true;this._injectCategoryStyles();} 691 {WebInspector.Panel.prototype.wasShown.call(this);if(!WebInspector.TimelinePanel ._categoryStylesInitialized){WebInspector.TimelinePanel._categoryStylesInitializ ed=true;this._injectCategoryStyles();}
676 this._overviewPane.setMode(this._overviewModeSetting.get());this._refresh();},wi llHide:function() 692 this._overviewPane.setMode(this._overviewModeSetting.get());this._refresh();},wi llHide:function()
677 {this._closeRecordDetails();WebInspector.Panel.prototype.willHide.call(this);},_ onScroll:function(event) 693 {this._closeRecordDetails();WebInspector.Panel.prototype.willHide.call(this);},_ onScroll:function(event)
678 {this._closeRecordDetails();this._scrollTop=this._containerElement.scrollTop;var dividersTop=Math.max(0,this._scrollTop);this._timelineGrid.setScrollAndDividerT op(this._scrollTop,dividersTop);this._scheduleRefresh(true,true);},_invalidateAn dScheduleRefresh:function(preserveBoundaries,userGesture) 694 {this._closeRecordDetails();this._scrollTop=this._containerElement.scrollTop;var dividersTop=Math.max(0,this._scrollTop);this._timelineGrid.setScrollAndDividerT op(this._scrollTop,dividersTop);this._scheduleRefresh(true,true);},_invalidateAn dScheduleRefresh:function(preserveBoundaries,userGesture)
(...skipping 12 matching lines...) Expand all
691 {var recordToReveal;function findRecordToReveal(record) 707 {var recordToReveal;function findRecordToReveal(record)
692 {if(record.containsTime(time)){recordToReveal=record;return true;} 708 {if(record.containsTime(time)){recordToReveal=record;return true;}
693 if(!recordToReveal||record.endTime<time&&recordToReveal.endTime<record.endTime) 709 if(!recordToReveal||record.endTime<time&&recordToReveal.endTime<record.endTime)
694 recordToReveal=record;return false;} 710 recordToReveal=record;return false;}
695 WebInspector.TimelinePresentationModel.forAllRecords(this._presentationModel.roo tRecord().children,null,findRecordToReveal);if(!recordToReveal){this._containerE lement.scrollTop=0;return;} 711 WebInspector.TimelinePresentationModel.forAllRecords(this._presentationModel.roo tRecord().children,null,findRecordToReveal);if(!recordToReveal){this._containerE lement.scrollTop=0;return;}
696 this._revealRecord(recordToReveal);},_revealRecord:function(recordToReveal) 712 this._revealRecord(recordToReveal);},_revealRecord:function(recordToReveal)
697 {for(var parent=recordToReveal.parent;parent!==this._rootRecord();parent=parent. parent){if(!parent.collapsed) 713 {for(var parent=recordToReveal.parent;parent!==this._rootRecord();parent=parent. parent){if(!parent.collapsed)
698 continue;this._presentationModel.invalidateFilteredRecords();parent.collapsed=fa lse;} 714 continue;this._presentationModel.invalidateFilteredRecords();parent.collapsed=fa lse;}
699 var recordsInWindow=this._presentationModel.filteredRecords();var index=recordsI nWindow.indexOf(recordToReveal);this._recordToHighlight=recordToReveal;var oldSc rollTop=this._containerElement.scrollTop;this._containerElement.scrollTop=index* WebInspector.TimelinePanel.rowHeight;if(this._containerElement.scrollTop===oldSc rollTop) 715 var recordsInWindow=this._presentationModel.filteredRecords();var index=recordsI nWindow.indexOf(recordToReveal);this._recordToHighlight=recordToReveal;var oldSc rollTop=this._containerElement.scrollTop;this._containerElement.scrollTop=index* WebInspector.TimelinePanel.rowHeight;if(this._containerElement.scrollTop===oldSc rollTop)
700 this._refresh();},_refreshRecords:function() 716 this._refresh();},_refreshRecords:function()
701 {var recordsInWindow=this._presentationModel.filteredRecords();var visibleTop=th is._scrollTop;var visibleBottom=visibleTop+this._containerElementHeight;const ro wHeight=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._head erLineCount);if(this._automaticallySizeWindow&&recordsInWindow.length>lastVisibl eLine){this._automaticallySizeWindow=false;var windowStartTime=startIndex?record sInWindow[startIndex].startTime:this._model.minimumRecordTime();this._overviewPa ne.setWindowTimes(windowStartTime,recordsInWindow[Math.max(0,lastVisibleLine-1)] .endTime);recordsInWindow=this._presentationModel.filteredRecords();endIndex=Mat h.min(recordsInWindow.length,lastVisibleLine);} 717 {var recordsInWindow=this._presentationModel.filteredRecords();var visibleTop=th is._scrollTop;var visibleBottom=visibleTop+this._containerElementHeight;const ro wHeight=WebInspector.TimelinePanel.rowHeight;const headerHeight=WebInspector.Tim elinePanel.headerHeight;var startIndex=Math.max(0,Math.min(Math.floor(visibleTop /rowHeight)-this._headerLineCount,recordsInWindow.length-1));var endIndex=Math.m in(recordsInWindow.length,Math.ceil(visibleBottom/rowHeight));var lastVisibleLin e=Math.max(0,Math.floor(visibleBottom/rowHeight)-this._headerLineCount);if(this. _automaticallySizeWindow&&recordsInWindow.length>lastVisibleLine){this._automati callySizeWindow=false;var windowStartTime=startIndex?recordsInWindow[startIndex] .startTime:this._model.minimumRecordTime();this._overviewPane.setWindowTimes(win dowStartTime,recordsInWindow[Math.max(0,lastVisibleLine-1)].endTime);recordsInWi ndow=this._presentationModel.filteredRecords();endIndex=Math.min(recordsInWindow .length,lastVisibleLine);}
702 this._topGapElement.style.height=(startIndex*rowHeight)+"px";this.sidebarTreeEle ment.style.height=((startIndex+this._headerLineCount)*rowHeight)+"px";this._bott omGapElement.style.height=(recordsInWindow.length-endIndex)*rowHeight+"px";var l istRowElement=this._sidebarListElement.firstChild;var width=this._graphRowsEleme ntWidth;this._itemsGraphsElement.removeChild(this._graphRowsElement);var graphRo wElement=this._graphRowsElement.firstChild;var scheduleRefreshCallback=this._inv alidateAndScheduleRefresh.bind(this,true,true);this._itemsGraphsElement.removeCh ild(this._expandElements);this._expandElements.removeChildren();var highlightedR ecord=this._recordToHighlight;delete this._recordToHighlight;var highlightedList RowElement;var highlightedGraphRowElement;for(var i=0;i<endIndex;++i){var record =recordsInWindow[i];var isEven=!(i%2);if(i<startIndex){var lastChildIndex=i+reco rd.visibleChildrenCount;if(lastChildIndex>=startIndex&&lastChildIndex<endIndex){ var expandElement=new WebInspector.TimelineExpandableElement(this._expandElement s);var positions=this._calculator.computeBarGraphWindowPosition(record);expandEl ement._update(record,i,positions.left-this._expandOffset,positions.width);}}else {if(!listRowElement){listRowElement=new WebInspector.TimelineRecordListRow().ele ment;this._sidebarListElement.appendChild(listRowElement);} 718 this._topGapElement.style.height=(startIndex*rowHeight)+"px";this.sidebarTreeEle ment.style.height=((startIndex+this._headerLineCount)*rowHeight)+"px";this._bott omGapElement.style.height=(recordsInWindow.length-endIndex)*rowHeight+"px";var r owsHeight=headerHeight+recordsInWindow.length*rowHeight;var totalHeight=Math.max (this._containerElementHeight,rowsHeight);this.splitView.firstElement().style.he ight=totalHeight+"px";this.splitView.secondElement().style.height=totalHeight+"p x";this.splitView.resizerElement().style.height=totalHeight+"px";var listRowElem ent=this._sidebarListElement.firstChild;var width=this._graphRowsElementWidth;th is._itemsGraphsElement.removeChild(this._graphRowsElement);var graphRowElement=t his._graphRowsElement.firstChild;var scheduleRefreshCallback=this._invalidateAnd ScheduleRefresh.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=recordsIn Window[i];var isEven=!(i%2);if(i<startIndex){var lastChildIndex=i+record.visible ChildrenCount;if(lastChildIndex>=startIndex&&lastChildIndex<endIndex){var expand Element=new WebInspector.TimelineExpandableElement(this._expandElements);var pos itions=this._calculator.computeBarGraphWindowPosition(record);expandElement._upd ate(record,i,positions.left-this._expandOffset,positions.width);}}else{if(!listR owElement){listRowElement=new WebInspector.TimelineRecordListRow().element;this. _sidebarListElement.appendChild(listRowElement);}
703 if(!graphRowElement){graphRowElement=new WebInspector.TimelineRecordGraphRow(thi s._itemsGraphsElement,scheduleRefreshCallback).element;this._graphRowsElement.ap pendChild(graphRowElement);} 719 if(!graphRowElement){graphRowElement=new WebInspector.TimelineRecordGraphRow(thi s._itemsGraphsElement,scheduleRefreshCallback).element;this._graphRowsElement.ap pendChild(graphRowElement);}
704 if(highlightedRecord===record){highlightedListRowElement=listRowElement;highligh tedGraphRowElement=graphRowElement;} 720 if(highlightedRecord===record){highlightedListRowElement=listRowElement;highligh tedGraphRowElement=graphRowElement;}
705 listRowElement.row.update(record,isEven,visibleTop);graphRowElement.row.update(r ecord,isEven,this._calculator,this._expandOffset,i);listRowElement=listRowElemen t.nextSibling;graphRowElement=graphRowElement.nextSibling;}} 721 listRowElement.row.update(record,isEven,visibleTop);graphRowElement.row.update(r ecord,isEven,this._calculator,this._expandOffset,i);listRowElement=listRowElemen t.nextSibling;graphRowElement=graphRowElement.nextSibling;}}
706 while(listRowElement){var nextElement=listRowElement.nextSibling;listRowElement. row.dispose();listRowElement=nextElement;} 722 while(listRowElement){var nextElement=listRowElement.nextSibling;listRowElement. row.dispose();listRowElement=nextElement;}
707 while(graphRowElement){var nextElement=graphRowElement.nextSibling;graphRowEleme nt.row.dispose();graphRowElement=nextElement;} 723 while(graphRowElement){var nextElement=graphRowElement.nextSibling;graphRowEleme nt.row.dispose();graphRowElement=nextElement;}
708 this._itemsGraphsElement.insertBefore(this._graphRowsElement,this._bottomGapElem ent);this._itemsGraphsElement.appendChild(this._expandElements);this._adjustScro llPosition((recordsInWindow.length+this._headerLineCount)*rowHeight);this._updat eSearchHighlight(false,true);if(highlightedListRowElement){highlightedListRowEle ment.addStyleClass("highlighted-timeline-record");highlightedGraphRowElement.add StyleClass("highlighted-timeline-record");} 724 this._itemsGraphsElement.insertBefore(this._graphRowsElement,this._bottomGapElem ent);this._itemsGraphsElement.appendChild(this._expandElements);this._adjustScro llPosition((recordsInWindow.length+this._headerLineCount)*rowHeight);this._updat eSearchHighlight(false,true);if(highlightedListRowElement){highlightedListRowEle ment.addStyleClass("highlighted-timeline-record");highlightedGraphRowElement.add StyleClass("highlighted-timeline-record");}
709 return recordsInWindow.length;},_refreshMainThreadBars:function() 725 return recordsInWindow.length;},_refreshMainThreadBars:function()
710 {const barOffset=3;const minGap=3;var minWidth=WebInspector.TimelineCalculator._ minWidth;var widthAdjustment=minWidth/2;var width=this._graphRowsElementWidth;va r boundarySpan=this._overviewPane.windowEndTime()-this._overviewPane.windowStart Time();var scale=boundarySpan/(width-minWidth-this._timelinePaddingLeft);var sta rtTime=this._overviewPane.windowStartTime()-this._timelinePaddingLeft*scale;var endTime=startTime+width*scale;var tasks=this._mainThreadMonitoringEnabled?this._ mainThreadTasks:[];function compareEndTime(value,task) 726 {const barOffset=3;const minGap=3;var minWidth=WebInspector.TimelineCalculator._ minWidth;var widthAdjustment=minWidth/2;var width=this._graphRowsElementWidth;va r boundarySpan=this._overviewPane.windowEndTime()-this._overviewPane.windowStart Time();var scale=boundarySpan/(width-minWidth-this._timelinePaddingLeft);var sta rtTime=this._overviewPane.windowStartTime()-this._timelinePaddingLeft*scale;var endTime=startTime+width*scale;var tasks=this._mainThreadMonitoringEnabled?this._ mainThreadTasks:[];function compareEndTime(value,task)
711 {return value<task.endTime?-1:1;} 727 {return value<task.endTime?-1:1;}
712 var taskIndex=insertionIndexForObjectInListSortedByFunction(startTime,tasks,comp areEndTime);var container=this._cpuBarsElement;var element=container.firstChild; var lastElement;var lastLeft;var lastRight;for(;taskIndex<tasks.length;++taskInd ex){var task=tasks[taskIndex];if(task.startTime>endTime) 728 var taskIndex=insertionIndexForObjectInListSortedByFunction(startTime,tasks,comp areEndTime);var container=this._cpuBarsElement;var element=container.firstChild; var lastElement;var lastLeft;var lastRight;for(;taskIndex<tasks.length;++taskInd ex){var task=tasks[taskIndex];if(task.startTime>endTime)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 WebInspector.revertDomChanges(this._highlightDomChanges);this._highlightDomChang es=[];},_updateSearchHighlight:function(revealRecord,shouldJump) 766 WebInspector.revertDomChanges(this._highlightDomChanges);this._highlightDomChang es=[];},_updateSearchHighlight:function(revealRecord,shouldJump)
751 {if(this._searchFilter||!this._searchRegExp){this._clearHighlight();return;} 767 {if(this._searchFilter||!this._searchRegExp){this._clearHighlight();return;}
752 if(!this._searchResults) 768 if(!this._searchResults)
753 this._updateSearchResults(shouldJump);this._highlightSelectedSearchResult(reveal Record);},_updateSearchResults:function(shouldJump) 769 this._updateSearchResults(shouldJump);this._highlightSelectedSearchResult(reveal Record);},_updateSearchResults:function(shouldJump)
754 {var searchRegExp=this._searchRegExp;if(!searchRegExp) 770 {var searchRegExp=this._searchRegExp;if(!searchRegExp)
755 return;var matches=[];var presentationModel=this._presentationModel;function pro cessRecord(record) 771 return;var matches=[];var presentationModel=this._presentationModel;function pro cessRecord(record)
756 {if(presentationModel.isVisible(record)&&WebInspector.TimelineRecordListRow.test ContentMatching(record,searchRegExp)) 772 {if(presentationModel.isVisible(record)&&WebInspector.TimelineRecordListRow.test ContentMatching(record,searchRegExp))
757 matches.push(record);return false;} 773 matches.push(record);return false;}
758 WebInspector.TimelinePresentationModel.forAllRecords(presentationModel.rootRecor d().children,processRecord);var matchesCount=matches.length;if(matchesCount){thi s._searchResults=matches;WebInspector.searchController.updateSearchMatchesCount( matchesCount,this);var selectedIndex=matches.indexOf(this._selectedSearchResult) ;if(shouldJump&&selectedIndex===-1) 774 WebInspector.TimelinePresentationModel.forAllRecords(presentationModel.rootRecor d().children,processRecord);var matchesCount=matches.length;if(matchesCount){thi s._searchResults=matches;WebInspector.searchController.updateSearchMatchesCount( matchesCount,this);var selectedIndex=matches.indexOf(this._selectedSearchResult) ;if(shouldJump&&selectedIndex===-1)
759 selectedIndex=0;this._selectSearchResult(selectedIndex);}else{WebInspector.searc hController.updateSearchMatchesCount(0,this);delete this._selectedSearchResult;} },searchCanceled:function() 775 selectedIndex=0;this._selectSearchResult(selectedIndex);}else{WebInspector.searc hController.updateSearchMatchesCount(0,this);delete this._selectedSearchResult;} },searchCanceled:function()
760 {this._clearHighlight();delete this._searchResults;delete this._selectedSearchRe sult;delete this._searchRegExp;},canFilter:function() 776 {this._clearHighlight();delete this._searchResults;delete this._selectedSearchRe sult;delete this._searchRegExp;},performSearch:function(query,shouldJump)
761 {return true;},performFilter:function(searchQuery)
762 {this._presentationModel.setSearchFilter(null);delete this._searchFilter;functio n cleanRecord(record)
763 {delete record.clicked;}
764 WebInspector.TimelinePresentationModel.forAllRecords(this._presentationModel.roo tRecord().children,cleanRecord);this.searchCanceled();if(searchQuery){this._sear chFilter=new WebInspector.TimelineSearchFilter(createPlainTextSearchRegex(search Query,"i"));this._presentationModel.setSearchFilter(this._searchFilter);}
765 this._invalidateAndScheduleRefresh(true,true);},performSearch:function(query,sho uldJump)
766 {this._searchRegExp=createPlainTextSearchRegex(query,"i");delete this._searchRes ults;this._updateSearchHighlight(true,shouldJump);},__proto__:WebInspector.Panel .prototype} 777 {this._searchRegExp=createPlainTextSearchRegex(query,"i");delete this._searchRes ults;this._updateSearchHighlight(true,shouldJump);},__proto__:WebInspector.Panel .prototype}
767 WebInspector.TimelineCalculator=function(model) 778 WebInspector.TimelineCalculator=function(model)
768 {this._model=model;} 779 {this._model=model;}
769 WebInspector.TimelineCalculator._minWidth=5;WebInspector.TimelineCalculator.prot otype={computePosition:function(time) 780 WebInspector.TimelineCalculator._minWidth=5;WebInspector.TimelineCalculator.prot otype={computePosition:function(time)
770 {return(time-this._minimumBoundary)/this.boundarySpan()*this._workingArea+this.p addingLeft;},computeBarGraphPercentages:function(record) 781 {return(time-this._minimumBoundary)/this.boundarySpan()*this._workingArea+this.p addingLeft;},computeBarGraphPercentages:function(record)
771 {var start=(record.startTime-this._minimumBoundary)/this.boundarySpan()*100;var end=(record.startTime+record.selfTime-this._minimumBoundary)/this.boundarySpan() *100;var endWithChildren=(record.lastChildEndTime-this._minimumBoundary)/this.bo undarySpan()*100;var cpuWidth=record.coalesced?endWithChildren-start:record.cpuT ime/this.boundarySpan()*100;return{start:start,end:end,endWithChildren:endWithCh ildren,cpuWidth:cpuWidth};},computeBarGraphWindowPosition:function(record) 782 {var start=(record.startTime-this._minimumBoundary)/this.boundarySpan()*100;var end=(record.startTime+record.selfTime-this._minimumBoundary)/this.boundarySpan() *100;var endWithChildren=(record.lastChildEndTime-this._minimumBoundary)/this.bo undarySpan()*100;var cpuWidth=record.coalesced?endWithChildren-start:record.cpuT ime/this.boundarySpan()*100;return{start:start,end:end,endWithChildren:endWithCh ildren,cpuWidth:cpuWidth};},computeBarGraphWindowPosition:function(record)
772 {var percentages=this.computeBarGraphPercentages(record);var widthAdjustment=0;v ar left=this.computePosition(record.startTime);var width=(percentages.end-percen tages.start)/100*this._workingArea;if(width<WebInspector.TimelineCalculator._min Width){widthAdjustment=WebInspector.TimelineCalculator._minWidth-width;width=Web Inspector.TimelineCalculator._minWidth;} 783 {var percentages=this.computeBarGraphPercentages(record);var widthAdjustment=0;v ar left=this.computePosition(record.startTime);var width=(percentages.end-percen tages.start)/100*this._workingArea;if(width<WebInspector.TimelineCalculator._min Width){widthAdjustment=WebInspector.TimelineCalculator._minWidth-width;width=Web Inspector.TimelineCalculator._minWidth;}
773 var widthWithChildren=(percentages.endWithChildren-percentages.start)/100*this._ workingArea+widthAdjustment;var cpuWidth=percentages.cpuWidth/100*this._workingA rea+widthAdjustment;if(percentages.endWithChildren>percentages.end) 784 var widthWithChildren=(percentages.endWithChildren-percentages.start)/100*this._ workingArea+widthAdjustment;var cpuWidth=percentages.cpuWidth/100*this._workingA rea+widthAdjustment;if(percentages.endWithChildren>percentages.end)
774 widthWithChildren+=widthAdjustment;return{left:left,width:width,widthWithChildre n:widthWithChildren,cpuWidth:cpuWidth};},setWindow:function(minimumBoundary,maxi mumBoundary) 785 widthWithChildren+=widthAdjustment;return{left:left,width:width,widthWithChildre n:widthWithChildren,cpuWidth:cpuWidth};},setWindow:function(minimumBoundary,maxi mumBoundary)
775 {this._minimumBoundary=minimumBoundary;this._maximumBoundary=maximumBoundary;},s etDisplayWindow:function(paddingLeft,clientWidth) 786 {this._minimumBoundary=minimumBoundary;this._maximumBoundary=maximumBoundary;},s etDisplayWindow:function(paddingLeft,clientWidth)
776 {this._workingArea=clientWidth-WebInspector.TimelineCalculator._minWidth-padding Left;this.paddingLeft=paddingLeft;},formatTime:function(value) 787 {this._workingArea=clientWidth-WebInspector.TimelineCalculator._minWidth-padding Left;this.paddingLeft=paddingLeft;},formatTime:function(value)
777 {return Number.secondsToString(value+this._minimumBoundary-this._model.minimumRe cordTime());},maximumBoundary:function() 788 {return Number.secondsToString(value+this._minimumBoundary-this._model.minimumRe cordTime());},maximumBoundary:function()
778 {return this._maximumBoundary;},minimumBoundary:function() 789 {return this._maximumBoundary;},minimumBoundary:function()
779 {return this._minimumBoundary;},zeroTime:function() 790 {return this._minimumBoundary;},zeroTime:function()
780 {return this._model.minimumRecordTime();},boundarySpan:function() 791 {return this._model.minimumRecordTime();},boundarySpan:function()
781 {return this._maximumBoundary-this._minimumBoundary;}} 792 {return this._maximumBoundary-this._minimumBoundary;}}
782 WebInspector.TimelineRecordListRow=function() 793 WebInspector.TimelineRecordListRow=function()
783 {this.element=document.createElement("div");this.element.row=this;this.element.s tyle.cursor="pointer";var iconElement=document.createElement("span");iconElement .className="timeline-tree-icon";this.element.appendChild(iconElement);this._type Element=document.createElement("span");this._typeElement.className="type";this.e lement.appendChild(this._typeElement);var separatorElement=document.createElemen t("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);} 794 {this.element=document.createElement("div");this.element.row=this;this.element.s tyle.cursor="pointer";var iconElement=document.createElement("span");iconElement .className="timeline-tree-icon";this.element.appendChild(iconElement);this._type Element=document.createElement("span");this._typeElement.className="type";this.e lement.appendChild(this._typeElement);var separatorElement=document.createElemen t("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);}
784 WebInspector.TimelineRecordListRow.prototype={update:function(record,isEven,offs et) 795 WebInspector.TimelineRecordListRow.prototype={update:function(record,isEven,offs et)
785 {this._record=record;this._offset=offset;this.element.className="timeline-tree-i tem timeline-category-"+record.category.name;if(isEven) 796 {this._record=record;this._offset=offset;this.element.className="timeline-tree-i tem timeline-category-"+record.category.name;if(isEven)
786 this.element.addStyleClass("even");if(record.hasWarning) 797 this.element.addStyleClass("even");if(record.hasWarnings())
787 this.element.addStyleClass("warning");else if(record.childHasWarning) 798 this.element.addStyleClass("warning");else if(record.childHasWarnings())
788 this.element.addStyleClass("child-warning");if(record.isBackground) 799 this.element.addStyleClass("child-warning");if(record.isBackground)
789 this.element.addStyleClass("background");this._typeElement.textContent=record.ti tle;if(this._dataElement.firstChild) 800 this.element.addStyleClass("background");this._typeElement.textContent=record.ti tle;if(this._dataElement.firstChild)
790 this._dataElement.removeChildren();if(record.detailsNode()) 801 this._dataElement.removeChildren();if(record.detailsNode())
791 this._dataElement.appendChild(record.detailsNode());},highlight:function(regExp, domChanges) 802 this._dataElement.appendChild(record.detailsNode());},highlight:function(regExp, domChanges)
792 {var matchInfo=this.element.textContent.match(regExp);if(matchInfo) 803 {var matchInfo=this.element.textContent.match(regExp);if(matchInfo)
793 WebInspector.highlightSearchResult(this.element,matchInfo.index,matchInfo[0].len gth,domChanges);},dispose:function() 804 WebInspector.highlightSearchResult(this.element,matchInfo.index,matchInfo[0].len gth,domChanges);},dispose:function()
794 {this.element.remove();}} 805 {this.element.remove();}}
795 WebInspector.TimelineRecordListRow.testContentMatching=function(record,regExp) 806 WebInspector.TimelineRecordListRow.testContentMatching=function(record,regExp)
796 {var toSearchText=record.title;if(record.detailsNode()) 807 {var toSearchText=record.title;if(record.detailsNode())
797 toSearchText+=" "+record.detailsNode().textContent;return regExp.test(toSearchTe xt);} 808 toSearchText+=" "+record.detailsNode().textContent;return regExp.test(toSearchTe xt);}
(...skipping 19 matching lines...) Expand all
817 {return!record.category.hidden&&record.type!==WebInspector.TimelineModel.RecordT ype.BeginFrame;}} 828 {return!record.category.hidden&&record.type!==WebInspector.TimelineModel.RecordT ype.BeginFrame;}}
818 WebInspector.TimelineIsLongFilter=function() 829 WebInspector.TimelineIsLongFilter=function()
819 {this._minimumRecordDuration=0;} 830 {this._minimumRecordDuration=0;}
820 WebInspector.TimelineIsLongFilter.prototype={setMinimumRecordDuration:function(v alue) 831 WebInspector.TimelineIsLongFilter.prototype={setMinimumRecordDuration:function(v alue)
821 {this._minimumRecordDuration=value;},accept:function(record) 832 {this._minimumRecordDuration=value;},accept:function(record)
822 {return this._minimumRecordDuration?((record.lastChildEndTime-record.startTime)> =this._minimumRecordDuration):true;}} 833 {return this._minimumRecordDuration?((record.lastChildEndTime-record.startTime)> =this._minimumRecordDuration):true;}}
823 WebInspector.TimelineSearchFilter=function(regExp) 834 WebInspector.TimelineSearchFilter=function(regExp)
824 {this._regExp=regExp;} 835 {this._regExp=regExp;}
825 WebInspector.TimelineSearchFilter.prototype={accept:function(record) 836 WebInspector.TimelineSearchFilter.prototype={accept:function(record)
826 {return WebInspector.TimelineRecordListRow.testContentMatching(record,this._regE xp);}} 837 {return WebInspector.TimelineRecordListRow.testContentMatching(record,this._regE xp);}}
OLDNEW
« no previous file with comments | « chrome_linux/resources/inspector/SourcesPanel.js ('k') | chrome_linux/resources/inspector/auditsPanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698