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

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

Issue 42163002: Roll Linux reference build to official build 31.0.1650.34 (trunk r224845, branch r230433) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 const UserInitiatedProfileName="org.webkit.profiles.user-initiated";WebInspector .ProfileType=function(id,name) 1 const UserInitiatedProfileName="org.webkit.profiles.user-initiated";WebInspector .ProfileType=function(id,name)
2 {this._id=id;this._name=name;this._profiles=[];this._profilesIdMap={};this.treeE lement=null;} 2 {this._id=id;this._name=name;this._profiles=[];this._profilesIdMap={};this.treeE lement=null;}
3 WebInspector.ProfileType.Events={AddProfileHeader:"add-profile-header",RemovePro fileHeader:"remove-profile-header",ProgressUpdated:"progress-updated",ViewUpdate d:"view-updated"} 3 WebInspector.ProfileType.Events={AddProfileHeader:"add-profile-header",RemovePro fileHeader:"remove-profile-header",ProgressUpdated:"progress-updated",ViewUpdate d:"view-updated"}
4 WebInspector.ProfileType.prototype={hasTemporaryView:function() 4 WebInspector.ProfileType.prototype={hasTemporaryView:function()
5 {return false;},fileExtension:function() 5 {return false;},fileExtension:function()
6 {return null;},get statusBarItems() 6 {return null;},get statusBarItems()
7 {return[];},get buttonTooltip() 7 {return[];},get buttonTooltip()
8 {return"";},get id() 8 {return"";},get id()
9 {return this._id;},get treeItemTitle() 9 {return this._id;},get treeItemTitle()
10 {return this._name;},get name() 10 {return this._name;},get name()
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 {},load:function(callback) 46 {},load:function(callback)
47 {},canSaveToFile:function() 47 {},canSaveToFile:function()
48 {return false;},saveToFile:function() 48 {return false;},saveToFile:function()
49 {throw new Error("Needs implemented");},loadFromFile:function(file) 49 {throw new Error("Needs implemented");},loadFromFile:function(file)
50 {throw new Error("Needs implemented");},fromFile:function() 50 {throw new Error("Needs implemented");},fromFile:function()
51 {return this._fromFile;},setFromFile:function() 51 {return this._fromFile;},setFromFile:function()
52 {this._fromFile=true;this.uid=-2;}} 52 {this._fromFile=true;this.uid=-2;}}
53 WebInspector.ProfilesPanel=function(name,type) 53 WebInspector.ProfilesPanel=function(name,type)
54 {var singleProfileMode=typeof name!=="undefined";name=name||"profiles";WebInspec tor.Panel.call(this,name);this.registerRequiredCSS("panelEnablerView.css");this. registerRequiredCSS("heapProfiler.css");this.registerRequiredCSS("profilesPanel. css");this.createSidebarViewWithTree();this.profilesItemTreeElement=new WebInspe ctor.ProfilesSidebarTreeElement(this);this.sidebarTree.appendChild(this.profiles ItemTreeElement);this._singleProfileMode=singleProfileMode;this._profileTypesByI dMap={};this.profileViews=document.createElement("div");this.profileViews.id="pr ofile-views";this.splitView.mainElement.appendChild(this.profileViews);this._sta tusBarButtons=[];this.recordButton=new WebInspector.StatusBarButton("","record-p rofile-status-bar-item");this.recordButton.addEventListener("click",this.toggleR ecordButton,this);this._statusBarButtons.push(this.recordButton);this.clearResul tsButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profi les."),"clear-status-bar-item");this.clearResultsButton.addEventListener("click" ,this._clearProfiles,this);this._statusBarButtons.push(this.clearResultsButton); this._profileTypeStatusBarItemsContainer=document.createElement("div");this._pro fileTypeStatusBarItemsContainer.className="status-bar-items";this._profileViewSt atusBarItemsContainer=document.createElement("div");this._profileViewStatusBarIt emsContainer.className="status-bar-items";if(singleProfileMode){this._launcherVi ew=this._createLauncherView();this._registerProfileType((type));this._selectedPr ofileType=type;this._updateProfileTypeSpecificUI();}else{this._launcherView=new WebInspector.MultiProfileLauncherView(this);this._launcherView.addEventListener( WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,this._onPro fileTypeSelected,this);this._registerProfileType(new WebInspector.CPUProfileType ());this._registerProfileType(new WebInspector.HeapSnapshotProfileType());this._ registerProfileType(new WebInspector.TrackingHeapSnapshotProfileType(this));if(! WebInspector.WorkerManager.isWorkerFrontend()&&WebInspector.experimentsSettings. canvasInspection.isEnabled()) 54 {var singleProfileMode=typeof name!=="undefined";name=name||"profiles";WebInspec tor.Panel.call(this,name);this.registerRequiredCSS("panelEnablerView.css");this. registerRequiredCSS("heapProfiler.css");this.registerRequiredCSS("profilesPanel. css");this.createSidebarViewWithTree();this.profilesItemTreeElement=new WebInspe ctor.ProfilesSidebarTreeElement(this);this.sidebarTree.appendChild(this.profiles ItemTreeElement);this._singleProfileMode=singleProfileMode;this._profileTypesByI dMap={};this.profileViews=document.createElement("div");this.profileViews.id="pr ofile-views";this.splitView.mainElement.appendChild(this.profileViews);this._sta tusBarButtons=[];this.recordButton=new WebInspector.StatusBarButton("","record-p rofile-status-bar-item");this.recordButton.addEventListener("click",this.toggleR ecordButton,this);this._statusBarButtons.push(this.recordButton);this.clearResul tsButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profi les."),"clear-status-bar-item");this.clearResultsButton.addEventListener("click" ,this._clearProfiles,this);this._statusBarButtons.push(this.clearResultsButton); this._profileTypeStatusBarItemsContainer=document.createElement("div");this._pro fileTypeStatusBarItemsContainer.className="status-bar-items";this._profileViewSt atusBarItemsContainer=document.createElement("div");this._profileViewStatusBarIt emsContainer.className="status-bar-items";if(singleProfileMode){this._launcherVi ew=this._createLauncherView();this._registerProfileType((type));this._selectedPr ofileType=type;this._updateProfileTypeSpecificUI();}else{this._launcherView=new WebInspector.MultiProfileLauncherView(this);this._launcherView.addEventListener( WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,this._onPro fileTypeSelected,this);this._registerProfileType(new WebInspector.CPUProfileType ());this._registerProfileType(new WebInspector.HeapSnapshotProfileType());this._ registerProfileType(new WebInspector.TrackingHeapSnapshotProfileType(this));if(! WebInspector.WorkerManager.isWorkerFrontend()&&WebInspector.experimentsSettings. canvasInspection.isEnabled())
55 this._registerProfileType(new WebInspector.CanvasProfileType());} 55 this._registerProfileType(new WebInspector.CanvasProfileType());}
56 this._profilesWereRequested=false;this._reset();this._createFileSelectorElement( );this.element.addEventListener("contextmenu",this._handleContextMenuEvent.bind( this),true);this._registerShortcuts();WebInspector.ContextMenu.registerProvider( this);} 56 this._profilesWereRequested=false;this._reset();this._createFileSelectorElement( );this.element.addEventListener("contextmenu",this._handleContextMenuEvent.bind( this),true);this._registerShortcuts();WebInspector.ContextMenu.registerProvider( this);this._configureCpuProfilerSamplingInterval();WebInspector.settings.highRes olutionCpuProfiling.addChangeListener(this._configureCpuProfilerSamplingInterval ,this);}
57 WebInspector.ProfilesPanel.prototype={_createFileSelectorElement:function() 57 WebInspector.ProfilesPanel.prototype={_createFileSelectorElement:function()
58 {if(this._fileSelectorElement) 58 {if(this._fileSelectorElement)
59 this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=We bInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element .appendChild(this._fileSelectorElement);},_createLauncherView:function() 59 this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=We bInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element .appendChild(this._fileSelectorElement);},_createLauncherView:function()
60 {return new WebInspector.ProfileLauncherView(this);},_findProfileTypeByExtension :function(fileName) 60 {return new WebInspector.ProfileLauncherView(this);},_findProfileTypeByExtension :function(fileName)
61 {for(var id in this._profileTypesByIdMap){var type=this._profileTypesByIdMap[id] ;var extension=type.fileExtension();if(!extension) 61 {for(var id in this._profileTypesByIdMap){var type=this._profileTypesByIdMap[id] ;var extension=type.fileExtension();if(!extension)
62 continue;if(fileName.endsWith(type.fileExtension())) 62 continue;if(fileName.endsWith(type.fileExtension()))
63 return type;} 63 return type;}
64 return null;},_registerShortcuts:function() 64 return null;},_registerShortcuts:function()
65 {this.registerShortcuts(WebInspector.ProfilesPanelDescriptor.ShortcutKeys.StartS topRecording,this.toggleRecordButton.bind(this));},_loadFromFile:function(file) 65 {this.registerShortcuts(WebInspector.ProfilesPanelDescriptor.ShortcutKeys.StartS topRecording,this.toggleRecordButton.bind(this));},_configureCpuProfilerSampling Interval:function()
66 {var intervalUs=WebInspector.settings.highResolutionCpuProfiling.get()?100:1000; ProfilerAgent.setSamplingInterval(intervalUs,didChangeInterval.bind(this));funct ion didChangeInterval(error)
67 {if(error)
68 WebInspector.showErrorMessage(error)}},_loadFromFile:function(file)
66 {this._createFileSelectorElement();var profileType=this._findProfileTypeByExtens ion(file.name);if(!profileType){var extensions=[];for(var id in this._profileTyp esByIdMap){var extension=this._profileTypesByIdMap[id].fileExtension();if(!exten sion) 69 {this._createFileSelectorElement();var profileType=this._findProfileTypeByExtens ion(file.name);if(!profileType){var extensions=[];for(var id in this._profileTyp esByIdMap){var extension=this._profileTypesByIdMap[id].fileExtension();if(!exten sion)
67 continue;extensions.push(extension);} 70 continue;extensions.push(extension);}
68 WebInspector.log(WebInspector.UIString("Can't load file. Only files with extensi ons '%s' can be loaded.",extensions.join("', '")));return;} 71 WebInspector.log(WebInspector.UIString("Can't load file. Only files with extensi ons '%s' can be loaded.",extensions.join("', '")));return;}
69 if(!!profileType.findTemporaryProfile()){WebInspector.log(WebInspector.UIString( "Can't load profile when other profile is recording."));return;} 72 if(!!profileType.findTemporaryProfile()){WebInspector.log(WebInspector.UIString( "Can't load profile when other profile is recording."));return;}
70 var temporaryProfile=profileType.createTemporaryProfile(WebInspector.ProfilesPan elDescriptor.UserInitiatedProfileName+"."+file.name);temporaryProfile.setFromFil e();profileType.addProfile(temporaryProfile);temporaryProfile.loadFromFile(file) ;},get statusBarItems() 73 var temporaryProfile=profileType.createTemporaryProfile(WebInspector.ProfilesPan elDescriptor.UserInitiatedProfileName+"."+file.name);temporaryProfile.setFromFil e();profileType.addProfile(temporaryProfile);temporaryProfile.loadFromFile(file) ;},get statusBarItems()
71 {return this._statusBarButtons.select("element").concat(this._profileTypeStatusB arItemsContainer,this._profileViewStatusBarItemsContainer);},toggleRecordButton: function(event) 74 {return this._statusBarButtons.select("element").concat(this._profileTypeStatusB arItemsContainer,this._profileViewStatusBarItemsContainer);},toggleRecordButton: function(event)
72 {var isProfiling=this._selectedProfileType.buttonClicked();this.setRecordingProf ile(this._selectedProfileType.id,isProfiling);return true;},_populateAllProfiles :function() 75 {var isProfiling=this._selectedProfileType.buttonClicked();this.setRecordingProf ile(this._selectedProfileType.id,isProfiling);return true;},_populateAllProfiles :function()
73 {if(this._profilesWereRequested) 76 {if(this._profilesWereRequested)
74 return;this._profilesWereRequested=true;for(var typeId in this._profileTypesById Map) 77 return;this._profilesWereRequested=true;for(var typeId in this._profileTypesById Map)
75 this._profileTypesByIdMap[typeId]._populateProfiles();},wasShown:function() 78 this._profileTypesByIdMap[typeId]._populateProfiles();},wasShown:function()
(...skipping 11 matching lines...) Expand all
87 {this._profileTypesByIdMap[profileType.id]=profileType;this._launcherView.addPro fileType(profileType);profileType.treeElement=new WebInspector.SidebarSectionTre eElement(profileType.treeItemTitle,null,true);profileType.treeElement.hidden=!th is._singleProfileMode;this.sidebarTree.appendChild(profileType.treeElement);prof ileType.treeElement.childrenListElement.addEventListener("contextmenu",this._han dleContextMenuEvent.bind(this),true);function onAddProfileHeader(event) 90 {this._profileTypesByIdMap[profileType.id]=profileType;this._launcherView.addPro fileType(profileType);profileType.treeElement=new WebInspector.SidebarSectionTre eElement(profileType.treeItemTitle,null,true);profileType.treeElement.hidden=!th is._singleProfileMode;this.sidebarTree.appendChild(profileType.treeElement);prof ileType.treeElement.childrenListElement.addEventListener("contextmenu",this._han dleContextMenuEvent.bind(this),true);function onAddProfileHeader(event)
88 {this._addProfileHeader(event.data);} 91 {this._addProfileHeader(event.data);}
89 function onRemoveProfileHeader(event) 92 function onRemoveProfileHeader(event)
90 {this._removeProfileHeader(event.data);} 93 {this._removeProfileHeader(event.data);}
91 function onProgressUpdated(event) 94 function onProgressUpdated(event)
92 {this._reportProfileProgress(event.data.profile,event.data.done,event.data.total );} 95 {this._reportProfileProgress(event.data.profile,event.data.done,event.data.total );}
93 profileType.addEventListener(WebInspector.ProfileType.Events.ViewUpdated,this._u pdateProfileTypeSpecificUI,this);profileType.addEventListener(WebInspector.Profi leType.Events.AddProfileHeader,onAddProfileHeader,this);profileType.addEventList ener(WebInspector.ProfileType.Events.RemoveProfileHeader,onRemoveProfileHeader,t his);profileType.addEventListener(WebInspector.ProfileType.Events.ProgressUpdate d,onProgressUpdated,this);},_handleContextMenuEvent:function(event) 96 profileType.addEventListener(WebInspector.ProfileType.Events.ViewUpdated,this._u pdateProfileTypeSpecificUI,this);profileType.addEventListener(WebInspector.Profi leType.Events.AddProfileHeader,onAddProfileHeader,this);profileType.addEventList ener(WebInspector.ProfileType.Events.RemoveProfileHeader,onRemoveProfileHeader,t his);profileType.addEventListener(WebInspector.ProfileType.Events.ProgressUpdate d,onProgressUpdated,this);},_handleContextMenuEvent:function(event)
94 {var element=event.srcElement;while(element&&!element.treeElement&&element!==thi s.element) 97 {var element=event.srcElement;while(element&&!element.treeElement&&element!==thi s.element)
95 element=element.parentElement;if(!element) 98 element=element.parentElement;if(!element)
96 return;if(element.treeElement&&element.treeElement.handleContextMenuEvent){eleme nt.treeElement.handleContextMenuEvent(event,this);return;} 99 return;if(element.treeElement&&element.treeElement.handleContextMenuEvent){eleme nt.treeElement.handleContextMenuEvent(event,this);return;}
97 if(element!==this.element||event.srcElement===this.sidebarElement){var contextMe nu=new WebInspector.ContextMenu(event);if(this.visibleView instanceof WebInspect or.HeapSnapshotView) 100 var contextMenu=new WebInspector.ContextMenu(event);if(this.visibleView instance of WebInspector.HeapSnapshotView){this.visibleView.populateContextMenu(contextMe nu,event);}
98 this.visibleView.populateContextMenu(contextMenu,event);contextMenu.appendItem(W ebInspector.UIString("Load\u2026"),this._fileSelectorElement.click.bind(this._fi leSelectorElement));contextMenu.show();}},_makeTitleKey:function(text,profileTyp eId) 101 if(element!==this.element||event.srcElement===this.sidebarElement){contextMenu.a ppendItem(WebInspector.UIString("Load\u2026"),this._fileSelectorElement.click.bi nd(this._fileSelectorElement));}
102 contextMenu.show();},_makeTitleKey:function(text,profileTypeId)
99 {return escape(text)+'/'+escape(profileTypeId);},_addProfileHeader:function(prof ile) 103 {return escape(text)+'/'+escape(profileTypeId);},_addProfileHeader:function(prof ile)
100 {var profileType=profile.profileType();var typeId=profileType.id;var sidebarPare nt=profileType.treeElement;sidebarParent.hidden=false;var small=false;var altern ateTitle;if(!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(profile .title)&&!profile.isTemporary){var profileTitleKey=this._makeTitleKey(profile.ti tle,typeId);if(!(profileTitleKey in this._profileGroups)) 104 {var profileType=profile.profileType();var typeId=profileType.id;var sidebarPare nt=profileType.treeElement;sidebarParent.hidden=false;var small=false;var altern ateTitle;if(!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(profile .title)&&!profile.isTemporary){var profileTitleKey=this._makeTitleKey(profile.ti tle,typeId);if(!(profileTitleKey in this._profileGroups))
101 this._profileGroups[profileTitleKey]=[];var group=this._profileGroups[profileTit leKey];group.push(profile);if(group.length===2){group._profilesTreeElement=new W ebInspector.ProfileGroupSidebarTreeElement(this,profile.title);var index=sidebar Parent.children.indexOf(group[0]._profilesTreeElement);sidebarParent.insertChild (group._profilesTreeElement,index);var selected=group[0]._profilesTreeElement.se lected;sidebarParent.removeChild(group[0]._profilesTreeElement);group._profilesT reeElement.appendChild(group[0]._profilesTreeElement);if(selected) 105 this._profileGroups[profileTitleKey]=[];var group=this._profileGroups[profileTit leKey];group.push(profile);if(group.length===2){group._profilesTreeElement=new W ebInspector.ProfileGroupSidebarTreeElement(this,profile.title);var index=sidebar Parent.children.indexOf(group[0]._profilesTreeElement);sidebarParent.insertChild (group._profilesTreeElement,index);var selected=group[0]._profilesTreeElement.se lected;sidebarParent.removeChild(group[0]._profilesTreeElement);group._profilesT reeElement.appendChild(group[0]._profilesTreeElement);if(selected)
102 group[0]._profilesTreeElement.revealAndSelect();group[0]._profilesTreeElement.sm all=true;group[0]._profilesTreeElement.mainTitle=WebInspector.UIString("Run %d", 1);this.sidebarTreeElement.addStyleClass("some-expandable");} 106 group[0]._profilesTreeElement.revealAndSelect();group[0]._profilesTreeElement.sm all=true;group[0]._profilesTreeElement.mainTitle=WebInspector.UIString("Run %d", 1);this.sidebarTreeElement.addStyleClass("some-expandable");}
103 if(group.length>=2){sidebarParent=group._profilesTreeElement;alternateTitle=WebI nspector.UIString("Run %d",group.length);small=true;}} 107 if(group.length>=2){sidebarParent=group._profilesTreeElement;alternateTitle=WebI nspector.UIString("Run %d",group.length);small=true;}}
104 var profileTreeElement=profile.createSidebarTreeElement();profile.sidebarElement =profileTreeElement;profileTreeElement.small=small;if(alternateTitle) 108 var profileTreeElement=profile.createSidebarTreeElement();profile.sidebarElement =profileTreeElement;profileTreeElement.small=small;if(alternateTitle)
105 profileTreeElement.mainTitle=alternateTitle;profile._profilesTreeElement=profile TreeElement;var temporaryProfile=profileType.findTemporaryProfile();if(profile.i sTemporary||!temporaryProfile) 109 profileTreeElement.mainTitle=alternateTitle;profile._profilesTreeElement=profile TreeElement;var temporaryProfile=profileType.findTemporaryProfile();if(profile.i sTemporary||!temporaryProfile)
106 sidebarParent.appendChild(profileTreeElement);else{if(temporaryProfile){sidebarP arent.insertBeforeChild(profileTreeElement,temporaryProfile._profilesTreeElement );this._removeTemporaryProfile(profile.profileType().id);} 110 sidebarParent.appendChild(profileTreeElement);else{if(temporaryProfile){sidebarP arent.insertBeforeChild(profileTreeElement,temporaryProfile._profilesTreeElement );this._removeTemporaryProfile(profile.profileType().id);}
107 if(!this.visibleView||this.visibleView===this._launcherView) 111 if(!this.visibleView||this.visibleView===this._launcherView)
108 this._showProfile(profile);this.dispatchEventToListeners("profile added",{type:t ypeId});}},_removeProfileHeader:function(profile) 112 this._showProfile(profile);this.dispatchEventToListeners("profile added",{type:t ypeId});}},_removeProfileHeader:function(profile)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 {WebInspector.ProfilesPanel.call(this,"cpu-profiler",new WebInspector.CPUProfile Type());} 222 {WebInspector.ProfilesPanel.call(this,"cpu-profiler",new WebInspector.CPUProfile Type());}
219 WebInspector.CPUProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel.pr ototype} 223 WebInspector.CPUProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel.pr ototype}
220 WebInspector.HeapProfilerPanel=function() 224 WebInspector.HeapProfilerPanel=function()
221 {var heapSnapshotProfileType=new WebInspector.HeapSnapshotProfileType();WebInspe ctor.ProfilesPanel.call(this,"heap-profiler",heapSnapshotProfileType);this._sing leProfileMode=false;this._registerProfileType(new WebInspector.TrackingHeapSnaps hotProfileType(this));this._launcherView.addEventListener(WebInspector.MultiProf ileLauncherView.EventTypes.ProfileTypeSelected,this._onProfileTypeSelected,this) ;this._launcherView._profileTypeChanged(heapSnapshotProfileType);} 225 {var heapSnapshotProfileType=new WebInspector.HeapSnapshotProfileType();WebInspe ctor.ProfilesPanel.call(this,"heap-profiler",heapSnapshotProfileType);this._sing leProfileMode=false;this._registerProfileType(new WebInspector.TrackingHeapSnaps hotProfileType(this));this._launcherView.addEventListener(WebInspector.MultiProf ileLauncherView.EventTypes.ProfileTypeSelected,this._onProfileTypeSelected,this) ;this._launcherView._profileTypeChanged(heapSnapshotProfileType);}
222 WebInspector.HeapProfilerPanel.prototype={_createLauncherView:function() 226 WebInspector.HeapProfilerPanel.prototype={_createLauncherView:function()
223 {return new WebInspector.MultiProfileLauncherView(this);},__proto__:WebInspector .ProfilesPanel.prototype} 227 {return new WebInspector.MultiProfileLauncherView(this);},__proto__:WebInspector .ProfilesPanel.prototype}
224 WebInspector.CanvasProfilerPanel=function() 228 WebInspector.CanvasProfilerPanel=function()
225 {WebInspector.ProfilesPanel.call(this,"canvas-profiler",new WebInspector.CanvasP rofileType());} 229 {WebInspector.ProfilesPanel.call(this,"canvas-profiler",new WebInspector.CanvasP rofileType());}
226 WebInspector.CanvasProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel .prototype} 230 WebInspector.CanvasProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel .prototype}
227 WebInspector.ProfileDataGridNode=function(profileNode,owningTree,hasChildren) 231 WebInspector.ProfileDataGridNode=function(profileNode,owningTree,hasChildren)
228 {this.profileNode=profileNode;WebInspector.DataGridNode.call(this,null,hasChildr en);this.tree=owningTree;this.childrenByCallUID={};this.lastComparator=null;this .callUID=profileNode.callUID;this.selfTime=profileNode.selfTime;this.totalTime=p rofileNode.totalTime;this.functionName=profileNode.functionName;this.url=profile Node.url;} 232 {this.profileNode=profileNode;WebInspector.DataGridNode.call(this,null,hasChildr en);this.tree=owningTree;this.childrenByCallUID={};this.lastComparator=null;this .callUID=profileNode.callUID;this.selfTime=profileNode.selfTime;this.totalTime=p rofileNode.totalTime;this.functionName=profileNode.functionName;this._deoptReaso n=(!profileNode.deoptReason||profileNode.deoptReason==="no reason")?"":profileNo de.deoptReason;this.url=profileNode.url;}
229 WebInspector.ProfileDataGridNode.prototype={get data() 233 WebInspector.ProfileDataGridNode.prototype={get data()
230 {function formatMilliseconds(time) 234 {function formatMilliseconds(time)
231 {return WebInspector.UIString("%.0f\u2009ms",time);} 235 {return WebInspector.UIString("%.0f\u2009ms",time);}
232 var data={};data["function"]=this.functionName;if(this.tree.profileView.showSelf TimeAsPercent.get()) 236 var data={};if(this._deoptReason){var div=document.createElement("div");var mark er=div.createChild("span");marker.className="profile-warn-marker";marker.title=W ebInspector.UIString("Not optimized: %s",this._deoptReason);var functionName=div .createChild("span");functionName.textContent=this.functionName;data["function"] =div;}else
237 data["function"]=this.functionName;if(this.tree.profileView.showSelfTimeAsPercen t.get())
233 data["self"]=WebInspector.UIString("%.2f%",this.selfPercent);else 238 data["self"]=WebInspector.UIString("%.2f%",this.selfPercent);else
234 data["self"]=formatMilliseconds(this.selfTime);if(this.tree.profileView.showTota lTimeAsPercent.get()) 239 data["self"]=formatMilliseconds(this.selfTime);if(this.tree.profileView.showTota lTimeAsPercent.get())
235 data["total"]=WebInspector.UIString("%.2f%",this.totalPercent);else 240 data["total"]=WebInspector.UIString("%.2f%",this.totalPercent);else
236 data["total"]=formatMilliseconds(this.totalTime);return data;},createCell:functi on(columnIdentifier) 241 data["total"]=formatMilliseconds(this.totalTime);return data;},createCell:functi on(columnIdentifier)
237 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier==="self"&&this._searchMatchedSelfColumn) 242 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier==="self"&&this._searchMatchedSelfColumn)
238 cell.addStyleClass("highlight");else if(columnIdentifier==="total"&&this._search MatchedTotalColumn) 243 cell.addStyleClass("highlight");else if(columnIdentifier==="total"&&this._search MatchedTotalColumn)
239 cell.addStyleClass("highlight");if(columnIdentifier!=="function") 244 cell.addStyleClass("highlight");if(columnIdentifier!=="function")
240 return cell;if(this.profileNode._searchMatchedFunctionColumn) 245 return cell;if(this._deoptReason)
246 cell.addStyleClass("not-optimized");if(this.profileNode._searchMatchedFunctionCo lumn)
241 cell.addStyleClass("highlight");if(this.profileNode.url){var lineNumber=this.pro fileNode.lineNumber?this.profileNode.lineNumber-1:0;var urlElement=this.tree.pro fileView._linkifier.linkifyLocation(this.profileNode.url,lineNumber,0,"profile-n ode-file");urlElement.style.maxWidth="75%";cell.insertBefore(urlElement,cell.fir stChild);} 247 cell.addStyleClass("highlight");if(this.profileNode.url){var lineNumber=this.pro fileNode.lineNumber?this.profileNode.lineNumber-1:0;var urlElement=this.tree.pro fileView._linkifier.linkifyLocation(this.profileNode.url,lineNumber,0,"profile-n ode-file");urlElement.style.maxWidth="75%";cell.insertBefore(urlElement,cell.fir stChild);}
242 return cell;},select:function(supressSelectedEvent) 248 return cell;},select:function(supressSelectedEvent)
243 {WebInspector.DataGridNode.prototype.select.call(this,supressSelectedEvent);this .tree.profileView._dataGridNodeSelected(this);},deselect:function(supressDeselec tedEvent) 249 {WebInspector.DataGridNode.prototype.select.call(this,supressSelectedEvent);this .tree.profileView._dataGridNodeSelected(this);},deselect:function(supressDeselec tedEvent)
244 {WebInspector.DataGridNode.prototype.deselect.call(this,supressDeselectedEvent); this.tree.profileView._dataGridNodeDeselected(this);},sort:function(comparator,f orce) 250 {WebInspector.DataGridNode.prototype.deselect.call(this,supressDeselectedEvent); this.tree.profileView._dataGridNodeDeselected(this);},sort:function(comparator,f orce)
245 {var gridNodeGroups=[[this]];for(var gridNodeGroupIndex=0;gridNodeGroupIndex<gri dNodeGroups.length;++gridNodeGroupIndex){var gridNodes=gridNodeGroups[gridNodeGr oupIndex];var count=gridNodes.length;for(var index=0;index<count;++index){var gr idNode=gridNodes[index];if(!force&&(!gridNode.expanded||gridNode.lastComparator= ==comparator)){if(gridNode.children.length) 251 {var gridNodeGroups=[[this]];for(var gridNodeGroupIndex=0;gridNodeGroupIndex<gri dNodeGroups.length;++gridNodeGroupIndex){var gridNodes=gridNodeGroups[gridNodeGr oupIndex];var count=gridNodes.length;for(var index=0;index<count;++index){var gr idNode=gridNodes[index];if(!force&&(!gridNode.expanded||gridNode.lastComparator= ==comparator)){if(gridNode.children.length)
246 gridNode.shouldRefreshChildren=true;continue;} 252 gridNode.shouldRefreshChildren=true;continue;}
247 gridNode.lastComparator=comparator;var children=gridNode.children;var childCount =children.length;if(childCount){children.sort(comparator);for(var childIndex=0;c hildIndex<childCount;++childIndex) 253 gridNode.lastComparator=comparator;var children=gridNode.children;var childCount =children.length;if(childCount){children.sort(comparator);for(var childIndex=0;c hildIndex<childCount;++childIndex)
248 children[childIndex]._recalculateSiblings(childIndex);gridNodeGroups.push(childr en);}}}},insertChild:function(profileDataGridNode,index) 254 children[childIndex]._recalculateSiblings(childIndex);gridNodeGroups.push(childr en);}}}},insertChild:function(profileDataGridNode,index)
249 {WebInspector.DataGridNode.prototype.insertChild.call(this,profileDataGridNode,i ndex);this.childrenByCallUID[profileDataGridNode.callUID]=profileDataGridNode;}, removeChild:function(profileDataGridNode) 255 {WebInspector.DataGridNode.prototype.insertChild.call(this,profileDataGridNode,i ndex);this.childrenByCallUID[profileDataGridNode.callUID]=profileDataGridNode;}, removeChild:function(profileDataGridNode)
250 {WebInspector.DataGridNode.prototype.removeChild.call(this,profileDataGridNode); delete this.childrenByCallUID[profileDataGridNode.callUID];},removeChildren:func tion() 256 {WebInspector.DataGridNode.prototype.removeChild.call(this,profileDataGridNode); delete this.childrenByCallUID[profileDataGridNode.callUID];},removeChildren:func tion()
(...skipping 30 matching lines...) Expand all
281 children[index]._restore();this._savedChildren=null;}} 287 children[index]._restore();this._savedChildren=null;}}
282 WebInspector.ProfileDataGridTree.propertyComparators=[{},{}];WebInspector.Profil eDataGridTree.propertyComparator=function(property,isAscending) 288 WebInspector.ProfileDataGridTree.propertyComparators=[{},{}];WebInspector.Profil eDataGridTree.propertyComparator=function(property,isAscending)
283 {var comparator=WebInspector.ProfileDataGridTree.propertyComparators[(isAscendin g?1:0)][property];if(!comparator){if(isAscending){comparator=function(lhs,rhs) 289 {var comparator=WebInspector.ProfileDataGridTree.propertyComparators[(isAscendin g?1:0)][property];if(!comparator){if(isAscending){comparator=function(lhs,rhs)
284 {if(lhs[property]<rhs[property]) 290 {if(lhs[property]<rhs[property])
285 return-1;if(lhs[property]>rhs[property]) 291 return-1;if(lhs[property]>rhs[property])
286 return 1;return 0;}}else{comparator=function(lhs,rhs) 292 return 1;return 0;}}else{comparator=function(lhs,rhs)
287 {if(lhs[property]>rhs[property]) 293 {if(lhs[property]>rhs[property])
288 return-1;if(lhs[property]<rhs[property]) 294 return-1;if(lhs[property]<rhs[property])
289 return 1;return 0;}} 295 return 1;return 0;}}
290 WebInspector.ProfileDataGridTree.propertyComparators[(isAscending?1:0)][property ]=comparator;} 296 WebInspector.ProfileDataGridTree.propertyComparators[(isAscending?1:0)][property ]=comparator;}
291 return comparator;};WebInspector.BottomUpProfileDataGridNode=function(profileNod e,owningTree) 297 return comparator;};WebInspector.AllocationProfile=function(profile)
298 {this._strings=profile.strings;this._nextNodeId=1;this._idToFunctionInfo={};this ._idToNode={};this._collapsedTopNodeIdToFunctionInfo={};this._traceTops=null;thi s._buildAllocationFunctionInfos(profile.trace_function_infos);this._traceTree=th is._buildInvertedAllocationTree(profile.trace_tree);}
299 WebInspector.AllocationProfile.prototype={_buildAllocationFunctionInfos:function (rawInfos)
300 {var strings=this._strings;var functionIdOffset=0;var functionNameOffset=1;var s criptNameOffset=2;var functionInfoFieldCount=3;var map=this._idToFunctionInfo;ma p[0]=new WebInspector.FunctionAllocationInfo("(root)","<unknown>");var infoLengt h=rawInfos.length;for(var i=0;i<infoLength;i+=functionInfoFieldCount){map[rawInf os[i+functionIdOffset]]=new WebInspector.FunctionAllocationInfo(strings[rawInfos [i+functionNameOffset]],strings[rawInfos[i+scriptNameOffset]]);}},_buildInverted AllocationTree:function(traceTreeRaw)
301 {var idToFunctionInfo=this._idToFunctionInfo;var nodeIdOffset=0;var functionIdOf fset=1;var allocationCountOffset=2;var allocationSizeOffset=3;var childrenOffset =4;var nodeFieldCount=5;function traverseNode(rawNodeArray,nodeOffset,parent)
302 {var functionInfo=idToFunctionInfo[rawNodeArray[nodeOffset+functionIdOffset]];va r result=new WebInspector.AllocationTraceNode(rawNodeArray[nodeOffset+nodeIdOffs et],functionInfo,rawNodeArray[nodeOffset+allocationCountOffset],rawNodeArray[nod eOffset+allocationSizeOffset],parent);functionInfo.addTraceTopNode(result);var r awChildren=rawNodeArray[nodeOffset+childrenOffset];for(var i=0;i<rawChildren.len gth;i+=nodeFieldCount){result.children.push(traverseNode(rawChildren,i,result)); }
303 return result;}
304 return traverseNode(traceTreeRaw,0,null);},serializeTraceTops:function()
305 {if(this._traceTops)
306 return this._traceTops;var result=this._traceTops=[];var idToFunctionInfo=this._ idToFunctionInfo;for(var id in idToFunctionInfo){var info=idToFunctionInfo[id];i f(info.totalCount===0)
307 continue;var nodeId=this._nextNodeId++;result.push(this._serializeNode(nodeId,in fo.functionName,info.totalCount,info.totalSize,true));this._collapsedTopNodeIdTo FunctionInfo[nodeId]=info;}
308 return result;},serializeCallers:function(nodeId)
309 {var node=this._idToNode[nodeId];if(!node){var functionInfo=this._collapsedTopNo deIdToFunctionInfo[nodeId];node=functionInfo.tracesWithThisTop();delete this._co llapsedTopNodeIdToFunctionInfo[nodeId];this._idToNode[nodeId]=node;}
310 var result=[];var callers=node.callers();for(var i=0;i<callers.length;i++){var c allerNode=callers[i];var callerId=this._nextNodeId++;this._idToNode[callerId]=ca llerNode;result.push(this._serializeNode(callerId,callerNode.functionInfo.functi onName,callerNode.allocationCount,callerNode.allocationSize,callerNode.hasCaller s()));}
311 return result;},_serializeNode:function(nodeId,functionName,count,size,hasChildr en)
312 {return{id:nodeId,name:functionName,count:count,size:size,hasChildren:hasChildre n};}}
313 WebInspector.AllocationTraceNode=function(id,functionInfo,count,size,parent)
314 {this.id=id;this.functionInfo=functionInfo;this.allocationCount=count;this.alloc ationSize=size;this.parent=parent;this.children=[];}
315 WebInspector.AllocationBackTraceNode=function(functionInfo)
316 {this.functionInfo=functionInfo;this.allocationCount=0;this.allocationSize=0;thi s._callers=[];}
317 WebInspector.AllocationBackTraceNode.prototype={addCaller:function(traceNode)
318 {var functionInfo=traceNode.functionInfo;var result;for(var i=0;i<this._callers. length;i++){var caller=this._callers[i];if(caller.functionInfo===functionInfo){r esult=caller;break;}}
319 if(!result){result=new WebInspector.AllocationBackTraceNode(functionInfo);this._ callers.push(result);}
320 return result;},callers:function()
321 {return this._callers;},hasCallers:function()
322 {return this._callers.length>0;}}
323 WebInspector.FunctionAllocationInfo=function(functionName,scriptName)
324 {this.functionName=functionName;this.scriptName=scriptName;this.totalCount=0;thi s.totalSize=0;this._traceTops=[];}
325 WebInspector.FunctionAllocationInfo.prototype={addTraceTopNode:function(node)
326 {if(node.allocationCount===0)
327 return;this._traceTops.push(node);this.totalCount+=node.allocationCount;this.tot alSize+=node.allocationSize;},tracesWithThisTop:function()
328 {if(!this._traceTops.length)
329 return null;if(!this._backTraceTree)
330 this._buildAllocationTraceTree();return this._backTraceTree;},_buildAllocationTr aceTree:function()
331 {this._backTraceTree=new WebInspector.AllocationBackTraceNode(this._traceTops[0] .functionInfo);for(var i=0;i<this._traceTops.length;i++){var node=this._traceTop s[i];var backTraceNode=this._backTraceTree;var count=node.allocationCount;var si ze=node.allocationSize;while(true){backTraceNode.allocationCount+=count;backTrac eNode.allocationSize+=size;node=node.parent;if(node===null){break;}
332 backTraceNode=backTraceNode.addCaller(node);}}}};WebInspector.BottomUpProfileDat aGridNode=function(profileNode,owningTree)
292 {WebInspector.ProfileDataGridNode.call(this,profileNode,owningTree,this._willHav eChildren(profileNode));this._remainingNodeInfos=[];} 333 {WebInspector.ProfileDataGridNode.call(this,profileNode,owningTree,this._willHav eChildren(profileNode));this._remainingNodeInfos=[];}
293 WebInspector.BottomUpProfileDataGridNode.prototype={_takePropertiesFromProfileDa taGridNode:function(profileDataGridNode) 334 WebInspector.BottomUpProfileDataGridNode.prototype={_takePropertiesFromProfileDa taGridNode:function(profileDataGridNode)
294 {this._save();this.selfTime=profileDataGridNode.selfTime;this.totalTime=profileD ataGridNode.totalTime;},_keepOnlyChild:function(child) 335 {this._save();this.selfTime=profileDataGridNode.selfTime;this.totalTime=profileD ataGridNode.totalTime;},_keepOnlyChild:function(child)
295 {this._save();this.removeChildren();this.appendChild(child);},_exclude:function( aCallUID) 336 {this._save();this.removeChildren();this.appendChild(child);},_exclude:function( aCallUID)
296 {if(this._remainingNodeInfos) 337 {if(this._remainingNodeInfos)
297 this.populate();this._save();var children=this.children;var index=this.children. length;while(index--) 338 this.populate();this._save();var children=this.children;var index=this.children. length;while(index--)
298 children[index]._exclude(aCallUID);var child=this.childrenByCallUID[aCallUID];if (child) 339 children[index]._exclude(aCallUID);var child=this.childrenByCallUID[aCallUID];if (child)
299 this._merge(child,true);},_restore:function() 340 this._merge(child,true);},_restore:function()
300 {WebInspector.ProfileDataGridNode.prototype._restore();if(!this.children.length) 341 {WebInspector.ProfileDataGridNode.prototype._restore();if(!this.children.length)
301 this.hasChildren=this._willHaveChildren(this.profileNode);},_merge:function(chil d,shouldAbsorb) 342 this.hasChildren=this._willHaveChildren(this.profileNode);},_merge:function(chil d,shouldAbsorb)
(...skipping 27 matching lines...) Expand all
329 ProfilerAgent.getCPUProfile(this.profile.uid,this._getCPUProfileCallback.bind(th is));} 370 ProfilerAgent.getCPUProfile(this.profile.uid,this._getCPUProfileCallback.bind(th is));}
330 WebInspector.CPUProfileView._TypeFlame="Flame";WebInspector.CPUProfileView._Type Tree="Tree";WebInspector.CPUProfileView._TypeHeavy="Heavy";WebInspector.CPUProfi leView.prototype={selectRange:function(timeLeft,timeRight) 371 WebInspector.CPUProfileView._TypeFlame="Flame";WebInspector.CPUProfileView._Type Tree="Tree";WebInspector.CPUProfileView._TypeHeavy="Heavy";WebInspector.CPUProfi leView.prototype={selectRange:function(timeLeft,timeRight)
331 {if(!this._flameChart) 372 {if(!this._flameChart)
332 return;this._flameChart.selectRange(timeLeft,timeRight);},_revealProfilerNode:fu nction(event) 373 return;this._flameChart.selectRange(timeLeft,timeRight);},_revealProfilerNode:fu nction(event)
333 {var current=this.profileDataGridTree.children[0];while(current&&current.profile Node!==event.data) 374 {var current=this.profileDataGridTree.children[0];while(current&&current.profile Node!==event.data)
334 current=current.traverseNextNode(false,null,false);if(current) 375 current=current.traverseNextNode(false,null,false);if(current)
335 current.revealAndSelect();},_getCPUProfileCallback:function(error,profile) 376 current.revealAndSelect();},_getCPUProfileCallback:function(error,profile)
336 {if(error) 377 {if(error)
337 return;if(!profile.head){return;} 378 return;if(!profile.head){return;}
338 this._processProfileData(profile);},_processProfileData:function(profile) 379 this._processProfileData(profile);},_processProfileData:function(profile)
339 {this.profileHead=profile.head;this.samples=profile.samples;this._calculateTimes (profile);if(profile.idleTime) 380 {this.profileHead=profile.head;this.samples=profile.samples;this._calculateTimes (profile);this._assignParentsInProfile();if(this.samples)
340 this._injectIdleTimeNode(profile);this._assignParentsInProfile();if(this.samples )
341 this._buildIdToNodeMap();this._changeView();this._updatePercentButton();if(this. _flameChart) 381 this._buildIdToNodeMap();this._changeView();this._updatePercentButton();if(this. _flameChart)
342 this._flameChart.update();},get statusBarItems() 382 this._flameChart.update();},get statusBarItems()
343 {return[this.viewSelectComboBox.element,this._statusBarButtonsElement];},_getBot tomUpProfileDataGridTree:function() 383 {return[this.viewSelectComboBox.element,this._statusBarButtonsElement];},_getBot tomUpProfileDataGridTree:function()
344 {if(!this._bottomUpProfileDataGridTree) 384 {if(!this._bottomUpProfileDataGridTree)
345 this._bottomUpProfileDataGridTree=new WebInspector.BottomUpProfileDataGridTree(t his,this.profileHead);return this._bottomUpProfileDataGridTree;},_getTopDownProf ileDataGridTree:function() 385 this._bottomUpProfileDataGridTree=new WebInspector.BottomUpProfileDataGridTree(t his,this.profileHead);return this._bottomUpProfileDataGridTree;},_getTopDownProf ileDataGridTree:function()
346 {if(!this._topDownProfileDataGridTree) 386 {if(!this._topDownProfileDataGridTree)
347 this._topDownProfileDataGridTree=new WebInspector.TopDownProfileDataGridTree(thi s,this.profileHead);return this._topDownProfileDataGridTree;},willHide:function( ) 387 this._topDownProfileDataGridTree=new WebInspector.TopDownProfileDataGridTree(thi s,this.profileHead);return this._topDownProfileDataGridTree;},willHide:function( )
348 {this._currentSearchResultIndex=-1;},refresh:function() 388 {this._currentSearchResultIndex=-1;},refresh:function()
349 {var selectedProfileNode=this.dataGrid.selectedNode?this.dataGrid.selectedNode.p rofileNode:null;this.dataGrid.rootNode().removeChildren();var children=this.prof ileDataGridTree.children;var count=children.length;for(var index=0;index<count;+ +index) 389 {var selectedProfileNode=this.dataGrid.selectedNode?this.dataGrid.selectedNode.p rofileNode:null;this.dataGrid.rootNode().removeChildren();var children=this.prof ileDataGridTree.children;var count=children.length;for(var index=0;index<count;+ +index)
350 this.dataGrid.rootNode().appendChild(children[index]);if(selectedProfileNode) 390 this.dataGrid.rootNode().appendChild(children[index]);if(selectedProfileNode)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 {return(this._currentSearchResultIndex===0);},showingLastSearchResult:function() 434 {return(this._currentSearchResultIndex===0);},showingLastSearchResult:function()
395 {return(this._searchResults&&this._currentSearchResultIndex===(this._searchResul ts.length-1));},_jumpToSearchResult:function(index) 435 {return(this._searchResults&&this._currentSearchResultIndex===(this._searchResul ts.length-1));},_jumpToSearchResult:function(index)
396 {var searchResult=this._searchResults[index];if(!searchResult) 436 {var searchResult=this._searchResults[index];if(!searchResult)
397 return;var profileNode=searchResult.profileNode;profileNode.revealAndSelect();}, _ensureFlameChartCreated:function() 437 return;var profileNode=searchResult.profileNode;profileNode.revealAndSelect();}, _ensureFlameChartCreated:function()
398 {if(this._flameChart) 438 {if(this._flameChart)
399 return;this._flameChart=new WebInspector.FlameChart(this);this._flameChart.addEv entListener(WebInspector.FlameChart.Events.SelectedNode,this._onSelectedNode.bin d(this));},_onSelectedNode:function(event) 439 return;this._flameChart=new WebInspector.FlameChart(this);this._flameChart.addEv entListener(WebInspector.FlameChart.Events.SelectedNode,this._onSelectedNode.bin d(this));},_onSelectedNode:function(event)
400 {var node=event.data;if(!node||!node.scriptId) 440 {var node=event.data;if(!node||!node.scriptId)
401 return;var script=WebInspector.debuggerModel.scriptForId(node.scriptId) 441 return;var script=WebInspector.debuggerModel.scriptForId(node.scriptId)
402 if(!script) 442 if(!script)
403 return;var uiLocation=script.rawLocationToUILocation(node.lineNumber);if(!uiLoca tion) 443 return;var uiLocation=script.rawLocationToUILocation(node.lineNumber);if(!uiLoca tion)
404 return;WebInspector.showPanel("scripts").showUISourceCode(uiLocation.uiSourceCod e,uiLocation.lineNumber,uiLocation.columnNumber);},_changeView:function() 444 return;WebInspector.showPanel("sources").showUILocation(uiLocation);},_changeVie w:function()
405 {if(!this.profile) 445 {if(!this.profile)
406 return;switch(this.viewSelectComboBox.selectedOption().value){case WebInspector. CPUProfileView._TypeFlame:this._ensureFlameChartCreated();this.dataGrid.detach() ;this._flameChart.show(this.element);this._viewType.set(WebInspector.CPUProfileV iew._TypeFlame);this._statusBarButtonsElement.enableStyleClass("hidden",true);re turn;case WebInspector.CPUProfileView._TypeTree:this.profileDataGridTree=this._g etTopDownProfileDataGridTree();this._sortProfile();this._viewType.set(WebInspect or.CPUProfileView._TypeTree);break;case WebInspector.CPUProfileView._TypeHeavy:t his.profileDataGridTree=this._getBottomUpProfileDataGridTree();this._sortProfile ();this._viewType.set(WebInspector.CPUProfileView._TypeHeavy);break;} 446 return;switch(this.viewSelectComboBox.selectedOption().value){case WebInspector. CPUProfileView._TypeFlame:this._ensureFlameChartCreated();this.dataGrid.detach() ;this._flameChart.show(this.element);this._viewType.set(WebInspector.CPUProfileV iew._TypeFlame);this._statusBarButtonsElement.enableStyleClass("hidden",true);re turn;case WebInspector.CPUProfileView._TypeTree:this.profileDataGridTree=this._g etTopDownProfileDataGridTree();this._sortProfile();this._viewType.set(WebInspect or.CPUProfileView._TypeTree);break;case WebInspector.CPUProfileView._TypeHeavy:t his.profileDataGridTree=this._getBottomUpProfileDataGridTree();this._sortProfile ();this._viewType.set(WebInspector.CPUProfileView._TypeHeavy);break;}
407 this._statusBarButtonsElement.enableStyleClass("hidden",false);if(this._flameCha rt) 447 this._statusBarButtonsElement.enableStyleClass("hidden",false);if(this._flameCha rt)
408 this._flameChart.detach();this.dataGrid.show(this.element);if(!this.currentQuery ||!this._searchFinishedCallback||!this._searchResults) 448 this._flameChart.detach();this.dataGrid.show(this.element);if(!this.currentQuery ||!this._searchFinishedCallback||!this._searchResults)
409 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_percentClicked:funct ion(event) 449 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_percentClicked:funct ion(event)
410 {var currentState=this.showSelfTimeAsPercent.get()&&this.showTotalTimeAsPercent. get()&&this.showAverageTimeAsPercent.get();this.showSelfTimeAsPercent.set(!curre ntState);this.showTotalTimeAsPercent.set(!currentState);this.showAverageTimeAsPe rcent.set(!currentState);this.refreshShowAsPercents();},_updatePercentButton:fun ction() 450 {var currentState=this.showSelfTimeAsPercent.get()&&this.showTotalTimeAsPercent. get()&&this.showAverageTimeAsPercent.get();this.showSelfTimeAsPercent.set(!curre ntState);this.showTotalTimeAsPercent.set(!currentState);this.showAverageTimeAsPe rcent.set(!currentState);this.refreshShowAsPercents();},_updatePercentButton:fun ction()
411 {if(this.showSelfTimeAsPercent.get()&&this.showTotalTimeAsPercent.get()&&this.sh owAverageTimeAsPercent.get()){this.percentButton.title=WebInspector.UIString("Sh ow absolute total and self times.");this.percentButton.toggled=true;}else{this.p ercentButton.title=WebInspector.UIString("Show total and self times as percentag es.");this.percentButton.toggled=false;}},_focusClicked:function(event) 451 {if(this.showSelfTimeAsPercent.get()&&this.showTotalTimeAsPercent.get()&&this.sh owAverageTimeAsPercent.get()){this.percentButton.title=WebInspector.UIString("Sh ow absolute total and self times.");this.percentButton.toggled=true;}else{this.p ercentButton.title=WebInspector.UIString("Show total and self times as percentag es.");this.percentButton.toggled=false;}},_focusClicked:function(event)
412 {if(!this.dataGrid.selectedNode) 452 {if(!this.dataGrid.selectedNode)
413 return;this.resetButton.visible=true;this.profileDataGridTree.focus(this.dataGri d.selectedNode);this.refresh();this.refreshVisibleData();},_excludeClicked:funct ion(event) 453 return;this.resetButton.visible=true;this.profileDataGridTree.focus(this.dataGri d.selectedNode);this.refresh();this.refreshVisibleData();},_excludeClicked:funct ion(event)
414 {var selectedNode=this.dataGrid.selectedNode 454 {var selectedNode=this.dataGrid.selectedNode
415 if(!selectedNode) 455 if(!selectedNode)
416 return;selectedNode.deselect();this.resetButton.visible=true;this.profileDataGri dTree.exclude(selectedNode);this.refresh();this.refreshVisibleData();},_resetCli cked:function(event) 456 return;selectedNode.deselect();this.resetButton.visible=true;this.profileDataGri dTree.exclude(selectedNode);this.refresh();this.refreshVisibleData();},_resetCli cked:function(event)
417 {this.resetButton.visible=false;this.profileDataGridTree.restore();this._linkifi er.reset();this.refresh();this.refreshVisibleData();},_dataGridNodeSelected:func tion(node) 457 {this.resetButton.visible=false;this.profileDataGridTree.restore();this._linkifi er.reset();this.refresh();this.refreshVisibleData();},_dataGridNodeSelected:func tion(node)
418 {this.focusButton.setEnabled(true);this.excludeButton.setEnabled(true);},_dataGr idNodeDeselected:function(node) 458 {this.focusButton.setEnabled(true);this.excludeButton.setEnabled(true);},_dataGr idNodeDeselected:function(node)
419 {this.focusButton.setEnabled(false);this.excludeButton.setEnabled(false);},_sort Profile:function() 459 {this.focusButton.setEnabled(false);this.excludeButton.setEnabled(false);},_sort Profile:function()
420 {var sortAscending=this.dataGrid.isSortOrderAscending();var sortColumnIdentifier =this.dataGrid.sortColumnIdentifier();var sortProperty={"self":"selfTime","total ":"totalTime","function":"functionName"}[sortColumnIdentifier];this.profileDataG ridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator(sortProperty,so rtAscending));this.refresh();},_mouseDownInDataGrid:function(event) 460 {var sortAscending=this.dataGrid.isSortOrderAscending();var sortColumnIdentifier =this.dataGrid.sortColumnIdentifier();var sortProperty={"self":"selfTime","total ":"totalTime","function":"functionName"}[sortColumnIdentifier];this.profileDataG ridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator(sortProperty,so rtAscending));this.refresh();},_mouseDownInDataGrid:function(event)
421 {if(event.detail<2) 461 {if(event.detail<2)
422 return;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell||(!c ell.hasStyleClass("total-column")&&!cell.hasStyleClass("self-column")&&!cell.has StyleClass("average-column"))) 462 return;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell||(!c ell.hasStyleClass("total-column")&&!cell.hasStyleClass("self-column")&&!cell.has StyleClass("average-column")))
423 return;if(cell.hasStyleClass("total-column")) 463 return;if(cell.hasStyleClass("total-column"))
424 this.showTotalTimeAsPercent.set(!this.showTotalTimeAsPercent.get());else if(cell .hasStyleClass("self-column")) 464 this.showTotalTimeAsPercent.set(!this.showTotalTimeAsPercent.get());else if(cell .hasStyleClass("self-column"))
425 this.showSelfTimeAsPercent.set(!this.showSelfTimeAsPercent.get());else if(cell.h asStyleClass("average-column")) 465 this.showSelfTimeAsPercent.set(!this.showSelfTimeAsPercent.get());else if(cell.h asStyleClass("average-column"))
426 this.showAverageTimeAsPercent.set(!this.showAverageTimeAsPercent.get());this.ref reshShowAsPercents();event.consume(true);},_calculateTimes:function(profile) 466 this.showAverageTimeAsPercent.set(!this.showAverageTimeAsPercent.get());this.ref reshShowAsPercents();event.consume(true);},_calculateTimes:function(profile)
427 {function totalHitCount(node){var result=node.hitCount;for(var i=0;i<node.childr en.length;i++) 467 {function totalHitCount(node){var result=node.hitCount;for(var i=0;i<node.childr en.length;i++)
428 result+=totalHitCount(node.children[i]);return result;} 468 result+=totalHitCount(node.children[i]);return result;}
429 profile.totalHitCount=totalHitCount(profile.head);var durationMs=1000*profile.en dTime-1000*profile.startTime;var samplingRate=profile.totalHitCount/durationMs;f unction calculateTimesForNode(node){node.selfTime=node.hitCount*samplingRate;var totalTime=node.selfTime;for(var i=0;i<node.children.length;i++) 469 profile.totalHitCount=totalHitCount(profile.head);var durationMs=1000*(profile.e ndTime-profile.startTime);var samplingInterval=durationMs/profile.totalHitCount; this.samplingIntervalMs=samplingInterval;function calculateTimesForNode(node){no de.selfTime=node.hitCount*samplingInterval;var totalHitCount=node.hitCount;for(v ar i=0;i<node.children.length;i++)
430 totalTime+=calculateTimesForNode(node.children[i]);node.totalTime=totalTime;retu rn totalTime;} 470 totalHitCount+=calculateTimesForNode(node.children[i]);node.totalTime=totalHitCo unt*samplingInterval;return totalHitCount;}
431 calculateTimesForNode(profile.head);},_assignParentsInProfile:function() 471 calculateTimesForNode(profile.head);},_assignParentsInProfile:function()
432 {var head=this.profileHead;head.parent=null;head.head=null;var nodesToTraverse=[ {parent:head,children:head.children}];while(nodesToTraverse.length>0){var pair=n odesToTraverse.pop();var parent=pair.parent;var children=pair.children;var lengt h=children.length;for(var i=0;i<length;++i){children[i].head=head;children[i].pa rent=parent;if(children[i].children.length>0) 472 {var head=this.profileHead;head.parent=null;head.head=null;var nodesToTraverse=[ {parent:head,children:head.children}];while(nodesToTraverse.length>0){var pair=n odesToTraverse.pop();var parent=pair.parent;var children=pair.children;var lengt h=children.length;for(var i=0;i<length;++i){children[i].head=head;children[i].pa rent=parent;if(children[i].children.length>0)
433 nodesToTraverse.push({parent:children[i],children:children[i].children});}}},_bu ildIdToNodeMap:function() 473 nodesToTraverse.push({parent:children[i],children:children[i].children});}}},_bu ildIdToNodeMap:function()
434 {var idToNode=this._idToNode={};var stack=[this.profileHead];while(stack.length) {var node=stack.pop();idToNode[node.id]=node;for(var i=0;i<node.children.length; i++) 474 {var idToNode=this._idToNode={};var stack=[this.profileHead];while(stack.length) {var node=stack.pop();idToNode[node.id]=node;for(var i=0;i<node.children.length; i++)
435 stack.push(node.children[i]);} 475 stack.push(node.children[i]);}
436 var topLevelNodes=this.profileHead.children;for(var i=0;i<topLevelNodes.length;i ++){var node=topLevelNodes[i];if(node.functionName=="(garbage collector)"){this. _gcNode=node;break;}}},_injectIdleTimeNode:function(profile) 476 var topLevelNodes=this.profileHead.children;for(var i=0;i<topLevelNodes.length;i ++){var node=topLevelNodes[i];if(node.functionName=="(garbage collector)"){this. _gcNode=node;break;}}},__proto__:WebInspector.View.prototype}
437 {var idleTime=profile.idleTime;var nodes=profile.head.children;var programNode={ selfTime:0};for(var i=nodes.length-1;i>=0;--i){if(nodes[i].functionName==="(prog ram)"){programNode=nodes[i];break;}}
438 var programTime=programNode.selfTime;if(idleTime>programTime)
439 idleTime=programTime;programTime=programTime-idleTime;programNode.selfTime=progr amTime;programNode.totalTime=programTime;var idleNode={functionName:"(idle)",url :null,lineNumber:0,totalTime:idleTime,selfTime:idleTime,callUID:0,children:[]};n odes.push(idleNode);},__proto__:WebInspector.View.prototype}
440 WebInspector.CPUProfileType=function() 477 WebInspector.CPUProfileType=function()
441 {WebInspector.ProfileType.call(this,WebInspector.CPUProfileType.TypeId,WebInspec tor.UIString("Collect JavaScript CPU Profile"));InspectorBackend.registerProfile rDispatcher(this);this._recording=false;WebInspector.CPUProfileType.instance=thi s;} 478 {WebInspector.ProfileType.call(this,WebInspector.CPUProfileType.TypeId,WebInspec tor.UIString("Collect JavaScript CPU Profile"));InspectorBackend.registerProfile rDispatcher(this);this._recording=false;WebInspector.CPUProfileType.instance=thi s;}
442 WebInspector.CPUProfileType.TypeId="CPU";WebInspector.CPUProfileType.prototype={ fileExtension:function() 479 WebInspector.CPUProfileType.TypeId="CPU";WebInspector.CPUProfileType.prototype={ fileExtension:function()
443 {return".cpuprofile";},get buttonTooltip() 480 {return".cpuprofile";},get buttonTooltip()
444 {return this._recording?WebInspector.UIString("Stop CPU profiling."):WebInspecto r.UIString("Start CPU profiling.");},buttonClicked:function() 481 {return this._recording?WebInspector.UIString("Stop CPU profiling."):WebInspecto r.UIString("Start CPU profiling.");},buttonClicked:function()
445 {if(this._recording){this.stopRecordingProfile();return false;}else{this.startRe cordingProfile();return true;}},get treeItemTitle() 482 {if(this._recording){this.stopRecordingProfile();return false;}else{this.startRe cordingProfile();return true;}},get treeItemTitle()
446 {return WebInspector.UIString("CPU PROFILES");},get description() 483 {return WebInspector.UIString("CPU PROFILES");},get description()
447 {return WebInspector.UIString("CPU profiles show where the execution time is spe nt in your page's JavaScript functions.");},addProfileHeader:function(profileHea der) 484 {return WebInspector.UIString("CPU profiles show where the execution time is spe nt in your page's JavaScript functions.");},addProfileHeader:function(profileHea der)
448 {this.addProfile(this.createProfile(profileHeader));},isRecordingProfile:functio n() 485 {this.addProfile(this.createProfile(profileHeader));},isRecordingProfile:functio n()
449 {return this._recording;},startRecordingProfile:function() 486 {return this._recording;},startRecordingProfile:function()
(...skipping 21 matching lines...) Expand all
471 {return new WebInspector.CPUProfileView(this);},canSaveToFile:function() 508 {return new WebInspector.CPUProfileView(this);},canSaveToFile:function()
472 {return true;},saveToFile:function() 509 {return true;},saveToFile:function()
473 {var fileOutputStream=new WebInspector.FileOutputStream();function getCPUProfile Callback(error,profile) 510 {var fileOutputStream=new WebInspector.FileOutputStream();function getCPUProfile Callback(error,profile)
474 {if(error){fileOutputStream.close();return;} 511 {if(error){fileOutputStream.close();return;}
475 if(!profile.head){fileOutputStream.close();return;} 512 if(!profile.head){fileOutputStream.close();return;}
476 fileOutputStream.write(JSON.stringify(profile),fileOutputStream.close.bind(fileO utputStream));} 513 fileOutputStream.write(JSON.stringify(profile),fileOutputStream.close.bind(fileO utputStream));}
477 function onOpen() 514 function onOpen()
478 {ProfilerAgent.getCPUProfile(this.uid,getCPUProfileCallback.bind(this));} 515 {ProfilerAgent.getCPUProfile(this.uid,getCPUProfileCallback.bind(this));}
479 this._fileName=this._fileName||"CPU-"+new Date().toISO8601Compact()+this._profil eType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));}, loadFromFile:function(file) 516 this._fileName=this._fileName||"CPU-"+new Date().toISO8601Compact()+this._profil eType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));}, loadFromFile:function(file)
480 {this.title=file.name;this.sidebarElement.subtitle=WebInspector.UIString("Loadin g\u2026");this.sidebarElement.wait=true;var fileReader=new WebInspector.ChunkedF ileReader(file,10000000,this);fileReader.start(this);},__proto__:WebInspector.Pr ofileHeader.prototype};WebInspector.FlameChart=function(cpuProfileView) 517 {this.title=file.name;this.sidebarElement.subtitle=WebInspector.UIString("Loadin g\u2026");this.sidebarElement.wait=true;var fileReader=new WebInspector.ChunkedF ileReader(file,10000000,this);fileReader.start(this);},__proto__:WebInspector.Pr ofileHeader.prototype};WebInspector.FlameChart=function(cpuProfileView)
481 {WebInspector.View.call(this);this.registerRequiredCSS("flameChart.css");this.el ement.className="fill";this.element.id="cpu-flame-chart";this._overviewContainer =this.element.createChild("div","overview-container");this._overviewGrid=new Web Inspector.OverviewGrid("flame-chart");this._overviewCanvas=this._overviewContain er.createChild("canvas","flame-chart-overview-canvas");this._overviewContainer.a ppendChild(this._overviewGrid.element);this._overviewCalculator=new WebInspector .FlameChart.OverviewCalculator();this._overviewGrid.addEventListener(WebInspecto r.OverviewGrid.Events.WindowChanged,this._onWindowChanged,this);this._chartConta iner=this.element.createChild("div","chart-container");this._timelineGrid=new We bInspector.TimelineGrid();this._chartContainer.appendChild(this._timelineGrid.el ement);this._calculator=new WebInspector.FlameChart.Calculator();this._canvas=th is._chartContainer.createChild("canvas");this._canvas.addEventListener("mousemov e",this._onMouseMove.bind(this));WebInspector.installDragHandle(this._canvas,thi s._startCanvasDragging.bind(this),this._canvasDragging.bind(this),this._endCanva sDragging.bind(this),"col-resize");this._cpuProfileView=cpuProfileView;this._win dowLeft=0.0;this._windowRight=1.0;this._barHeight=15;this._minWidth=2;this._padd ingLeft=15;this._canvas.addEventListener("mousewheel",this._onMouseWheel.bind(th is),false);this.element.addEventListener("click",this._onClick.bind(this),false) ;this._linkifier=new WebInspector.Linkifier();this._highlightedEntryIndex=-1;if( !WebInspector.FlameChart._colorGenerator) 518 {WebInspector.View.call(this);this.registerRequiredCSS("flameChart.css");this.el ement.className="fill";this.element.id="cpu-flame-chart";this._overviewContainer =this.element.createChild("div","overview-container");this._overviewGrid=new Web Inspector.OverviewGrid("flame-chart");this._overviewCanvas=this._overviewContain er.createChild("canvas","flame-chart-overview-canvas");this._overviewContainer.a ppendChild(this._overviewGrid.element);this._overviewCalculator=new WebInspector .FlameChart.OverviewCalculator();this._overviewGrid.addEventListener(WebInspecto r.OverviewGrid.Events.WindowChanged,this._onWindowChanged,this);this._chartConta iner=this.element.createChild("div","chart-container");this._timelineGrid=new We bInspector.TimelineGrid();this._chartContainer.appendChild(this._timelineGrid.el ement);this._calculator=new WebInspector.FlameChart.Calculator();this._canvas=th is._chartContainer.createChild("canvas");this._canvas.addEventListener("mousemov e",this._onMouseMove.bind(this));WebInspector.installDragHandle(this._canvas,thi s._startCanvasDragging.bind(this),this._canvasDragging.bind(this),this._endCanva sDragging.bind(this),"col-resize");this._cpuProfileView=cpuProfileView;this._win dowLeft=0.0;this._windowRight=1.0;this._barHeight=15;this._minWidth=2;this._padd ingLeft=15;this._canvas.addEventListener("mousewheel",this._onMouseWheel.bind(th is),false);this._canvas.addEventListener("click",this._onClick.bind(this),false) ;this._linkifier=new WebInspector.Linkifier();this._highlightedEntryIndex=-1;if( !WebInspector.FlameChart._colorGenerator)
482 WebInspector.FlameChart._colorGenerator=new WebInspector.FlameChart.ColorGenerat or();} 519 WebInspector.FlameChart._colorGenerator=new WebInspector.FlameChart.ColorGenerat or();}
483 WebInspector.FlameChart.Calculator=function() 520 WebInspector.FlameChart.Calculator=function()
484 {} 521 {}
485 WebInspector.FlameChart.Calculator.prototype={_updateBoundaries:function(flameCh art) 522 WebInspector.FlameChart.Calculator.prototype={_updateBoundaries:function(flameCh art)
486 {this._minimumBoundaries=flameChart._windowLeft*flameChart._timelineData.totalTi me;this._maximumBoundaries=flameChart._windowRight*flameChart._timelineData.tota lTime;this.paddingLeft=flameChart._paddingLeft;this._width=flameChart._canvas.wi dth-this.paddingLeft;this._timeToPixel=this._width/this.boundarySpan();},compute Position:function(time) 523 {this._minimumBoundaries=flameChart._windowLeft*flameChart._timelineData.totalTi me;this._maximumBoundaries=flameChart._windowRight*flameChart._timelineData.tota lTime;this.paddingLeft=flameChart._paddingLeft;this._width=flameChart._canvas.wi dth-this.paddingLeft;this._timeToPixel=this._width/this.boundarySpan();},compute Position:function(time)
487 {return(time-this._minimumBoundaries)*this._timeToPixel+this.paddingLeft;},forma tTime:function(value) 524 {return(time-this._minimumBoundaries)*this._timeToPixel+this.paddingLeft;},forma tTime:function(value)
488 {return WebInspector.UIString("%s\u2009ms",Number.withThousandsSeparator(Math.ro und(value+this._minimumBoundaries)));},maximumBoundary:function() 525 {return WebInspector.UIString("%s\u2009ms",Number.withThousandsSeparator(Math.ro und(value+this._minimumBoundaries)));},maximumBoundary:function()
489 {return this._maximumBoundaries;},minimumBoundary:function() 526 {return this._maximumBoundaries;},minimumBoundary:function()
490 {return this._minimumBoundaries;},zeroTime:function() 527 {return this._minimumBoundaries;},zeroTime:function()
491 {return 0;},boundarySpan:function() 528 {return 0;},boundarySpan:function()
492 {return this._maximumBoundaries-this._minimumBoundaries;}} 529 {return this._maximumBoundaries-this._minimumBoundaries;}}
493 WebInspector.FlameChart.OverviewCalculator=function() 530 WebInspector.FlameChart.OverviewCalculator=function()
494 {} 531 {}
495 WebInspector.FlameChart.OverviewCalculator.prototype={_updateBoundaries:function (flameChart) 532 WebInspector.FlameChart.OverviewCalculator.prototype={_updateBoundaries:function (flameChart)
496 {this._minimumBoundaries=0;this._maximumBoundaries=flameChart._timelineData.tota lTime;this._xScaleFactor=flameChart._canvas.width/flameChart._timelineData.total Time;},computePosition:function(time) 533 {this._minimumBoundaries=0;this._maximumBoundaries=flameChart._timelineData.tota lTime;this._xScaleFactor=flameChart._canvas.width/flameChart._timelineData.total Time;},computePosition:function(time)
497 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue) 534 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue)
498 {return Number.secondsToString((value+this._minimumBoundaries)/1000);},maximumBo undary:function() 535 {return Number.secondsToString((value+this._minimumBoundaries)/1000);},maximumBo undary:function()
499 {return this._maximumBoundaries;},minimumBoundary:function() 536 {return this._maximumBoundaries;},minimumBoundary:function()
500 {return this._minimumBoundaries;},zeroTime:function() 537 {return this._minimumBoundaries;},zeroTime:function()
501 {return this._minimumBoundaries;},boundarySpan:function() 538 {return this._minimumBoundaries;},boundarySpan:function()
502 {return this._maximumBoundaries-this._minimumBoundaries;}} 539 {return this._maximumBoundaries-this._minimumBoundaries;}}
503 WebInspector.FlameChart.Events={SelectedNode:"SelectedNode"} 540 WebInspector.FlameChart.Events={SelectedNode:"SelectedNode"}
504 WebInspector.FlameChart.ColorGenerator=function() 541 WebInspector.FlameChart.ColorGenerator=function()
505 {this._colorPairs={};this._currentColorIndex=0;this._colorPairs["(idle)::0"]=thi s._createPair(0,50);this._colorPairs["(program)::0"]=this._createPair(5,50);this ._colorPairs["(garbage collector)::0"]=this._createPair(10,50);} 542 {this._colorPairs={};this._currentColorIndex=0;this._colorPairs["(idle)::0"]=thi s._createPair(this._currentColorIndex++,50);this._colorPairs["(program)::0"]=thi s._createPair(this._currentColorIndex++,50);this._colorPairs["(garbage collector )::0"]=this._createPair(this._currentColorIndex++,50);}
506 WebInspector.FlameChart.ColorGenerator.prototype={_colorPairForID:function(id) 543 WebInspector.FlameChart.ColorGenerator.prototype={_colorPairForID:function(id)
507 {var colorPairs=this._colorPairs;var colorPair=colorPairs[id];if(!colorPair) 544 {var colorPairs=this._colorPairs;var colorPair=colorPairs[id];if(!colorPair)
508 colorPairs[id]=colorPair=this._createPair(++this._currentColorIndex);return colo rPair;},_createPair:function(index,sat) 545 colorPairs[id]=colorPair=this._createPair(this._currentColorIndex++);return colo rPair;},_createPair:function(index,sat)
509 {var hue=(index*7+12*(index%2))%360;if(typeof sat!=="number") 546 {var hue=(index*7+12*(index%2))%360;if(typeof sat!=="number")
510 sat=100;return{highlighted:"hsla("+hue+", "+sat+"%, 33%, 0.7)",normal:"hsla("+hu e+", "+sat+"%, 66%, 0.7)"}}} 547 sat=100;return{index:index,highlighted:"hsla("+hue+", "+sat+"%, 33%, 0.7)",norma l:"hsla("+hue+", "+sat+"%, 66%, 0.7)"}}}
511 WebInspector.FlameChart.Entry=function(colorPair,depth,duration,startTime,node) 548 WebInspector.FlameChart.Entry=function(colorPair,depth,duration,startTime,node)
512 {this.colorPair=colorPair;this.depth=depth;this.duration=duration;this.startTime =startTime;this.node=node;this.selfTime=0;} 549 {this.colorPair=colorPair;this.depth=depth;this.duration=duration;this.startTime =startTime;this.node=node;this.selfTime=0;}
513 WebInspector.FlameChart.prototype={selectRange:function(timeLeft,timeRight) 550 WebInspector.FlameChart.prototype={selectRange:function(timeLeft,timeRight)
514 {this._overviewGrid.setWindow(timeLeft/this._totalTime,timeRight/this._totalTime );},_onWindowChanged:function(event) 551 {this._overviewGrid.setWindow(timeLeft/this._totalTime,timeRight/this._totalTime );},_onWindowChanged:function(event)
515 {this._scheduleUpdate();},_startCanvasDragging:function(event) 552 {this._scheduleUpdate();},_startCanvasDragging:function(event)
516 {if(!this._timelineData) 553 {if(!this._timelineData)
517 return false;this._isDragging=true;this._dragStartPoint=event.pageX;this._dragSt artWindowLeft=this._windowLeft;this._dragStartWindowRight=this._windowRight;retu rn true;},_canvasDragging:function(event) 554 return false;this._isDragging=true;this._wasDragged=false;this._dragStartPoint=e vent.pageX;this._dragStartWindowLeft=this._windowLeft;this._dragStartWindowRight =this._windowRight;return true;},_canvasDragging:function(event)
518 {var pixelShift=this._dragStartPoint-event.pageX;var windowShift=pixelShift/this ._totalPixels;var windowLeft=Math.max(0,this._dragStartWindowLeft+windowShift);i f(windowLeft===this._windowLeft) 555 {var pixelShift=this._dragStartPoint-event.pageX;var windowShift=pixelShift/this ._totalPixels;var windowLeft=Math.max(0,this._dragStartWindowLeft+windowShift);i f(windowLeft===this._windowLeft)
519 return;windowShift=windowLeft-this._dragStartWindowLeft;var windowRight=Math.min (1,this._dragStartWindowRight+windowShift);if(windowRight===this._windowRight) 556 return;windowShift=windowLeft-this._dragStartWindowLeft;var windowRight=Math.min (1,this._dragStartWindowRight+windowShift);if(windowRight===this._windowRight)
520 return;windowShift=windowRight-this._dragStartWindowRight;this._overviewGrid.set Window(this._dragStartWindowLeft+windowShift,this._dragStartWindowRight+windowSh ift);},_endCanvasDragging:function() 557 return;windowShift=windowRight-this._dragStartWindowRight;this._overviewGrid.set Window(this._dragStartWindowLeft+windowShift,this._dragStartWindowRight+windowSh ift);this._wasDragged=true;},_endCanvasDragging:function()
521 {this._isDragging=false;},_calculateTimelineData:function() 558 {this._isDragging=false;},_calculateTimelineData:function()
522 {if(this._cpuProfileView.samples) 559 {if(this._cpuProfileView.samples)
523 return this._calculateTimelineDataForSamples();if(this._timelineData) 560 return this._calculateTimelineDataForSamples();if(this._timelineData)
524 return this._timelineData;if(!this._cpuProfileView.profileHead) 561 return this._timelineData;if(!this._cpuProfileView.profileHead)
525 return null;var index=0;var entries=[];function appendReversedArray(toArray,from Array) 562 return null;var index=0;var entries=[];function appendReversedArray(toArray,from Array)
526 {for(var i=fromArray.length-1;i>=0;--i) 563 {for(var i=fromArray.length-1;i>=0;--i)
527 toArray.push(fromArray[i]);} 564 toArray.push(fromArray[i]);}
528 var stack=[];appendReversedArray(stack,this._cpuProfileView.profileHead.children );var levelOffsets=([0]);var levelExitIndexes=([0]);var colorGenerator=WebInspec tor.FlameChart._colorGenerator;while(stack.length){var level=levelOffsets.length -1;var node=stack.pop();var offset=levelOffsets[level];var colorPair=colorGenera tor._colorPairForID(node.functionName+":"+node.url+":"+node.lineNumber);entries. push(new WebInspector.FlameChart.Entry(colorPair,level,node.totalTime,offset,nod e));++index;levelOffsets[level]+=node.totalTime;if(node.children.length){levelEx itIndexes.push(stack.length);levelOffsets.push(offset+node.selfTime/2);appendRev ersedArray(stack,node.children);} 565 var stack=[];appendReversedArray(stack,this._cpuProfileView.profileHead.children );var levelOffsets=([0]);var levelExitIndexes=([0]);var colorGenerator=WebInspec tor.FlameChart._colorGenerator;var colorIndexEntryChains=[[],[],[]];while(stack. length){var level=levelOffsets.length-1;var node=stack.pop();var offset=levelOff sets[level];var id=node.functionName+":"+node.url+":"+node.lineNumber;var colorP air=colorGenerator._colorPairForID(id);var colorIndexEntries=colorIndexEntryChai ns[colorPair.index];if(!colorIndexEntries)
566 colorIndexEntries=colorIndexEntryChains[colorPair.index]=[];var entry=new WebIns pector.FlameChart.Entry(colorPair,level,node.totalTime,offset,node);entries.push (entry);colorIndexEntries.push(entry);++index;levelOffsets[level]+=node.totalTim e;if(node.children.length){levelExitIndexes.push(stack.length);levelOffsets.push (offset+node.selfTime/2);appendReversedArray(stack,node.children);}
529 while(stack.length===levelExitIndexes[levelExitIndexes.length-1]){levelOffsets.p op();levelExitIndexes.pop();}} 567 while(stack.length===levelExitIndexes[levelExitIndexes.length-1]){levelOffsets.p op();levelExitIndexes.pop();}}
530 this._timelineData={entries:entries,totalTime:this._cpuProfileView.profileHead.t otalTime,} 568 this._timelineData={entries:entries,colorIndexEntryChains:colorIndexEntryChains, totalTime:this._cpuProfileView.profileHead.totalTime,}
531 return this._timelineData;},_calculateTimelineDataForSamples:function() 569 return this._timelineData;},_calculateTimelineDataForSamples:function()
532 {if(this._timelineData) 570 {if(this._timelineData)
533 return this._timelineData;if(!this._cpuProfileView.profileHead) 571 return this._timelineData;if(!this._cpuProfileView.profileHead)
534 return null;var samples=this._cpuProfileView.samples;var idToNode=this._cpuProfi leView._idToNode;var gcNode=this._cpuProfileView._gcNode;var samplesCount=sample s.length;var index=0;var entries=([]);var openIntervals=[];var stackTrace=[];var colorGenerator=WebInspector.FlameChart._colorGenerator;for(var sampleIndex=0;sa mpleIndex<samplesCount;sampleIndex++){var node=idToNode[samples[sampleIndex]];st ackTrace.length=0;while(node){stackTrace.push(node);node=node.parent;} 572 return null;var samples=this._cpuProfileView.samples;var idToNode=this._cpuProfi leView._idToNode;var gcNode=this._cpuProfileView._gcNode;var samplesCount=sample s.length;var samplingInterval=this._cpuProfileView.samplingIntervalMs;var index= 0;var entries=([]);var openIntervals=[];var stackTrace=[];var colorGenerator=Web Inspector.FlameChart._colorGenerator;var colorIndexEntryChains=[[],[],[]];for(va r sampleIndex=0;sampleIndex<samplesCount;sampleIndex++){var node=idToNode[sample s[sampleIndex]];stackTrace.length=0;while(node){stackTrace.push(node);node=node. parent;}
535 stackTrace.pop();var depth=0;node=stackTrace.pop();var intervalIndex;if(node===g cNode){while(depth<openIntervals.length){intervalIndex=openIntervals[depth].inde x;entries[intervalIndex].duration+=1;++depth;} 573 stackTrace.pop();var depth=0;node=stackTrace.pop();var intervalIndex;if(node===g cNode){while(depth<openIntervals.length){intervalIndex=openIntervals[depth].inde x;entries[intervalIndex].duration+=samplingInterval;++depth;}
536 if(openIntervals.length>0&&openIntervals.peekLast().node===node){entries[interva lIndex].selfTime+=1;continue;}} 574 if(openIntervals.length>0&&openIntervals.peekLast().node===node){entries[interva lIndex].selfTime+=samplingInterval;continue;}}
537 while(node&&depth<openIntervals.length&&node===openIntervals[depth].node){interv alIndex=openIntervals[depth].index;entries[intervalIndex].duration+=1;node=stack Trace.pop();++depth;} 575 while(node&&depth<openIntervals.length&&node===openIntervals[depth].node){interv alIndex=openIntervals[depth].index;entries[intervalIndex].duration+=samplingInte rval;node=stackTrace.pop();++depth;}
538 if(depth<openIntervals.length) 576 if(depth<openIntervals.length)
539 openIntervals.length=depth;if(!node){entries[intervalIndex].selfTime+=1;continue ;} 577 openIntervals.length=depth;if(!node){entries[intervalIndex].selfTime+=samplingIn terval;continue;}
540 while(node){var colorPair=colorGenerator._colorPairForID(node.functionName+":"+n ode.url+":"+node.lineNumber);entries.push(new WebInspector.FlameChart.Entry(colo rPair,depth,1,sampleIndex,node));openIntervals.push({node:node,index:index});++i ndex;node=stackTrace.pop();++depth;} 578 while(node){var colorPair=colorGenerator._colorPairForID(node.functionName+":"+n ode.url+":"+node.lineNumber);var colorIndexEntries=colorIndexEntryChains[colorPa ir.index];if(!colorIndexEntries)
541 entries[entries.length-1].selfTime+=1;} 579 colorIndexEntries=colorIndexEntryChains[colorPair.index]=[];var entry=new WebIns pector.FlameChart.Entry(colorPair,depth,samplingInterval,sampleIndex*samplingInt erval,node);entries.push(entry);colorIndexEntries.push(entry);openIntervals.push ({node:node,index:index});++index;node=stackTrace.pop();++depth;}
542 this._timelineData={entries:entries,totalTime:samplesCount,};return this._timeli neData;},_onMouseMove:function(event) 580 entries[entries.length-1].selfTime+=samplingInterval;}
581 this._timelineData={entries:entries,colorIndexEntryChains:colorIndexEntryChains, totalTime:this._cpuProfileView.profileHead.totalTime};return this._timelineData; },_onMouseMove:function(event)
543 {if(this._isDragging) 582 {if(this._isDragging)
544 return;var entryIndex=this._coordinatesToEntryIndex(event.offsetX,event.offsetY) ;if(this._highlightedEntryIndex===entryIndex) 583 return;var entryIndex=this._coordinatesToEntryIndex(event.offsetX,event.offsetY) ;if(this._highlightedEntryIndex===entryIndex)
545 return;if(entryIndex===-1||this._timelineData.entries[entryIndex].node.scriptId= =="0") 584 return;if(entryIndex===-1||this._timelineData.entries[entryIndex].node.scriptId= =="0")
546 this._canvas.style.cursor="default";else 585 this._canvas.style.cursor="default";else
547 this._canvas.style.cursor="pointer";this._highlightedEntryIndex=entryIndex;this. _scheduleUpdate();},_prepareHighlightedEntryInfo:function() 586 this._canvas.style.cursor="pointer";this._highlightedEntryIndex=entryIndex;this. _scheduleUpdate();},_millisecondsToString:function(ms)
587 {if(ms===0)
588 return"0";if(ms<1000)
589 return WebInspector.UIString("%.1f\u2009ms",ms);return Number.secondsToString(ms /1000,true);},_prepareHighlightedEntryInfo:function()
548 {if(this._isDragging) 590 {if(this._isDragging)
549 return null;var entry=this._timelineData.entries[this._highlightedEntryIndex];if (!entry) 591 return null;var entry=this._timelineData.entries[this._highlightedEntryIndex];if (!entry)
550 return null;var node=entry.node;if(!node) 592 return null;var node=entry.node;if(!node)
551 return null;var entryInfo=[];function pushEntryInfoRow(title,text) 593 return null;var entryInfo=[];function pushEntryInfoRow(title,text)
552 {var row={};row.title=title;row.text=text;entryInfo.push(row);} 594 {var row={};row.title=title;row.text=text;entryInfo.push(row);}
553 pushEntryInfoRow(WebInspector.UIString("Name"),node.functionName);if(this._cpuPr ofileView.samples){pushEntryInfoRow(WebInspector.UIString("Self time"),Number.se condsToString(entry.selfTime/1000,true));pushEntryInfoRow(WebInspector.UIString( "Total time"),Number.secondsToString(entry.duration/1000,true));} 595 pushEntryInfoRow(WebInspector.UIString("Name"),node.functionName);if(this._cpuPr ofileView.samples){var selfTime=this._millisecondsToString(entry.selfTime);var t otalTime=this._millisecondsToString(entry.duration);pushEntryInfoRow(WebInspecto r.UIString("Self time"),selfTime);pushEntryInfoRow(WebInspector.UIString("Total time"),totalTime);}
554 if(node.url) 596 if(node.url)
555 pushEntryInfoRow(WebInspector.UIString("URL"),node.url+":"+node.lineNumber);push EntryInfoRow(WebInspector.UIString("Aggregated self time"),Number.secondsToStrin g(node.selfTime/1000,true));pushEntryInfoRow(WebInspector.UIString("Aggregated t otal time"),Number.secondsToString(node.totalTime/1000,true));return entryInfo;} ,_onClick:function(e) 597 pushEntryInfoRow(WebInspector.UIString("URL"),node.url+":"+node.lineNumber);push EntryInfoRow(WebInspector.UIString("Aggregated self time"),Number.secondsToStrin g(node.selfTime/1000,true));pushEntryInfoRow(WebInspector.UIString("Aggregated t otal time"),Number.secondsToString(node.totalTime/1000,true));if(node.deoptReaso n&&node.deoptReason!=="no reason")
556 {if(this._highlightedEntryIndex===-1) 598 pushEntryInfoRow(WebInspector.UIString("Not optimized"),node.deoptReason);return entryInfo;},_onClick:function(e)
599 {if(this._wasDragged)
600 return;if(this._highlightedEntryIndex===-1)
557 return;var node=this._timelineData.entries[this._highlightedEntryIndex].node;thi s.dispatchEventToListeners(WebInspector.FlameChart.Events.SelectedNode,node);},_ onMouseWheel:function(e) 601 return;var node=this._timelineData.entries[this._highlightedEntryIndex].node;thi s.dispatchEventToListeners(WebInspector.FlameChart.Events.SelectedNode,node);},_ onMouseWheel:function(e)
558 {if(e.wheelDeltaY){const zoomFactor=1.1;const mouseWheelZoomSpeed=1/120;var zoom =Math.pow(zoomFactor,-e.wheelDeltaY*mouseWheelZoomSpeed);var overviewReference=( this._pixelWindowLeft+e.offsetX-this._paddingLeft)/this._totalPixels;this._overv iewGrid.zoom(zoom,overviewReference);}else{var shift=Number.constrain(-1*this._w indowWidth/4*e.wheelDeltaX/120,-this._windowLeft,1-this._windowRight);this._over viewGrid.setWindow(this._windowLeft+shift,this._windowRight+shift);}},_coordinat esToEntryIndex:function(x,y) 602 {if(e.wheelDeltaY){const zoomFactor=1.1;const mouseWheelZoomSpeed=1/120;var zoom =Math.pow(zoomFactor,-e.wheelDeltaY*mouseWheelZoomSpeed);var overviewReference=( this._pixelWindowLeft+e.offsetX-this._paddingLeft)/this._totalPixels;this._overv iewGrid.zoom(zoom,overviewReference);}else{var shift=Number.constrain(-1*this._w indowWidth/4*e.wheelDeltaX/120,-this._windowLeft,1-this._windowRight);this._over viewGrid.setWindow(this._windowLeft+shift,this._windowRight+shift);}},_coordinat esToEntryIndex:function(x,y)
559 {var timelineData=this._timelineData;if(!timelineData) 603 {var timelineData=this._timelineData;if(!timelineData)
560 return-1;var timelineEntries=timelineData.entries;var cursorTime=(x+this._pixelW indowLeft-this._paddingLeft)*this._pixelToTime;var cursorLevel=Math.floor((this. _canvas.height/window.devicePixelRatio-y)/this._barHeight);for(var i=0;i<timelin eEntries.length;++i){if(cursorTime<timelineEntries[i].startTime) 604 return-1;var timelineEntries=timelineData.entries;var cursorTime=(x+this._pixelW indowLeft-this._paddingLeft)*this._pixelToTime;var cursorLevel=Math.floor((this. _canvas.height/window.devicePixelRatio-y)/this._barHeight);for(var i=0;i<timelin eEntries.length;++i){if(cursorTime<timelineEntries[i].startTime)
561 return-1;if(cursorTime<(timelineEntries[i].startTime+timelineEntries[i].duration )&&cursorLevel===timelineEntries[i].depth) 605 return-1;if(cursorTime<(timelineEntries[i].startTime+timelineEntries[i].duration )&&cursorLevel===timelineEntries[i].depth)
562 return i;} 606 return i;}
563 return-1;},onResize:function() 607 return-1;},onResize:function()
564 {this._updateOverviewCanvas=true;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height) 608 {this._updateOverviewCanvas=true;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height)
565 {if(!this._timelineData) 609 {if(!this._timelineData)
566 return;var timelineEntries=this._timelineData.entries;var drawData=new Uint8Arra y(width);var scaleFactor=width/this._totalTime;var maxStackDepth=5;for(var entry Index=0;entryIndex<timelineEntries.length;++entryIndex){var entry=timelineEntrie s[entryIndex];var start=Math.floor(entry.startTime*scaleFactor);var finish=Math. floor((entry.startTime+entry.duration)*scaleFactor);for(var x=start;x<finish;++x ){drawData[x]=Math.max(drawData[x],entry.depth+1);maxStackDepth=Math.max(maxStac kDepth,entry.depth+1);}} 610 return;var timelineEntries=this._timelineData.entries;var drawData=new Uint8Arra y(width);var scaleFactor=width/this._totalTime;var maxStackDepth=5;for(var entry Index=0;entryIndex<timelineEntries.length;++entryIndex){var entry=timelineEntrie s[entryIndex];var start=Math.floor(entry.startTime*scaleFactor);var finish=Math. floor((entry.startTime+entry.duration)*scaleFactor);for(var x=start;x<finish;++x ){drawData[x]=Math.max(drawData[x],entry.depth+1);maxStackDepth=Math.max(maxStac kDepth,entry.depth+1);}}
567 var ratio=window.devicePixelRatio;var canvasWidth=width*ratio;var canvasHeight=h eight*ratio;this._overviewCanvas.width=canvasWidth;this._overviewCanvas.height=c anvasHeight;this._overviewCanvas.style.width=width+"px";this._overviewCanvas.sty le.height=height+"px";var context=this._overviewCanvas.getContext("2d");var ySca leFactor=canvasHeight/(maxStackDepth*1.1);context.lineWidth=1;context.translate( 0.5,0.5);context.strokeStyle="rgba(20,0,0,0.4)";context.fillStyle="rgba(214,225, 254,0.8)";context.moveTo(-1,canvasHeight-1);if(drawData) 611 var ratio=window.devicePixelRatio;var canvasWidth=width*ratio;var canvasHeight=h eight*ratio;this._overviewCanvas.width=canvasWidth;this._overviewCanvas.height=c anvasHeight;this._overviewCanvas.style.width=width+"px";this._overviewCanvas.sty le.height=height+"px";var context=this._overviewCanvas.getContext("2d");var ySca leFactor=canvasHeight/(maxStackDepth*1.1);context.lineWidth=1;context.translate( 0.5,0.5);context.strokeStyle="rgba(20,0,0,0.4)";context.fillStyle="rgba(214,225, 254,0.8)";context.moveTo(-1,canvasHeight-1);if(drawData)
568 context.lineTo(-1,Math.round(height-drawData[0]*yScaleFactor-1));var value;for(v ar x=0;x<width;++x){value=Math.round(canvasHeight-drawData[x]*yScaleFactor-1);co ntext.lineTo(x*ratio,value);} 612 context.lineTo(-1,Math.round(height-drawData[0]*yScaleFactor-1));var value;for(v ar x=0;x<width;++x){value=Math.round(canvasHeight-drawData[x]*yScaleFactor-1);co ntext.lineTo(x*ratio,value);}
569 context.lineTo(canvasWidth+1,value);context.lineTo(canvasWidth+1,canvasHeight-1) ;context.fill();context.stroke();context.closePath();},_entryToAnchorBox:functio n(entry,anchorBox) 613 context.lineTo(canvasWidth+1,value);context.lineTo(canvasWidth+1,canvasHeight-1) ;context.fill();context.stroke();context.closePath();},_entryToAnchorBox:functio n(entry,anchorBox)
570 {anchorBox.x=Math.floor(entry.startTime*this._timeToPixel)-this._pixelWindowLeft +this._paddingLeft;anchorBox.y=this._canvas.height/window.devicePixelRatio-(entr y.depth+1)*this._barHeight;anchorBox.width=Math.max(Math.ceil(entry.duration*thi s._timeToPixel),this._minWidth);anchorBox.height=this._barHeight;if(anchorBox.x< 0){anchorBox.width+=anchorBox.x;anchorBox.x=0;} 614 {anchorBox.x=Math.floor(entry.startTime*this._timeToPixel)-this._pixelWindowLeft +this._paddingLeft;anchorBox.y=this._canvas.height/window.devicePixelRatio-(entr y.depth+1)*this._barHeight;anchorBox.width=Math.max(Math.ceil(entry.duration*thi s._timeToPixel),this._minWidth);anchorBox.height=this._barHeight;if(anchorBox.x< 0){anchorBox.width+=anchorBox.x;anchorBox.x=0;}
571 anchorBox.width=Number.constrain(anchorBox.width,0,this._canvas.width-anchorBox. x);},draw:function(width,height) 615 anchorBox.width=Number.constrain(anchorBox.width,0,this._canvas.width-anchorBox. x);},draw:function(width,height)
572 {var timelineData=this._calculateTimelineData();if(!timelineData) 616 {var timelineData=this._calculateTimelineData();if(!timelineData)
573 return;var timelineEntries=timelineData.entries;var ratio=window.devicePixelRati o;var canvasWidth=width*ratio;var canvasHeight=height*ratio;this._canvas.width=c anvasWidth;this._canvas.height=canvasHeight;this._canvas.style.width=width+"px"; this._canvas.style.height=height+"px";var barHeight=this._barHeight;var context= this._canvas.getContext("2d");var textPaddingLeft=2;context.scale(ratio,ratio);c ontext.font=(barHeight-4)+"px "+window.getComputedStyle(this.element,null).getPr opertyValue("font-family");context.textBaseline="alphabetic";this._dotsWidth=con text.measureText("\u2026").width;var visibleTimeLeft=this._timeWindowLeft-this._ paddingLeftTime;var anchorBox=new AnchorBox();for(var i=0;i<timelineEntries.leng th;++i){var entry=timelineEntries[i];var startTime=entry.startTime;if(startTime> this._timeWindowRight) 617 return;var colorIndexEntryChains=timelineData.colorIndexEntryChains;var ratio=wi ndow.devicePixelRatio;var canvasWidth=width*ratio;var canvasHeight=height*ratio; this._canvas.width=canvasWidth;this._canvas.height=canvasHeight;this._canvas.sty le.width=width+"px";this._canvas.style.height=height+"px";var barHeight=this._ba rHeight;var context=this._canvas.getContext("2d");context.scale(ratio,ratio);var visibleTimeLeft=this._timeWindowLeft-this._paddingLeftTime;var timeWindowRight= this._timeWindowRight;var lastUsedColor="";function forEachEntry(flameChart,call back)
618 {var anchorBox=new AnchorBox();for(var j=0;j<colorIndexEntryChains.length;++j){v ar entries=colorIndexEntryChains[j];if(!entries)
619 continue;for(var i=0;i<entries.length;++i){var entry=entries[i];var startTime=en try.startTime;if(startTime>timeWindowRight)
574 break;if((startTime+entry.duration)<visibleTimeLeft) 620 break;if((startTime+entry.duration)<visibleTimeLeft)
575 continue;this._entryToAnchorBox(entry,anchorBox);var colorPair=entry.colorPair;v ar color;if(this._highlightedEntryIndex===i) 621 continue;flameChart._entryToAnchorBox(entry,anchorBox);callback(flameChart,conte xt,entry,anchorBox,flameChart._highlightedEntryIndex===i);}}}
576 color=colorPair.highlighted;else 622 function drawBar(flameChart,context,entry,anchorBox,highlighted)
577 color=colorPair.normal;context.beginPath();context.rect(anchorBox.x,anchorBox.y, anchorBox.width-1,anchorBox.height-1);context.fillStyle=color;context.fill();var xText=Math.max(0,anchorBox.x);var widthText=anchorBox.width-textPaddingLeft+anc horBox.x-xText;var title=this._prepareText(context,entry.node.functionName,width Text);if(title){context.fillStyle="#333";context.fillText(title,xText+textPaddin gLeft,anchorBox.y+barHeight-4);}} 623 {context.beginPath();context.rect(anchorBox.x,anchorBox.y,anchorBox.width-1,anch orBox.height-1);var color=highlighted?entry.colorPair.highlighted:entry.colorPai r.normal;if(lastUsedColor!==color){lastUsedColor=color;context.fillStyle=color;}
578 var entryInfo=this._prepareHighlightedEntryInfo();if(entryInfo) 624 context.fill();}
625 forEachEntry(this,drawBar);var font=(barHeight-4)+"px "+window.getComputedStyle( this.element,null).getPropertyValue("font-family");var boldFont="bold "+font;var isBoldFontSelected=false;context.font=font;context.textBaseline="alphabetic";co ntext.fillStyle="#333";this._dotsWidth=context.measureText("\u2026").width;var t extPaddingLeft=2;function drawText(flameChart,context,entry,anchorBox,highlighte d)
626 {var deoptReason=entry.node.deoptReason;if(isBoldFontSelected){if(!deoptReason|| deoptReason==="no reason"){context.font=font;isBoldFontSelected=false;}}else{if( deoptReason&&deoptReason!=="no reason"){context.font=boldFont;isBoldFontSelected =true;}}
627 var xText=Math.max(0,anchorBox.x);var widthText=anchorBox.width-textPaddingLeft+ anchorBox.x-xText;var title=flameChart._prepareText(context,entry.node.functionN ame,widthText);if(title)
628 context.fillText(title,xText+textPaddingLeft,anchorBox.y+barHeight-4);}
629 forEachEntry(this,drawText);var entryInfo=this._prepareHighlightedEntryInfo();if (entryInfo)
579 this._printEntryInfo(context,entryInfo,0,25,width);},_printEntryInfo:function(co ntext,entryInfo,x,y,width) 630 this._printEntryInfo(context,entryInfo,0,25,width);},_printEntryInfo:function(co ntext,entryInfo,x,y,width)
580 {const lineHeight=18;const paddingLeft=10;const paddingTop=5;var maxTitleWidth=0 ;var basicFont="100% "+window.getComputedStyle(this.element,null).getPropertyVal ue("font-family");context.font="bold "+basicFont;context.textBaseline="top";for( var i=0;i<entryInfo.length;++i) 631 {const lineHeight=18;const paddingLeft=10;const paddingTop=5;var maxTitleWidth=0 ;var basicFont="100% "+window.getComputedStyle(this.element,null).getPropertyVal ue("font-family");context.font="bold "+basicFont;context.textBaseline="top";for( var i=0;i<entryInfo.length;++i)
581 maxTitleWidth=Math.max(maxTitleWidth,context.measureText(entryInfo[i].title).wid th);var maxTextWidth=0;for(var i=0;i<entryInfo.length;++i) 632 maxTitleWidth=Math.max(maxTitleWidth,context.measureText(entryInfo[i].title).wid th);var maxTextWidth=0;for(var i=0;i<entryInfo.length;++i)
582 maxTextWidth=Math.max(maxTextWidth,context.measureText(entryInfo[i].text).width) ;maxTextWidth=Math.min(maxTextWidth,width-2*paddingLeft-maxTitleWidth);context.b eginPath();context.rect(x,y,maxTitleWidth+maxTextWidth+5,lineHeight*entryInfo.le ngth+5);context.strokeStyle="rgba(0,0,0,0)";context.fillStyle="rgba(254,254,254, 0.8)";context.fill();context.stroke();context.fillStyle="#333";for(var i=0;i<ent ryInfo.length;++i) 633 maxTextWidth=Math.max(maxTextWidth,context.measureText(entryInfo[i].text).width) ;maxTextWidth=Math.min(maxTextWidth,width-2*paddingLeft-maxTitleWidth);context.b eginPath();context.rect(x,y,maxTitleWidth+maxTextWidth+5,lineHeight*entryInfo.le ngth+5);context.strokeStyle="rgba(0,0,0,0)";context.fillStyle="rgba(254,254,254, 0.8)";context.fill();context.stroke();context.fillStyle="#333";for(var i=0;i<ent ryInfo.length;++i)
583 context.fillText(entryInfo[i].title,x+paddingLeft,y+lineHeight*i);context.font=b asicFont;for(var i=0;i<entryInfo.length;++i){var text=this._prepareText(context, entryInfo[i].text,maxTextWidth);context.fillText(text,x+paddingLeft+maxTitleWidt h+paddingLeft,y+lineHeight*i);}},_prepareText:function(context,title,maxSize) 634 context.fillText(entryInfo[i].title,x+paddingLeft,y+lineHeight*i);context.font=b asicFont;for(var i=0;i<entryInfo.length;++i){var text=this._prepareText(context, entryInfo[i].text,maxTextWidth);context.fillText(text,x+paddingLeft+maxTitleWidt h+paddingLeft,y+lineHeight*i);}},_prepareText:function(context,title,maxSize)
584 {if(maxSize<this._dotsWidth) 635 {if(maxSize<this._dotsWidth)
585 return null;var titleWidth=context.measureText(title).width;if(maxSize>titleWidt h) 636 return null;var titleWidth=context.measureText(title).width;if(maxSize>titleWidt h)
586 return title;maxSize-=this._dotsWidth;var dotRegExp=/[\.\$]/g;var match=dotRegEx p.exec(title);if(!match){var visiblePartSize=maxSize/titleWidth;var newTextLengt h=Math.floor(title.length*visiblePartSize)+1;var minTextLength=4;if(newTextLengt h<minTextLength) 637 return title;maxSize-=this._dotsWidth;var dotRegExp=/[\.\$]/g;var match=dotRegEx p.exec(title);if(!match){var visiblePartSize=maxSize/titleWidth;var newTextLengt h=Math.floor(title.length*visiblePartSize)+1;var minTextLength=4;if(newTextLengt h<minTextLength)
587 return null;var substring;do{--newTextLength;substring=title.substring(0,newText Length);}while(context.measureText(substring).width>maxSize);return title.substr ing(0,newTextLength)+"\u2026";} 638 return null;var substring;do{--newTextLength;substring=title.substring(0,newText Length);}while(context.measureText(substring).width>maxSize);return title.substr ing(0,newTextLength)+"\u2026";}
588 while(match){var substring=title.substring(match.index+1);var width=context.meas ureText(substring).width;if(maxSize>width) 639 while(match){var substring=title.substring(match.index+1);var width=context.meas ureText(substring).width;if(maxSize>width)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 {return this.nodeIndex+this._snapshot._nodeFieldCount;},_type:function() 721 {return this.nodeIndex+this._snapshot._nodeFieldCount;},_type:function()
671 {var snapshot=this._snapshot;return snapshot._nodes[this.nodeIndex+snapshot._nod eTypeOffset];}};WebInspector.HeapSnapshotNodeIterator=function(node) 722 {var snapshot=this._snapshot;return snapshot._nodes[this.nodeIndex+snapshot._nod eTypeOffset];}};WebInspector.HeapSnapshotNodeIterator=function(node)
672 {this.node=node;this._nodesLength=node._snapshot._nodes.length;} 723 {this.node=node;this._nodesLength=node._snapshot._nodes.length;}
673 WebInspector.HeapSnapshotNodeIterator.prototype={rewind:function() 724 WebInspector.HeapSnapshotNodeIterator.prototype={rewind:function()
674 {this.node.nodeIndex=this.node._firstNodeIndex;},hasNext:function() 725 {this.node.nodeIndex=this.node._firstNodeIndex;},hasNext:function()
675 {return this.node.nodeIndex<this._nodesLength;},index:function() 726 {return this.node.nodeIndex<this._nodesLength;},index:function()
676 {return this.node.nodeIndex;},setIndex:function(newIndex) 727 {return this.node.nodeIndex;},setIndex:function(newIndex)
677 {this.node.nodeIndex=newIndex;},item:function() 728 {this.node.nodeIndex=newIndex;},item:function()
678 {return this.node;},next:function() 729 {return this.node;},next:function()
679 {this.node.nodeIndex=this.node._nextNodeIndex();}} 730 {this.node.nodeIndex=this.node._nextNodeIndex();}}
680 WebInspector.HeapSnapshot=function(profile) 731 WebInspector.HeapSnapshotProgress=function(dispatcher)
681 {this.uid=profile.snapshot.uid;this._nodes=profile.nodes;this._containmentEdges= profile.edges;this._metaNode=profile.snapshot.meta;this._strings=profile.strings ;this._noDistance=-5;this._rootNodeIndex=0;if(profile.snapshot.root_index) 732 {this._dispatcher=dispatcher;}
682 this._rootNodeIndex=profile.snapshot.root_index;this._snapshotDiffs={};this._agg regatesForDiff=null;this._init();} 733 WebInspector.HeapSnapshotProgress.Event={Update:"ProgressUpdate"};WebInspector.H eapSnapshotProgress.prototype={updateStatus:function(status)
683 function HeapSnapshotMetainfo() 734 {this._sendUpdateEvent(WebInspector.UIString(status));},updateProgress:function( title,value,total)
735 {var percentValue=((total?(value/total):0)*100).toFixed(0);this._sendUpdateEvent (WebInspector.UIString(title,percentValue));},_sendUpdateEvent:function(text)
736 {if(this._dispatcher)
737 this._dispatcher.sendEvent(WebInspector.HeapSnapshotProgress.Event.Update,text); }}
738 WebInspector.HeapSnapshot=function(profile,progress)
739 {this.uid=profile.snapshot.uid;this._nodes=profile.nodes;this._containmentEdges= profile.edges;this._metaNode=profile.snapshot.meta;this._strings=profile.strings ;this._progress=progress;this._noDistance=-5;this._rootNodeIndex=0;if(profile.sn apshot.root_index)
740 this._rootNodeIndex=profile.snapshot.root_index;this._snapshotDiffs={};this._agg regatesForDiff=null;this._init();if(WebInspector.HeapSnapshot.enableAllocationPr ofiler){this._progress.updateStatus("Buiding allocation statistics\u2026");this. _allocationProfile=new WebInspector.AllocationProfile(profile);this._progress.up dateStatus("Done");}}
741 WebInspector.HeapSnapshot.enableAllocationProfiler=false;function HeapSnapshotMe tainfo()
684 {this.node_fields=[];this.node_types=[];this.edge_fields=[];this.edge_types=[];t his.type_strings={};this.fields=[];this.types=[];} 742 {this.node_fields=[];this.node_types=[];this.edge_fields=[];this.edge_types=[];t his.type_strings={};this.fields=[];this.types=[];}
685 function HeapSnapshotHeader() 743 function HeapSnapshotHeader()
686 {this.title="";this.uid=0;this.meta=new HeapSnapshotMetainfo();this.node_count=0 ;this.edge_count=0;} 744 {this.title="";this.uid=0;this.meta=new HeapSnapshotMetainfo();this.node_count=0 ;this.edge_count=0;}
687 WebInspector.HeapSnapshot.prototype={_init:function() 745 WebInspector.HeapSnapshot.prototype={_init:function()
688 {var meta=this._metaNode;this._nodeTypeOffset=meta.node_fields.indexOf("type");t his._nodeNameOffset=meta.node_fields.indexOf("name");this._nodeIdOffset=meta.nod e_fields.indexOf("id");this._nodeSelfSizeOffset=meta.node_fields.indexOf("self_s ize");this._nodeEdgeCountOffset=meta.node_fields.indexOf("edge_count");this._nod eFieldCount=meta.node_fields.length;this._nodeTypes=meta.node_types[this._nodeTy peOffset];this._nodeHiddenType=this._nodeTypes.indexOf("hidden");this._nodeObjec tType=this._nodeTypes.indexOf("object");this._nodeNativeType=this._nodeTypes.ind exOf("native");this._nodeCodeType=this._nodeTypes.indexOf("code");this._nodeSynt heticType=this._nodeTypes.indexOf("synthetic");this._edgeFieldsCount=meta.edge_f ields.length;this._edgeTypeOffset=meta.edge_fields.indexOf("type");this._edgeNam eOffset=meta.edge_fields.indexOf("name_or_index");this._edgeToNodeOffset=meta.ed ge_fields.indexOf("to_node");this._edgeTypes=meta.edge_types[this._edgeTypeOffse t];this._edgeTypes.push("invisible");this._edgeElementType=this._edgeTypes.index Of("element");this._edgeHiddenType=this._edgeTypes.indexOf("hidden");this._edgeI nternalType=this._edgeTypes.indexOf("internal");this._edgeShortcutType=this._edg eTypes.indexOf("shortcut");this._edgeWeakType=this._edgeTypes.indexOf("weak");th is._edgeInvisibleType=this._edgeTypes.indexOf("invisible");this.nodeCount=this._ nodes.length/this._nodeFieldCount;this._edgeCount=this._containmentEdges.length/ this._edgeFieldsCount;this._buildEdgeIndexes();this._markInvisibleEdges();this._ buildRetainers();this._calculateFlags();this._calculateDistances();var result=th is._buildPostOrderIndex();this._dominatorsTree=this._buildDominatorTree(result.p ostOrderIndex2NodeOrdinal,result.nodeOrdinal2PostOrderIndex);this._calculateReta inedSizes(result.postOrderIndex2NodeOrdinal);this._buildDominatedNodes();},_buil dEdgeIndexes:function() 746 {var meta=this._metaNode;this._nodeTypeOffset=meta.node_fields.indexOf("type");t his._nodeNameOffset=meta.node_fields.indexOf("name");this._nodeIdOffset=meta.nod e_fields.indexOf("id");this._nodeSelfSizeOffset=meta.node_fields.indexOf("self_s ize");this._nodeEdgeCountOffset=meta.node_fields.indexOf("edge_count");this._nod eFieldCount=meta.node_fields.length;this._nodeTypes=meta.node_types[this._nodeTy peOffset];this._nodeHiddenType=this._nodeTypes.indexOf("hidden");this._nodeObjec tType=this._nodeTypes.indexOf("object");this._nodeNativeType=this._nodeTypes.ind exOf("native");this._nodeConsStringType=this._nodeTypes.indexOf("concatenated st ring");this._nodeSlicedStringType=this._nodeTypes.indexOf("sliced string");this. _nodeCodeType=this._nodeTypes.indexOf("code");this._nodeSyntheticType=this._node Types.indexOf("synthetic");this._edgeFieldsCount=meta.edge_fields.length;this._e dgeTypeOffset=meta.edge_fields.indexOf("type");this._edgeNameOffset=meta.edge_fi elds.indexOf("name_or_index");this._edgeToNodeOffset=meta.edge_fields.indexOf("t o_node");this._edgeTypes=meta.edge_types[this._edgeTypeOffset];this._edgeTypes.p ush("invisible");this._edgeElementType=this._edgeTypes.indexOf("element");this._ edgeHiddenType=this._edgeTypes.indexOf("hidden");this._edgeInternalType=this._ed geTypes.indexOf("internal");this._edgeShortcutType=this._edgeTypes.indexOf("shor tcut");this._edgeWeakType=this._edgeTypes.indexOf("weak");this._edgeInvisibleTyp e=this._edgeTypes.indexOf("invisible");this.nodeCount=this._nodes.length/this._n odeFieldCount;this._edgeCount=this._containmentEdges.length/this._edgeFieldsCoun t;this._progress.updateStatus("Building edge indexes\u2026");this._buildEdgeInde xes();this._progress.updateStatus("Marking invisible edges\u2026");this._markInv isibleEdges();this._progress.updateStatus("Building retainers\u2026");this._buil dRetainers();this._progress.updateStatus("Calculating node flags\u2026");this._c alculateFlags();this._progress.updateStatus("Calculating distances\u2026");this. _calculateDistances();this._progress.updateStatus("Building postorder index\u202 6");var result=this._buildPostOrderIndex();this._progress.updateStatus("Building dominator tree\u2026");this._dominatorsTree=this._buildDominatorTree(result.pos tOrderIndex2NodeOrdinal,result.nodeOrdinal2PostOrderIndex);this._progress.update Status("Calculating retained sizes\u2026");this._calculateRetainedSizes(result.p ostOrderIndex2NodeOrdinal);this._progress.updateStatus("Buiding dominated nodes\ u2026");this._buildDominatedNodes();this._progress.updateStatus("Finished proces sing.");},_buildEdgeIndexes:function()
689 {var nodes=this._nodes;var nodeCount=this.nodeCount;var firstEdgeIndexes=this._f irstEdgeIndexes=new Uint32Array(nodeCount+1);var nodeFieldCount=this._nodeFieldC ount;var edgeFieldsCount=this._edgeFieldsCount;var nodeEdgeCountOffset=this._nod eEdgeCountOffset;firstEdgeIndexes[nodeCount]=this._containmentEdges.length;for(v ar nodeOrdinal=0,edgeIndex=0;nodeOrdinal<nodeCount;++nodeOrdinal){firstEdgeIndex es[nodeOrdinal]=edgeIndex;edgeIndex+=nodes[nodeOrdinal*nodeFieldCount+nodeEdgeCo untOffset]*edgeFieldsCount;}},_buildRetainers:function() 747 {var nodes=this._nodes;var nodeCount=this.nodeCount;var firstEdgeIndexes=this._f irstEdgeIndexes=new Uint32Array(nodeCount+1);var nodeFieldCount=this._nodeFieldC ount;var edgeFieldsCount=this._edgeFieldsCount;var nodeEdgeCountOffset=this._nod eEdgeCountOffset;firstEdgeIndexes[nodeCount]=this._containmentEdges.length;for(v ar nodeOrdinal=0,edgeIndex=0;nodeOrdinal<nodeCount;++nodeOrdinal){firstEdgeIndex es[nodeOrdinal]=edgeIndex;edgeIndex+=nodes[nodeOrdinal*nodeFieldCount+nodeEdgeCo untOffset]*edgeFieldsCount;}},_buildRetainers:function()
690 {var retainingNodes=this._retainingNodes=new Uint32Array(this._edgeCount);var re tainingEdges=this._retainingEdges=new Uint32Array(this._edgeCount);var firstReta inerIndex=this._firstRetainerIndex=new Uint32Array(this.nodeCount+1);var contain mentEdges=this._containmentEdges;var edgeFieldsCount=this._edgeFieldsCount;var n odeFieldCount=this._nodeFieldCount;var edgeToNodeOffset=this._edgeToNodeOffset;v ar nodes=this._nodes;var firstEdgeIndexes=this._firstEdgeIndexes;var nodeCount=t his.nodeCount;for(var toNodeFieldIndex=edgeToNodeOffset,l=containmentEdges.lengt h;toNodeFieldIndex<l;toNodeFieldIndex+=edgeFieldsCount){var toNodeIndex=containm entEdges[toNodeFieldIndex];if(toNodeIndex%nodeFieldCount) 748 {var retainingNodes=this._retainingNodes=new Uint32Array(this._edgeCount);var re tainingEdges=this._retainingEdges=new Uint32Array(this._edgeCount);var firstReta inerIndex=this._firstRetainerIndex=new Uint32Array(this.nodeCount+1);var contain mentEdges=this._containmentEdges;var edgeFieldsCount=this._edgeFieldsCount;var n odeFieldCount=this._nodeFieldCount;var edgeToNodeOffset=this._edgeToNodeOffset;v ar nodes=this._nodes;var firstEdgeIndexes=this._firstEdgeIndexes;var nodeCount=t his.nodeCount;for(var toNodeFieldIndex=edgeToNodeOffset,l=containmentEdges.lengt h;toNodeFieldIndex<l;toNodeFieldIndex+=edgeFieldsCount){var toNodeIndex=containm entEdges[toNodeFieldIndex];if(toNodeIndex%nodeFieldCount)
691 throw new Error("Invalid toNodeIndex "+toNodeIndex);++firstRetainerIndex[toNodeI ndex/nodeFieldCount];} 749 throw new Error("Invalid toNodeIndex "+toNodeIndex);++firstRetainerIndex[toNodeI ndex/nodeFieldCount];}
692 for(var i=0,firstUnusedRetainerSlot=0;i<nodeCount;i++){var retainersCount=firstR etainerIndex[i];firstRetainerIndex[i]=firstUnusedRetainerSlot;retainingNodes[fir stUnusedRetainerSlot]=retainersCount;firstUnusedRetainerSlot+=retainersCount;} 750 for(var i=0,firstUnusedRetainerSlot=0;i<nodeCount;i++){var retainersCount=firstR etainerIndex[i];firstRetainerIndex[i]=firstUnusedRetainerSlot;retainingNodes[fir stUnusedRetainerSlot]=retainersCount;firstUnusedRetainerSlot+=retainersCount;}
693 firstRetainerIndex[nodeCount]=retainingNodes.length;var nextNodeFirstEdgeIndex=f irstEdgeIndexes[0];for(var srcNodeOrdinal=0;srcNodeOrdinal<nodeCount;++srcNodeOr dinal){var firstEdgeIndex=nextNodeFirstEdgeIndex;nextNodeFirstEdgeIndex=firstEdg eIndexes[srcNodeOrdinal+1];var srcNodeIndex=srcNodeOrdinal*nodeFieldCount;for(va r edgeIndex=firstEdgeIndex;edgeIndex<nextNodeFirstEdgeIndex;edgeIndex+=edgeField sCount){var toNodeIndex=containmentEdges[edgeIndex+edgeToNodeOffset];if(toNodeIn dex%nodeFieldCount) 751 firstRetainerIndex[nodeCount]=retainingNodes.length;var nextNodeFirstEdgeIndex=f irstEdgeIndexes[0];for(var srcNodeOrdinal=0;srcNodeOrdinal<nodeCount;++srcNodeOr dinal){var firstEdgeIndex=nextNodeFirstEdgeIndex;nextNodeFirstEdgeIndex=firstEdg eIndexes[srcNodeOrdinal+1];var srcNodeIndex=srcNodeOrdinal*nodeFieldCount;for(va r edgeIndex=firstEdgeIndex;edgeIndex<nextNodeFirstEdgeIndex;edgeIndex+=edgeField sCount){var toNodeIndex=containmentEdges[edgeIndex+edgeToNodeOffset];if(toNodeIn dex%nodeFieldCount)
694 throw new Error("Invalid toNodeIndex "+toNodeIndex);var firstRetainerSlotIndex=f irstRetainerIndex[toNodeIndex/nodeFieldCount];var nextUnusedRetainerSlotIndex=fi rstRetainerSlotIndex+(--retainingNodes[firstRetainerSlotIndex]);retainingNodes[n extUnusedRetainerSlotIndex]=srcNodeIndex;retainingEdges[nextUnusedRetainerSlotIn dex]=edgeIndex;}}},createNode:function(nodeIndex) 752 throw new Error("Invalid toNodeIndex "+toNodeIndex);var firstRetainerSlotIndex=f irstRetainerIndex[toNodeIndex/nodeFieldCount];var nextUnusedRetainerSlotIndex=fi rstRetainerSlotIndex+(--retainingNodes[firstRetainerSlotIndex]);retainingNodes[n extUnusedRetainerSlotIndex]=srcNodeIndex;retainingEdges[nextUnusedRetainerSlotIn dex]=edgeIndex;}}},createNode:function(nodeIndex)
695 {throw new Error("Not implemented");},createEdge:function(edges,edgeIndex) 753 {throw new Error("Not implemented");},createEdge:function(edges,edgeIndex)
696 {throw new Error("Not implemented");},createRetainingEdge:function(retainedNodeI ndex,retainerIndex) 754 {throw new Error("Not implemented");},createRetainingEdge:function(retainedNodeI ndex,retainerIndex)
697 {throw new Error("Not implemented");},dispose:function() 755 {throw new Error("Not implemented");},dispose:function()
698 {delete this._nodes;delete this._strings;delete this._retainingEdges;delete this ._retainingNodes;delete this._firstRetainerIndex;if(this._aggregates){delete thi s._aggregates;delete this._aggregatesSortedFlags;} 756 {delete this._nodes;delete this._strings;delete this._retainingEdges;delete this ._retainingNodes;delete this._firstRetainerIndex;if(this._aggregates){delete thi s._aggregates;delete this._aggregatesSortedFlags;}
699 delete this._dominatedNodes;delete this._firstDominatedNodeIndex;delete this._no deDistances;delete this._dominatorsTree;},_allNodes:function() 757 delete this._dominatedNodes;delete this._firstDominatedNodeIndex;delete this._no deDistances;delete this._dominatorsTree;},_allNodes:function()
700 {return new WebInspector.HeapSnapshotNodeIterator(this.rootNode());},rootNode:fu nction() 758 {return new WebInspector.HeapSnapshotNodeIterator(this.rootNode());},rootNode:fu nction()
701 {return this.createNode(this._rootNodeIndex);},get rootNodeIndex() 759 {return this.createNode(this._rootNodeIndex);},get rootNodeIndex()
702 {return this._rootNodeIndex;},get totalSize() 760 {return this._rootNodeIndex;},get totalSize()
703 {return this.rootNode().retainedSize();},_getDominatedIndex:function(nodeIndex) 761 {return this.rootNode().retainedSize();},_getDominatedIndex:function(nodeIndex)
704 {if(nodeIndex%this._nodeFieldCount) 762 {if(nodeIndex%this._nodeFieldCount)
705 throw new Error("Invalid nodeIndex: "+nodeIndex);return this._firstDominatedNode Index[nodeIndex/this._nodeFieldCount];},_dominatedNodesOfNode:function(node) 763 throw new Error("Invalid nodeIndex: "+nodeIndex);return this._firstDominatedNode Index[nodeIndex/this._nodeFieldCount];},_dominatedNodesOfNode:function(node)
706 {var dominatedIndexFrom=this._getDominatedIndex(node.nodeIndex);var dominatedInd exTo=this._getDominatedIndex(node._nextNodeIndex());return new WebInspector.Heap SnapshotArraySlice(this._dominatedNodes,dominatedIndexFrom,dominatedIndexTo);},a ggregates:function(sortedIndexes,key,filterString) 764 {var dominatedIndexFrom=this._getDominatedIndex(node.nodeIndex);var dominatedInd exTo=this._getDominatedIndex(node._nextNodeIndex());return new WebInspector.Heap SnapshotArraySlice(this._dominatedNodes,dominatedIndexFrom,dominatedIndexTo);},a ggregates:function(sortedIndexes,key,filterString)
707 {if(!this._aggregates){this._aggregates={};this._aggregatesSortedFlags={};} 765 {if(!this._aggregates){this._aggregates={};this._aggregatesSortedFlags={};}
708 var aggregatesByClassName=this._aggregates[key];if(aggregatesByClassName){if(sor tedIndexes&&!this._aggregatesSortedFlags[key]){this._sortAggregateIndexes(aggreg atesByClassName);this._aggregatesSortedFlags[key]=sortedIndexes;} 766 var aggregatesByClassName=this._aggregates[key];if(aggregatesByClassName){if(sor tedIndexes&&!this._aggregatesSortedFlags[key]){this._sortAggregateIndexes(aggreg atesByClassName);this._aggregatesSortedFlags[key]=sortedIndexes;}
709 return aggregatesByClassName;} 767 return aggregatesByClassName;}
710 var filter;if(filterString) 768 var filter;if(filterString)
711 filter=this._parseFilter(filterString);var aggregates=this._buildAggregates(filt er);this._calculateClassesRetainedSize(aggregates.aggregatesByClassIndex,filter) ;aggregatesByClassName=aggregates.aggregatesByClassName;if(sortedIndexes) 769 filter=this._parseFilter(filterString);var aggregates=this._buildAggregates(filt er);this._calculateClassesRetainedSize(aggregates.aggregatesByClassIndex,filter) ;aggregatesByClassName=aggregates.aggregatesByClassName;if(sortedIndexes)
712 this._sortAggregateIndexes(aggregatesByClassName);this._aggregatesSortedFlags[ke y]=sortedIndexes;this._aggregates[key]=aggregatesByClassName;return aggregatesBy ClassName;},aggregatesForDiff:function() 770 this._sortAggregateIndexes(aggregatesByClassName);this._aggregatesSortedFlags[ke y]=sortedIndexes;this._aggregates[key]=aggregatesByClassName;return aggregatesBy ClassName;},allocationTracesTops:function()
771 {return this._allocationProfile.serializeTraceTops();},allocationNodeCallers:fun ction(nodeId)
772 {return this._allocationProfile.serializeCallers(nodeId);},aggregatesForDiff:fun ction()
713 {if(this._aggregatesForDiff) 773 {if(this._aggregatesForDiff)
714 return this._aggregatesForDiff;var aggregatesByClassName=this.aggregates(true,"a llObjects");this._aggregatesForDiff={};var node=this.createNode();for(var classN ame in aggregatesByClassName){var aggregate=aggregatesByClassName[className];var indexes=aggregate.idxs;var ids=new Array(indexes.length);var selfSizes=new Arra y(indexes.length);for(var i=0;i<indexes.length;i++){node.nodeIndex=indexes[i];id s[i]=node.id();selfSizes[i]=node.selfSize();} 774 return this._aggregatesForDiff;var aggregatesByClassName=this.aggregates(true,"a llObjects");this._aggregatesForDiff={};var node=this.createNode();for(var classN ame in aggregatesByClassName){var aggregate=aggregatesByClassName[className];var indexes=aggregate.idxs;var ids=new Array(indexes.length);var selfSizes=new Arra y(indexes.length);for(var i=0;i<indexes.length;i++){node.nodeIndex=indexes[i];id s[i]=node.id();selfSizes[i]=node.selfSize();}
715 this._aggregatesForDiff[className]={indexes:indexes,ids:ids,selfSizes:selfSizes} ;} 775 this._aggregatesForDiff[className]={indexes:indexes,ids:ids,selfSizes:selfSizes} ;}
716 return this._aggregatesForDiff;},_isUserRoot:function(node) 776 return this._aggregatesForDiff;},_isUserRoot:function(node)
717 {return true;},forEachRoot:function(action,userRootsOnly) 777 {return true;},forEachRoot:function(action,userRootsOnly)
718 {for(var iter=this.rootNode().edges();iter.hasNext();iter.next()){var node=iter. edge.node();if(!userRootsOnly||this._isUserRoot(node)) 778 {for(var iter=this.rootNode().edges();iter.hasNext();iter.next()){var node=iter. edge.node();if(!userRootsOnly||this._isUserRoot(node))
719 action(node);}},_calculateDistances:function() 779 action(node);}},_calculateDistances:function()
720 {var nodeFieldCount=this._nodeFieldCount;var nodeCount=this.nodeCount;var distan ces=new Int32Array(nodeCount);var noDistance=this._noDistance;for(var i=0;i<node Count;++i) 780 {var nodeFieldCount=this._nodeFieldCount;var nodeCount=this.nodeCount;var distan ces=new Int32Array(nodeCount);var noDistance=this._noDistance;for(var i=0;i<node Count;++i)
721 distances[i]=noDistance;var nodesToVisit=new Uint32Array(this.nodeCount);var nod esToVisitLength=0;function enqueueNode(node) 781 distances[i]=noDistance;var nodesToVisit=new Uint32Array(this.nodeCount);var nod esToVisitLength=0;function enqueueNode(node)
722 {var ordinal=node._ordinal();if(distances[ordinal]!==noDistance) 782 {var ordinal=node._ordinal();if(distances[ordinal]!==noDistance)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 {var node=this.createNode(nodeIndex);return new WebInspector.HeapSnapshotEdgesPr ovider(this,filter,node.edges());},retainingEdgesFilter:function(showHiddenData) 855 {var node=this.createNode(nodeIndex);return new WebInspector.HeapSnapshotEdgesPr ovider(this,filter,node.edges());},retainingEdgesFilter:function(showHiddenData)
796 {return null;},containmentEdgesFilter:function(showHiddenData) 856 {return null;},containmentEdgesFilter:function(showHiddenData)
797 {return null;},createRetainingEdgesProvider:function(nodeIndex,showHiddenData) 857 {return null;},createRetainingEdgesProvider:function(nodeIndex,showHiddenData)
798 {var node=this.createNode(nodeIndex);var filter=this.retainingEdgesFilter(showHi ddenData);return new WebInspector.HeapSnapshotEdgesProvider(this,filter,node.ret ainers());},createAddedNodesProvider:function(baseSnapshotId,className) 858 {var node=this.createNode(nodeIndex);var filter=this.retainingEdgesFilter(showHi ddenData);return new WebInspector.HeapSnapshotEdgesProvider(this,filter,node.ret ainers());},createAddedNodesProvider:function(baseSnapshotId,className)
799 {var snapshotDiff=this._snapshotDiffs[baseSnapshotId];var diffForClass=snapshotD iff[className];return new WebInspector.HeapSnapshotNodesProvider(this,null,diffF orClass.addedIndexes);},createDeletedNodesProvider:function(nodeIndexes) 859 {var snapshotDiff=this._snapshotDiffs[baseSnapshotId];var diffForClass=snapshotD iff[className];return new WebInspector.HeapSnapshotNodesProvider(this,null,diffF orClass.addedIndexes);},createDeletedNodesProvider:function(nodeIndexes)
800 {return new WebInspector.HeapSnapshotNodesProvider(this,null,nodeIndexes);},clas sNodesFilter:function() 860 {return new WebInspector.HeapSnapshotNodesProvider(this,null,nodeIndexes);},clas sNodesFilter:function()
801 {return null;},createNodesProviderForClass:function(className,aggregatesKey) 861 {return null;},createNodesProviderForClass:function(className,aggregatesKey)
802 {return new WebInspector.HeapSnapshotNodesProvider(this,this.classNodesFilter(), this.aggregates(false,aggregatesKey)[className].idxs);},createNodesProviderForDo minator:function(nodeIndex) 862 {return new WebInspector.HeapSnapshotNodesProvider(this,this.classNodesFilter(), this.aggregates(false,aggregatesKey)[className].idxs);},createNodesProviderForDo minator:function(nodeIndex)
803 {var node=this.createNode(nodeIndex);return new WebInspector.HeapSnapshotNodesPr ovider(this,null,this._dominatedNodesOfNode(node));},updateStaticData:function() 863 {var node=this.createNode(nodeIndex);return new WebInspector.HeapSnapshotNodesPr ovider(this,null,this._dominatedNodesOfNode(node));},updateStaticData:function()
804 {return{nodeCount:this.nodeCount,rootNodeIndex:this._rootNodeIndex,totalSize:thi s.totalSize,uid:this.uid};}};WebInspector.HeapSnapshotFilteredOrderedIterator=fu nction(iterator,filter,unfilteredIterationOrder) 864 {return{nodeCount:this.nodeCount,rootNodeIndex:this._rootNodeIndex,totalSize:thi s.totalSize,uid:this.uid};}};WebInspector.HeapSnapshotFilteredOrderedIterator=fu nction(iterator,filter,unfilteredIterationOrder)
805 {this._filter=filter;this._iterator=iterator;this._unfilteredIterationOrder=unfi lteredIterationOrder;this._iterationOrder=null;this._position=0;this._currentCom parator=null;this._sortedPrefixLength=0;} 865 {this._filter=filter;this._iterator=iterator;this._unfilteredIterationOrder=unfi lteredIterationOrder;this._iterationOrder=null;this._position=0;this._currentCom parator=null;this._sortedPrefixLength=0;this._sortedSuffixLength=0;}
806 WebInspector.HeapSnapshotFilteredOrderedIterator.prototype={_createIterationOrde r:function() 866 WebInspector.HeapSnapshotFilteredOrderedIterator.prototype={_createIterationOrde r:function()
807 {if(this._iterationOrder) 867 {if(this._iterationOrder)
808 return;if(this._unfilteredIterationOrder&&!this._filter){this._iterationOrder=th is._unfilteredIterationOrder.slice(0);this._unfilteredIterationOrder=null;return ;} 868 return;if(this._unfilteredIterationOrder&&!this._filter){this._iterationOrder=th is._unfilteredIterationOrder.slice(0);this._unfilteredIterationOrder=null;return ;}
809 this._iterationOrder=[];var iterator=this._iterator;if(!this._unfilteredIteratio nOrder&&!this._filter){for(iterator.rewind();iterator.hasNext();iterator.next()) 869 this._iterationOrder=[];var iterator=this._iterator;if(!this._unfilteredIteratio nOrder&&!this._filter){for(iterator.rewind();iterator.hasNext();iterator.next())
810 this._iterationOrder.push(iterator.index());}else if(!this._unfilteredIterationO rder){for(iterator.rewind();iterator.hasNext();iterator.next()){if(this._filter( iterator.item())) 870 this._iterationOrder.push(iterator.index());}else if(!this._unfilteredIterationO rder){for(iterator.rewind();iterator.hasNext();iterator.next()){if(this._filter( iterator.item()))
811 this._iterationOrder.push(iterator.index());}}else{var order=this._unfilteredIte rationOrder.constructor===Array?this._unfilteredIterationOrder:this._unfilteredI terationOrder.slice(0);for(var i=0,l=order.length;i<l;++i){iterator.setIndex(ord er[i]);if(this._filter(iterator.item())) 871 this._iterationOrder.push(iterator.index());}}else{var order=this._unfilteredIte rationOrder.constructor===Array?this._unfilteredIterationOrder:this._unfilteredI terationOrder.slice(0);for(var i=0,l=order.length;i<l;++i){iterator.setIndex(ord er[i]);if(this._filter(iterator.item()))
812 this._iterationOrder.push(iterator.index());} 872 this._iterationOrder.push(iterator.index());}
813 this._unfilteredIterationOrder=null;}},rewind:function() 873 this._unfilteredIterationOrder=null;}},rewind:function()
814 {this._position=0;},hasNext:function() 874 {this._position=0;},hasNext:function()
815 {return this._position<this._iterationOrder.length;},isEmpty:function() 875 {return this._position<this._iterationOrder.length;},isEmpty:function()
816 {if(this._iterationOrder) 876 {if(this._iterationOrder)
817 return!this._iterationOrder.length;if(this._unfilteredIterationOrder&&!this._fil ter) 877 return!this._iterationOrder.length;if(this._unfilteredIterationOrder&&!this._fil ter)
818 return!this._unfilteredIterationOrder.length;var iterator=this._iterator;if(!thi s._unfilteredIterationOrder&&!this._filter){iterator.rewind();return!iterator.ha sNext();}else if(!this._unfilteredIterationOrder){for(iterator.rewind();iterator .hasNext();iterator.next()) 878 return!this._unfilteredIterationOrder.length;var iterator=this._iterator;if(!thi s._unfilteredIterationOrder&&!this._filter){iterator.rewind();return!iterator.ha sNext();}else if(!this._unfilteredIterationOrder){for(iterator.rewind();iterator .hasNext();iterator.next())
819 if(this._filter(iterator.item())) 879 if(this._filter(iterator.item()))
820 return false;}else{var order=this._unfilteredIterationOrder.constructor===Array? this._unfilteredIterationOrder:this._unfilteredIterationOrder.slice(0);for(var i =0,l=order.length;i<l;++i){iterator.setIndex(order[i]);if(this._filter(iterator. item())) 880 return false;}else{var order=this._unfilteredIterationOrder.constructor===Array? this._unfilteredIterationOrder:this._unfilteredIterationOrder.slice(0);for(var i =0,l=order.length;i<l;++i){iterator.setIndex(order[i]);if(this._filter(iterator. item()))
821 return false;}} 881 return false;}}
822 return true;},item:function() 882 return true;},item:function()
823 {this._iterator.setIndex(this._iterationOrder[this._position]);return this._iter ator.item();},get length() 883 {this._iterator.setIndex(this._iterationOrder[this._position]);return this._iter ator.item();},get length()
824 {this._createIterationOrder();return this._iterationOrder.length;},next:function () 884 {this._createIterationOrder();return this._iterationOrder.length;},next:function ()
825 {++this._position;},serializeItemsRange:function(begin,end) 885 {++this._position;},serializeItemsRange:function(begin,end)
826 {this._createIterationOrder();if(begin>end) 886 {this._createIterationOrder();if(begin>end)
827 throw new Error("Start position > end position: "+begin+" > "+end);if(end>=this. _iterationOrder.length) 887 throw new Error("Start position > end position: "+begin+" > "+end);if(end>this._ iterationOrder.length)
828 end=this._iterationOrder.length;if(this._sortedPrefixLength<end){this.sort(this. _currentComparator,this._sortedPrefixLength,this._iterationOrder.length-1,end-th is._sortedPrefixLength);this._sortedPrefixLength=end;} 888 end=this._iterationOrder.length;if(this._sortedPrefixLength<end&&begin<this._ite rationOrder.length-this._sortedSuffixLength){this.sort(this._currentComparator,t his._sortedPrefixLength,this._iterationOrder.length-1-this._sortedSuffixLength,b egin,end-1);if(begin<=this._sortedPrefixLength)
889 this._sortedPrefixLength=end;if(end>=this._iterationOrder.length-this._sortedSuf fixLength)
890 this._sortedSuffixLength=this._iterationOrder.length-begin;}
829 this._position=begin;var startPosition=this._position;var count=end-begin;var re sult=new Array(count);for(var i=0;i<count&&this.hasNext();++i,this.next()) 891 this._position=begin;var startPosition=this._position;var count=end-begin;var re sult=new Array(count);for(var i=0;i<count&&this.hasNext();++i,this.next())
830 result[i]=this.item().serialize();result.length=i;result.totalLength=this._itera tionOrder.length;result.startPosition=startPosition;result.endPosition=this._pos ition;return result;},sortAll:function() 892 result[i]=this.item().serialize();result.length=i;result.totalLength=this._itera tionOrder.length;result.startPosition=startPosition;result.endPosition=this._pos ition;return result;},sortAll:function()
831 {this._createIterationOrder();if(this._sortedPrefixLength===this._iterationOrder .length) 893 {this._createIterationOrder();if(this._sortedPrefixLength+this._sortedSuffixLeng th>=this._iterationOrder.length)
832 return;this.sort(this._currentComparator,this._sortedPrefixLength,this._iteratio nOrder.length-1,this._iterationOrder.length);this._sortedPrefixLength=this._iter ationOrder.length;},sortAndRewind:function(comparator) 894 return;this.sort(this._currentComparator,this._sortedPrefixLength,this._iteratio nOrder.length-1-this._sortedSuffixLength,this._sortedPrefixLength,this._iteratio nOrder.length-1-this._sortedSuffixLength);this._sortedPrefixLength=this._iterati onOrder.length;this._sortedSuffixLength=0;},sortAndRewind:function(comparator)
833 {this._currentComparator=comparator;this._sortedPrefixLength=0;this.rewind();}} 895 {this._currentComparator=comparator;this._sortedPrefixLength=0;this._sortedSuffi xLength=0;this.rewind();}}
834 WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator=func tion(fieldNames) 896 WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator=func tion(fieldNames)
835 {return{fieldName1:fieldNames[0],ascending1:fieldNames[1],fieldName2:fieldNames[ 2],ascending2:fieldNames[3]};} 897 {return{fieldName1:fieldNames[0],ascending1:fieldNames[1],fieldName2:fieldNames[ 2],ascending2:fieldNames[3]};}
836 WebInspector.HeapSnapshotEdgesProvider=function(snapshot,filter,edgesIter) 898 WebInspector.HeapSnapshotEdgesProvider=function(snapshot,filter,edgesIter)
837 {this.snapshot=snapshot;WebInspector.HeapSnapshotFilteredOrderedIterator.call(th is,edgesIter,filter);} 899 {this.snapshot=snapshot;WebInspector.HeapSnapshotFilteredOrderedIterator.call(th is,edgesIter,filter);}
838 WebInspector.HeapSnapshotEdgesProvider.prototype={sort:function(comparator,leftB ound,rightBound,count) 900 WebInspector.HeapSnapshotEdgesProvider.prototype={sort:function(comparator,leftB ound,rightBound,windowLeft,windowRight)
839 {var fieldName1=comparator.fieldName1;var fieldName2=comparator.fieldName2;var a scending1=comparator.ascending1;var ascending2=comparator.ascending2;var edgeA=t his._iterator.item().clone();var edgeB=edgeA.clone();var nodeA=this.snapshot.cre ateNode();var nodeB=this.snapshot.createNode();function compareEdgeFieldName(asc ending,indexA,indexB) 901 {var fieldName1=comparator.fieldName1;var fieldName2=comparator.fieldName2;var a scending1=comparator.ascending1;var ascending2=comparator.ascending2;var edgeA=t his._iterator.item().clone();var edgeB=edgeA.clone();var nodeA=this.snapshot.cre ateNode();var nodeB=this.snapshot.createNode();function compareEdgeFieldName(asc ending,indexA,indexB)
840 {edgeA.edgeIndex=indexA;edgeB.edgeIndex=indexB;if(edgeB.name()==="__proto__")ret urn-1;if(edgeA.name()==="__proto__")return 1;var result=edgeA.hasStringName()=== edgeB.hasStringName()?(edgeA.name()<edgeB.name()?-1:(edgeA.name()>edgeB.name()?1 :0)):(edgeA.hasStringName()?-1:1);return ascending?result:-result;} 902 {edgeA.edgeIndex=indexA;edgeB.edgeIndex=indexB;if(edgeB.name()==="__proto__")ret urn-1;if(edgeA.name()==="__proto__")return 1;var result=edgeA.hasStringName()=== edgeB.hasStringName()?(edgeA.name()<edgeB.name()?-1:(edgeA.name()>edgeB.name()?1 :0)):(edgeA.hasStringName()?-1:1);return ascending?result:-result;}
841 function compareNodeField(fieldName,ascending,indexA,indexB) 903 function compareNodeField(fieldName,ascending,indexA,indexB)
842 {edgeA.edgeIndex=indexA;nodeA.nodeIndex=edgeA.nodeIndex();var valueA=nodeA[field Name]();edgeB.edgeIndex=indexB;nodeB.nodeIndex=edgeB.nodeIndex();var valueB=node B[fieldName]();var result=valueA<valueB?-1:(valueA>valueB?1:0);return ascending? result:-result;} 904 {edgeA.edgeIndex=indexA;nodeA.nodeIndex=edgeA.nodeIndex();var valueA=nodeA[field Name]();edgeB.edgeIndex=indexB;nodeB.nodeIndex=edgeB.nodeIndex();var valueB=node B[fieldName]();var result=valueA<valueB?-1:(valueA>valueB?1:0);return ascending? result:-result;}
843 function compareEdgeAndNode(indexA,indexB){var result=compareEdgeFieldName(ascen ding1,indexA,indexB);if(result===0) 905 function compareEdgeAndNode(indexA,indexB){var result=compareEdgeFieldName(ascen ding1,indexA,indexB);if(result===0)
844 result=compareNodeField(fieldName2,ascending2,indexA,indexB);return result;} 906 result=compareNodeField(fieldName2,ascending2,indexA,indexB);if(result===0)
907 return indexA-indexB;return result;}
845 function compareNodeAndEdge(indexA,indexB){var result=compareNodeField(fieldName 1,ascending1,indexA,indexB);if(result===0) 908 function compareNodeAndEdge(indexA,indexB){var result=compareNodeField(fieldName 1,ascending1,indexA,indexB);if(result===0)
846 result=compareEdgeFieldName(ascending2,indexA,indexB);return result;} 909 result=compareEdgeFieldName(ascending2,indexA,indexB);if(result===0)
910 return indexA-indexB;return result;}
847 function compareNodeAndNode(indexA,indexB){var result=compareNodeField(fieldName 1,ascending1,indexA,indexB);if(result===0) 911 function compareNodeAndNode(indexA,indexB){var result=compareNodeField(fieldName 1,ascending1,indexA,indexB);if(result===0)
848 result=compareNodeField(fieldName2,ascending2,indexA,indexB);return result;} 912 result=compareNodeField(fieldName2,ascending2,indexA,indexB);if(result===0)
913 return indexA-indexB;return result;}
849 if(fieldName1==="!edgeName") 914 if(fieldName1==="!edgeName")
850 this._iterationOrder.sortRange(compareEdgeAndNode,leftBound,rightBound,count);el se if(fieldName2==="!edgeName") 915 this._iterationOrder.sortRange(compareEdgeAndNode,leftBound,rightBound,windowLef t,windowRight);else if(fieldName2==="!edgeName")
851 this._iterationOrder.sortRange(compareNodeAndEdge,leftBound,rightBound,count);el se 916 this._iterationOrder.sortRange(compareNodeAndEdge,leftBound,rightBound,windowLef t,windowRight);else
852 this._iterationOrder.sortRange(compareNodeAndNode,leftBound,rightBound,count);}, __proto__:WebInspector.HeapSnapshotFilteredOrderedIterator.prototype} 917 this._iterationOrder.sortRange(compareNodeAndNode,leftBound,rightBound,windowLef t,windowRight);},__proto__:WebInspector.HeapSnapshotFilteredOrderedIterator.prot otype}
853 WebInspector.HeapSnapshotNodesProvider=function(snapshot,filter,nodeIndexes) 918 WebInspector.HeapSnapshotNodesProvider=function(snapshot,filter,nodeIndexes)
854 {this.snapshot=snapshot;WebInspector.HeapSnapshotFilteredOrderedIterator.call(th is,snapshot._allNodes(),filter,nodeIndexes);} 919 {this.snapshot=snapshot;WebInspector.HeapSnapshotFilteredOrderedIterator.call(th is,snapshot._allNodes(),filter,nodeIndexes);}
855 WebInspector.HeapSnapshotNodesProvider.prototype={nodePosition:function(snapshot ObjectId) 920 WebInspector.HeapSnapshotNodesProvider.prototype={nodePosition:function(snapshot ObjectId)
856 {this._createIterationOrder();if(this.isEmpty()) 921 {this._createIterationOrder();if(this.isEmpty())
857 return-1;this.sortAll();var node=this.snapshot.createNode();for(var i=0;i<this._ iterationOrder.length;i++){node.nodeIndex=this._iterationOrder[i];if(node.id()== =snapshotObjectId) 922 return-1;this.sortAll();var node=this.snapshot.createNode();for(var i=0;i<this._ iterationOrder.length;i++){node.nodeIndex=this._iterationOrder[i];if(node.id()== =snapshotObjectId)
858 return i;} 923 return i;}
859 return-1;},sort:function(comparator,leftBound,rightBound,count) 924 return-1;},sort:function(comparator,leftBound,rightBound,windowLeft,windowRight)
860 {var fieldName1=comparator.fieldName1;var fieldName2=comparator.fieldName2;var a scending1=comparator.ascending1;var ascending2=comparator.ascending2;var nodeA=t his.snapshot.createNode();var nodeB=this.snapshot.createNode();function sortByNo deField(fieldName,ascending) 925 {var fieldName1=comparator.fieldName1;var fieldName2=comparator.fieldName2;var a scending1=comparator.ascending1;var ascending2=comparator.ascending2;var nodeA=t his.snapshot.createNode();var nodeB=this.snapshot.createNode();function sortByNo deField(fieldName,ascending)
861 {var valueOrFunctionA=nodeA[fieldName];var valueA=typeof valueOrFunctionA!=="fun ction"?valueOrFunctionA:valueOrFunctionA.call(nodeA);var valueOrFunctionB=nodeB[ fieldName];var valueB=typeof valueOrFunctionB!=="function"?valueOrFunctionB:valu eOrFunctionB.call(nodeB);var result=valueA<valueB?-1:(valueA>valueB?1:0);return ascending?result:-result;} 926 {var valueOrFunctionA=nodeA[fieldName];var valueA=typeof valueOrFunctionA!=="fun ction"?valueOrFunctionA:valueOrFunctionA.call(nodeA);var valueOrFunctionB=nodeB[ fieldName];var valueB=typeof valueOrFunctionB!=="function"?valueOrFunctionB:valu eOrFunctionB.call(nodeB);var result=valueA<valueB?-1:(valueA>valueB?1:0);return ascending?result:-result;}
862 function sortByComparator(indexA,indexB){nodeA.nodeIndex=indexA;nodeB.nodeIndex= indexB;var result=sortByNodeField(fieldName1,ascending1);if(result===0) 927 function sortByComparator(indexA,indexB){nodeA.nodeIndex=indexA;nodeB.nodeIndex= indexB;var result=sortByNodeField(fieldName1,ascending1);if(result===0)
863 result=sortByNodeField(fieldName2,ascending2);return result;} 928 result=sortByNodeField(fieldName2,ascending2);if(result===0)
864 this._iterationOrder.sortRange(sortByComparator,leftBound,rightBound,count);},__ proto__:WebInspector.HeapSnapshotFilteredOrderedIterator.prototype};WebInspector .HeapSnapshotSortableDataGrid=function(columns) 929 return indexA-indexB;return result;}
930 this._iterationOrder.sortRange(sortByComparator,leftBound,rightBound,windowLeft, windowRight);},__proto__:WebInspector.HeapSnapshotFilteredOrderedIterator.protot ype};WebInspector.HeapSnapshotSortableDataGrid=function(columns)
865 {WebInspector.DataGrid.call(this,columns);this._recursiveSortingDepth=0;this._hi ghlightedNode=null;this._populatedAndSorted=false;this.addEventListener("sorting complete",this._sortingComplete,this);this.addEventListener(WebInspector.DataGr id.Events.SortingChanged,this.sortingChanged,this);} 931 {WebInspector.DataGrid.call(this,columns);this._recursiveSortingDepth=0;this._hi ghlightedNode=null;this._populatedAndSorted=false;this.addEventListener("sorting complete",this._sortingComplete,this);this.addEventListener(WebInspector.DataGr id.Events.SortingChanged,this.sortingChanged,this);}
866 WebInspector.HeapSnapshotSortableDataGrid.Events={ContentShown:"ContentShown"} 932 WebInspector.HeapSnapshotSortableDataGrid.Events={ContentShown:"ContentShown"}
867 WebInspector.HeapSnapshotSortableDataGrid.prototype={defaultPopulateCount:functi on() 933 WebInspector.HeapSnapshotSortableDataGrid.prototype={defaultPopulateCount:functi on()
868 {return 100;},dispose:function() 934 {return 100;},dispose:function()
869 {var children=this.topLevelNodes();for(var i=0,l=children.length;i<l;++i) 935 {var children=this.topLevelNodes();for(var i=0,l=children.length;i<l;++i)
870 children[i].dispose();},wasShown:function() 936 children[i].dispose();},wasShown:function()
871 {if(this._populatedAndSorted) 937 {if(this._populatedAndSorted)
872 this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.C ontentShown,this);},_sortingComplete:function() 938 this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.C ontentShown,this);},_sortingComplete:function()
873 {this.removeEventListener("sorting complete",this._sortingComplete,this);this._p opulatedAndSorted=true;this.dispatchEventToListeners(WebInspector.HeapSnapshotSo rtableDataGrid.Events.ContentShown,this);},willHide:function() 939 {this.removeEventListener("sorting complete",this._sortingComplete,this);this._p opulatedAndSorted=true;this.dispatchEventToListeners(WebInspector.HeapSnapshotSo rtableDataGrid.Events.ContentShown,this);},willHide:function()
874 {this._clearCurrentHighlight();},populateContextMenu:function(profilesPanel,cont extMenu,event) 940 {this._clearCurrentHighlight();},populateContextMenu:function(profilesPanel,cont extMenu,event)
875 {var td=event.target.enclosingNodeOrSelfWithNodeName("td");if(!td) 941 {var td=event.target.enclosingNodeOrSelfWithNodeName("td");if(!td)
876 return;var node=td.heapSnapshotNode;if(node instanceof WebInspector.HeapSnapshot InstanceNode||node instanceof WebInspector.HeapSnapshotObjectNode){function reve alInDominatorsView() 942 return;var node=td.heapSnapshotNode;function revealInDominatorsView()
877 {profilesPanel.showObject(node.snapshotNodeId,"Dominators");} 943 {profilesPanel.showObject(node.snapshotNodeId,"Dominators");}
878 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInDominatorsVi ew.bind(this));}else if(node instanceof WebInspector.HeapSnapshotDominatorObject Node){function revealInSummaryView() 944 function revealInSummaryView()
879 {profilesPanel.showObject(node.snapshotNodeId,"Summary");} 945 {profilesPanel.showObject(node.snapshotNodeId,"Summary");}
880 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView.bind(t his));}},resetSortingCache:function() 946 if(node&&node.showRetainingEdges){contextMenu.appendItem(WebInspector.UIString(W ebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView.bind(this));contextMenu.appendItem(WebInspector.UISt ring(WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal i n Dominators View"),revealInDominatorsView.bind(this));}
947 else if(node instanceof WebInspector.HeapSnapshotInstanceNode||node instanceof W ebInspector.HeapSnapshotObjectNode){contextMenu.appendItem(WebInspector.UIString (WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Do minators View"),revealInDominatorsView.bind(this));}else if(node instanceof WebI nspector.HeapSnapshotDominatorObjectNode){contextMenu.appendItem(WebInspector.UI String(WebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView.bind(this));}},resetSortingCache:function()
881 {delete this._lastSortColumnIdentifier;delete this._lastSortAscending;},topLevel Nodes:function() 948 {delete this._lastSortColumnIdentifier;delete this._lastSortAscending;},topLevel Nodes:function()
882 {return this.rootNode().children;},highlightObjectByHeapSnapshotId:function(heap SnapshotObjectId) 949 {return this.rootNode().children;},highlightObjectByHeapSnapshotId:function(heap SnapshotObjectId)
883 {},highlightNode:function(node) 950 {},highlightNode:function(node)
884 {var prevNode=this._highlightedNode;this._clearCurrentHighlight();this._highligh tedNode=node;this._highlightedNode.element.addStyleClass("highlighted-row");if(n ode===prevNode){var element=node.element;var parent=element.parentElement;var ne xtSibling=element.nextSibling;parent.removeChild(element);parent.insertBefore(el ement,nextSibling);}},nodeWasDetached:function(node) 951 {var prevNode=this._highlightedNode;this._clearCurrentHighlight();this._highligh tedNode=node;this._highlightedNode.element.addStyleClass("highlighted-row");if(n ode===prevNode){var element=node.element;var parent=element.parentElement;var ne xtSibling=element.nextSibling;parent.removeChild(element);parent.insertBefore(el ement,nextSibling);}},nodeWasDetached:function(node)
885 {if(this._highlightedNode===node) 952 {if(this._highlightedNode===node)
886 this._clearCurrentHighlight();},_clearCurrentHighlight:function() 953 this._clearCurrentHighlight();},_clearCurrentHighlight:function()
887 {if(!this._highlightedNode) 954 {if(!this._highlightedNode)
888 return 955 return
889 this._highlightedNode.element.removeStyleClass("highlighted-row");this._highligh tedNode=null;},changeNameFilter:function(filter) 956 this._highlightedNode.element.removeStyleClass("highlighted-row");this._highligh tedNode=null;},changeNameFilter:function(filter)
890 {filter=filter.toLowerCase();var children=this.topLevelNodes();for(var i=0,l=chi ldren.length;i<l;++i){var node=children[i];if(node.depth===0) 957 {filter=filter.toLowerCase();var children=this.topLevelNodes();for(var i=0,l=chi ldren.length;i<l;++i){var node=children[i];if(node.depth===0)
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 {this.snapshot=snapshot;var fakeNode={nodeIndex:this.snapshot.rootNodeIndex};thi s.setRootNode(new WebInspector.HeapSnapshotDominatorObjectNode(this,fakeNode));t his.rootNode().sort();if(this._objectIdToSelect){this.highlightObjectByHeapSnaps hotId(this._objectIdToSelect);this._objectIdToSelect=null;}},sortingChanged:func tion() 1059 {this.snapshot=snapshot;var fakeNode={nodeIndex:this.snapshot.rootNodeIndex};thi s.setRootNode(new WebInspector.HeapSnapshotDominatorObjectNode(this,fakeNode));t his.rootNode().sort();if(this._objectIdToSelect){this.highlightObjectByHeapSnaps hotId(this._objectIdToSelect);this._objectIdToSelect=null;}},sortingChanged:func tion()
993 {this.rootNode().sort();},highlightObjectByHeapSnapshotId:function(id) 1060 {this.rootNode().sort();},highlightObjectByHeapSnapshotId:function(id)
994 {if(!this.snapshot){this._objectIdToSelect=id;return;} 1061 {if(!this.snapshot){this._objectIdToSelect=id;return;}
995 function didGetDominators(dominatorIds) 1062 function didGetDominators(dominatorIds)
996 {if(!dominatorIds){WebInspector.log(WebInspector.UIString("Cannot find correspon ding heap snapshot node"));return;} 1063 {if(!dominatorIds){WebInspector.log(WebInspector.UIString("Cannot find correspon ding heap snapshot node"));return;}
997 var dominatorNode=this.rootNode();expandNextDominator.call(this,dominatorIds,dom inatorNode);} 1064 var dominatorNode=this.rootNode();expandNextDominator.call(this,dominatorIds,dom inatorNode);}
998 function expandNextDominator(dominatorIds,dominatorNode) 1065 function expandNextDominator(dominatorIds,dominatorNode)
999 {if(!dominatorNode){console.error("Cannot find dominator node");return;} 1066 {if(!dominatorNode){console.error("Cannot find dominator node");return;}
1000 if(!dominatorIds.length){this.highlightNode(dominatorNode);dominatorNode.element .scrollIntoViewIfNeeded(true);return;} 1067 if(!dominatorIds.length){this.highlightNode(dominatorNode);dominatorNode.element .scrollIntoViewIfNeeded(true);return;}
1001 var snapshotObjectId=dominatorIds.pop();dominatorNode.retrieveChildBySnapshotObj ectId(snapshotObjectId,expandNextDominator.bind(this,dominatorIds));} 1068 var snapshotObjectId=dominatorIds.pop();dominatorNode.retrieveChildBySnapshotObj ectId(snapshotObjectId,expandNextDominator.bind(this,dominatorIds));}
1002 this.snapshot.dominatorIdsForNode(parseInt(id,10),didGetDominators.bind(this));} ,__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype};WebInspector.Hea pSnapshotGridNode=function(tree,hasChildren) 1069 this.snapshot.dominatorIdsForNode(parseInt(id,10),didGetDominators.bind(this));} ,__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
1070 WebInspector.AllocationDataGrid=function()
1071 {var columns=[{id:"name",title:WebInspector.UIString("Function"),width:"200px",d isclosure:true,sortable:true},{id:"count",title:WebInspector.UIString("Count"),s ortable:true,sort:WebInspector.DataGrid.Order.Descending},{id:"size",title:WebIn spector.UIString("Size"),sortable:true,sort:WebInspector.DataGrid.Order.Descendi ng},];WebInspector.DataGrid.call(this,columns);}
1072 WebInspector.AllocationDataGrid.prototype={setDataSource:function(snapshot)
1073 {this._snapshot=snapshot;this._snapshot.allocationTracesTops(didReceiveAllocatio nTracesTops.bind(this));function didReceiveAllocationTracesTops(tops)
1074 {var root=this.rootNode();for(var i=0;i<tops.length;i++)
1075 root.appendChild(new WebInspector.AllocationGridNode(this,tops[i]));}},__proto__ :WebInspector.DataGrid.prototype}
1076 WebInspector.AllocationGridNode=function(dataGrid,data)
1077 {WebInspector.DataGridNode.call(this,data,data.hasChildren);this._dataGrid=dataG rid;}
1078 WebInspector.AllocationGridNode.prototype={populate:function()
1079 {this._dataGrid._snapshot.allocationNodeCallers(this.data.id,didReceiveCallers.b ind(this));function didReceiveCallers(callers)
1080 {for(var i=0;i<callers.length;i++)
1081 this.appendChild(new WebInspector.AllocationGridNode(this._dataGrid,callers[i])) ;}},__proto__:WebInspector.DataGridNode.prototype};WebInspector.HeapSnapshotGrid Node=function(tree,hasChildren)
1003 {WebInspector.DataGridNode.call(this,null,hasChildren);this._dataGrid=tree;this. _instanceCount=0;this._savedChildren=null;this._retrievedChildrenRanges=[];} 1082 {WebInspector.DataGridNode.call(this,null,hasChildren);this._dataGrid=tree;this. _instanceCount=0;this._savedChildren=null;this._retrievedChildrenRanges=[];}
1004 WebInspector.HeapSnapshotGridNode.Events={PopulateComplete:"PopulateComplete"} 1083 WebInspector.HeapSnapshotGridNode.Events={PopulateComplete:"PopulateComplete"}
1005 WebInspector.HeapSnapshotGridNode.prototype={createProvider:function() 1084 WebInspector.HeapSnapshotGridNode.prototype={createProvider:function()
1006 {throw new Error("Needs implemented.");},_provider:function() 1085 {throw new Error("Needs implemented.");},_provider:function()
1007 {if(!this._providerObject) 1086 {if(!this._providerObject)
1008 this._providerObject=this.createProvider();return this._providerObject;},createC ell:function(columnIdentifier) 1087 this._providerObject=this.createProvider();return this._providerObject;},createC ell:function(columnIdentifier)
1009 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(this._searchMatched) 1088 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(this._searchMatched)
1010 cell.addStyleClass("highlight");return cell;},collapse:function() 1089 cell.addStyleClass("highlight");return cell;},collapse:function()
1011 {WebInspector.DataGridNode.prototype.collapse.call(this);this._dataGrid.updateVi sibleNodes();},dispose:function() 1090 {WebInspector.DataGridNode.prototype.collapse.call(this);this._dataGrid.updateVi sibleNodes();},dispose:function()
1012 {if(this._provider()) 1091 {if(this._provider())
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 this._reachableFromWindow=true;else if(this._type==="object"&&this._name.startsW ith("Window")){this._name=this.shortenWindowURL(this._name,false);this._reachabl eFromWindow=true;}else if(node.canBeQueried) 1148 this._reachableFromWindow=true;else if(this._type==="object"&&this._name.startsW ith("Window")){this._name=this.shortenWindowURL(this._name,false);this._reachabl eFromWindow=true;}else if(node.canBeQueried)
1070 this._reachableFromWindow=true;if(node.detachedDOMTreeNode) 1149 this._reachableFromWindow=true;if(node.detachedDOMTreeNode)
1071 this.detachedDOMTreeNode=true;};WebInspector.HeapSnapshotGenericObjectNode.proto type={createCell:function(columnIdentifier) 1150 this.detachedDOMTreeNode=true;};WebInspector.HeapSnapshotGenericObjectNode.proto type={createCell:function(columnIdentifier)
1072 {var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):th is._createObjectCell();if(this._searchMatched) 1151 {var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):th is._createObjectCell();if(this._searchMatched)
1073 cell.addStyleClass("highlight");return cell;},_createObjectCell:function() 1152 cell.addStyleClass("highlight");return cell;},_createObjectCell:function()
1074 {var cell=document.createElement("td");cell.className="object-column";var div=do cument.createElement("div");div.className="source-code event-properties";div.sty le.overflow="visible";var data=this.data["object"];if(this._prefixObjectCell) 1153 {var cell=document.createElement("td");cell.className="object-column";var div=do cument.createElement("div");div.className="source-code event-properties";div.sty le.overflow="visible";var data=this.data["object"];if(this._prefixObjectCell)
1075 this._prefixObjectCell(div,data);var valueSpan=document.createElement("span");va lueSpan.className="value console-formatted-"+data.valueStyle;valueSpan.textConte nt=data.value;div.appendChild(valueSpan);if(this.data.displayName){var nameSpan= document.createElement("span");nameSpan.className="name console-formatted-name"; nameSpan.textContent=" "+this.data.displayName;div.appendChild(nameSpan);} 1154 this._prefixObjectCell(div,data);var valueSpan=document.createElement("span");va lueSpan.className="value console-formatted-"+data.valueStyle;valueSpan.textConte nt=data.value;div.appendChild(valueSpan);if(this.data.displayName){var nameSpan= document.createElement("span");nameSpan.className="name console-formatted-name"; nameSpan.textContent=" "+this.data.displayName;div.appendChild(nameSpan);}
1076 var idSpan=document.createElement("span");idSpan.className="console-formatted-id ";idSpan.textContent=" @"+data["nodeId"];div.appendChild(idSpan);if(this._postfi xObjectCell) 1155 var idSpan=document.createElement("span");idSpan.className="console-formatted-id ";idSpan.textContent=" @"+data["nodeId"];div.appendChild(idSpan);if(this._postfi xObjectCell)
1077 this._postfixObjectCell(div,data);cell.appendChild(div);cell.addStyleClass("disc losure");if(this.depth) 1156 this._postfixObjectCell(div,data);cell.appendChild(div);cell.addStyleClass("disc losure");if(this.depth)
1078 cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px ");cell.heapSnapshotNode=this;return cell;},get data() 1157 cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px ");cell.heapSnapshotNode=this;return cell;},get data()
1079 {var data=this._emptyData();var value=this._name;var valueStyle="object";switch( this._type){case"string":value="\""+value+"\"";valueStyle="string";break;case"re gexp":value="/"+value+"/";valueStyle="string";break;case"closure":value="functio n"+(value?" ":"")+value+"()";valueStyle="function";break;case"number":valueStyle ="number";break;case"hidden":valueStyle="null";break;case"array":if(!value) 1158 {var data=this._emptyData();var value=this._name;var valueStyle="object";switch( this._type){case"concatenated string":case"string":value="\""+value+"\"";valueSt yle="string";break;case"regexp":value="/"+value+"/";valueStyle="string";break;ca se"closure":value="function"+(value?" ":"")+value+"()";valueStyle="function";bre ak;case"number":valueStyle="number";break;case"hidden":valueStyle="null";break;c ase"array":if(!value)
1080 value="[]";else 1159 value="[]";else
1081 value+="[]";break;};if(this._reachableFromWindow) 1160 value+="[]";break;};if(this._reachableFromWindow)
1082 valueStyle+=" highlight";if(value==="Object") 1161 valueStyle+=" highlight";if(value==="Object")
1083 value="";if(this.detachedDOMTreeNode) 1162 value="";if(this.detachedDOMTreeNode)
1084 valueStyle+=" detached-dom-tree-node";data["object"]={valueStyle:valueStyle,valu e:value,nodeId:this.snapshotNodeId};data["displayName"]=this._displayName;data[" distance"]=this._distance;data["shallowSize"]=Number.withThousandsSeparator(this ._shallowSize);data["retainedSize"]=Number.withThousandsSeparator(this._retained Size);data["shallowSize-percent"]=this._toPercentString(this._shallowSizePercent );data["retainedSize-percent"]=this._toPercentString(this._retainedSizePercent); return this._enhanceData?this._enhanceData(data):data;},queryObjectContent:funct ion(callback,objectGroupName) 1163 valueStyle+=" detached-dom-tree-node";data["object"]={valueStyle:valueStyle,valu e:value,nodeId:this.snapshotNodeId};data["displayName"]=this._displayName;data[" distance"]=this._distance;data["shallowSize"]=Number.withThousandsSeparator(this ._shallowSize);data["retainedSize"]=Number.withThousandsSeparator(this._retained Size);data["shallowSize-percent"]=this._toPercentString(this._shallowSizePercent );data["retainedSize-percent"]=this._toPercentString(this._retainedSizePercent); return this._enhanceData?this._enhanceData(data):data;},queryObjectContent:funct ion(callback,objectGroupName)
1085 {if(this._type==="string") 1164 {if(this._type==="string")
1086 callback(WebInspector.RemoteObject.fromPrimitiveValue(this._name));else{function formatResult(error,object) 1165 callback(WebInspector.RemoteObject.fromPrimitiveValue(this._name));else{function formatResult(error,object)
1087 {if(!error&&object.type) 1166 {if(!error&&object.type)
1088 callback(WebInspector.RemoteObject.fromPayload(object),!!error);else 1167 callback(WebInspector.RemoteObject.fromPayload(object),!!error);else
1089 callback(WebInspector.RemoteObject.fromPrimitiveValue(WebInspector.UIString("Not available")));} 1168 callback(WebInspector.RemoteObject.fromPrimitiveValue(WebInspector.UIString("Not available")));}
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 {if(nodePosition===-1) 1215 {if(nodePosition===-1)
1137 this.collapse();else 1216 this.collapse();else
1138 this._populateChildren(nodePosition,null,didPopulateChildren.bind(this,nodePosit ion));} 1217 this._populateChildren(nodePosition,null,didPopulateChildren.bind(this,nodePosit ion));}
1139 function didPopulateChildren(nodePosition) 1218 function didPopulateChildren(nodePosition)
1140 {var indexOfFirsChildInRange=0;for(var i=0;i<this._retrievedChildrenRanges.lengt h;i++){var range=this._retrievedChildrenRanges[i];if(range.from<=nodePosition&&n odePosition<range.to){var childIndex=indexOfFirsChildInRange+nodePosition-range. from;var instanceNode=this.children[childIndex];this._dataGrid.highlightNode(ins tanceNode);return;} 1219 {var indexOfFirsChildInRange=0;for(var i=0;i<this._retrievedChildrenRanges.lengt h;i++){var range=this._retrievedChildrenRanges[i];if(range.from<=nodePosition&&n odePosition<range.to){var childIndex=indexOfFirsChildInRange+nodePosition-range. from;var instanceNode=this.children[childIndex];this._dataGrid.highlightNode(ins tanceNode);return;}
1141 indexOfFirsChildInRange+=range.to-range.from+1;}} 1220 indexOfFirsChildInRange+=range.to-range.from+1;}}
1142 this.expandWithoutPopulate(didExpand.bind(this));},createCell:function(columnIde ntifier) 1221 this.expandWithoutPopulate(didExpand.bind(this));},createCell:function(columnIde ntifier)
1143 {var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):We bInspector.HeapSnapshotGridNode.prototype.createCell.call(this,columnIdentifier) ;if(this._searchMatched) 1222 {var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):We bInspector.HeapSnapshotGridNode.prototype.createCell.call(this,columnIdentifier) ;if(this._searchMatched)
1144 cell.addStyleClass("highlight");return cell;},_createChildNode:function(item) 1223 cell.addStyleClass("highlight");return cell;},_createChildNode:function(item)
1145 {return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,null,this._data Grid.snapshot,item);},comparator:function() 1224 {return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,null,this._data Grid.snapshot,item);},comparator:function()
1146 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"retainedSize",false],distance:["distance",true,"retainedSize",false],count:[ "id",true,"retainedSize",false],shallowSize:["selfSize",sortAscending,"id",true] ,retainedSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdentifier];re turn WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator (sortFields);},_childHashForEntity:function(node) 1225 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"retainedSize",false],distance:["distance",sortAscending,"retainedSize",false ],count:["id",true,"retainedSize",false],shallowSize:["selfSize",sortAscending," id",true],retainedSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdent ifier];return WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createC omparator(sortFields);},_childHashForEntity:function(node)
1147 {return node.id;},_childHashForNode:function(childNode) 1226 {return node.id;},_childHashForNode:function(childNode)
1148 {return childNode.snapshotNodeId;},get data() 1227 {return childNode.snapshotNodeId;},get data()
1149 {var data={object:this._name};data["count"]=Number.withThousandsSeparator(this._ count);data["distance"]=this._distance;data["shallowSize"]=Number.withThousandsS eparator(this._shallowSize);data["retainedSize"]=Number.withThousandsSeparator(t his._retainedSize);data["count-percent"]=this._toPercentString(this._countPercen t);data["shallowSize-percent"]=this._toPercentString(this._shallowSizePercent);d ata["retainedSize-percent"]=this._toPercentString(this._retainedSizePercent);ret urn data;},get _countPercent() 1228 {var data={object:this._name};data["count"]=Number.withThousandsSeparator(this._ count);data["distance"]=this._distance;data["shallowSize"]=Number.withThousandsS eparator(this._shallowSize);data["retainedSize"]=Number.withThousandsSeparator(t his._retainedSize);data["count-percent"]=this._toPercentString(this._countPercen t);data["shallowSize-percent"]=this._toPercentString(this._shallowSizePercent);d ata["retainedSize-percent"]=this._toPercentString(this._retainedSizePercent);ret urn data;},get _countPercent()
1150 {return this._count/this.dataGrid.snapshot.nodeCount*100.0;},get _retainedSizePe rcent() 1229 {return this._count/this.dataGrid.snapshot.nodeCount*100.0;},get _retainedSizePe rcent()
1151 {return this._retainedSize/this.dataGrid.snapshot.totalSize*100.0;},get _shallow SizePercent() 1230 {return this._retainedSize/this.dataGrid.snapshot.totalSize*100.0;},get _shallow SizePercent()
1152 {return this._shallowSize/this.dataGrid.snapshot.totalSize*100.0;},__proto__:Web Inspector.HeapSnapshotGridNode.prototype} 1231 {return this._shallowSize/this.dataGrid.snapshot.totalSize*100.0;},__proto__:Web Inspector.HeapSnapshotGridNode.prototype}
1153 WebInspector.HeapSnapshotDiffNodesProvider=function(addedNodesProvider,deletedNo desProvider,addedCount,removedCount) 1232 WebInspector.HeapSnapshotDiffNodesProvider=function(addedNodesProvider,deletedNo desProvider,addedCount,removedCount)
1154 {this._addedNodesProvider=addedNodesProvider;this._deletedNodesProvider=deletedN odesProvider;this._addedCount=addedCount;this._removedCount=removedCount;} 1233 {this._addedNodesProvider=addedNodesProvider;this._deletedNodesProvider=deletedN odesProvider;this._addedCount=addedCount;this._removedCount=removedCount;}
1155 WebInspector.HeapSnapshotDiffNodesProvider.prototype={dispose:function() 1234 WebInspector.HeapSnapshotDiffNodesProvider.prototype={dispose:function()
1156 {this._addedNodesProvider.dispose();this._deletedNodesProvider.dispose();},isEmp ty:function(callback) 1235 {this._addedNodesProvider.dispose();this._deletedNodesProvider.dispose();},isEmp ty:function(callback)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 function didGetNodePosition(nodePosition) 1272 function didGetNodePosition(nodePosition)
1194 {if(nodePosition===-1){this.collapse();callback(null);}else 1273 {if(nodePosition===-1){this.collapse();callback(null);}else
1195 this._populateChildren(nodePosition,null,didPopulateChildren.bind(this,nodePosit ion));} 1274 this._populateChildren(nodePosition,null,didPopulateChildren.bind(this,nodePosit ion));}
1196 function didPopulateChildren(nodePosition) 1275 function didPopulateChildren(nodePosition)
1197 {var child=this.childForPosition(nodePosition);callback(child);} 1276 {var child=this.childForPosition(nodePosition);callback(child);}
1198 this.hasChildren=true;this.expandWithoutPopulate(didExpand.bind(this));},_create ChildNode:function(item) 1277 this.hasChildren=true;this.expandWithoutPopulate(didExpand.bind(this));},_create ChildNode:function(item)
1199 {return new WebInspector.HeapSnapshotDominatorObjectNode(this._dataGrid,item);}, _childHashForEntity:function(node) 1278 {return new WebInspector.HeapSnapshotDominatorObjectNode(this._dataGrid,item);}, _childHashForEntity:function(node)
1200 {return node.id;},_childHashForNode:function(childNode) 1279 {return node.id;},_childHashForNode:function(childNode)
1201 {return childNode.snapshotNodeId;},comparator:function() 1280 {return childNode.snapshotNodeId;},comparator:function()
1202 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"retainedSize",false],shallowSize:["selfSize",sortAscending,"id",true],retain edSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdentifier];return We bInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator(sortFi elds);},_emptyData:function() 1281 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"retainedSize",false],shallowSize:["selfSize",sortAscending,"id",true],retain edSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdentifier];return We bInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator(sortFi elds);},_emptyData:function()
1203 {return{};},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype};WebI nspector.HeapSnapshotLoader=function() 1282 {return{};},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype};WebI nspector.HeapSnapshotLoader=function(dispatcher)
1204 {this._reset();} 1283 {this._reset();this._progress=new WebInspector.HeapSnapshotProgress(dispatcher); }
1205 WebInspector.HeapSnapshotLoader.prototype={dispose:function() 1284 WebInspector.HeapSnapshotLoader.prototype={dispose:function()
1206 {this._reset();},_reset:function() 1285 {this._reset();},_reset:function()
1207 {this._json="";this._state="find-snapshot-info";this._snapshot={};},close:functi on() 1286 {this._json="";this._state="find-snapshot-info";this._snapshot={};},close:functi on()
1208 {if(this._json) 1287 {if(this._json)
1209 this._parseStringsArray();},buildSnapshot:function(constructorName) 1288 this._parseStringsArray();},buildSnapshot:function(constructorName)
1210 {var constructor=WebInspector[constructorName];var result=new constructor(this._ snapshot);this._reset();return result;},_parseUintArray:function() 1289 {this._progress.updateStatus("Processing snapshot\u2026");var constructor=WebIns pector[constructorName];var result=new constructor(this._snapshot,this._progress );this._reset();return result;},_parseUintArray:function()
1211 {var index=0;var char0="0".charCodeAt(0),char9="9".charCodeAt(0),closingBracket= "]".charCodeAt(0);var length=this._json.length;while(true){while(index<length){v ar code=this._json.charCodeAt(index);if(char0<=code&&code<=char9) 1290 {var index=0;var char0="0".charCodeAt(0),char9="9".charCodeAt(0),closingBracket= "]".charCodeAt(0);var length=this._json.length;while(true){while(index<length){v ar code=this._json.charCodeAt(index);if(char0<=code&&code<=char9)
1212 break;else if(code===closingBracket){this._json=this._json.slice(index+1);return false;} 1291 break;else if(code===closingBracket){this._json=this._json.slice(index+1);return false;}
1213 ++index;} 1292 ++index;}
1214 if(index===length){this._json="";return true;} 1293 if(index===length){this._json="";return true;}
1215 var nextNumber=0;var startIndex=index;while(index<length){var code=this._json.ch arCodeAt(index);if(char0>code||code>char9) 1294 var nextNumber=0;var startIndex=index;while(index<length){var code=this._json.ch arCodeAt(index);if(char0>code||code>char9)
1216 break;nextNumber*=10;nextNumber+=(code-char0);++index;} 1295 break;nextNumber*=10;nextNumber+=(code-char0);++index;}
1217 if(index===length){this._json=this._json.slice(startIndex);return true;} 1296 if(index===length){this._json=this._json.slice(startIndex);return true;}
1218 this._array[this._arrayIndex++]=nextNumber;}},_parseStringsArray:function() 1297 this._array[this._arrayIndex++]=nextNumber;}},_parseStringsArray:function()
1219 {var closingBracketIndex=this._json.lastIndexOf("]");if(closingBracketIndex===-1 ) 1298 {this._progress.updateStatus("Parsing strings\u2026");var closingBracketIndex=th is._json.lastIndexOf("]");if(closingBracketIndex===-1)
1220 throw new Error("Incomplete JSON");this._json=this._json.slice(0,closingBracketI ndex+1);this._snapshot.strings=JSON.parse(this._json);},write:function(chunk) 1299 throw new Error("Incomplete JSON");this._json=this._json.slice(0,closingBracketI ndex+1);this._snapshot.strings=JSON.parse(this._json);},write:function(chunk)
1221 {this._json+=chunk;switch(this._state){case"find-snapshot-info":{var snapshotTok en="\"snapshot\"";var snapshotTokenIndex=this._json.indexOf(snapshotToken);if(sn apshotTokenIndex===-1) 1300 {this._json+=chunk;while(true){switch(this._state){case"find-snapshot-info":{var snapshotToken="\"snapshot\"";var snapshotTokenIndex=this._json.indexOf(snapshot Token);if(snapshotTokenIndex===-1)
1222 throw new Error("Snapshot token not found");this._json=this._json.slice(snapshot TokenIndex+snapshotToken.length+1);this._state="parse-snapshot-info";} 1301 throw new Error("Snapshot token not found");this._json=this._json.slice(snapshot TokenIndex+snapshotToken.length+1);this._state="parse-snapshot-info";this._progr ess.updateStatus("Loading snapshot info\u2026");break;}
1223 case"parse-snapshot-info":{var closingBracketIndex=WebInspector.findBalancedCurl yBrackets(this._json);if(closingBracketIndex===-1) 1302 case"parse-snapshot-info":{var closingBracketIndex=WebInspector.findBalancedCurl yBrackets(this._json);if(closingBracketIndex===-1)
1224 return;this._snapshot.snapshot=(JSON.parse(this._json.slice(0,closingBracketInde x)));this._json=this._json.slice(closingBracketIndex);this._state="find-nodes";} 1303 return;this._snapshot.snapshot=(JSON.parse(this._json.slice(0,closingBracketInde x)));this._json=this._json.slice(closingBracketIndex);this._state="find-nodes";b reak;}
1225 case"find-nodes":{var nodesToken="\"nodes\"";var nodesTokenIndex=this._json.inde xOf(nodesToken);if(nodesTokenIndex===-1) 1304 case"find-nodes":{var nodesToken="\"nodes\"";var nodesTokenIndex=this._json.inde xOf(nodesToken);if(nodesTokenIndex===-1)
1226 return;var bracketIndex=this._json.indexOf("[",nodesTokenIndex);if(bracketIndex= ==-1) 1305 return;var bracketIndex=this._json.indexOf("[",nodesTokenIndex);if(bracketIndex= ==-1)
1227 return;this._json=this._json.slice(bracketIndex+1);var node_fields_count=this._s napshot.snapshot.meta.node_fields.length;var nodes_length=this._snapshot.snapsho t.node_count*node_fields_count;this._array=new Uint32Array(nodes_length);this._a rrayIndex=0;this._state="parse-nodes";} 1306 return;this._json=this._json.slice(bracketIndex+1);var node_fields_count=this._s napshot.snapshot.meta.node_fields.length;var nodes_length=this._snapshot.snapsho t.node_count*node_fields_count;this._array=new Uint32Array(nodes_length);this._a rrayIndex=0;this._state="parse-nodes";break;}
1228 case"parse-nodes":{if(this._parseUintArray()) 1307 case"parse-nodes":{var hasMoreData=this._parseUintArray();this._progress.updateP rogress("Loading nodes\u2026 %d\%",this._arrayIndex,this._array.length);if(hasMo reData)
1229 return;this._snapshot.nodes=this._array;this._state="find-edges";this._array=nul l;} 1308 return;this._snapshot.nodes=this._array;this._state="find-edges";this._array=nul l;break;}
1230 case"find-edges":{var edgesToken="\"edges\"";var edgesTokenIndex=this._json.inde xOf(edgesToken);if(edgesTokenIndex===-1) 1309 case"find-edges":{var edgesToken="\"edges\"";var edgesTokenIndex=this._json.inde xOf(edgesToken);if(edgesTokenIndex===-1)
1231 return;var bracketIndex=this._json.indexOf("[",edgesTokenIndex);if(bracketIndex= ==-1) 1310 return;var bracketIndex=this._json.indexOf("[",edgesTokenIndex);if(bracketIndex= ==-1)
1232 return;this._json=this._json.slice(bracketIndex+1);var edge_fields_count=this._s napshot.snapshot.meta.edge_fields.length;var edges_length=this._snapshot.snapsho t.edge_count*edge_fields_count;this._array=new Uint32Array(edges_length);this._a rrayIndex=0;this._state="parse-edges";} 1311 return;this._json=this._json.slice(bracketIndex+1);var edge_fields_count=this._s napshot.snapshot.meta.edge_fields.length;var edges_length=this._snapshot.snapsho t.edge_count*edge_fields_count;this._array=new Uint32Array(edges_length);this._a rrayIndex=0;this._state="parse-edges";break;}
1233 case"parse-edges":{if(this._parseUintArray()) 1312 case"parse-edges":{var hasMoreData=this._parseUintArray();this._progress.updateP rogress("Loading edges\u2026 %d\%",this._arrayIndex,this._array.length);if(hasMo reData)
1234 return;this._snapshot.edges=this._array;this._array=null;this._state="find-strin gs";} 1313 return;this._snapshot.edges=this._array;this._array=null;if(WebInspector.HeapSna pshot.enableAllocationProfiler)
1314 this._state="find-trace-function-infos";else
1315 this._state="find-strings";break;}
1316 case"find-trace-function-infos":{var tracesToken="\"trace_function_infos\"";var tracesTokenIndex=this._json.indexOf(tracesToken);if(tracesTokenIndex===-1)
1317 return;var bracketIndex=this._json.indexOf("[",tracesTokenIndex);if(bracketIndex ===-1)
1318 return;this._json=this._json.slice(bracketIndex+1);var trace_function_info_field _count=3;var trace_function_info_length=this._snapshot.snapshot.trace_function_c ount*trace_function_info_field_count;this._array=new Uint32Array(trace_function_ info_length);this._arrayIndex=0;this._state="parse-trace-function-infos";break;}
1319 case"parse-trace-function-infos":{if(this._parseUintArray())
1320 return;this._snapshot.trace_function_infos=this._array;this._array=null;this._st ate="find-trace-tree";break;}
1321 case"find-trace-tree":{var tracesToken="\"trace_tree\"";var tracesTokenIndex=thi s._json.indexOf(tracesToken);if(tracesTokenIndex===-1)
1322 return;var bracketIndex=this._json.indexOf("[",tracesTokenIndex);if(bracketIndex ===-1)
1323 return;this._json=this._json.slice(bracketIndex);this._state="parse-trace-tree"; break;}
1324 case"parse-trace-tree":{var stringsToken="\"strings\"";var stringsTokenIndex=thi s._json.indexOf(stringsToken);if(stringsTokenIndex===-1)
1325 return;var bracketIndex=this._json.lastIndexOf("]",stringsTokenIndex);this._snap shot.trace_tree=JSON.parse(this._json.substring(0,bracketIndex+1));this._json=th is._json.slice(bracketIndex);this._state="find-strings";this._progress.updateSta tus("Loading strings\u2026");break;}
1235 case"find-strings":{var stringsToken="\"strings\"";var stringsTokenIndex=this._j son.indexOf(stringsToken);if(stringsTokenIndex===-1) 1326 case"find-strings":{var stringsToken="\"strings\"";var stringsTokenIndex=this._j son.indexOf(stringsToken);if(stringsTokenIndex===-1)
1236 return;var bracketIndex=this._json.indexOf("[",stringsTokenIndex);if(bracketInde x===-1) 1327 return;var bracketIndex=this._json.indexOf("[",stringsTokenIndex);if(bracketInde x===-1)
1237 return;this._json=this._json.slice(bracketIndex);this._state="accumulate-strings ";break;} 1328 return;this._json=this._json.slice(bracketIndex);this._state="accumulate-strings ";break;}
1238 case"accumulate-strings":break;}}};;WebInspector.HeapSnapshotWorkerWrapper=funct ion() 1329 case"accumulate-strings":return;}}}};;WebInspector.HeapSnapshotWorkerWrapper=fun ction()
1239 {} 1330 {}
1240 WebInspector.HeapSnapshotWorkerWrapper.prototype={postMessage:function(message) 1331 WebInspector.HeapSnapshotWorkerWrapper.prototype={postMessage:function(message)
1241 {},terminate:function() 1332 {},terminate:function()
1242 {},__proto__:WebInspector.Object.prototype} 1333 {},__proto__:WebInspector.Object.prototype}
1243 WebInspector.HeapSnapshotRealWorker=function() 1334 WebInspector.HeapSnapshotRealWorker=function()
1244 {this._worker=new Worker("HeapSnapshotWorker.js");this._worker.addEventListener( "message",this._messageReceived.bind(this),false);} 1335 {this._worker=new Worker("HeapSnapshotWorker.js");this._worker.addEventListener( "message",this._messageReceived.bind(this),false);}
1245 WebInspector.HeapSnapshotRealWorker.prototype={_messageReceived:function(event) 1336 WebInspector.HeapSnapshotRealWorker.prototype={_messageReceived:function(event)
1246 {var message=event.data;if("callId"in message) 1337 {var message=event.data;this.dispatchEventToListeners("message",message);},postM essage:function(message)
1247 this.dispatchEventToListeners("message",message);else{if(message.object!=="conso le"){console.log(WebInspector.UIString("Worker asks to call a method '%s' on an unsupported object '%s'.",message.method,message.object));return;}
1248 if(message.method!=="log"&&message.method!=="info"&&message.method!=="error"){co nsole.log(WebInspector.UIString("Worker asks to call an unsupported method '%s' on the console object.",message.method));return;}
1249 console[message.method].apply(window[message.object],message.arguments);}},postM essage:function(message)
1250 {this._worker.postMessage(message);},terminate:function() 1338 {this._worker.postMessage(message);},terminate:function()
1251 {this._worker.terminate();},__proto__:WebInspector.HeapSnapshotWorkerWrapper.pro totype} 1339 {this._worker.terminate();},__proto__:WebInspector.HeapSnapshotWorkerWrapper.pro totype}
1252 WebInspector.AsyncTaskQueue=function() 1340 WebInspector.AsyncTaskQueue=function()
1253 {this._queue=[];this._isTimerSheduled=false;} 1341 {this._queue=[];this._isTimerSheduled=false;}
1254 WebInspector.AsyncTaskQueue.prototype={addTask:function(task) 1342 WebInspector.AsyncTaskQueue.prototype={addTask:function(task)
1255 {this._queue.push(task);this._scheduleTimer();},_onTimeout:function() 1343 {this._queue.push(task);this._scheduleTimer();},_onTimeout:function()
1256 {this._isTimerSheduled=false;var queue=this._queue;this._queue=[];for(var i=0;i< queue.length;i++){try{queue[i]();}catch(e){console.error("Exception while runnin g task: "+e.stack);}} 1344 {this._isTimerSheduled=false;var queue=this._queue;this._queue=[];for(var i=0;i< queue.length;i++){try{queue[i]();}catch(e){console.error("Exception while runnin g task: "+e.stack);}}
1257 this._scheduleTimer();},_scheduleTimer:function() 1345 this._scheduleTimer();},_scheduleTimer:function()
1258 {if(this._queue.length&&!this._isTimerSheduled){setTimeout(this._onTimeout.bind( this),0);this._isTimerSheduled=true;}}} 1346 {if(this._queue.length&&!this._isTimerSheduled){setTimeout(this._onTimeout.bind( this),0);this._isTimerSheduled=true;}}}
1259 WebInspector.HeapSnapshotFakeWorker=function() 1347 WebInspector.HeapSnapshotFakeWorker=function()
1260 {this._dispatcher=new WebInspector.HeapSnapshotWorkerDispatcher(window,this._pos tMessageFromWorker.bind(this));this._asyncTaskQueue=new WebInspector.AsyncTaskQu eue();} 1348 {this._dispatcher=new WebInspector.HeapSnapshotWorkerDispatcher(window,this._pos tMessageFromWorker.bind(this));this._asyncTaskQueue=new WebInspector.AsyncTaskQu eue();}
1261 WebInspector.HeapSnapshotFakeWorker.prototype={postMessage:function(message) 1349 WebInspector.HeapSnapshotFakeWorker.prototype={postMessage:function(message)
1262 {function dispatch() 1350 {function dispatch()
1263 {if(this._dispatcher) 1351 {if(this._dispatcher)
1264 this._dispatcher.dispatchMessage({data:message});} 1352 this._dispatcher.dispatchMessage({data:message});}
1265 this._asyncTaskQueue.addTask(dispatch.bind(this));},terminate:function() 1353 this._asyncTaskQueue.addTask(dispatch.bind(this));},terminate:function()
1266 {this._dispatcher=null;},_postMessageFromWorker:function(message) 1354 {this._dispatcher=null;},_postMessageFromWorker:function(message)
1267 {function send() 1355 {function send()
1268 {this.dispatchEventToListeners("message",message);} 1356 {this.dispatchEventToListeners("message",message);}
1269 this._asyncTaskQueue.addTask(send.bind(this));},__proto__:WebInspector.HeapSnaps hotWorkerWrapper.prototype} 1357 this._asyncTaskQueue.addTask(send.bind(this));},__proto__:WebInspector.HeapSnaps hotWorkerWrapper.prototype}
1270 WebInspector.HeapSnapshotWorker=function() 1358 WebInspector.HeapSnapshotWorkerProxy=function(eventHandler)
1271 {this._nextObjectId=1;this._nextCallId=1;this._callbacks=[];this._previousCallba cks=[];this._worker=typeof InspectorTest==="undefined"?new WebInspector.HeapSnap shotRealWorker():new WebInspector.HeapSnapshotFakeWorker();this._worker.addEvent Listener("message",this._messageReceived,this);} 1359 {this._eventHandler=eventHandler;this._nextObjectId=1;this._nextCallId=1;this._c allbacks=[];this._previousCallbacks=[];this._worker=typeof InspectorTest==="unde fined"?new WebInspector.HeapSnapshotRealWorker():new WebInspector.HeapSnapshotFa keWorker();this._worker.addEventListener("message",this._messageReceived,this);}
1272 WebInspector.HeapSnapshotWorker.prototype={createLoader:function(snapshotConstru ctorName,proxyConstructor) 1360 WebInspector.HeapSnapshotWorkerProxy.prototype={createLoader:function(snapshotCo nstructorName,proxyConstructor)
1273 {var objectId=this._nextObjectId++;var proxy=new WebInspector.HeapSnapshotLoader Proxy(this,objectId,snapshotConstructorName,proxyConstructor);this._postMessage( {callId:this._nextCallId++,disposition:"create",objectId:objectId,methodName:"We bInspector.HeapSnapshotLoader"});return proxy;},dispose:function() 1361 {var objectId=this._nextObjectId++;var proxy=new WebInspector.HeapSnapshotLoader Proxy(this,objectId,snapshotConstructorName,proxyConstructor);this._postMessage( {callId:this._nextCallId++,disposition:"create",objectId:objectId,methodName:"We bInspector.HeapSnapshotLoader"});return proxy;},dispose:function()
1274 {this._worker.terminate();if(this._interval) 1362 {this._worker.terminate();if(this._interval)
1275 clearInterval(this._interval);},disposeObject:function(objectId) 1363 clearInterval(this._interval);},disposeObject:function(objectId)
1276 {this._postMessage({callId:this._nextCallId++,disposition:"dispose",objectId:obj ectId});},callGetter:function(callback,objectId,getterName) 1364 {this._postMessage({callId:this._nextCallId++,disposition:"dispose",objectId:obj ectId});},callGetter:function(callback,objectId,getterName)
1277 {var callId=this._nextCallId++;this._callbacks[callId]=callback;this._postMessag e({callId:callId,disposition:"getter",objectId:objectId,methodName:getterName}); },callFactoryMethod:function(callback,objectId,methodName,proxyConstructor) 1365 {var callId=this._nextCallId++;this._callbacks[callId]=callback;this._postMessag e({callId:callId,disposition:"getter",objectId:objectId,methodName:getterName}); },callFactoryMethod:function(callback,objectId,methodName,proxyConstructor)
1278 {var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(ar guments,4);var newObjectId=this._nextObjectId++;if(callback){function wrapCallba ck(remoteResult) 1366 {var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(ar guments,4);var newObjectId=this._nextObjectId++;if(callback){function wrapCallba ck(remoteResult)
1279 {callback(remoteResult?new proxyConstructor(this,newObjectId):null);} 1367 {callback(remoteResult?new proxyConstructor(this,newObjectId):null);}
1280 this._callbacks[callId]=wrapCallback.bind(this);this._postMessage({callId:callId ,disposition:"factory",objectId:objectId,methodName:methodName,methodArguments:m ethodArguments,newObjectId:newObjectId});return null;}else{this._postMessage({ca llId:callId,disposition:"factory",objectId:objectId,methodName:methodName,method Arguments:methodArguments,newObjectId:newObjectId});return new proxyConstructor( this,newObjectId);}},callMethod:function(callback,objectId,methodName) 1368 this._callbacks[callId]=wrapCallback.bind(this);this._postMessage({callId:callId ,disposition:"factory",objectId:objectId,methodName:methodName,methodArguments:m ethodArguments,newObjectId:newObjectId});return null;}else{this._postMessage({ca llId:callId,disposition:"factory",objectId:objectId,methodName:methodName,method Arguments:methodArguments,newObjectId:newObjectId});return new proxyConstructor( this,newObjectId);}},callMethod:function(callback,objectId,methodName)
1281 {var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(ar guments,3);if(callback) 1369 {var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(ar guments,3);if(callback)
1282 this._callbacks[callId]=callback;this._postMessage({callId:callId,disposition:"m ethod",objectId:objectId,methodName:methodName,methodArguments:methodArguments}) ;},startCheckingForLongRunningCalls:function() 1370 this._callbacks[callId]=callback;this._postMessage({callId:callId,disposition:"m ethod",objectId:objectId,methodName:methodName,methodArguments:methodArguments}) ;},startCheckingForLongRunningCalls:function()
1283 {if(this._interval) 1371 {if(this._interval)
1284 return;this._checkLongRunningCalls();this._interval=setInterval(this._checkLongR unningCalls.bind(this),300);},_checkLongRunningCalls:function() 1372 return;this._checkLongRunningCalls();this._interval=setInterval(this._checkLongR unningCalls.bind(this),300);},_checkLongRunningCalls:function()
1285 {for(var callId in this._previousCallbacks) 1373 {for(var callId in this._previousCallbacks)
1286 if(!(callId in this._callbacks)) 1374 if(!(callId in this._callbacks))
1287 delete this._previousCallbacks[callId];var hasLongRunningCalls=false;for(callId in this._previousCallbacks){hasLongRunningCalls=true;break;} 1375 delete this._previousCallbacks[callId];var hasLongRunningCalls=false;for(callId in this._previousCallbacks){hasLongRunningCalls=true;break;}
1288 this.dispatchEventToListeners("wait",hasLongRunningCalls);for(callId in this._ca llbacks) 1376 this.dispatchEventToListeners("wait",hasLongRunningCalls);for(callId in this._ca llbacks)
1289 this._previousCallbacks[callId]=true;},_findFunction:function(name) 1377 this._previousCallbacks[callId]=true;},_findFunction:function(name)
1290 {var path=name.split(".");var result=window;for(var i=0;i<path.length;++i) 1378 {var path=name.split(".");var result=window;for(var i=0;i<path.length;++i)
1291 result=result[path[i]];return result;},_messageReceived:function(event) 1379 result=result[path[i]];return result;},_messageReceived:function(event)
1292 {var data=event.data;if(event.data.error){if(event.data.errorMethodName) 1380 {var data=event.data;if(data.eventName){if(this._eventHandler)
1293 WebInspector.log(WebInspector.UIString("An error happened when a call for method '%s' was requested",event.data.errorMethodName));WebInspector.log(event.data.er rorCallStack);delete this._callbacks[data.callId];return;} 1381 this._eventHandler(data.eventName,data.data);return;}
1382 if(data.error){if(data.errorMethodName)
1383 WebInspector.log(WebInspector.UIString("An error happened when a call for method '%s' was requested",data.errorMethodName));WebInspector.log(data.errorCallStack );delete this._callbacks[data.callId];return;}
1294 if(!this._callbacks[data.callId]) 1384 if(!this._callbacks[data.callId])
1295 return;var callback=this._callbacks[data.callId];delete this._callbacks[data.cal lId];callback(data.result);},_postMessage:function(message) 1385 return;var callback=this._callbacks[data.callId];delete this._callbacks[data.cal lId];callback(data.result);},_postMessage:function(message)
1296 {this._worker.postMessage(message);},__proto__:WebInspector.Object.prototype} 1386 {this._worker.postMessage(message);},__proto__:WebInspector.Object.prototype}
1297 WebInspector.HeapSnapshotProxyObject=function(worker,objectId) 1387 WebInspector.HeapSnapshotProxyObject=function(worker,objectId)
1298 {this._worker=worker;this._objectId=objectId;} 1388 {this._worker=worker;this._objectId=objectId;}
1299 WebInspector.HeapSnapshotProxyObject.prototype={_callWorker:function(workerMetho dName,args) 1389 WebInspector.HeapSnapshotProxyObject.prototype={_callWorker:function(workerMetho dName,args)
1300 {args.splice(1,0,this._objectId);return this._worker[workerMethodName].apply(thi s._worker,args);},dispose:function() 1390 {args.splice(1,0,this._objectId);return this._worker[workerMethodName].apply(thi s._worker,args);},dispose:function()
1301 {this._worker.disposeObject(this._objectId);},disposeWorker:function() 1391 {this._worker.disposeObject(this._objectId);},disposeWorker:function()
1302 {this._worker.dispose();},callFactoryMethod:function(callback,methodName,proxyCo nstructor,var_args) 1392 {this._worker.dispose();},callFactoryMethod:function(callback,methodName,proxyCo nstructor,var_args)
1303 {return this._callWorker("callFactoryMethod",Array.prototype.slice.call(argument s,0));},callGetter:function(callback,getterName) 1393 {return this._callWorker("callFactoryMethod",Array.prototype.slice.call(argument s,0));},callGetter:function(callback,getterName)
1304 {return this._callWorker("callGetter",Array.prototype.slice.call(arguments,0));} ,callMethod:function(callback,methodName,var_args) 1394 {return this._callWorker("callGetter",Array.prototype.slice.call(arguments,0));} ,callMethod:function(callback,methodName,var_args)
1305 {return this._callWorker("callMethod",Array.prototype.slice.call(arguments,0));} ,get worker(){return this._worker;}};WebInspector.HeapSnapshotLoaderProxy=functi on(worker,objectId,snapshotConstructorName,proxyConstructor) 1395 {return this._callWorker("callMethod",Array.prototype.slice.call(arguments,0));} ,get worker(){return this._worker;}};WebInspector.HeapSnapshotLoaderProxy=functi on(worker,objectId,snapshotConstructorName,proxyConstructor)
1306 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);this._snapshotC onstructorName=snapshotConstructorName;this._proxyConstructor=proxyConstructor;t his._pendingSnapshotConsumers=[];} 1396 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);this._snapshotC onstructorName=snapshotConstructorName;this._proxyConstructor=proxyConstructor;t his._pendingSnapshotConsumers=[];}
1307 WebInspector.HeapSnapshotLoaderProxy.prototype={addConsumer:function(callback) 1397 WebInspector.HeapSnapshotLoaderProxy.prototype={addConsumer:function(callback)
1308 {this._pendingSnapshotConsumers.push(callback);},write:function(chunk,callback) 1398 {this._pendingSnapshotConsumers.push(callback);},write:function(chunk,callback)
1309 {this.callMethod(callback,"write",chunk);},close:function() 1399 {this.callMethod(callback,"write",chunk);},close:function(callback)
1310 {function buildSnapshot() 1400 {function buildSnapshot()
1311 {this.callFactoryMethod(updateStaticData.bind(this),"buildSnapshot",this._proxyC onstructor,this._snapshotConstructorName);} 1401 {if(callback)
1402 callback();this.callFactoryMethod(updateStaticData.bind(this),"buildSnapshot",th is._proxyConstructor,this._snapshotConstructorName);}
1312 function updateStaticData(snapshotProxy) 1403 function updateStaticData(snapshotProxy)
1313 {this.dispose();snapshotProxy.updateStaticData(notifyPendingConsumers.bind(this) );} 1404 {this.dispose();snapshotProxy.updateStaticData(notifyPendingConsumers.bind(this) );}
1314 function notifyPendingConsumers(snapshotProxy) 1405 function notifyPendingConsumers(snapshotProxy)
1315 {for(var i=0;i<this._pendingSnapshotConsumers.length;++i) 1406 {for(var i=0;i<this._pendingSnapshotConsumers.length;++i)
1316 this._pendingSnapshotConsumers[i](snapshotProxy);this._pendingSnapshotConsumers= [];} 1407 this._pendingSnapshotConsumers[i](snapshotProxy);this._pendingSnapshotConsumers= [];}
1317 this.callMethod(buildSnapshot.bind(this),"close");},__proto__:WebInspector.HeapS napshotProxyObject.prototype} 1408 this.callMethod(buildSnapshot.bind(this),"close");},__proto__:WebInspector.HeapS napshotProxyObject.prototype}
1318 WebInspector.HeapSnapshotProxy=function(worker,objectId) 1409 WebInspector.HeapSnapshotProxy=function(worker,objectId)
1319 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);} 1410 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);}
1320 WebInspector.HeapSnapshotProxy.prototype={aggregates:function(sortedIndexes,key, filter,callback) 1411 WebInspector.HeapSnapshotProxy.prototype={aggregates:function(sortedIndexes,key, filter,callback)
1321 {this.callMethod(callback,"aggregates",sortedIndexes,key,filter);},aggregatesFor Diff:function(callback) 1412 {this.callMethod(callback,"aggregates",sortedIndexes,key,filter);},aggregatesFor Diff:function(callback)
1322 {this.callMethod(callback,"aggregatesForDiff");},calculateSnapshotDiff:function( baseSnapshotId,baseSnapshotAggregates,callback) 1413 {this.callMethod(callback,"aggregatesForDiff");},calculateSnapshotDiff:function( baseSnapshotId,baseSnapshotAggregates,callback)
1323 {this.callMethod(callback,"calculateSnapshotDiff",baseSnapshotId,baseSnapshotAgg regates);},nodeClassName:function(snapshotObjectId,callback) 1414 {this.callMethod(callback,"calculateSnapshotDiff",baseSnapshotId,baseSnapshotAgg regates);},nodeClassName:function(snapshotObjectId,callback)
1324 {this.callMethod(callback,"nodeClassName",snapshotObjectId);},dominatorIdsForNod e:function(nodeIndex,callback) 1415 {this.callMethod(callback,"nodeClassName",snapshotObjectId);},dominatorIdsForNod e:function(nodeIndex,callback)
1325 {this.callMethod(callback,"dominatorIdsForNode",nodeIndex);},createEdgesProvider :function(nodeIndex,showHiddenData) 1416 {this.callMethod(callback,"dominatorIdsForNode",nodeIndex);},createEdgesProvider :function(nodeIndex,showHiddenData)
1326 {return this.callFactoryMethod(null,"createEdgesProvider",WebInspector.HeapSnaps hotProviderProxy,nodeIndex,showHiddenData);},createRetainingEdgesProvider:functi on(nodeIndex,showHiddenData) 1417 {return this.callFactoryMethod(null,"createEdgesProvider",WebInspector.HeapSnaps hotProviderProxy,nodeIndex,showHiddenData);},createRetainingEdgesProvider:functi on(nodeIndex,showHiddenData)
1327 {return this.callFactoryMethod(null,"createRetainingEdgesProvider",WebInspector. HeapSnapshotProviderProxy,nodeIndex,showHiddenData);},createAddedNodesProvider:f unction(baseSnapshotId,className) 1418 {return this.callFactoryMethod(null,"createRetainingEdgesProvider",WebInspector. HeapSnapshotProviderProxy,nodeIndex,showHiddenData);},createAddedNodesProvider:f unction(baseSnapshotId,className)
1328 {return this.callFactoryMethod(null,"createAddedNodesProvider",WebInspector.Heap SnapshotProviderProxy,baseSnapshotId,className);},createDeletedNodesProvider:fun ction(nodeIndexes) 1419 {return this.callFactoryMethod(null,"createAddedNodesProvider",WebInspector.Heap SnapshotProviderProxy,baseSnapshotId,className);},createDeletedNodesProvider:fun ction(nodeIndexes)
1329 {return this.callFactoryMethod(null,"createDeletedNodesProvider",WebInspector.He apSnapshotProviderProxy,nodeIndexes);},createNodesProvider:function(filter) 1420 {return this.callFactoryMethod(null,"createDeletedNodesProvider",WebInspector.He apSnapshotProviderProxy,nodeIndexes);},createNodesProvider:function(filter)
1330 {return this.callFactoryMethod(null,"createNodesProvider",WebInspector.HeapSnaps hotProviderProxy,filter);},createNodesProviderForClass:function(className,aggreg atesKey) 1421 {return this.callFactoryMethod(null,"createNodesProvider",WebInspector.HeapSnaps hotProviderProxy,filter);},createNodesProviderForClass:function(className,aggreg atesKey)
1331 {return this.callFactoryMethod(null,"createNodesProviderForClass",WebInspector.H eapSnapshotProviderProxy,className,aggregatesKey);},createNodesProviderForDomina tor:function(nodeIndex) 1422 {return this.callFactoryMethod(null,"createNodesProviderForClass",WebInspector.H eapSnapshotProviderProxy,className,aggregatesKey);},createNodesProviderForDomina tor:function(nodeIndex)
1332 {return this.callFactoryMethod(null,"createNodesProviderForDominator",WebInspect or.HeapSnapshotProviderProxy,nodeIndex);},dispose:function() 1423 {return this.callFactoryMethod(null,"createNodesProviderForDominator",WebInspect or.HeapSnapshotProviderProxy,nodeIndex);},allocationTracesTops:function(callback )
1424 {this.callMethod(callback,"allocationTracesTops");},allocationNodeCallers:functi on(nodeId,callback)
1425 {this.callMethod(callback,"allocationNodeCallers",nodeId);},dispose:function()
1333 {this.disposeWorker();},get nodeCount() 1426 {this.disposeWorker();},get nodeCount()
1334 {return this._staticData.nodeCount;},get rootNodeIndex() 1427 {return this._staticData.nodeCount;},get rootNodeIndex()
1335 {return this._staticData.rootNodeIndex;},updateStaticData:function(callback) 1428 {return this._staticData.rootNodeIndex;},updateStaticData:function(callback)
1336 {function dataReceived(staticData) 1429 {function dataReceived(staticData)
1337 {this._staticData=staticData;callback(this);} 1430 {this._staticData=staticData;callback(this);}
1338 this.callMethod(dataReceived.bind(this),"updateStaticData");},get totalSize() 1431 this.callMethod(dataReceived.bind(this),"updateStaticData");},get totalSize()
1339 {return this._staticData.totalSize;},get uid() 1432 {return this._staticData.totalSize;},get uid()
1340 {return this._staticData.uid;},__proto__:WebInspector.HeapSnapshotProxyObject.pr ototype} 1433 {return this._staticData.uid;},__proto__:WebInspector.HeapSnapshotProxyObject.pr ototype}
1341 WebInspector.NativeHeapSnapshotProxy=function(worker,objectId)
1342 {WebInspector.HeapSnapshotProxy.call(this,worker,objectId);}
1343 WebInspector.NativeHeapSnapshotProxy.prototype={images:function(callback)
1344 {this.callMethod(callback,"images");},__proto__:WebInspector.HeapSnapshotProxy.p rototype}
1345 WebInspector.HeapSnapshotProviderProxy=function(worker,objectId) 1434 WebInspector.HeapSnapshotProviderProxy=function(worker,objectId)
1346 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);} 1435 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);}
1347 WebInspector.HeapSnapshotProviderProxy.prototype={nodePosition:function(snapshot ObjectId,callback) 1436 WebInspector.HeapSnapshotProviderProxy.prototype={nodePosition:function(snapshot ObjectId,callback)
1348 {this.callMethod(callback,"nodePosition",snapshotObjectId);},isEmpty:function(ca llback) 1437 {this.callMethod(callback,"nodePosition",snapshotObjectId);},isEmpty:function(ca llback)
1349 {this.callMethod(callback,"isEmpty");},serializeItemsRange:function(startPositio n,endPosition,callback) 1438 {this.callMethod(callback,"isEmpty");},serializeItemsRange:function(startPositio n,endPosition,callback)
1350 {this.callMethod(callback,"serializeItemsRange",startPosition,endPosition);},sor tAndRewind:function(comparator,callback) 1439 {this.callMethod(callback,"serializeItemsRange",startPosition,endPosition);},sor tAndRewind:function(comparator,callback)
1351 {this.callMethod(callback,"sortAndRewind",comparator);},__proto__:WebInspector.H eapSnapshotProxyObject.prototype};WebInspector.HeapSnapshotView=function(parent, profile) 1440 {this.callMethod(callback,"sortAndRewind",comparator);},__proto__:WebInspector.H eapSnapshotProxyObject.prototype};WebInspector.HeapSnapshotView=function(parent, profile)
1352 {WebInspector.View.call(this);this.element.addStyleClass("heap-snapshot-view");t his.parent=parent;this.parent.addEventListener("profile added",this._onProfileHe aderAdded,this);if(profile._profileType.id===WebInspector.TrackingHeapSnapshotPr ofileType.TypeId){this._trackingOverviewGrid=new WebInspector.HeapTrackingOvervi ewGrid(profile);this._trackingOverviewGrid.addEventListener(WebInspector.HeapTra ckingOverviewGrid.IdsRangeChanged,this._onIdsRangeChanged.bind(this));this._trac kingOverviewGrid.show(this.element);} 1441 {WebInspector.View.call(this);this.element.addStyleClass("heap-snapshot-view");t his.parent=parent;this.parent.addEventListener("profile added",this._onProfileHe aderAdded,this);if(profile._profileType.id===WebInspector.TrackingHeapSnapshotPr ofileType.TypeId){this._trackingOverviewGrid=new WebInspector.HeapTrackingOvervi ewGrid(profile);this._trackingOverviewGrid.addEventListener(WebInspector.HeapTra ckingOverviewGrid.IdsRangeChanged,this._onIdsRangeChanged.bind(this));this._trac kingOverviewGrid.show(this.element);}
1353 this.viewsContainer=document.createElement("div");this.viewsContainer.addStyleCl ass("views-container");this.element.appendChild(this.viewsContainer);this.contai nmentView=new WebInspector.View();this.containmentView.element.addStyleClass("vi ew");this.containmentDataGrid=new WebInspector.HeapSnapshotContainmentDataGrid() ;this.containmentDataGrid.element.addEventListener("mousedown",this._mouseDownIn ContentsGrid.bind(this),true);this.containmentDataGrid.show(this.containmentView .element);this.containmentDataGrid.addEventListener(WebInspector.DataGrid.Events .SelectedNode,this._selectionChanged,this);this.constructorsView=new WebInspecto r.View();this.constructorsView.element.addStyleClass("view");this.constructorsVi ew.element.appendChild(this._createToolbarWithClassNameFilter());this.constructo rsDataGrid=new WebInspector.HeapSnapshotConstructorsDataGrid();this.constructors DataGrid.element.addStyleClass("class-view-grid");this.constructorsDataGrid.elem ent.addEventListener("mousedown",this._mouseDownInContentsGrid.bind(this),true); this.constructorsDataGrid.show(this.constructorsView.element);this.constructorsD ataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selecti onChanged,this);this.dataGrid=(this.constructorsDataGrid);this.currentView=this. constructorsView;this.currentView.show(this.viewsContainer);this.diffView=new We bInspector.View();this.diffView.element.addStyleClass("view");this.diffView.elem ent.appendChild(this._createToolbarWithClassNameFilter());this.diffDataGrid=new WebInspector.HeapSnapshotDiffDataGrid();this.diffDataGrid.element.addStyleClass( "class-view-grid");this.diffDataGrid.show(this.diffView.element);this.diffDataGr id.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionCha nged,this);this.dominatorView=new WebInspector.View();this.dominatorView.element .addStyleClass("view");this.dominatorDataGrid=new WebInspector.HeapSnapshotDomin atorsDataGrid();this.dominatorDataGrid.element.addEventListener("mousedown",this ._mouseDownInContentsGrid.bind(this),true);this.dominatorDataGrid.show(this.domi natorView.element);this.dominatorDataGrid.addEventListener(WebInspector.DataGrid .Events.SelectedNode,this._selectionChanged,this);this.retainmentViewHeader=docu ment.createElement("div");this.retainmentViewHeader.addStyleClass("retainers-vie w-header");WebInspector.installDragHandle(this.retainmentViewHeader,this._startR etainersHeaderDragging.bind(this),this._retainersHeaderDragging.bind(this),this. _endRetainersHeaderDragging.bind(this),"row-resize");var retainingPathsTitleDiv= document.createElement("div");retainingPathsTitleDiv.className="title";var retai ningPathsTitle=document.createElement("span");retainingPathsTitle.textContent=We bInspector.UIString("Object's retaining tree");retainingPathsTitleDiv.appendChil d(retainingPathsTitle);this.retainmentViewHeader.appendChild(retainingPathsTitle Div);this.element.appendChild(this.retainmentViewHeader);this.retainmentView=new WebInspector.View();this.retainmentView.element.addStyleClass("view");this.reta inmentView.element.addStyleClass("retaining-paths-view");this.retainmentDataGrid =new WebInspector.HeapSnapshotRetainmentDataGrid();this.retainmentDataGrid.show( this.retainmentView.element);this.retainmentDataGrid.addEventListener(WebInspect or.DataGrid.Events.SelectedNode,this._inspectedObjectChanged,this);this.retainme ntView.show(this.element);this.retainmentDataGrid.reset();this.viewSelect=new We bInspector.StatusBarComboBox(this._onSelectedViewChanged.bind(this));this.views= [{title:"Summary",view:this.constructorsView,grid:this.constructorsDataGrid},{ti tle:"Comparison",view:this.diffView,grid:this.diffDataGrid},{title:"Containment" ,view:this.containmentView,grid:this.containmentDataGrid}];if(WebInspector.setti ngs.showAdvancedHeapSnapshotProperties.get()) 1442 this.viewsContainer=document.createElement("div");this.viewsContainer.addStyleCl ass("views-container");this.element.appendChild(this.viewsContainer);this.contai nmentView=new WebInspector.View();this.containmentView.element.addStyleClass("vi ew");this.containmentDataGrid=new WebInspector.HeapSnapshotContainmentDataGrid() ;this.containmentDataGrid.element.addEventListener("mousedown",this._mouseDownIn ContentsGrid.bind(this),true);this.containmentDataGrid.show(this.containmentView .element);this.containmentDataGrid.addEventListener(WebInspector.DataGrid.Events .SelectedNode,this._selectionChanged,this);this.constructorsView=new WebInspecto r.View();this.constructorsView.element.addStyleClass("view");this.constructorsVi ew.element.appendChild(this._createToolbarWithClassNameFilter());this.constructo rsDataGrid=new WebInspector.HeapSnapshotConstructorsDataGrid();this.constructors DataGrid.element.addStyleClass("class-view-grid");this.constructorsDataGrid.elem ent.addEventListener("mousedown",this._mouseDownInContentsGrid.bind(this),true); this.constructorsDataGrid.show(this.constructorsView.element);this.constructorsD ataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selecti onChanged,this);this.dataGrid=(this.constructorsDataGrid);this.currentView=this. constructorsView;this.currentView.show(this.viewsContainer);this.diffView=new We bInspector.View();this.diffView.element.addStyleClass("view");this.diffView.elem ent.appendChild(this._createToolbarWithClassNameFilter());this.diffDataGrid=new WebInspector.HeapSnapshotDiffDataGrid();this.diffDataGrid.element.addStyleClass( "class-view-grid");this.diffDataGrid.show(this.diffView.element);this.diffDataGr id.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionCha nged,this);this.dominatorView=new WebInspector.View();this.dominatorView.element .addStyleClass("view");this.dominatorDataGrid=new WebInspector.HeapSnapshotDomin atorsDataGrid();this.dominatorDataGrid.element.addEventListener("mousedown",this ._mouseDownInContentsGrid.bind(this),true);this.dominatorDataGrid.show(this.domi natorView.element);this.dominatorDataGrid.addEventListener(WebInspector.DataGrid .Events.SelectedNode,this._selectionChanged,this);if(WebInspector.HeapSnapshot.e nableAllocationProfiler){this.allocationView=new WebInspector.View();this.alloca tionView.element.addStyleClass("view");this.allocationDataGrid=new WebInspector. AllocationDataGrid();this.allocationDataGrid.element.addEventListener("mousedown ",this._mouseDownInContentsGrid.bind(this),true);this.allocationDataGrid.show(th is.allocationView.element);this.allocationDataGrid.addEventListener(WebInspector .DataGrid.Events.SelectedNode,this._selectionChanged,this);}
1354 this.views.push({title:"Dominators",view:this.dominatorView,grid:this.dominatorD ataGrid});this.views.current=0;for(var i=0;i<this.views.length;++i) 1443 this.retainmentViewHeader=document.createElement("div");this.retainmentViewHeade r.addStyleClass("retainers-view-header");WebInspector.installDragHandle(this.ret ainmentViewHeader,this._startRetainersHeaderDragging.bind(this),this._retainersH eaderDragging.bind(this),this._endRetainersHeaderDragging.bind(this),"row-resize ");var retainingPathsTitleDiv=document.createElement("div");retainingPathsTitleD iv.className="title";var retainingPathsTitle=document.createElement("span");reta iningPathsTitle.textContent=WebInspector.UIString("Object's retaining tree");ret ainingPathsTitleDiv.appendChild(retainingPathsTitle);this.retainmentViewHeader.a ppendChild(retainingPathsTitleDiv);this.element.appendChild(this.retainmentViewH eader);this.retainmentView=new WebInspector.View();this.retainmentView.element.a ddStyleClass("view");this.retainmentView.element.addStyleClass("retaining-paths- view");this.retainmentDataGrid=new WebInspector.HeapSnapshotRetainmentDataGrid() ;this.retainmentDataGrid.show(this.retainmentView.element);this.retainmentDataGr id.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._inspectedObj ectChanged,this);this.retainmentView.show(this.element);this.retainmentDataGrid. reset();this.viewSelect=new WebInspector.StatusBarComboBox(this._onSelectedViewC hanged.bind(this));this.views=[{title:"Summary",view:this.constructorsView,grid: this.constructorsDataGrid},{title:"Comparison",view:this.diffView,grid:this.diff DataGrid},{title:"Containment",view:this.containmentView,grid:this.containmentDa taGrid}];if(WebInspector.settings.showAdvancedHeapSnapshotProperties.get())
1355 this.viewSelect.createOption(WebInspector.UIString(this.views[i].title));this._p rofileUid=profile.uid;this._profileTypeId=profile.profileType().id;this.baseSele ct=new WebInspector.StatusBarComboBox(this._changeBase.bind(this));this.baseSele ct.element.addStyleClass("hidden");this._updateBaseOptions();this.filterSelect=n ew WebInspector.StatusBarComboBox(this._changeFilter.bind(this));this._updateFil terOptions();this.helpButton=new WebInspector.StatusBarButton("","heap-snapshot- help-status-bar-item status-bar-item");this.helpButton.addEventListener("click", this._helpClicked,this);this.selectedSizeText=new WebInspector.StatusBarText("") ;this._popoverHelper=new WebInspector.ObjectPopoverHelper(this.element,this._get HoverAnchor.bind(this),this._resolveObjectForPopover.bind(this),undefined,true); this.profile.load(profileCallback.bind(this));function profileCallback(heapSnaps hotProxy) 1444 this.views.push({title:"Dominators",view:this.dominatorView,grid:this.dominatorD ataGrid});if(WebInspector.HeapSnapshot.enableAllocationProfiler)
1445 this.views.push({title:"Allocation",view:this.allocationView,grid:this.allocatio nDataGrid});this.views.current=0;for(var i=0;i<this.views.length;++i)
1446 this.viewSelect.createOption(WebInspector.UIString(this.views[i].title));this._p rofileUid=profile.uid;this._profileTypeId=profile.profileType().id;this.baseSele ct=new WebInspector.StatusBarComboBox(this._changeBase.bind(this));this.baseSele ct.element.addStyleClass("hidden");this._updateBaseOptions();this.filterSelect=n ew WebInspector.StatusBarComboBox(this._changeFilter.bind(this));this._updateFil terOptions();this.selectedSizeText=new WebInspector.StatusBarText("");this._popo verHelper=new WebInspector.ObjectPopoverHelper(this.element,this._getHoverAnchor .bind(this),this._resolveObjectForPopover.bind(this),undefined,true);this.profil e.load(profileCallback.bind(this));function profileCallback(heapSnapshotProxy)
1356 {var list=this._profiles();var profileIndex;for(var i=0;i<list.length;++i){if(li st[i].uid===this._profileUid){profileIndex=i;break;}} 1447 {var list=this._profiles();var profileIndex;for(var i=0;i<list.length;++i){if(li st[i].uid===this._profileUid){profileIndex=i;break;}}
1357 if(profileIndex>0) 1448 if(profileIndex>0)
1358 this.baseSelect.setSelectedIndex(profileIndex-1);else 1449 this.baseSelect.setSelectedIndex(profileIndex-1);else
1359 this.baseSelect.setSelectedIndex(profileIndex);this.dataGrid.setDataSource(heapS napshotProxy);}} 1450 this.baseSelect.setSelectedIndex(profileIndex);this.dataGrid.setDataSource(heapS napshotProxy);}}
1360 WebInspector.HeapSnapshotView.prototype={_onIdsRangeChanged:function(event) 1451 WebInspector.HeapSnapshotView.prototype={_onIdsRangeChanged:function(event)
1361 {var minId=event.data.minId;var maxId=event.data.maxId;this.selectedSizeText.set Text(WebInspector.UIString("Selected size: %s",Number.bytesToString(event.data.s ize)));if(this.constructorsDataGrid.snapshot) 1452 {var minId=event.data.minId;var maxId=event.data.maxId;this.selectedSizeText.set Text(WebInspector.UIString("Selected size: %s",Number.bytesToString(event.data.s ize)));if(this.constructorsDataGrid.snapshot)
1362 this.constructorsDataGrid.setSelectionRange(minId,maxId);},dispose:function() 1453 this.constructorsDataGrid.setSelectionRange(minId,maxId);},dispose:function()
1363 {this.parent.removeEventListener("profile added",this._onProfileHeaderAdded,this );this.profile.dispose();if(this.baseProfile) 1454 {this.parent.removeEventListener("profile added",this._onProfileHeaderAdded,this );this.profile.dispose();if(this.baseProfile)
1364 this.baseProfile.dispose();this.containmentDataGrid.dispose();this.constructorsD ataGrid.dispose();this.diffDataGrid.dispose();this.dominatorDataGrid.dispose();t his.retainmentDataGrid.dispose();},get statusBarItems() 1455 this.baseProfile.dispose();this.containmentDataGrid.dispose();this.constructorsD ataGrid.dispose();this.diffDataGrid.dispose();this.dominatorDataGrid.dispose();t his.retainmentDataGrid.dispose();},get statusBarItems()
1365 {return[this.viewSelect.element,this.baseSelect.element,this.filterSelect.elemen t,this.helpButton.element,this.selectedSizeText.element];},get profile() 1456 {return[this.viewSelect.element,this.baseSelect.element,this.filterSelect.elemen t,this.selectedSizeText.element];},get profile()
1366 {return this.parent.getProfile(this._profileTypeId,this._profileUid);},get baseP rofile() 1457 {return this.parent.getProfile(this._profileTypeId,this._profileUid);},get baseP rofile()
1367 {return this.parent.getProfile(this._profileTypeId,this._baseProfileUid);},wasSh own:function() 1458 {return this.parent.getProfile(this._profileTypeId,this._baseProfileUid);},wasSh own:function()
1368 {this.profile.load(profileCallback.bind(this));function profileCallback(){this.p rofile._wasShown();if(this.baseProfile) 1459 {this.profile.load(profileCallback.bind(this));function profileCallback(){this.p rofile._wasShown();if(this.baseProfile)
1369 this.baseProfile.load(function(){});}},willHide:function() 1460 this.baseProfile.load(function(){});}},willHide:function()
1370 {this._currentSearchResultIndex=-1;this._popoverHelper.hidePopover();if(this.hel pPopover&&this.helpPopover.isShowing()) 1461 {this._currentSearchResultIndex=-1;this._popoverHelper.hidePopover();if(this.hel pPopover&&this.helpPopover.isShowing())
1371 this.helpPopover.hide();},onResize:function() 1462 this.helpPopover.hide();},onResize:function()
1372 {var height=this.retainmentView.element.clientHeight;this._updateRetainmentViewH eight(height);},searchCanceled:function() 1463 {var height=this.retainmentView.element.clientHeight;this._updateRetainmentViewH eight(height);},searchCanceled:function()
1373 {if(this._searchResults){for(var i=0;i<this._searchResults.length;++i){var node= this._searchResults[i].node;delete node._searchMatched;node.refresh();}} 1464 {if(this._searchResults){for(var i=0;i<this._searchResults.length;++i){var node= this._searchResults[i].node;delete node._searchMatched;node.refresh();}}
1374 delete this._searchFinishedCallback;this._currentSearchResultIndex=-1;this._sear chResults=[];},performSearch:function(query,finishedCallback) 1465 delete this._searchFinishedCallback;this._currentSearchResultIndex=-1;this._sear chResults=[];},performSearch:function(query,finishedCallback)
1375 {this.searchCanceled();query=query.trim();if(!query) 1466 {this.searchCanceled();query=query.trim();if(!query)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 this.baseSelect.element.removeStyleClass("hidden");else 1529 this.baseSelect.element.removeStyleClass("hidden");else
1439 this.baseSelect.element.addStyleClass("hidden");if(this.currentView===this.const ructorsView){if(this._trackingOverviewGrid){this._trackingOverviewGrid.element.r emoveStyleClass("hidden");this._trackingOverviewGrid.update();this.viewsContaine r.addStyleClass("reserve-80px-at-top");} 1530 this.baseSelect.element.addStyleClass("hidden");if(this.currentView===this.const ructorsView){if(this._trackingOverviewGrid){this._trackingOverviewGrid.element.r emoveStyleClass("hidden");this._trackingOverviewGrid.update();this.viewsContaine r.addStyleClass("reserve-80px-at-top");}
1440 this.filterSelect.element.removeStyleClass("hidden");}else{this.filterSelect.ele ment.addStyleClass("hidden");if(this._trackingOverviewGrid){this._trackingOvervi ewGrid.element.addStyleClass("hidden");this.viewsContainer.removeStyleClass("res erve-80px-at-top");}}},_changeView:function(selectedIndex) 1531 this.filterSelect.element.removeStyleClass("hidden");}else{this.filterSelect.ele ment.addStyleClass("hidden");if(this._trackingOverviewGrid){this._trackingOvervi ewGrid.element.addStyleClass("hidden");this.viewsContainer.removeStyleClass("res erve-80px-at-top");}}},_changeView:function(selectedIndex)
1441 {if(selectedIndex===this.views.current) 1532 {if(selectedIndex===this.views.current)
1442 return;this.views.current=selectedIndex;this.currentView.detach();var view=this. views[this.views.current];this.currentView=view.view;this.dataGrid=view.grid;thi s.currentView.show(this.viewsContainer);this.refreshVisibleData();this.dataGrid. updateWidths();this._updateSelectorsVisibility();this._updateDataSourceAndView() ;if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults) 1533 return;this.views.current=selectedIndex;this.currentView.detach();var view=this. views[this.views.current];this.currentView=view.view;this.dataGrid=view.grid;thi s.currentView.show(this.viewsContainer);this.refreshVisibleData();this.dataGrid. updateWidths();this._updateSelectorsVisibility();this._updateDataSourceAndView() ;if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults)
1443 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_getHoverAnchor:funct ion(target) 1534 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_getHoverAnchor:funct ion(target)
1444 {var span=target.enclosingNodeOrSelfWithNodeName("span");if(!span) 1535 {var span=target.enclosingNodeOrSelfWithNodeName("span");if(!span)
1445 return;var row=target.enclosingNodeOrSelfWithNodeName("tr");if(!row) 1536 return;var row=target.enclosingNodeOrSelfWithNodeName("tr");if(!row)
1446 return;span.node=row._dataGridNode;return span;},_resolveObjectForPopover:functi on(element,showCallback,objectGroupName) 1537 return;span.node=row._dataGridNode;return span;},_resolveObjectForPopover:functi on(element,showCallback,objectGroupName)
1447 {if(this.profile.fromFile()) 1538 {if(this.profile.fromFile())
1448 return;element.node.queryObjectContent(showCallback,objectGroupName);},_helpClic ked:function(event) 1539 return;element.node.queryObjectContent(showCallback,objectGroupName);},_startRet ainersHeaderDragging:function(event)
1449 {if(!this._helpPopoverContentElement){var refTypes=["a:","console-formatted-name ",WebInspector.UIString("property"),"0:","console-formatted-name",WebInspector.U IString("element"),"a:","console-formatted-number",WebInspector.UIString("contex t var"),"a:","console-formatted-null",WebInspector.UIString("system prop")];var objTypes=[" a ","console-formatted-object","Object","\"a\"","console-formatted-s tring","String","/a/","console-formatted-string","RegExp","a()","console-formatt ed-function","Function","a[]","console-formatted-object","Array","num","console- formatted-number","Number"," a ","console-formatted-null","System"];var contentE lement=document.createElement("table");contentElement.className="heap-snapshot-h elp";var headerRow=document.createElement("tr");var propsHeader=document.createE lement("th");propsHeader.textContent=WebInspector.UIString("Property types:");he aderRow.appendChild(propsHeader);var objsHeader=document.createElement("th");obj sHeader.textContent=WebInspector.UIString("Object types:");headerRow.appendChild (objsHeader);contentElement.appendChild(headerRow);function appendHelp(help,inde x,cell)
1450 {var div=document.createElement("div");div.className="source-code event-properti es";var name=document.createElement("span");name.textContent=help[index];name.cl assName=help[index+1];div.appendChild(name);var desc=document.createElement("spa n");desc.textContent=" "+help[index+2];div.appendChild(desc);cell.appendChild(di v);}
1451 var len=Math.max(refTypes.length,objTypes.length);for(var i=0;i<len;i+=3){var ro w=document.createElement("tr");var refCell=document.createElement("td");if(refTy pes[i])
1452 appendHelp(refTypes,i,refCell);row.appendChild(refCell);var objCell=document.cre ateElement("td");if(objTypes[i])
1453 appendHelp(objTypes,i,objCell);row.appendChild(objCell);contentElement.appendChi ld(row);}
1454 this._helpPopoverContentElement=contentElement;this.helpPopover=new WebInspector .Popover();}
1455 if(this.helpPopover.isShowing())
1456 this.helpPopover.hide();else
1457 this.helpPopover.show(this._helpPopoverContentElement,this.helpButton.element);} ,_startRetainersHeaderDragging:function(event)
1458 {if(!this.isShowing()) 1540 {if(!this.isShowing())
1459 return false;this._previousDragPosition=event.pageY;return true;},_retainersHead erDragging:function(event) 1541 return false;this._previousDragPosition=event.pageY;return true;},_retainersHead erDragging:function(event)
1460 {var height=this.retainmentView.element.clientHeight;height+=this._previousDragP osition-event.pageY;this._previousDragPosition=event.pageY;this._updateRetainmen tViewHeight(height);event.consume(true);},_endRetainersHeaderDragging:function(e vent) 1542 {var height=this.retainmentView.element.clientHeight;height+=this._previousDragP osition-event.pageY;this._previousDragPosition=event.pageY;this._updateRetainmen tViewHeight(height);event.consume(true);},_endRetainersHeaderDragging:function(e vent)
1461 {delete this._previousDragPosition;event.consume();},_updateRetainmentViewHeight :function(height) 1543 {delete this._previousDragPosition;event.consume();},_updateRetainmentViewHeight :function(height)
1462 {height=Number.constrain(height,Preferences.minConsoleHeight,this.element.client Height-Preferences.minConsoleHeight);this.viewsContainer.style.bottom=(height+th is.retainmentViewHeader.clientHeight)+"px";if(this._trackingOverviewGrid&&this.c urrentView===this.constructorsView) 1544 {height=Number.constrain(height,Preferences.minConsoleHeight,this.element.client Height-Preferences.minConsoleHeight);this.viewsContainer.style.bottom=(height+th is.retainmentViewHeader.clientHeight)+"px";if(this._trackingOverviewGrid&&this.c urrentView===this.constructorsView)
1463 this.viewsContainer.addStyleClass("reserve-80px-at-top");this.retainmentView.ele ment.style.height=height+"px";this.retainmentViewHeader.style.bottom=height+"px" ;this.currentView.doResize();},_updateBaseOptions:function() 1545 this.viewsContainer.addStyleClass("reserve-80px-at-top");this.retainmentView.ele ment.style.height=height+"px";this.retainmentViewHeader.style.bottom=height+"px" ;this.currentView.doResize();},_updateBaseOptions:function()
1464 {var list=this._profiles();if(this.baseSelect.size()===list.length) 1546 {var list=this._profiles();if(this.baseSelect.size()===list.length)
1465 return;for(var i=this.baseSelect.size(),n=list.length;i<n;++i){var title=list[i] .title;if(WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title)) 1547 return;for(var i=this.baseSelect.size(),n=list.length;i<n;++i){var title=list[i] .title;if(WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title))
1466 title=WebInspector.UIString("Snapshot %d",WebInspector.ProfilesPanelDescriptor.u serInitiatedProfileIndex(title));this.baseSelect.createOption(title);}},_updateF ilterOptions:function() 1548 title=WebInspector.UIString("Snapshot %d",WebInspector.ProfilesPanelDescriptor.u serInitiatedProfileIndex(title));this.baseSelect.createOption(title);}},_updateF ilterOptions:function()
1467 {var list=this._profiles();if(this.filterSelect.size()-1===list.length) 1549 {var list=this._profiles();if(this.filterSelect.size()-1===list.length)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 {if(this._recording) 1617 {if(this._recording)
1536 this._stopRecordingProfile();else 1618 this._stopRecordingProfile();else
1537 this._startRecordingProfile();return this._recording;},get treeItemTitle() 1619 this._startRecordingProfile();return this._recording;},get treeItemTitle()
1538 {return WebInspector.UIString("HEAP TIMELINES");},get description() 1620 {return WebInspector.UIString("HEAP TIMELINES");},get description()
1539 {return WebInspector.UIString("Record JavaScript object allocations over time. U se this profile type to isolate memory leaks.");},_reset:function() 1621 {return WebInspector.UIString("Record JavaScript object allocations over time. U se this profile type to isolate memory leaks.");},_reset:function()
1540 {WebInspector.HeapSnapshotProfileType.prototype._reset.call(this);if(this._recor ding) 1622 {WebInspector.HeapSnapshotProfileType.prototype._reset.call(this);if(this._recor ding)
1541 this._stopRecordingProfile();this._profileSamples=null;this._lastSeenIndex=-1;}, createTemporaryProfile:function(title) 1623 this._stopRecordingProfile();this._profileSamples=null;this._lastSeenIndex=-1;}, createTemporaryProfile:function(title)
1542 {title=title||WebInspector.UIString("Recording\u2026");return new WebInspector.H eapProfileHeader(this,title);},_requestProfilesFromBackend:function(populateCall back) 1624 {title=title||WebInspector.UIString("Recording\u2026");return new WebInspector.H eapProfileHeader(this,title);},_requestProfilesFromBackend:function(populateCall back)
1543 {},__proto__:WebInspector.HeapSnapshotProfileType.prototype} 1625 {},__proto__:WebInspector.HeapSnapshotProfileType.prototype}
1544 WebInspector.HeapProfileHeader=function(type,title,uid,maxJSObjectId) 1626 WebInspector.HeapProfileHeader=function(type,title,uid,maxJSObjectId)
1545 {WebInspector.ProfileHeader.call(this,type,title,uid);this.maxJSObjectId=maxJSOb jectId;this._receiver=null;this._snapshotProxy=null;this._totalNumberOfChunks=0; } 1627 {WebInspector.ProfileHeader.call(this,type,title,uid);this.maxJSObjectId=maxJSOb jectId;this._receiver=null;this._snapshotProxy=null;this._totalNumberOfChunks=0; this._transferHandler=null;}
1546 WebInspector.HeapProfileHeader.prototype={createSidebarTreeElement:function() 1628 WebInspector.HeapProfileHeader.prototype={createSidebarTreeElement:function()
1547 {return new WebInspector.ProfileSidebarTreeElement(this,WebInspector.UIString("S napshot %d"),"heap-snapshot-sidebar-tree-item");},createView:function(profilesPa nel) 1629 {return new WebInspector.ProfileSidebarTreeElement(this,WebInspector.UIString("S napshot %d"),"heap-snapshot-sidebar-tree-item");},createView:function(profilesPa nel)
1548 {return new WebInspector.HeapSnapshotView(profilesPanel,this);},load:function(ca llback) 1630 {return new WebInspector.HeapSnapshotView(profilesPanel,this);},load:function(ca llback)
1549 {if(this.uid===-1) 1631 {if(this.uid===-1)
1550 return;if(this._snapshotProxy){callback(this._snapshotProxy);return;} 1632 return;if(this._snapshotProxy){callback(this._snapshotProxy);return;}
1551 this._numberOfChunks=0;this._savedChunks=0;this._savingToFile=false;if(!this._re ceiver){this._setupWorker();this.sidebarElement.subtitle=WebInspector.UIString(" Loading\u2026");this.sidebarElement.wait=true;this.startSnapshotTransfer();} 1633 this._numberOfChunks=0;if(!this._receiver){this._setupWorker();this._transferHan dler=new WebInspector.BackendSnapshotLoader(this);this.sidebarElement.subtitle=W ebInspector.UIString("Loading\u2026");this.sidebarElement.wait=true;this.startSn apshotTransfer();}
1552 var loaderProxy=(this._receiver);loaderProxy.addConsumer(callback);},startSnapsh otTransfer:function() 1634 var loaderProxy=(this._receiver);loaderProxy.addConsumer(callback);},startSnapsh otTransfer:function()
1553 {HeapProfilerAgent.getHeapSnapshot(this.uid);},snapshotConstructorName:function( ) 1635 {HeapProfilerAgent.getHeapSnapshot(this.uid);},snapshotConstructorName:function( )
1554 {return"JSHeapSnapshot";},snapshotProxyConstructor:function() 1636 {return"JSHeapSnapshot";},snapshotProxyConstructor:function()
1555 {return WebInspector.HeapSnapshotProxy;},_setupWorker:function() 1637 {return WebInspector.HeapSnapshotProxy;},_setupWorker:function()
1556 {function setProfileWait(event) 1638 {function setProfileWait(event)
1557 {this.sidebarElement.wait=event.data;} 1639 {this.sidebarElement.wait=event.data;}
1558 var worker=new WebInspector.HeapSnapshotWorker();worker.addEventListener("wait", setProfileWait,this);var loaderProxy=worker.createLoader(this.snapshotConstructo rName(),this.snapshotProxyConstructor());loaderProxy.addConsumer(this._snapshotR eceived.bind(this));this._receiver=loaderProxy;},dispose:function() 1640 var worker=new WebInspector.HeapSnapshotWorkerProxy(this._handleWorkerEvent.bind (this));worker.addEventListener("wait",setProfileWait,this);var loaderProxy=work er.createLoader(this.snapshotConstructorName(),this.snapshotProxyConstructor()); loaderProxy.addConsumer(this._snapshotReceived.bind(this));this._receiver=loader Proxy;},_handleWorkerEvent:function(eventName,data)
1641 {if(WebInspector.HeapSnapshotProgress.Event.Update!==eventName)
1642 return;this._updateSubtitle(data);},dispose:function()
1559 {if(this._receiver) 1643 {if(this._receiver)
1560 this._receiver.close();else if(this._snapshotProxy) 1644 this._receiver.close();else if(this._snapshotProxy)
1561 this._snapshotProxy.dispose();if(this._view){var view=this._view;this._view=null ;view.dispose();}},_updateTransferProgress:function(value,maxValue) 1645 this._snapshotProxy.dispose();if(this._view){var view=this._view;this._view=null ;view.dispose();}},_updateSubtitle:function(value)
1562 {var percentValue=((maxValue?(value/maxValue):0)*100).toFixed(0);if(this._saving ToFile) 1646 {this.sidebarElement.subtitle=value;},_didCompleteSnapshotTransfer:function()
1563 this.sidebarElement.subtitle=WebInspector.UIString("Saving\u2026 %d\%",percentVa lue);else
1564 this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026 %d\%",percentV alue);},_updateSnapshotStatus:function()
1565 {this.sidebarElement.subtitle=Number.bytesToString(this._snapshotProxy.totalSize );this.sidebarElement.wait=false;},transferChunk:function(chunk) 1647 {this.sidebarElement.subtitle=Number.bytesToString(this._snapshotProxy.totalSize );this.sidebarElement.wait=false;},transferChunk:function(chunk)
1566 {++this._numberOfChunks;this._receiver.write(chunk,callback.bind(this));function callback() 1648 {this._transferHandler.transferChunk(chunk);},_snapshotReceived:function(snapsho tProxy)
1567 {this._updateTransferProgress(++this._savedChunks,this._totalNumberOfChunks);if( this._totalNumberOfChunks===this._savedChunks){if(this._savingToFile)
1568 this._updateSnapshotStatus();else
1569 this.sidebarElement.subtitle=WebInspector.UIString("Parsing\u2026");this._receiv er.close();}}},_snapshotReceived:function(snapshotProxy)
1570 {this._receiver=null;if(snapshotProxy) 1649 {this._receiver=null;if(snapshotProxy)
1571 this._snapshotProxy=snapshotProxy;this._updateSnapshotStatus();var worker=(this. _snapshotProxy.worker);this.isTemporary=false;worker.startCheckingForLongRunning Calls();this.notifySnapshotReceived();},notifySnapshotReceived:function() 1650 this._snapshotProxy=snapshotProxy;this._didCompleteSnapshotTransfer();var worker =(this._snapshotProxy.worker);this.isTemporary=false;worker.startCheckingForLong RunningCalls();this.notifySnapshotReceived();},notifySnapshotReceived:function()
1572 {this._profileType._snapshotReceived(this);},finishHeapSnapshot:function() 1651 {this._profileType._snapshotReceived(this);},finishHeapSnapshot:function()
1573 {this._totalNumberOfChunks=this._numberOfChunks;},_wasShown:function() 1652 {if(this._transferHandler){this._transferHandler.finishTransfer();this._totalNum berOfChunks=this._transferHandler._totalNumberOfChunks;}},_wasShown:function()
1574 {},canSaveToFile:function() 1653 {},canSaveToFile:function()
1575 {return!this.fromFile()&&!!this._snapshotProxy&&!this._receiver;},saveToFile:fun ction() 1654 {return!this.fromFile()&&!!this._snapshotProxy&&!this._receiver;},saveToFile:fun ction()
1576 {this._numberOfChunks=0;var fileOutputStream=new WebInspector.FileOutputStream() ;function onOpen() 1655 {var fileOutputStream=new WebInspector.FileOutputStream();function onOpen()
1577 {this._receiver=fileOutputStream;this._savedChunks=0;this._updateTransferProgres s(0,this._totalNumberOfChunks);HeapProfilerAgent.getHeapSnapshot(this.uid);} 1656 {this._receiver=fileOutputStream;this._transferHandler=new WebInspector.SaveSnap shotHandler(this);HeapProfilerAgent.getHeapSnapshot(this.uid);}
1578 this._savingToFile=true;this._fileName=this._fileName||"Heap-"+new Date().toISO8 601Compact()+this._profileType.fileExtension();fileOutputStream.open(this._fileN ame,onOpen.bind(this));},loadFromFile:function(file) 1657 this._fileName=this._fileName||"Heap-"+new Date().toISO8601Compact()+this._profi leType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));} ,loadFromFile:function(file)
1579 {this.title=file.name;this.sidebarElement.subtitle=WebInspector.UIString("Loadin g\u2026");this.sidebarElement.wait=true;this._setupWorker();this._numberOfChunks =0;this._savingToFile=false;var delegate=new WebInspector.HeapSnapshotLoadFromFi leDelegate(this);var fileReader=this._createFileReader(file,delegate);fileReader .start(this._receiver);},_createFileReader:function(file,delegate) 1658 {this.title=file.name;this.sidebarElement.subtitle=WebInspector.UIString("Loadin g\u2026");this.sidebarElement.wait=true;this._setupWorker();var delegate=new Web Inspector.HeapSnapshotLoadFromFileDelegate(this);var fileReader=this._createFile Reader(file,delegate);fileReader.start(this._receiver);},_createFileReader:funct ion(file,delegate)
1580 {return new WebInspector.ChunkedFileReader(file,10000000,delegate);},__proto__:W ebInspector.ProfileHeader.prototype} 1659 {return new WebInspector.ChunkedFileReader(file,10000000,delegate);},__proto__:W ebInspector.ProfileHeader.prototype}
1660 WebInspector.SnapshotTransferHandler=function(header,title)
1661 {this._numberOfChunks=0;this._savedChunks=0;this._header=header;this._totalNumbe rOfChunks=0;this._title=title;}
1662 WebInspector.SnapshotTransferHandler.prototype={transferChunk:function(chunk)
1663 {++this._numberOfChunks;this._header._receiver.write(chunk,this._didTransferChun k.bind(this));},finishTransfer:function()
1664 {},_didTransferChunk:function()
1665 {this._updateProgress(++this._savedChunks,this._totalNumberOfChunks);},_updatePr ogress:function(value,total)
1666 {}}
1667 WebInspector.SaveSnapshotHandler=function(header)
1668 {WebInspector.SnapshotTransferHandler.call(this,header,"Saving\u2026 %d\%");this ._totalNumberOfChunks=header._totalNumberOfChunks;this._updateProgress(0,this._t otalNumberOfChunks);}
1669 WebInspector.SaveSnapshotHandler.prototype={_updateProgress:function(value,total )
1670 {var percentValue=((total?(value/total):0)*100).toFixed(0);this._header._updateS ubtitle(WebInspector.UIString(this._title,percentValue));if(value===total){this. _header._receiver.close();this._header._didCompleteSnapshotTransfer();}},__proto __:WebInspector.SnapshotTransferHandler.prototype}
1671 WebInspector.BackendSnapshotLoader=function(header)
1672 {WebInspector.SnapshotTransferHandler.call(this,header,"Loading\u2026 %d\%");}
1673 WebInspector.BackendSnapshotLoader.prototype={finishTransfer:function()
1674 {this._header._receiver.close(this._didFinishTransfer.bind(this));this._totalNum berOfChunks=this._numberOfChunks;},_didFinishTransfer:function()
1675 {console.assert(this._totalNumberOfChunks===this._savedChunks,"Not all chunks we re transfered.");},__proto__:WebInspector.SnapshotTransferHandler.prototype}
1581 WebInspector.HeapSnapshotLoadFromFileDelegate=function(snapshotHeader) 1676 WebInspector.HeapSnapshotLoadFromFileDelegate=function(snapshotHeader)
1582 {this._snapshotHeader=snapshotHeader;} 1677 {this._snapshotHeader=snapshotHeader;}
1583 WebInspector.HeapSnapshotLoadFromFileDelegate.prototype={onTransferStarted:funct ion() 1678 WebInspector.HeapSnapshotLoadFromFileDelegate.prototype={onTransferStarted:funct ion()
1584 {},onChunkTransferred:function(reader) 1679 {},onChunkTransferred:function(reader)
1585 {this._snapshotHeader._updateTransferProgress(reader.loadedSize(),reader.fileSiz e());},onTransferFinished:function() 1680 {},onTransferFinished:function()
1586 {this._snapshotHeader.finishHeapSnapshot();},onError:function(reader,e) 1681 {},onError:function(reader,e)
1587 {switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:this._snapshotHea der.sidebarElement.subtitle=WebInspector.UIString("'%s' not found.",reader.fileN ame());break;case e.target.error.NOT_READABLE_ERR:this._snapshotHeader.sidebarEl ement.subtitle=WebInspector.UIString("'%s' is not readable",reader.fileName());b reak;case e.target.error.ABORT_ERR:break;default:this._snapshotHeader.sidebarEle ment.subtitle=WebInspector.UIString("'%s' error %d",reader.fileName(),e.target.e rror.code);}}} 1682 {switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:this._snapshotHea der._updateSubtitle(WebInspector.UIString("'%s' not found.",reader.fileName())); break;case e.target.error.NOT_READABLE_ERR:this._snapshotHeader._updateSubtitle( WebInspector.UIString("'%s' is not readable",reader.fileName()));break;case e.ta rget.error.ABORT_ERR:break;default:this._snapshotHeader._updateSubtitle(WebInspe ctor.UIString("'%s' error %d",reader.fileName(),e.target.error.code));}}}
1588 WebInspector.HeapTrackingOverviewGrid=function(heapProfileHeader) 1683 WebInspector.HeapTrackingOverviewGrid=function(heapProfileHeader)
1589 {WebInspector.View.call(this);this.registerRequiredCSS("flameChart.css");this.el ement.id="heap-recording-view";this._overviewContainer=this.element.createChild( "div","overview-container");this._overviewGrid=new WebInspector.OverviewGrid("he ap-recording");this._overviewCanvas=this._overviewContainer.createChild("canvas" ,"heap-recording-overview-canvas");this._overviewContainer.appendChild(this._ove rviewGrid.element);this._overviewCalculator=new WebInspector.HeapTrackingOvervie wGrid.OverviewCalculator();this._overviewGrid.addEventListener(WebInspector.Over viewGrid.Events.WindowChanged,this._onWindowChanged,this);this._profileSamples=h eapProfileHeader._profileSamples||heapProfileHeader._profileType._profileSamples ;if(heapProfileHeader.isTemporary){this._profileType=heapProfileHeader._profileT ype;this._profileType.addEventListener(WebInspector.TrackingHeapSnapshotProfileT ype.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.addEventList ener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onStopTr acking,this);} 1684 {WebInspector.View.call(this);this.registerRequiredCSS("flameChart.css");this.el ement.id="heap-recording-view";this._overviewContainer=this.element.createChild( "div","overview-container");this._overviewGrid=new WebInspector.OverviewGrid("he ap-recording");this._overviewCanvas=this._overviewContainer.createChild("canvas" ,"heap-recording-overview-canvas");this._overviewContainer.appendChild(this._ove rviewGrid.element);this._overviewCalculator=new WebInspector.HeapTrackingOvervie wGrid.OverviewCalculator();this._overviewGrid.addEventListener(WebInspector.Over viewGrid.Events.WindowChanged,this._onWindowChanged,this);this._profileSamples=h eapProfileHeader._profileSamples||heapProfileHeader._profileType._profileSamples ;if(heapProfileHeader.isTemporary){this._profileType=heapProfileHeader._profileT ype;this._profileType.addEventListener(WebInspector.TrackingHeapSnapshotProfileT ype.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.addEventList ener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onStopTr acking,this);}
1590 var timestamps=this._profileSamples.timestamps;var totalTime=this._profileSample s.totalTime;this._windowLeft=0.0;this._windowRight=totalTime&&timestamps.length? (timestamps[timestamps.length-1]-timestamps[0])/totalTime:1.0;this._overviewGrid .setWindow(this._windowLeft,this._windowRight);this._yScale=new WebInspector.Hea pTrackingOverviewGrid.SmoothScale();this._xScale=new WebInspector.HeapTrackingOv erviewGrid.SmoothScale();} 1685 var timestamps=this._profileSamples.timestamps;var totalTime=this._profileSample s.totalTime;this._windowLeft=0.0;this._windowRight=totalTime&&timestamps.length? (timestamps[timestamps.length-1]-timestamps[0])/totalTime:1.0;this._overviewGrid .setWindow(this._windowLeft,this._windowRight);this._yScale=new WebInspector.Hea pTrackingOverviewGrid.SmoothScale();this._xScale=new WebInspector.HeapTrackingOv erviewGrid.SmoothScale();}
1591 WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged="IdsRangeChanged";WebInspe ctor.HeapTrackingOverviewGrid.prototype={_onStopTracking:function(event) 1686 WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged="IdsRangeChanged";WebInspe ctor.HeapTrackingOverviewGrid.prototype={_onStopTracking:function(event)
1592 {this._profileType.removeEventListener(WebInspector.TrackingHeapSnapshotProfileT ype.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.removeEventL istener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onSto pTracking,this);},_onHeapStatsUpdate:function(event) 1687 {this._profileType.removeEventListener(WebInspector.TrackingHeapSnapshotProfileT ype.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.removeEventL istener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onSto pTracking,this);},_onHeapStatsUpdate:function(event)
1593 {this._profileSamples=event.data;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height) 1688 {this._profileSamples=event.data;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height)
1594 {if(!this._profileSamples) 1689 {if(!this._profileSamples)
1595 return;var profileSamples=this._profileSamples;var sizes=profileSamples.sizes;va r topSizes=profileSamples.max;var timestamps=profileSamples.timestamps;var start Time=timestamps[0];var endTime=timestamps[timestamps.length-1];var scaleFactor=t his._xScale.nextScale(width/profileSamples.totalTime);var maxSize=0;function agg regateAndCall(sizes,callback) 1690 return;var profileSamples=this._profileSamples;var sizes=profileSamples.sizes;va r topSizes=profileSamples.max;var timestamps=profileSamples.timestamps;var start Time=timestamps[0];var endTime=timestamps[timestamps.length-1];var scaleFactor=t his._xScale.nextScale(width/profileSamples.totalTime);var maxSize=0;function agg regateAndCall(sizes,callback)
1596 {var size=0;var currentX=0;for(var i=1;i<timestamps.length;++i){var x=Math.floor ((timestamps[i]-startTime)*scaleFactor);if(x!==currentX){if(size) 1691 {var size=0;var currentX=0;for(var i=1;i<timestamps.length;++i){var x=Math.floor ((timestamps[i]-startTime)*scaleFactor);if(x!==currentX){if(size)
1597 callback(currentX,size);size=0;currentX=x;} 1692 callback(currentX,size);size=0;currentX=x;}
(...skipping 29 matching lines...) Expand all
1627 {this._minimumBoundaries=0;this._maximumBoundaries=chart._profileSamples.totalTi me;this._xScaleFactor=chart._overviewContainer.clientWidth/this._maximumBoundari es;},computePosition:function(time) 1722 {this._minimumBoundaries=0;this._maximumBoundaries=chart._profileSamples.totalTi me;this._xScaleFactor=chart._overviewContainer.clientWidth/this._maximumBoundari es;},computePosition:function(time)
1628 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue) 1723 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue)
1629 {return Number.secondsToString((value+this._minimumBoundaries)/1000);},maximumBo undary:function() 1724 {return Number.secondsToString((value+this._minimumBoundaries)/1000);},maximumBo undary:function()
1630 {return this._maximumBoundaries;},minimumBoundary:function() 1725 {return this._maximumBoundaries;},minimumBoundary:function()
1631 {return this._minimumBoundaries;},zeroTime:function() 1726 {return this._minimumBoundaries;},zeroTime:function()
1632 {return this._minimumBoundaries;},boundarySpan:function() 1727 {return this._minimumBoundaries;},boundarySpan:function()
1633 {return this._maximumBoundaries-this._minimumBoundaries;}};WebInspector.HeapSnap shotWorkerDispatcher=function(globalObject,postMessage) 1728 {return this._maximumBoundaries-this._minimumBoundaries;}};WebInspector.HeapSnap shotWorkerDispatcher=function(globalObject,postMessage)
1634 {this._objects=[];this._global=globalObject;this._postMessage=postMessage;} 1729 {this._objects=[];this._global=globalObject;this._postMessage=postMessage;}
1635 WebInspector.HeapSnapshotWorkerDispatcher.prototype={_findFunction:function(name ) 1730 WebInspector.HeapSnapshotWorkerDispatcher.prototype={_findFunction:function(name )
1636 {var path=name.split(".");var result=this._global;for(var i=0;i<path.length;++i) 1731 {var path=name.split(".");var result=this._global;for(var i=0;i<path.length;++i)
1637 result=result[path[i]];return result;},dispatchMessage:function(event) 1732 result=result[path[i]];return result;},sendEvent:function(name,data)
1638 {var data=event.data;var response={callId:data.callId};try{switch(data.dispositi on){case"create":{var constructorFunction=this._findFunction(data.methodName);th is._objects[data.objectId]=new constructorFunction();break;} 1733 {this._postMessage({eventName:name,data:data});},dispatchMessage:function(event)
1734 {var data=event.data;var response={callId:data.callId};try{switch(data.dispositi on){case"create":{var constructorFunction=this._findFunction(data.methodName);th is._objects[data.objectId]=new constructorFunction(this);break;}
1639 case"dispose":{delete this._objects[data.objectId];break;} 1735 case"dispose":{delete this._objects[data.objectId];break;}
1640 case"getter":{var object=this._objects[data.objectId];var result=object[data.met hodName];response.result=result;break;} 1736 case"getter":{var object=this._objects[data.objectId];var result=object[data.met hodName];response.result=result;break;}
1641 case"factory":{var object=this._objects[data.objectId];var result=object[data.me thodName].apply(object,data.methodArguments);if(result) 1737 case"factory":{var object=this._objects[data.objectId];var result=object[data.me thodName].apply(object,data.methodArguments);if(result)
1642 this._objects[data.newObjectId]=result;response.result=!!result;break;} 1738 this._objects[data.newObjectId]=result;response.result=!!result;break;}
1643 case"method":{var object=this._objects[data.objectId];response.result=object[dat a.methodName].apply(object,data.methodArguments);break;}}}catch(e){response.erro r=e.toString();response.errorCallStack=e.stack;if(data.methodName) 1739 case"method":{var object=this._objects[data.objectId];response.result=object[dat a.methodName].apply(object,data.methodArguments);break;}}}catch(e){response.erro r=e.toString();response.errorCallStack=e.stack;if(data.methodName)
1644 response.errorMethodName=data.methodName;} 1740 response.errorMethodName=data.methodName;}
1645 this._postMessage(response);}};;WebInspector.JSHeapSnapshot=function(profile) 1741 this._postMessage(response);}};;WebInspector.JSHeapSnapshot=function(profile,pro gress)
1646 {this._nodeFlags={canBeQueried:1,detachedDOMTreeNode:2,pageObject:4,visitedMarke rMask:0x0ffff,visitedMarker:0x10000};WebInspector.HeapSnapshot.call(this,profile );} 1742 {this._nodeFlags={canBeQueried:1,detachedDOMTreeNode:2,pageObject:4,visitedMarke rMask:0x0ffff,visitedMarker:0x10000};this._lazyStringCache={};WebInspector.HeapS napshot.call(this,profile,progress);}
1647 WebInspector.JSHeapSnapshot.prototype={createNode:function(nodeIndex) 1743 WebInspector.JSHeapSnapshot.prototype={createNode:function(nodeIndex)
1648 {return new WebInspector.JSHeapSnapshotNode(this,nodeIndex);},createEdge:functio n(edges,edgeIndex) 1744 {return new WebInspector.JSHeapSnapshotNode(this,nodeIndex);},createEdge:functio n(edges,edgeIndex)
1649 {return new WebInspector.JSHeapSnapshotEdge(this,edges,edgeIndex);},createRetain ingEdge:function(retainedNodeIndex,retainerIndex) 1745 {return new WebInspector.JSHeapSnapshotEdge(this,edges,edgeIndex);},createRetain ingEdge:function(retainedNodeIndex,retainerIndex)
1650 {return new WebInspector.JSHeapSnapshotRetainerEdge(this,retainedNodeIndex,retai nerIndex);},classNodesFilter:function() 1746 {return new WebInspector.JSHeapSnapshotRetainerEdge(this,retainedNodeIndex,retai nerIndex);},classNodesFilter:function()
1651 {function filter(node) 1747 {function filter(node)
1652 {return node.isUserObject();} 1748 {return node.isUserObject();}
1653 return filter;},containmentEdgesFilter:function(showHiddenData) 1749 return filter;},containmentEdgesFilter:function(showHiddenData)
1654 {function filter(edge){if(edge.isInvisible()) 1750 {function filter(edge){if(edge.isInvisible())
1655 return false;if(showHiddenData) 1751 return false;if(showHiddenData)
1656 return true;return!edge.isHidden()&&!edge.node().isHidden();} 1752 return true;return!edge.isHidden()&&!edge.node().isHidden();}
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 continue;list.push(childNodeOrdinal);}}},_markPageOwnedNodes:function() 1794 continue;list.push(childNodeOrdinal);}}},_markPageOwnedNodes:function()
1699 {var edgeShortcutType=this._edgeShortcutType;var edgeElementType=this._edgeEleme ntType;var edgeToNodeOffset=this._edgeToNodeOffset;var edgeTypeOffset=this._edge TypeOffset;var edgeFieldsCount=this._edgeFieldsCount;var edgeWeakType=this._edge WeakType;var firstEdgeIndexes=this._firstEdgeIndexes;var containmentEdges=this._ containmentEdges;var containmentEdgesLength=containmentEdges.length;var nodes=th is._nodes;var nodeFieldCount=this._nodeFieldCount;var nodesCount=this.nodeCount; var flags=this._flags;var flag=this._nodeFlags.pageObject;var visitedMarker=this ._nodeFlags.visitedMarker;var visitedMarkerMask=this._nodeFlags.visitedMarkerMas k;var markerAndFlag=visitedMarker|flag;var nodesToVisit=new Uint32Array(nodesCou nt);var nodesToVisitLength=0;var rootNodeOrdinal=this._rootNodeIndex/nodeFieldCo unt;var node=this.rootNode();for(var edgeIndex=firstEdgeIndexes[rootNodeOrdinal] ,endEdgeIndex=firstEdgeIndexes[rootNodeOrdinal+1];edgeIndex<endEdgeIndex;edgeInd ex+=edgeFieldsCount){var edgeType=containmentEdges[edgeIndex+edgeTypeOffset];var nodeIndex=containmentEdges[edgeIndex+edgeToNodeOffset];if(edgeType===edgeElemen tType){node.nodeIndex=nodeIndex;if(!node.isDocumentDOMTreesRoot()) 1795 {var edgeShortcutType=this._edgeShortcutType;var edgeElementType=this._edgeEleme ntType;var edgeToNodeOffset=this._edgeToNodeOffset;var edgeTypeOffset=this._edge TypeOffset;var edgeFieldsCount=this._edgeFieldsCount;var edgeWeakType=this._edge WeakType;var firstEdgeIndexes=this._firstEdgeIndexes;var containmentEdges=this._ containmentEdges;var containmentEdgesLength=containmentEdges.length;var nodes=th is._nodes;var nodeFieldCount=this._nodeFieldCount;var nodesCount=this.nodeCount; var flags=this._flags;var flag=this._nodeFlags.pageObject;var visitedMarker=this ._nodeFlags.visitedMarker;var visitedMarkerMask=this._nodeFlags.visitedMarkerMas k;var markerAndFlag=visitedMarker|flag;var nodesToVisit=new Uint32Array(nodesCou nt);var nodesToVisitLength=0;var rootNodeOrdinal=this._rootNodeIndex/nodeFieldCo unt;var node=this.rootNode();for(var edgeIndex=firstEdgeIndexes[rootNodeOrdinal] ,endEdgeIndex=firstEdgeIndexes[rootNodeOrdinal+1];edgeIndex<endEdgeIndex;edgeInd ex+=edgeFieldsCount){var edgeType=containmentEdges[edgeIndex+edgeTypeOffset];var nodeIndex=containmentEdges[edgeIndex+edgeToNodeOffset];if(edgeType===edgeElemen tType){node.nodeIndex=nodeIndex;if(!node.isDocumentDOMTreesRoot())
1700 continue;}else if(edgeType!==edgeShortcutType) 1796 continue;}else if(edgeType!==edgeShortcutType)
1701 continue;var nodeOrdinal=nodeIndex/nodeFieldCount;nodesToVisit[nodesToVisitLengt h++]=nodeOrdinal;flags[nodeOrdinal]|=visitedMarker;} 1797 continue;var nodeOrdinal=nodeIndex/nodeFieldCount;nodesToVisit[nodesToVisitLengt h++]=nodeOrdinal;flags[nodeOrdinal]|=visitedMarker;}
1702 while(nodesToVisitLength){var nodeOrdinal=nodesToVisit[--nodesToVisitLength];fla gs[nodeOrdinal]|=flag;flags[nodeOrdinal]&=visitedMarkerMask;var beginEdgeIndex=f irstEdgeIndexes[nodeOrdinal];var endEdgeIndex=firstEdgeIndexes[nodeOrdinal+1];fo r(var edgeIndex=beginEdgeIndex;edgeIndex<endEdgeIndex;edgeIndex+=edgeFieldsCount ){var childNodeIndex=containmentEdges[edgeIndex+edgeToNodeOffset];var childNodeO rdinal=childNodeIndex/nodeFieldCount;if(flags[childNodeOrdinal]&markerAndFlag) 1798 while(nodesToVisitLength){var nodeOrdinal=nodesToVisit[--nodesToVisitLength];fla gs[nodeOrdinal]|=flag;flags[nodeOrdinal]&=visitedMarkerMask;var beginEdgeIndex=f irstEdgeIndexes[nodeOrdinal];var endEdgeIndex=firstEdgeIndexes[nodeOrdinal+1];fo r(var edgeIndex=beginEdgeIndex;edgeIndex<endEdgeIndex;edgeIndex+=edgeFieldsCount ){var childNodeIndex=containmentEdges[edgeIndex+edgeToNodeOffset];var childNodeO rdinal=childNodeIndex/nodeFieldCount;if(flags[childNodeOrdinal]&markerAndFlag)
1703 continue;var type=containmentEdges[edgeIndex+edgeTypeOffset];if(type===edgeWeakT ype) 1799 continue;var type=containmentEdges[edgeIndex+edgeTypeOffset];if(type===edgeWeakT ype)
1704 continue;nodesToVisit[nodesToVisitLength++]=childNodeOrdinal;flags[childNodeOrdi nal]|=visitedMarker;}}},__proto__:WebInspector.HeapSnapshot.prototype};WebInspec tor.JSHeapSnapshotNode=function(snapshot,nodeIndex) 1800 continue;nodesToVisit[nodesToVisitLength++]=childNodeOrdinal;flags[childNodeOrdi nal]|=visitedMarker;}}},__proto__:WebInspector.HeapSnapshot.prototype};WebInspec tor.JSHeapSnapshotNode=function(snapshot,nodeIndex)
1705 {WebInspector.HeapSnapshotNode.call(this,snapshot,nodeIndex)} 1801 {WebInspector.HeapSnapshotNode.call(this,snapshot,nodeIndex)}
1706 WebInspector.JSHeapSnapshotNode.prototype={canBeQueried:function() 1802 WebInspector.JSHeapSnapshotNode.prototype={canBeQueried:function()
1707 {var flags=this._snapshot._flagsOfNode(this);return!!(flags&this._snapshot._node Flags.canBeQueried);},isUserObject:function() 1803 {var flags=this._snapshot._flagsOfNode(this);return!!(flags&this._snapshot._node Flags.canBeQueried);},isUserObject:function()
1708 {var flags=this._snapshot._flagsOfNode(this);return!!(flags&this._snapshot._node Flags.pageObject);},className:function() 1804 {var flags=this._snapshot._flagsOfNode(this);return!!(flags&this._snapshot._node Flags.pageObject);},name:function(){var snapshot=this._snapshot;if(this._type()= ==snapshot._nodeConsStringType){var string=snapshot._lazyStringCache[this.nodeIn dex];if(typeof string==="undefined"){string=this._consStringName();snapshot._laz yStringCache[this.nodeIndex]=string;}
1805 return string;}
1806 return WebInspector.HeapSnapshotNode.prototype.name.call(this);},_consStringName :function()
1807 {var snapshot=this._snapshot;var consStringType=snapshot._nodeConsStringType;var edgeInternalType=snapshot._edgeInternalType;var edgeFieldsCount=snapshot._edgeF ieldsCount;var edgeToNodeOffset=snapshot._edgeToNodeOffset;var edgeTypeOffset=sn apshot._edgeTypeOffset;var edgeNameOffset=snapshot._edgeNameOffset;var strings=s napshot._strings;var edges=snapshot._containmentEdges;var firstEdgeIndexes=snaps hot._firstEdgeIndexes;var nodeFieldCount=snapshot._nodeFieldCount;var nodeTypeOf fset=snapshot._nodeTypeOffset;var nodeNameOffset=snapshot._nodeNameOffset;var no des=snapshot._nodes;var nodesStack=[];nodesStack.push(this.nodeIndex);var name=" ";while(nodesStack.length&&name.length<1024){var nodeIndex=nodesStack.pop();if(n odes[nodeIndex+nodeTypeOffset]!==consStringType){name+=strings[nodes[nodeIndex+n odeNameOffset]];continue;}
1808 var nodeOrdinal=nodeIndex/nodeFieldCount;var beginEdgeIndex=firstEdgeIndexes[nod eOrdinal];var endEdgeIndex=firstEdgeIndexes[nodeOrdinal+1];var firstNodeIndex=0; var secondNodeIndex=0;for(var edgeIndex=beginEdgeIndex;edgeIndex<endEdgeIndex&&( !firstNodeIndex||!secondNodeIndex);edgeIndex+=edgeFieldsCount){var edgeType=edge s[edgeIndex+edgeTypeOffset];if(edgeType===edgeInternalType){var edgeName=strings [edges[edgeIndex+edgeNameOffset]];if(edgeName==="first")
1809 firstNodeIndex=edges[edgeIndex+edgeToNodeOffset];else if(edgeName==="second")
1810 secondNodeIndex=edges[edgeIndex+edgeToNodeOffset];}}
1811 nodesStack.push(secondNodeIndex);nodesStack.push(firstNodeIndex);}
1812 return name;},className:function()
1709 {var type=this.type();switch(type){case"hidden":return"(system)";case"object":ca se"native":return this.name();case"code":return"(compiled code)";default:return" ("+type+")";}},classIndex:function() 1813 {var type=this.type();switch(type){case"hidden":return"(system)";case"object":ca se"native":return this.name();case"code":return"(compiled code)";default:return" ("+type+")";}},classIndex:function()
1710 {var snapshot=this._snapshot;var nodes=snapshot._nodes;var type=nodes[this.nodeI ndex+snapshot._nodeTypeOffset];;if(type===snapshot._nodeObjectType||type===snaps hot._nodeNativeType) 1814 {var snapshot=this._snapshot;var nodes=snapshot._nodes;var type=nodes[this.nodeI ndex+snapshot._nodeTypeOffset];;if(type===snapshot._nodeObjectType||type===snaps hot._nodeNativeType)
1711 return nodes[this.nodeIndex+snapshot._nodeNameOffset];return-1-type;},id:functio n() 1815 return nodes[this.nodeIndex+snapshot._nodeNameOffset];return-1-type;},id:functio n()
1712 {var snapshot=this._snapshot;return snapshot._nodes[this.nodeIndex+snapshot._nod eIdOffset];},isHidden:function() 1816 {var snapshot=this._snapshot;return snapshot._nodes[this.nodeIndex+snapshot._nod eIdOffset];},isHidden:function()
1713 {return this._type()===this._snapshot._nodeHiddenType;},isSynthetic:function() 1817 {return this._type()===this._snapshot._nodeHiddenType;},isSynthetic:function()
1714 {return this._type()===this._snapshot._nodeSyntheticType;},isUserRoot:function() 1818 {return this._type()===this._snapshot._nodeSyntheticType;},isUserRoot:function()
1715 {return!this.isSynthetic();},isDocumentDOMTreesRoot:function() 1819 {return!this.isSynthetic();},isDocumentDOMTreesRoot:function()
1716 {return this.isSynthetic()&&this.name()==="(Document DOM trees)";},serialize:fun ction() 1820 {return this.isSynthetic()&&this.name()==="(Document DOM trees)";},serialize:fun ction()
1717 {var result=WebInspector.HeapSnapshotNode.prototype.serialize.call(this);var fla gs=this._snapshot._flagsOfNode(this);if(flags&this._snapshot._nodeFlags.canBeQue ried) 1821 {var result=WebInspector.HeapSnapshotNode.prototype.serialize.call(this);var fla gs=this._snapshot._flagsOfNode(this);if(flags&this._snapshot._nodeFlags.canBeQue ried)
1718 result.canBeQueried=true;if(flags&this._snapshot._nodeFlags.detachedDOMTreeNode) 1822 result.canBeQueried=true;if(flags&this._snapshot._nodeFlags.detachedDOMTreeNode)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 WebInspector.TopDownProfileDataGridTree=function(profileView,rootProfileNode) 1884 WebInspector.TopDownProfileDataGridTree=function(profileView,rootProfileNode)
1781 {WebInspector.ProfileDataGridTree.call(this,profileView,rootProfileNode);this._r emainingChildren=rootProfileNode.children;var any=(this);var node=(any);WebInspe ctor.TopDownProfileDataGridNode.prototype.populate.call(node);} 1885 {WebInspector.ProfileDataGridTree.call(this,profileView,rootProfileNode);this._r emainingChildren=rootProfileNode.children;var any=(this);var node=(any);WebInspe ctor.TopDownProfileDataGridNode.prototype.populate.call(node);}
1782 WebInspector.TopDownProfileDataGridTree.prototype={focus:function(profileDataGri dNode) 1886 WebInspector.TopDownProfileDataGridTree.prototype={focus:function(profileDataGri dNode)
1783 {if(!profileDataGridNode) 1887 {if(!profileDataGridNode)
1784 return;this._save();profileDataGridNode.savePosition();this.children=[profileDat aGridNode];this.totalTime=profileDataGridNode.totalTime;},exclude:function(profi leDataGridNode) 1888 return;this._save();profileDataGridNode.savePosition();this.children=[profileDat aGridNode];this.totalTime=profileDataGridNode.totalTime;},exclude:function(profi leDataGridNode)
1785 {if(!profileDataGridNode) 1889 {if(!profileDataGridNode)
1786 return;this._save();var excludedCallUID=profileDataGridNode.callUID;var any=(thi s);var node=(any);WebInspector.TopDownProfileDataGridNode.prototype._exclude.cal l(node,excludedCallUID);if(this.lastComparator) 1890 return;this._save();var excludedCallUID=profileDataGridNode.callUID;var any=(thi s);var node=(any);WebInspector.TopDownProfileDataGridNode.prototype._exclude.cal l(node,excludedCallUID);if(this.lastComparator)
1787 this.sort(this.lastComparator,true);},restore:function() 1891 this.sort(this.lastComparator,true);},restore:function()
1788 {if(!this._savedChildren) 1892 {if(!this._savedChildren)
1789 return;this.children[0].restorePosition();WebInspector.ProfileDataGridTree.proto type.restore.call(this);},_merge:WebInspector.TopDownProfileDataGridNode.prototy pe._merge,_sharedPopulate:WebInspector.TopDownProfileDataGridNode.prototype._sha redPopulate,__proto__:WebInspector.ProfileDataGridTree.prototype};WebInspector.C anvasProfileView=function(profile) 1893 return;this.children[0].restorePosition();WebInspector.ProfileDataGridTree.proto type.restore.call(this);},_merge:WebInspector.TopDownProfileDataGridNode.prototy pe._merge,_sharedPopulate:WebInspector.TopDownProfileDataGridNode.prototype._sha redPopulate,__proto__:WebInspector.ProfileDataGridTree.prototype};WebInspector.C anvasProfileView=function(profile)
1790 {WebInspector.View.call(this);this.registerRequiredCSS("canvasProfiler.css");thi s._profile=profile;this._traceLogId=profile.traceLogId();this.element.addStyleCl ass("canvas-profile-view");this._linkifier=new WebInspector.Linkifier();this._sp litView=new WebInspector.SplitView(false,"canvasProfileViewSplitLocation",300);v ar replayImageContainer=this._splitView.firstElement();replayImageContainer.id=" canvas-replay-image-container";this._replayImageElement=replayImageContainer.cre ateChild("image","canvas-replay-image");this._debugInfoElement=replayImageContai ner.createChild("div","canvas-debug-info hidden");this._spinnerIcon=replayImageC ontainer.createChild("img","canvas-spinner-icon hidden");var replayInfoContainer =this._splitView.secondElement();var controlsContainer=replayInfoContainer.creat eChild("div","status-bar");var logGridContainer=replayInfoContainer.createChild( "div","canvas-replay-log");this._createControlButton(controlsContainer,"canvas-r eplay-first-step",WebInspector.UIString("First call."),this._onReplayFirstStepCl ick.bind(this));this._createControlButton(controlsContainer,"canvas-replay-prev- step",WebInspector.UIString("Previous call."),this._onReplayStepClick.bind(this, false));this._createControlButton(controlsContainer,"canvas-replay-next-step",We bInspector.UIString("Next call."),this._onReplayStepClick.bind(this,true));this. _createControlButton(controlsContainer,"canvas-replay-prev-draw",WebInspector.UI String("Previous drawing call."),this._onReplayDrawingCallClick.bind(this,false) );this._createControlButton(controlsContainer,"canvas-replay-next-draw",WebInspe ctor.UIString("Next drawing call."),this._onReplayDrawingCallClick.bind(this,tru e));this._createControlButton(controlsContainer,"canvas-replay-last-step",WebIns pector.UIString("Last call."),this._onReplayLastStepClick.bind(this));this._repl ayContextSelector=new WebInspector.StatusBarComboBox(this._onReplayContextChange d.bind(this));this._replayContextSelector.createOption("<screenshot auto>",WebIn spector.UIString("Show screenshot of the last replayed resource."),"");controlsC ontainer.appendChild(this._replayContextSelector.element);this._replayContexts={ };this._currentResourceStates={};var columns=[{title:"#",sortable:true,width:"5% "},{title:WebInspector.UIString("Call"),sortable:true,width:"75%",disclosure:tru e},{title:WebInspector.UIString("Location"),sortable:true,width:"20%"}];this._lo gGrid=new WebInspector.DataGrid(columns);this._logGrid.element.addStyleClass("fi ll");this._logGrid.show(logGridContainer);this._logGrid.addEventListener(WebInsp ector.DataGrid.Events.SelectedNode,this._replayTraceLog.bind(this));this._popove rHelper=new WebInspector.ObjectPopoverHelper(this.element,this._popoverAnchor.bi nd(this),this._resolveObjectForPopover.bind(this),this._onHidePopover.bind(this) ,true);this._splitView.show(this.element);this._requestTraceLog(0);} 1894 {WebInspector.View.call(this);this.registerRequiredCSS("canvasProfiler.css");thi s.element.addStyleClass("canvas-profile-view");this._profile=profile;this._trace LogId=profile.traceLogId();this._traceLogPlayer=profile.traceLogPlayer();this._l inkifier=new WebInspector.Linkifier();const defaultReplayLogWidthPercent=0.34;th is._replayInfoSplitView=new WebInspector.SplitView(true,"canvasProfileViewReplay SplitLocation",defaultReplayLogWidthPercent);this._replayInfoSplitView.setMainEl ementConstraints(defaultReplayLogWidthPercent,defaultReplayLogWidthPercent);this ._replayInfoSplitView.show(this.element);this._imageSplitView=new WebInspector.S plitView(false,"canvasProfileViewSplitLocation",300);this._imageSplitView.show(t his._replayInfoSplitView.firstElement());var replayImageContainer=this._imageSpl itView.firstElement();replayImageContainer.id="canvas-replay-image-container";th is._replayImageElement=replayImageContainer.createChild("image","canvas-replay-i mage");this._debugInfoElement=replayImageContainer.createChild("div","canvas-deb ug-info hidden");this._spinnerIcon=replayImageContainer.createChild("img","canva s-spinner-icon hidden");var replayLogContainer=this._imageSplitView.secondElemen t();var controlsContainer=replayLogContainer.createChild("div","status-bar");var logGridContainer=replayLogContainer.createChild("div","canvas-replay-log");this ._createControlButton(controlsContainer,"canvas-replay-first-step",WebInspector. UIString("First call."),this._onReplayFirstStepClick.bind(this));this._createCon trolButton(controlsContainer,"canvas-replay-prev-step",WebInspector.UIString("Pr evious call."),this._onReplayStepClick.bind(this,false));this._createControlButt on(controlsContainer,"canvas-replay-next-step",WebInspector.UIString("Next call. "),this._onReplayStepClick.bind(this,true));this._createControlButton(controlsCo ntainer,"canvas-replay-prev-draw",WebInspector.UIString("Previous drawing call." ),this._onReplayDrawingCallClick.bind(this,false));this._createControlButton(con trolsContainer,"canvas-replay-next-draw",WebInspector.UIString("Next drawing cal l."),this._onReplayDrawingCallClick.bind(this,true));this._createControlButton(c ontrolsContainer,"canvas-replay-last-step",WebInspector.UIString("Last call."),t his._onReplayLastStepClick.bind(this));this._replayContextSelector=new WebInspec tor.StatusBarComboBox(this._onReplayContextChanged.bind(this));this._replayConte xtSelector.createOption(WebInspector.UIString("<screenshot auto>"),WebInspector. UIString("Show screenshot of the last replayed resource."),"");controlsContainer .appendChild(this._replayContextSelector.element);this._installReplayInfoSidebar Widgets(controlsContainer);this._replayStateView=new WebInspector.CanvasReplaySt ateView(this._traceLogPlayer);this._replayStateView.show(this._replayInfoSplitVi ew.secondElement());this._replayContexts={};var columns=[{title:"#",sortable:fal se,width:"5%"},{title:WebInspector.UIString("Call"),sortable:false,width:"75%",d isclosure:true},{title:WebInspector.UIString("Location"),sortable:false,width:"2 0%"}];this._logGrid=new WebInspector.DataGrid(columns);this._logGrid.element.add StyleClass("fill");this._logGrid.show(logGridContainer);this._logGrid.addEventLi stener(WebInspector.DataGrid.Events.SelectedNode,this._replayTraceLog,this);this .element.addEventListener("mousedown",this._onMouseClick.bind(this),true);this._ popoverHelper=new WebInspector.ObjectPopoverHelper(this.element,this._popoverAnc hor.bind(this),this._resolveObjectForPopover.bind(this),this._onHidePopover.bind (this),true);this._popoverHelper.setRemoteObjectFormatter(this._hexNumbersFormat ter.bind(this));this._requestTraceLog(0);}
1791 WebInspector.CanvasProfileView.TraceLogPollingInterval=500;WebInspector.CanvasPr ofileView.prototype={dispose:function() 1895 WebInspector.CanvasProfileView.TraceLogPollingInterval=500;WebInspector.CanvasPr ofileView.prototype={dispose:function()
1792 {this._linkifier.reset();},get statusBarItems() 1896 {this._linkifier.reset();},get statusBarItems()
1793 {return[];},get profile() 1897 {return[];},get profile()
1794 {return this._profile;},elementsToRestoreScrollPositionsFor:function() 1898 {return this._profile;},elementsToRestoreScrollPositionsFor:function()
1795 {return[this._logGrid.scrollContainer];},_createControlButton:function(parent,cl assName,title,clickCallback) 1899 {return[this._logGrid.scrollContainer];},_installReplayInfoSidebarWidgets:functi on(controlsContainer)
1796 {var button=new WebInspector.StatusBarButton(title,className);parent.appendChild (button.element);button.makeLongClickEnabled();button.addEventListener("click",c lickCallback,this);button.addEventListener("longClickDown",clickCallback,this);b utton.addEventListener("longClickPress",clickCallback,this);},_onReplayContextCh anged:function() 1900 {this._replayInfoResizeWidgetElement=controlsContainer.createChild("div","resize r-widget");this._replayInfoSplitView.installResizer(this._replayInfoResizeWidget Element);this._toggleReplayStateSidebarButton=new WebInspector.StatusBarButton(" ","right-sidebar-show-hide-button canvas-sidebar-show-hide-button",3);this._togg leReplayStateSidebarButton.addEventListener("click",clickHandler,this);controlsC ontainer.appendChild(this._toggleReplayStateSidebarButton.element);this._enableR eplayInfoSidebar(false);function clickHandler()
1797 {function didReceiveResourceState(error,resourceState) 1901 {this._enableReplayInfoSidebar(this._toggleReplayStateSidebarButton.state==="lef t");}},_enableReplayInfoSidebar:function(show)
1798 {const emptyTransparentImageURL="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKA AEALAAAAAABAAEAAAICTAEAOw==";this._enableWaitIcon(false);if(error) 1902 {if(show){this._toggleReplayStateSidebarButton.state="right";this._toggleReplayS tateSidebarButton.title=WebInspector.UIString("Hide sidebar.");this._replayInfoS plitView.showBoth();}else{this._toggleReplayStateSidebarButton.state="left";this ._toggleReplayStateSidebarButton.title=WebInspector.UIString("Show sidebar.");th is._replayInfoSplitView.showOnlyFirst();}
1799 return;this._currentResourceStates[resourceState.id]=resourceState;var selectedC ontextId=this._replayContextSelector.selectedOption().value;if(selectedContextId ===resourceState.id) 1903 this._replayInfoResizeWidgetElement.enableStyleClass("hidden",!show);},_onMouseC lick:function(event)
1800 this._replayImageElement.src=resourceState.imageURL||emptyTransparentImageURL;} 1904 {var resourceLinkElement=event.target.enclosingNodeOrSelfWithClass("canvas-forma tted-resource");if(resourceLinkElement){this._enableReplayInfoSidebar(true);this ._replayStateView.selectResource(resourceLinkElement.__resourceId);event.consume (true);return;}
1801 var selectedContextId=this._replayContextSelector.selectedOption().value||"auto" ;var resourceState=this._currentResourceStates[selectedContextId];if(resourceSta te) 1905 if(event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link"))
1802 this._replayImageElement.src=resourceState.imageURL;else{this._enableWaitIcon(tr ue);CanvasAgent.getResourceState(this._traceLogId,selectedContextId,didReceiveRe sourceState.bind(this));}},_onReplayStepClick:function(forward) 1906 event.consume(false);},_createControlButton:function(parent,className,title,clic kCallback)
1907 {var button=new WebInspector.StatusBarButton(title,className+" canvas-replay-but ton");parent.appendChild(button.element);button.makeLongClickEnabled();button.ad dEventListener("click",clickCallback,this);button.addEventListener("longClickDow n",clickCallback,this);button.addEventListener("longClickPress",clickCallback,th is);},_onReplayContextChanged:function()
1908 {var selectedContextId=this._replayContextSelector.selectedOption().value;functi on didReceiveResourceState(resourceState)
1909 {this._enableWaitIcon(false);if(selectedContextId!==this._replayContextSelector. selectedOption().value)
1910 return;var imageURL=(resourceState&&resourceState.imageURL)||"";this._replayImag eElement.src=imageURL;this._replayImageElement.style.visibility=imageURL?"":"hid den";}
1911 this._enableWaitIcon(true);this._traceLogPlayer.getResourceState(selectedContext Id,didReceiveResourceState.bind(this));},_onReplayStepClick:function(forward)
1803 {var selectedNode=this._logGrid.selectedNode;if(!selectedNode) 1912 {var selectedNode=this._logGrid.selectedNode;if(!selectedNode)
1804 return;var nextNode=selectedNode;do{nextNode=forward?nextNode.traverseNextNode(f alse):nextNode.traversePreviousNode(false);}while(nextNode&&typeof nextNode.inde x!=="number");(nextNode||selectedNode).revealAndSelect();},_onReplayDrawingCallC lick:function(forward) 1913 return;var nextNode=selectedNode;do{nextNode=forward?nextNode.traverseNextNode(f alse):nextNode.traversePreviousNode(false);}while(nextNode&&typeof nextNode.inde x!=="number");(nextNode||selectedNode).revealAndSelect();},_onReplayDrawingCallC lick:function(forward)
1805 {var selectedNode=this._logGrid.selectedNode;if(!selectedNode) 1914 {var selectedNode=this._logGrid.selectedNode;if(!selectedNode)
1806 return;var nextNode=selectedNode;while(nextNode){var sibling=forward?nextNode.ne xtSibling:nextNode.previousSibling;if(sibling){nextNode=sibling;if(nextNode.hasC hildren||nextNode.call.isDrawingCall) 1915 return;var nextNode=selectedNode;while(nextNode){var sibling=forward?nextNode.ne xtSibling:nextNode.previousSibling;if(sibling){nextNode=sibling;if(nextNode.hasC hildren||nextNode.call.isDrawingCall)
1807 break;}else{nextNode=nextNode.parent;if(!forward) 1916 break;}else{nextNode=nextNode.parent;if(!forward)
1808 break;}} 1917 break;}}
1809 if(!nextNode&&forward) 1918 if(!nextNode&&forward)
1810 this._onReplayLastStepClick();else 1919 this._onReplayLastStepClick();else
1811 (nextNode||selectedNode).revealAndSelect();},_onReplayFirstStepClick:function() 1920 (nextNode||selectedNode).revealAndSelect();},_onReplayFirstStepClick:function()
1812 {var firstNode=this._logGrid.rootNode().children[0];if(firstNode) 1921 {var firstNode=this._logGrid.rootNode().children[0];if(firstNode)
1813 firstNode.revealAndSelect();},_onReplayLastStepClick:function() 1922 firstNode.revealAndSelect();},_onReplayLastStepClick:function()
1814 {var lastNode=this._logGrid.rootNode().children.peekLast();if(!lastNode) 1923 {var lastNode=this._logGrid.rootNode().children.peekLast();if(!lastNode)
1815 return;while(lastNode.expanded){var lastChild=lastNode.children.peekLast();if(!l astChild) 1924 return;while(lastNode.expanded){var lastChild=lastNode.children.peekLast();if(!l astChild)
1816 break;lastNode=lastChild;} 1925 break;lastNode=lastChild;}
1817 lastNode.revealAndSelect();},_enableWaitIcon:function(enable) 1926 lastNode.revealAndSelect();},_enableWaitIcon:function(enable)
1818 {this._spinnerIcon.enableStyleClass("hidden",!enable);this._debugInfoElement.ena bleStyleClass("hidden",enable);},_replayTraceLog:function() 1927 {this._spinnerIcon.enableStyleClass("hidden",!enable);this._debugInfoElement.ena bleStyleClass("hidden",enable);},_replayTraceLog:function()
1819 {if(this._pendingReplayTraceLogEvent) 1928 {if(this._pendingReplayTraceLogEvent)
1820 return;var index=this._selectedCallIndex();if(index===-1||index===this._lastRepl ayCallIndex) 1929 return;var index=this._selectedCallIndex();if(index===-1||index===this._lastRepl ayCallIndex)
1821 return;this._lastReplayCallIndex=index;this._pendingReplayTraceLogEvent=true;fun ction didReplayTraceLog(error,resourceState,replayTime) 1930 return;this._lastReplayCallIndex=index;this._pendingReplayTraceLogEvent=true;fun ction didReplayTraceLog(resourceState,replayTime)
1822 {delete this._pendingReplayTraceLogEvent;this._enableWaitIcon(false);if(!error){ this._currentResourceStates={};this._currentResourceStates["auto"]=resourceState ;this._currentResourceStates[resourceState.id]=resourceState;this._debugInfoElem ent.textContent="Replay time: "+Number(replayTime).toFixed()+"ms";this._onReplay ContextChanged();} 1931 {delete this._pendingReplayTraceLogEvent;this._enableWaitIcon(false);this._debug InfoElement.textContent="Replay time: "+Number.secondsToString(replayTime/1000,t rue);this._onReplayContextChanged();if(index!==this._selectedCallIndex())
1823 if(index!==this._selectedCallIndex())
1824 this._replayTraceLog();} 1932 this._replayTraceLog();}
1825 this._enableWaitIcon(true);CanvasAgent.replayTraceLog(this._traceLogId,index,did ReplayTraceLog.bind(this));},_didReceiveTraceLog:function(error,traceLog) 1933 this._enableWaitIcon(true);this._traceLogPlayer.replayTraceLog(index,didReplayTr aceLog.bind(this));},_requestTraceLog:function(offset)
1826 {this._enableWaitIcon(false);if(error||!traceLog) 1934 {function didReceiveTraceLog(traceLog)
1935 {this._enableWaitIcon(false);if(!traceLog)
1827 return;var callNodes=[];var calls=traceLog.calls;var index=traceLog.startOffset; for(var i=0,n=calls.length;i<n;++i) 1936 return;var callNodes=[];var calls=traceLog.calls;var index=traceLog.startOffset; for(var i=0,n=calls.length;i<n;++i)
1828 callNodes.push(this._createCallNode(index++,calls[i]));var contexts=traceLog.con texts;for(var i=0,n=contexts.length;i<n;++i){var contextId=contexts[i].resourceI d||"";var description=contexts[i].description||"";if(this._replayContexts[contex tId]) 1937 callNodes.push(this._createCallNode(index++,calls[i]));var contexts=traceLog.con texts;for(var i=0,n=contexts.length;i<n;++i){var contextId=contexts[i].resourceI d||"";var description=contexts[i].description||"";if(this._replayContexts[contex tId])
1829 continue;this._replayContexts[contextId]=true;this._replayContextSelector.create Option(description,WebInspector.UIString("Show screenshot of this context's canv as."),contextId);} 1938 continue;this._replayContexts[contextId]=true;this._replayContextSelector.create Option(description,WebInspector.UIString("Show screenshot of this context's canv as."),contextId);}
1830 this._appendCallNodes(callNodes);if(traceLog.alive) 1939 this._appendCallNodes(callNodes);if(traceLog.alive)
1831 setTimeout(this._requestTraceLog.bind(this,index),WebInspector.CanvasProfileView .TraceLogPollingInterval);else 1940 setTimeout(this._requestTraceLog.bind(this,index),WebInspector.CanvasProfileView .TraceLogPollingInterval);else
1832 this._flattenSingleFrameNode();this._profile._updateCapturingStatus(traceLog);th is._onReplayLastStepClick();},_requestTraceLog:function(offset) 1941 this._flattenSingleFrameNode();this._profile._updateCapturingStatus(traceLog);th is._onReplayLastStepClick();}
1833 {this._enableWaitIcon(true);CanvasAgent.getTraceLog(this._traceLogId,offset,unde fined,this._didReceiveTraceLog.bind(this));},_selectedCallIndex:function() 1942 this._enableWaitIcon(true);this._traceLogPlayer.getTraceLog(offset,undefined,did ReceiveTraceLog.bind(this));},_selectedCallIndex:function()
1834 {var node=this._logGrid.selectedNode;return node?this._peekLastRecursively(node) .index:-1;},_peekLastRecursively:function(node) 1943 {var node=this._logGrid.selectedNode;return node?this._peekLastRecursively(node) .index:-1;},_peekLastRecursively:function(node)
1835 {var lastChild;while((lastChild=node.children.peekLast())) 1944 {var lastChild;while((lastChild=node.children.peekLast()))
1836 node=lastChild;return node;},_appendCallNodes:function(callNodes) 1945 node=lastChild;return node;},_appendCallNodes:function(callNodes)
1837 {var rootNode=this._logGrid.rootNode();var frameNode=rootNode.children.peekLast( );if(frameNode&&this._peekLastRecursively(frameNode).call.isFrameEndCall) 1946 {var rootNode=this._logGrid.rootNode();var frameNode=rootNode.children.peekLast( );if(frameNode&&this._peekLastRecursively(frameNode).call.isFrameEndCall)
1838 frameNode=null;for(var i=0,n=callNodes.length;i<n;++i){if(!frameNode){var index= rootNode.children.length;var data={};data[0]="";data[1]="Frame #"+(index+1);data [2]="";frameNode=new WebInspector.DataGridNode(data);frameNode.selectable=true;r ootNode.appendChild(frameNode);} 1947 frameNode=null;for(var i=0,n=callNodes.length;i<n;++i){if(!frameNode){var index= rootNode.children.length;var data={};data[0]="";data[1]="Frame #"+(index+1);data [2]="";frameNode=new WebInspector.DataGridNode(data);frameNode.selectable=true;r ootNode.appendChild(frameNode);}
1839 var nextFrameCallIndex=i+1;while(nextFrameCallIndex<n&&!callNodes[nextFrameCallI ndex-1].call.isFrameEndCall) 1948 var nextFrameCallIndex=i+1;while(nextFrameCallIndex<n&&!callNodes[nextFrameCallI ndex-1].call.isFrameEndCall)
1840 ++nextFrameCallIndex;this._appendCallNodesToFrameNode(frameNode,callNodes,i,next FrameCallIndex);i=nextFrameCallIndex-1;frameNode=null;}},_appendCallNodesToFrame Node:function(frameNode,callNodes,fromIndex,toIndex) 1949 ++nextFrameCallIndex;this._appendCallNodesToFrameNode(frameNode,callNodes,i,next FrameCallIndex);i=nextFrameCallIndex-1;frameNode=null;}},_appendCallNodesToFrame Node:function(frameNode,callNodes,fromIndex,toIndex)
1841 {var self=this;function appendDrawCallGroup() 1950 {var self=this;function appendDrawCallGroup()
1842 {var index=self._drawCallGroupsCount||0;var data={};data[0]="";data[1]="Draw cal l group #"+(index+1);data[2]="";var node=new WebInspector.DataGridNode(data);nod e.selectable=true;self._drawCallGroupsCount=index+1;frameNode.appendChild(node); return node;} 1951 {var index=self._drawCallGroupsCount||0;var data={};data[0]="";data[1]="Draw cal l group #"+(index+1);data[2]="";var node=new WebInspector.DataGridNode(data);nod e.selectable=true;self._drawCallGroupsCount=index+1;frameNode.appendChild(node); return node;}
1843 function splitDrawCallGroup(drawCallGroup) 1952 function splitDrawCallGroup(drawCallGroup)
1844 {var splitIndex=0;var splitNode;while((splitNode=drawCallGroup.children[splitInd ex])){if(splitNode.call.isDrawingCall) 1953 {var splitIndex=0;var splitNode;while((splitNode=drawCallGroup.children[splitInd ex])){if(splitNode.call.isDrawingCall)
1845 break;++splitIndex;} 1954 break;++splitIndex;}
1846 var newDrawCallGroup=appendDrawCallGroup();var lastNode;while((lastNode=drawCall Group.children[splitIndex+1])) 1955 var newDrawCallGroup=appendDrawCallGroup();var lastNode;while((lastNode=drawCall Group.children[splitIndex+1]))
1847 newDrawCallGroup.appendChild(lastNode);return newDrawCallGroup;} 1956 newDrawCallGroup.appendChild(lastNode);return newDrawCallGroup;}
1848 var drawCallGroup=frameNode.children.peekLast();var groupHasDrawCall=false;if(dr awCallGroup){for(var i=0,n=drawCallGroup.children.length;i<n;++i){if(drawCallGro up.children[i].call.isDrawingCall){groupHasDrawCall=true;break;}}}else 1957 var drawCallGroup=frameNode.children.peekLast();var groupHasDrawCall=false;if(dr awCallGroup){for(var i=0,n=drawCallGroup.children.length;i<n;++i){if(drawCallGro up.children[i].call.isDrawingCall){groupHasDrawCall=true;break;}}}else
1849 drawCallGroup=appendDrawCallGroup();for(var i=fromIndex;i<toIndex;++i){var node= callNodes[i];drawCallGroup.appendChild(node);if(node.call.isDrawingCall){if(grou pHasDrawCall) 1958 drawCallGroup=appendDrawCallGroup();for(var i=fromIndex;i<toIndex;++i){var node= callNodes[i];drawCallGroup.appendChild(node);if(node.call.isDrawingCall){if(grou pHasDrawCall)
1850 drawCallGroup=splitDrawCallGroup(drawCallGroup);else 1959 drawCallGroup=splitDrawCallGroup(drawCallGroup);else
1851 groupHasDrawCall=true;}}},_createCallNode:function(index,call) 1960 groupHasDrawCall=true;}}},_createCallNode:function(index,call)
1852 {var callViewElement=document.createElement("div");var data={};data[0]=index+1;d ata[1]=callViewElement;data[2]="";if(call.sourceURL){var lineNumber=Math.max(0,c all.lineNumber-1)||0;var columnNumber=Math.max(0,call.columnNumber-1)||0;data[2] =this._linkifier.linkifyLocation(call.sourceURL,lineNumber,columnNumber);} 1961 {var callViewElement=document.createElement("div");var data={};data[0]=index+1;d ata[1]=callViewElement;data[2]="";if(call.sourceURL){var lineNumber=Math.max(0,c all.lineNumber-1)||0;var columnNumber=Math.max(0,call.columnNumber-1)||0;data[2] =this._linkifier.linkifyLocation(call.sourceURL,lineNumber,columnNumber);}
1853 callViewElement.createChild("span","canvas-function-name").textContent=call.func tionName||"context."+call.property;if(call.arguments){callViewElement.createText Child("(");for(var i=0,n=call.arguments.length;i<n;++i){var argument=call.argume nts[i];if(i) 1962 callViewElement.createChild("span","canvas-function-name").textContent=call.func tionName||"context."+call.property;if(call.arguments){callViewElement.createText Child("(");for(var i=0,n=call.arguments.length;i<n;++i){var argument=(call.argum ents[i]);if(i)
1854 callViewElement.createTextChild(", ");this._createCallArgumentChild(callViewElem ent,argument)._argumentIndex=i;} 1963 callViewElement.createTextChild(", ");var element=WebInspector.CanvasProfileData GridHelper.createCallArgumentElement(argument);element.__argumentIndex=i;callVie wElement.appendChild(element);}
1855 callViewElement.createTextChild(")");}else if(typeof call.value!=="undefined"){c allViewElement.createTextChild(" = ");this._createCallArgumentChild(callViewElem ent,call.value);} 1964 callViewElement.createTextChild(")");}else if(call.value){callViewElement.create TextChild(" = ");callViewElement.appendChild(WebInspector.CanvasProfileDataGridH elper.createCallArgumentElement(call.value));}
1856 if(typeof call.result!=="undefined"){callViewElement.createTextChild(" => ");thi s._createCallArgumentChild(callViewElement,call.result);} 1965 if(call.result){callViewElement.createTextChild(" => ");callViewElement.appendCh ild(WebInspector.CanvasProfileDataGridHelper.createCallArgumentElement(call.resu lt));}
1857 var node=new WebInspector.DataGridNode(data);node.index=index;node.selectable=tr ue;node.call=call;return node;},_createCallArgumentChild:function(parentElement, callArgument) 1966 var node=new WebInspector.DataGridNode(data);node.index=index;node.selectable=tr ue;node.call=call;return node;},_popoverAnchor:function(element,event)
1858 {var element=parentElement.createChild("span","canvas-call-argument");element._a rgumentIndex=-1;if(callArgument.type==="string"){const maxStringLength=150;eleme nt.createTextChild("\"");element.createChild("span","canvas-formatted-string").t extContent=callArgument.description.trimMiddle(maxStringLength);element.createTe xtChild("\"");element._suppressPopover=(callArgument.description.length<=maxStri ngLength&&!/[\r\n]/.test(callArgument.description));}else{var type=callArgument. subtype||callArgument.type;if(type){element.addStyleClass("canvas-formatted-"+ty pe);switch(type){case"null":case"undefined":case"boolean":element._suppressPopov er=true;break;case"number":element._suppressPopover=!isNaN(callArgument.descript ion);break;}} 1967 {var argumentElement=element.enclosingNodeOrSelfWithClass("canvas-call-argument" );if(!argumentElement||argumentElement.__suppressPopover)
1859 element.textContent=callArgument.description;}
1860 if(callArgument.resourceId){element.addStyleClass("canvas-formatted-resource");e lement.resourceId=callArgument.resourceId;}
1861 return element;},_popoverAnchor:function(element,event)
1862 {var argumentElement=element.enclosingNodeOrSelfWithClass("canvas-call-argument" );if(!argumentElement||argumentElement._suppressPopover)
1863 return null;return argumentElement;},_resolveObjectForPopover:function(argumentE lement,showCallback,objectGroupName) 1968 return null;return argumentElement;},_resolveObjectForPopover:function(argumentE lement,showCallback,objectGroupName)
1864 {var dataGridNode=this._logGrid.dataGridNodeFromNode(argumentElement);if(!dataGr idNode){this._popoverHelper.hidePopover();return;} 1969 {function showObjectPopover(error,result,resourceState)
1865 var callIndex=dataGridNode.index;var argumentIndex=argumentElement._argumentInde x;function showObjectPopover(error,result,resourceState)
1866 {if(error) 1970 {if(error)
1867 return;if(!result) 1971 return;if(!result)
1868 return;if(result&&result.type==="number"){var str="0000"+Number(result.descripti on).toString(16).toUpperCase();str=str.replace(/^0+(.{4,})$/,"$1");result.descri ption="0x"+str;} 1972 return;this._popoverAnchorElement=argumentElement.cloneNode(true);this._popoverA nchorElement.addStyleClass("canvas-popover-anchor");this._popoverAnchorElement.a ddStyleClass("source-frame-eval-expression");argumentElement.parentElement.appen dChild(this._popoverAnchorElement);var diffLeft=this._popoverAnchorElement.boxIn Window().x-argumentElement.boxInWindow().x;this._popoverAnchorElement.style.left =this._popoverAnchorElement.offsetLeft-diffLeft+"px";showCallback(WebInspector.R emoteObject.fromPayload(result),false,this._popoverAnchorElement);}
1869 this._popoverAnchorElement=argumentElement.cloneNode(true);this._popoverAnchorEl ement.addStyleClass("canvas-popover-anchor");this._popoverAnchorElement.addStyle Class("source-frame-eval-expression");argumentElement.parentElement.appendChild( this._popoverAnchorElement);var diffLeft=this._popoverAnchorElement.boxInWindow( ).x-argumentElement.boxInWindow().x;this._popoverAnchorElement.style.left=this._ popoverAnchorElement.offsetLeft-diffLeft+"px";showCallback(WebInspector.RemoteOb ject.fromPayload(result),false,this._popoverAnchorElement);} 1973 var evalResult=argumentElement.__evalResult;if(evalResult)
1870 CanvasAgent.evaluateTraceLogCallArgument(this._traceLogId,callIndex,argumentInde x,objectGroupName,showObjectPopover.bind(this));},_onHidePopover:function() 1974 showObjectPopover.call(this,null,evalResult);else{var dataGridNode=this._logGrid .dataGridNodeFromNode(argumentElement);if(!dataGridNode||typeof dataGridNode.ind ex!=="number"){this._popoverHelper.hidePopover();return;}
1975 var callIndex=dataGridNode.index;var argumentIndex=argumentElement.__argumentInd ex;if(typeof argumentIndex!=="number")
1976 argumentIndex=-1;CanvasAgent.evaluateTraceLogCallArgument(this._traceLogId,callI ndex,argumentIndex,objectGroupName,showObjectPopover.bind(this));}},_hexNumbersF ormatter:function(object)
1977 {if(object.type==="number"){var str="0000"+Number(object.description).toString(1 6).toUpperCase();str=str.replace(/^0+(.{4,})$/,"$1");return"0x"+str;}
1978 return object.description||"";},_onHidePopover:function()
1871 {if(this._popoverAnchorElement){this._popoverAnchorElement.remove() 1979 {if(this._popoverAnchorElement){this._popoverAnchorElement.remove()
1872 delete this._popoverAnchorElement;}},_flattenSingleFrameNode:function() 1980 delete this._popoverAnchorElement;}},_flattenSingleFrameNode:function()
1873 {var rootNode=this._logGrid.rootNode();if(rootNode.children.length!==1) 1981 {var rootNode=this._logGrid.rootNode();if(rootNode.children.length!==1)
1874 return;var frameNode=rootNode.children[0];while(frameNode.children[0]) 1982 return;var frameNode=rootNode.children[0];while(frameNode.children[0])
1875 rootNode.appendChild(frameNode.children[0]);rootNode.removeChild(frameNode);},__ proto__:WebInspector.View.prototype} 1983 rootNode.appendChild(frameNode.children[0]);rootNode.removeChild(frameNode);},__ proto__:WebInspector.View.prototype}
1876 WebInspector.CanvasProfileType=function() 1984 WebInspector.CanvasProfileType=function()
1877 {WebInspector.ProfileType.call(this,WebInspector.CanvasProfileType.TypeId,WebIns pector.UIString("Capture Canvas Frame"));this._nextProfileUid=1;this._recording= false;this._lastProfileHeader=null;this._capturingModeSelector=new WebInspector. StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this));this._capturingMode Selector.element.title=WebInspector.UIString("Canvas capture mode.");this._captu ringModeSelector.createOption(WebInspector.UIString("Single Frame"),WebInspector .UIString("Capture a single canvas frame."),"");this._capturingModeSelector.crea teOption(WebInspector.UIString("Consecutive Frames"),WebInspector.UIString("Capt ure consecutive canvas frames."),"1");this._frameOptions={};this._framesWithCanv ases={};this._frameSelector=new WebInspector.StatusBarComboBox(this._dispatchVie wUpdatedEvent.bind(this));this._frameSelector.element.title=WebInspector.UIStrin g("Frame containing the canvases to capture.");this._frameSelector.element.addSt yleClass("hidden");WebInspector.runtimeModel.contextLists().forEach(this._addFra me,this);WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Ev ents.FrameExecutionContextListAdded,this._frameAdded,this);WebInspector.runtimeM odel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextList Removed,this._frameRemoved,this);this._dispatcher=new WebInspector.CanvasDispatc her(this);this._canvasAgentEnabled=false;this._decorationElement=document.create Element("div");this._decorationElement.className="profile-canvas-decoration";thi s._updateDecorationElement();} 1985 {WebInspector.ProfileType.call(this,WebInspector.CanvasProfileType.TypeId,WebIns pector.UIString("Capture Canvas Frame"));this._nextProfileUid=1;this._recording= false;this._lastProfileHeader=null;this._capturingModeSelector=new WebInspector. StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this));this._capturingMode Selector.element.title=WebInspector.UIString("Canvas capture mode.");this._captu ringModeSelector.createOption(WebInspector.UIString("Single Frame"),WebInspector .UIString("Capture a single canvas frame."),"");this._capturingModeSelector.crea teOption(WebInspector.UIString("Consecutive Frames"),WebInspector.UIString("Capt ure consecutive canvas frames."),"1");this._frameOptions={};this._framesWithCanv ases={};this._frameSelector=new WebInspector.StatusBarComboBox(this._dispatchVie wUpdatedEvent.bind(this));this._frameSelector.element.title=WebInspector.UIStrin g("Frame containing the canvases to capture.");this._frameSelector.element.addSt yleClass("hidden");WebInspector.runtimeModel.contextLists().forEach(this._addFra me,this);WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Ev ents.FrameExecutionContextListAdded,this._frameAdded,this);WebInspector.runtimeM odel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextList Removed,this._frameRemoved,this);this._dispatcher=new WebInspector.CanvasDispatc her(this);this._canvasAgentEnabled=false;this._decorationElement=document.create Element("div");this._decorationElement.className="profile-canvas-decoration";thi s._updateDecorationElement();}
1878 WebInspector.CanvasProfileType.TypeId="CANVAS_PROFILE";WebInspector.CanvasProfil eType.prototype={get statusBarItems() 1986 WebInspector.CanvasProfileType.TypeId="CANVAS_PROFILE";WebInspector.CanvasProfil eType.prototype={get statusBarItems()
1879 {return[this._capturingModeSelector.element,this._frameSelector.element];},get b uttonTooltip() 1987 {return[this._capturingModeSelector.element,this._frameSelector.element];},get b uttonTooltip()
1880 {if(this._isSingleFrameMode()) 1988 {if(this._isSingleFrameMode())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 {var option=this._frameSelector.selectedOption();return option?option.value:unde fined;},_dispatchViewUpdatedEvent:function() 2035 {var option=this._frameSelector.selectedOption();return option?option.value:unde fined;},_dispatchViewUpdatedEvent:function()
1928 {this._frameSelector.element.enableStyleClass("hidden",this._frameSelector.size( )<=1);this.dispatchEventToListeners(WebInspector.ProfileType.Events.ViewUpdated) ;},isInstantProfile:function() 2036 {this._frameSelector.element.enableStyleClass("hidden",this._frameSelector.size( )<=1);this.dispatchEventToListeners(WebInspector.ProfileType.Events.ViewUpdated) ;},isInstantProfile:function()
1929 {return this._isSingleFrameMode();},isEnabled:function() 2037 {return this._isSingleFrameMode();},isEnabled:function()
1930 {return this._canvasAgentEnabled;},__proto__:WebInspector.ProfileType.prototype} 2038 {return this._canvasAgentEnabled;},__proto__:WebInspector.ProfileType.prototype}
1931 WebInspector.CanvasDispatcher=function(profileType) 2039 WebInspector.CanvasDispatcher=function(profileType)
1932 {this._profileType=profileType;InspectorBackend.registerCanvasDispatcher(this);} 2040 {this._profileType=profileType;InspectorBackend.registerCanvasDispatcher(this);}
1933 WebInspector.CanvasDispatcher.prototype={contextCreated:function(frameId) 2041 WebInspector.CanvasDispatcher.prototype={contextCreated:function(frameId)
1934 {this._profileType._contextCreated(frameId);},traceLogsRemoved:function(frameId, traceLogId) 2042 {this._profileType._contextCreated(frameId);},traceLogsRemoved:function(frameId, traceLogId)
1935 {this._profileType._traceLogsRemoved(frameId,traceLogId);}} 2043 {this._profileType._traceLogsRemoved(frameId,traceLogId);}}
1936 WebInspector.CanvasProfileHeader=function(type,title,uid,traceLogId,frameId) 2044 WebInspector.CanvasProfileHeader=function(type,title,uid,traceLogId,frameId)
1937 {WebInspector.ProfileHeader.call(this,type,title,uid);this._traceLogId=traceLogI d||"";this._frameId=frameId;this._alive=true;this._traceLogSize=0;} 2045 {WebInspector.ProfileHeader.call(this,type,title,uid);this._traceLogId=traceLogI d||"";this._frameId=frameId;this._alive=true;this._traceLogSize=0;this._traceLog Player=traceLogId?new WebInspector.CanvasTraceLogPlayerProxy(traceLogId):null;}
1938 WebInspector.CanvasProfileHeader.prototype={traceLogId:function() 2046 WebInspector.CanvasProfileHeader.prototype={traceLogId:function()
1939 {return this._traceLogId;},frameId:function() 2047 {return this._traceLogId;},traceLogPlayer:function()
2048 {return this._traceLogPlayer;},frameId:function()
1940 {return this._frameId;},createSidebarTreeElement:function() 2049 {return this._frameId;},createSidebarTreeElement:function()
1941 {return new WebInspector.ProfileSidebarTreeElement(this,WebInspector.UIString("T race Log %d"),"profile-sidebar-tree-item");},createView:function(profilesPanel) 2050 {return new WebInspector.ProfileSidebarTreeElement(this,WebInspector.UIString("T race Log %d"),"profile-sidebar-tree-item");},createView:function(profilesPanel)
1942 {return new WebInspector.CanvasProfileView(this);},dispose:function() 2051 {return new WebInspector.CanvasProfileView(this);},dispose:function()
1943 {if(this._traceLogId){CanvasAgent.dropTraceLog(this._traceLogId);clearTimeout(th is._requestStatusTimer);this._alive=false;}},_updateCapturingStatus:function(tra ceLog) 2052 {if(this._traceLogPlayer)
2053 this._traceLogPlayer.dispose();clearTimeout(this._requestStatusTimer);this._aliv e=false;},_updateCapturingStatus:function(traceLog)
1944 {if(!this.sidebarElement||!this._traceLogId) 2054 {if(!this.sidebarElement||!this._traceLogId)
1945 return;if(traceLog){this._alive=traceLog.alive;this._traceLogSize=traceLog.total AvailableCalls;} 2055 return;if(traceLog){this._alive=traceLog.alive;this._traceLogSize=traceLog.total AvailableCalls;}
1946 this.sidebarElement.subtitle=this._alive?WebInspector.UIString("Capturing\u2026 %d calls",this._traceLogSize):WebInspector.UIString("Captured %d calls",this._tr aceLogSize);this.sidebarElement.wait=this._alive;if(this._alive){clearTimeout(th is._requestStatusTimer);this._requestStatusTimer=setTimeout(this._requestCapturi ngStatus.bind(this),WebInspector.CanvasProfileView.TraceLogPollingInterval);}},_ requestCapturingStatus:function() 2056 this.sidebarElement.subtitle=this._alive?WebInspector.UIString("Capturing\u2026 %d calls",this._traceLogSize):WebInspector.UIString("Captured %d calls",this._tr aceLogSize);this.sidebarElement.wait=this._alive;if(this._alive){clearTimeout(th is._requestStatusTimer);this._requestStatusTimer=setTimeout(this._requestCapturi ngStatus.bind(this),WebInspector.CanvasProfileView.TraceLogPollingInterval);}},_ requestCapturingStatus:function()
1947 {function didReceiveTraceLog(error,traceLog) 2057 {function didReceiveTraceLog(traceLog)
1948 {if(error) 2058 {if(!traceLog)
1949 return;this._alive=traceLog.alive;this._traceLogSize=traceLog.totalAvailableCall s;this._updateCapturingStatus();} 2059 return;this._alive=traceLog.alive;this._traceLogSize=traceLog.totalAvailableCall s;this._updateCapturingStatus();}
1950 CanvasAgent.getTraceLog(this._traceLogId,0,0,didReceiveTraceLog.bind(this));},__ proto__:WebInspector.ProfileHeader.prototype}; 2060 this._traceLogPlayer.getTraceLog(0,0,didReceiveTraceLog.bind(this));},__proto__: WebInspector.ProfileHeader.prototype}
2061 WebInspector.CanvasProfileDataGridHelper={createCallArgumentElement:function(cal lArgument)
2062 {if(callArgument.enumName)
2063 return WebInspector.CanvasProfileDataGridHelper.createEnumValueElement(callArgum ent.enumName,+callArgument.description);var element=document.createElement("span ");element.className="canvas-call-argument";var description=callArgument.descrip tion;if(callArgument.type==="string"){const maxStringLength=150;element.createTe xtChild("\"");element.createChild("span","canvas-formatted-string").textContent= description.trimMiddle(maxStringLength);element.createTextChild("\"");element.__ suppressPopover=(description.length<=maxStringLength&&!/[\r\n]/.test(description ));if(!element.__suppressPopover)
2064 element.__evalResult=WebInspector.RemoteObject.fromPrimitiveValue(description);} else{var type=callArgument.subtype||callArgument.type;if(type){element.addStyleC lass("canvas-formatted-"+type);if(["null","undefined","boolean","number"].indexO f(type)>=0)
2065 element.__suppressPopover=true;}
2066 element.textContent=description;if(callArgument.remoteObject)
2067 element.__evalResult=WebInspector.RemoteObject.fromPayload(callArgument.remoteOb ject);}
2068 if(callArgument.resourceId){element.addStyleClass("canvas-formatted-resource");e lement.__resourceId=callArgument.resourceId;}
2069 return element;},createEnumValueElement:function(enumName,enumValue)
2070 {var element=document.createElement("span");element.className="canvas-call-argum ent canvas-formatted-number";element.textContent=enumName;element.__evalResult=W ebInspector.RemoteObject.fromPrimitiveValue(enumValue);return element;}}
2071 WebInspector.CanvasTraceLogPlayerProxy=function(traceLogId)
2072 {this._traceLogId=traceLogId;this._currentResourceStates={};this._defaultResourc eId=null;}
2073 WebInspector.CanvasTraceLogPlayerProxy.Events={CanvasTraceLogReceived:"CanvasTra ceLogReceived",CanvasReplayStateChanged:"CanvasReplayStateChanged",CanvasResourc eStateReceived:"CanvasResourceStateReceived",}
2074 WebInspector.CanvasTraceLogPlayerProxy.prototype={getTraceLog:function(startOffs et,maxLength,userCallback)
2075 {function callback(error,traceLog)
2076 {if(error||!traceLog){userCallback(null);return;}
2077 userCallback(traceLog);this.dispatchEventToListeners(WebInspector.CanvasTraceLog PlayerProxy.Events.CanvasTraceLogReceived,traceLog);}
2078 CanvasAgent.getTraceLog(this._traceLogId,startOffset,maxLength,callback.bind(thi s));},dispose:function()
2079 {this._currentResourceStates={};CanvasAgent.dropTraceLog(this._traceLogId);this. dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasRep layStateChanged);},getResourceState:function(resourceId,userCallback)
2080 {resourceId=resourceId||this._defaultResourceId;if(!resourceId){userCallback(nul l);return;}
2081 if(this._currentResourceStates[resourceId]){userCallback(this._currentResourceSt ates[resourceId]);return;}
2082 function callback(error,resourceState)
2083 {if(error||!resourceState){userCallback(null);return;}
2084 this._currentResourceStates[resourceId]=resourceState;userCallback(resourceState );this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.Ca nvasResourceStateReceived,resourceState);}
2085 CanvasAgent.getResourceState(this._traceLogId,resourceId,callback.bind(this));}, replayTraceLog:function(index,userCallback)
2086 {function callback(error,resourceState,replayTime)
2087 {this._currentResourceStates={};if(error||!resourceState){resourceState=null;use rCallback(null,replayTime);}else{this._defaultResourceId=resourceState.id;this._ currentResourceStates[resourceState.id]=resourceState;userCallback(resourceState ,replayTime);}
2088 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.Canv asReplayStateChanged);if(resourceState)
2089 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.Canv asResourceStateReceived,resourceState);}
2090 CanvasAgent.replayTraceLog(this._traceLogId,index,callback.bind(this));},clearRe sourceStates:function()
2091 {this._currentResourceStates={};this.dispatchEventToListeners(WebInspector.Canva sTraceLogPlayerProxy.Events.CanvasReplayStateChanged);},__proto__:WebInspector.O bject.prototype};WebInspector.CanvasReplayStateView=function(traceLogPlayer)
2092 {WebInspector.View.call(this);this.registerRequiredCSS("canvasProfiler.css");thi s.element.addStyleClass("canvas-replay-state-view");this._traceLogPlayer=traceLo gPlayer;var controlsContainer=this.element.createChild("div","status-bar");this. _prevButton=this._createControlButton(controlsContainer,"canvas-replay-state-pre v",WebInspector.UIString("Previous resource."),this._onResourceNavigationClick.b ind(this,false));this._nextButton=this._createControlButton(controlsContainer,"c anvas-replay-state-next",WebInspector.UIString("Next resource."),this._onResourc eNavigationClick.bind(this,true));this._createControlButton(controlsContainer,"c anvas-replay-state-refresh",WebInspector.UIString("Refresh."),this._onStateRefre shClick.bind(this));this._resourceSelector=new WebInspector.StatusBarComboBox(th is._onReplayResourceChanged.bind(this));this._currentOption=this._resourceSelect or.createOption(WebInspector.UIString("<auto>"),WebInspector.UIString("Show stat e of the last replayed resource."),"");controlsContainer.appendChild(this._resou rceSelector.element);this._resourceIdToDescription={};this._gridNodesExpandedSta te={};this._gridScrollPositions={};this._currentResourceId=null;this._prevOption sStack=[];this._nextOptionsStack=[];this._highlightedGridNodes=[];var columns=[{ title:WebInspector.UIString("Name"),sortable:false,width:"50%",disclosure:true}, {title:WebInspector.UIString("Value"),sortable:false,width:"50%"}];this._stateGr id=new WebInspector.DataGrid(columns);this._stateGrid.element.addStyleClass("fil l");this._stateGrid.show(this.element);this._traceLogPlayer.addEventListener(Web Inspector.CanvasTraceLogPlayerProxy.Events.CanvasReplayStateChanged,this._onRepl ayResourceChanged,this);this._traceLogPlayer.addEventListener(WebInspector.Canva sTraceLogPlayerProxy.Events.CanvasTraceLogReceived,this._onCanvasTraceLogReceive d,this);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerP roxy.Events.CanvasResourceStateReceived,this._onCanvasResourceStateReceived,this );this._updateButtonsEnabledState();}
2093 WebInspector.CanvasReplayStateView.prototype={selectResource:function(resourceId )
2094 {if(resourceId===this._resourceSelector.selectedOption().value)
2095 return;var option=this._resourceSelector.selectElement().firstChild;for(var inde x=0;option;++index,option=option.nextSibling){if(resourceId===option.value){this ._resourceSelector.setSelectedIndex(index);this._onReplayResourceChanged();break ;}}},_createControlButton:function(parent,className,title,clickCallback)
2096 {var button=new WebInspector.StatusBarButton(title,className+" canvas-replay-but ton");parent.appendChild(button.element);button.makeLongClickEnabled();button.ad dEventListener("click",clickCallback,this);button.addEventListener("longClickDow n",clickCallback,this);button.addEventListener("longClickPress",clickCallback,th is);return button;},_onResourceNavigationClick:function(forward)
2097 {var newOption=forward?this._nextOptionsStack.pop():this._prevOptionsStack.pop() ;if(!newOption)
2098 return;(forward?this._prevOptionsStack:this._nextOptionsStack).push(this._curren tOption);this._isNavigationButton=true;this.selectResource(newOption.value);dele te this._isNavigationButton;this._updateButtonsEnabledState();},_onStateRefreshC lick:function()
2099 {this._traceLogPlayer.clearResourceStates();},_updateButtonsEnabledState:functio n()
2100 {this._prevButton.setEnabled(this._prevOptionsStack.length>0);this._nextButton.s etEnabled(this._nextOptionsStack.length>0);},_updateCurrentOption:function()
2101 {const maxStackSize=256;var selectedOption=this._resourceSelector.selectedOption ();if(this._currentOption===selectedOption)
2102 return;if(!this._isNavigationButton){this._prevOptionsStack.push(this._currentOp tion);this._nextOptionsStack=[];if(this._prevOptionsStack.length>maxStackSize)
2103 this._prevOptionsStack.shift();this._updateButtonsEnabledState();}
2104 this._currentOption=selectedOption;},_collectResourcesFromTraceLog:function(trac eLog)
2105 {var collectedResources=[];var calls=traceLog.calls;for(var i=0,n=calls.length;i <n;++i){var call=calls[i];var args=call.arguments||[];for(var j=0;j<args.length; ++j)
2106 this._collectResourceFromCallArgument(args[j],collectedResources);this._collectR esourceFromCallArgument(call.result,collectedResources);this._collectResourceFro mCallArgument(call.value,collectedResources);}
2107 var contexts=traceLog.contexts;for(var i=0,n=contexts.length;i<n;++i)
2108 this._collectResourceFromCallArgument(contexts[i],collectedResources);this._addC ollectedResourcesToSelector(collectedResources);},_collectResourcesFromResourceS tate:function(resourceState)
2109 {var collectedResources=[];this._collectResourceFromResourceStateDescriptors(res ourceState.descriptors,collectedResources);this._addCollectedResourcesToSelector (collectedResources);},_collectResourceFromResourceStateDescriptors:function(des criptors,output)
2110 {if(!descriptors)
2111 return;for(var i=0,n=descriptors.length;i<n;++i){var descriptor=descriptors[i];t his._collectResourceFromCallArgument(descriptor.value,output);this._collectResou rceFromResourceStateDescriptors(descriptor.values,output);}},_collectResourceFro mCallArgument:function(argument,output)
2112 {if(!argument)
2113 return;var resourceId=argument.resourceId;if(!resourceId||this._resourceIdToDesc ription[resourceId])
2114 return;this._resourceIdToDescription[resourceId]=argument.description;output.pus h(argument);},_addCollectedResourcesToSelector:function(collectedResources)
2115 {if(!collectedResources.length)
2116 return;function comparator(arg1,arg2)
2117 {var a=arg1.description;var b=arg2.description;return String.naturalOrderCompara tor(a,b);}
2118 collectedResources.sort(comparator);var selectElement=this._resourceSelector.sel ectElement();var currentOption=selectElement.firstChild;currentOption=currentOpt ion.nextSibling;for(var i=0,n=collectedResources.length;i<n;++i){var argument=co llectedResources[i];while(currentOption&&String.naturalOrderComparator(currentOp tion.text,argument.description)<0)
2119 currentOption=currentOption.nextSibling;var option=this._resourceSelector.create Option(argument.description,WebInspector.UIString("Show state of this resource." ),argument.resourceId);if(currentOption)
2120 selectElement.insertBefore(option,currentOption);}},_onReplayResourceChanged:fun ction()
2121 {this._updateCurrentOption();var selectedResourceId=this._resourceSelector.selec tedOption().value;function didReceiveResourceState(resourceState)
2122 {if(selectedResourceId!==this._resourceSelector.selectedOption().value)
2123 return;this._showResourceState(resourceState);}
2124 this._traceLogPlayer.getResourceState(selectedResourceId,didReceiveResourceState .bind(this));},_onCanvasTraceLogReceived:function(event)
2125 {var traceLog=(event.data);if(traceLog)
2126 this._collectResourcesFromTraceLog(traceLog);},_onCanvasResourceStateReceived:fu nction(event)
2127 {var resourceState=(event.data);if(resourceState)
2128 this._collectResourcesFromResourceState(resourceState);},_showResourceState:func tion(resourceState)
2129 {this._saveExpandedState();this._saveScrollState();var rootNode=this._stateGrid. rootNode();if(!resourceState){this._currentResourceId=null;this._updateDataGridH ighlights([]);rootNode.removeChildren();return;}
2130 var nodesToHighlight=[];var nameToOldGridNodes={};function populateNameToNodesMa p(map,node)
2131 {if(!node)
2132 return;for(var i=0,child;child=node.children[i];++i){var item={node:child,childr en:{}};map[child.name]=item;populateNameToNodesMap(item.children,child);}}
2133 populateNameToNodesMap(nameToOldGridNodes,rootNode);rootNode.removeChildren();fu nction comparator(d1,d2)
2134 {var hasChildren1=!!d1.values;var hasChildren2=!!d2.values;if(hasChildren1!==has Children2)
2135 return hasChildren1?1:-1;return String.naturalOrderComparator(d1.name,d2.name);}
2136 function appendResourceStateDescriptors(descriptors,parent,nameToOldChildren)
2137 {descriptors=descriptors||[];descriptors.sort(comparator);var oldChildren=nameTo OldChildren||{};for(var i=0,n=descriptors.length;i<n;++i){var descriptor=descrip tors[i];var childNode=this._createDataGridNode(descriptor);parent.appendChild(ch ildNode);var oldChildrenItem=oldChildren[childNode.name]||{};var oldChildNode=ol dChildrenItem.node;if(!oldChildNode||oldChildNode.element.textContent!==childNod e.element.textContent)
2138 nodesToHighlight.push(childNode);appendResourceStateDescriptors.call(this,descri ptor.values,childNode,oldChildrenItem.children);}}
2139 appendResourceStateDescriptors.call(this,resourceState.descriptors,rootNode,name ToOldGridNodes);var shouldHighlightChanges=(this._resourceKindId(this._currentRe sourceId)===this._resourceKindId(resourceState.id));this._currentResourceId=reso urceState.id;this._restoreExpandedState();this._updateDataGridHighlights(shouldH ighlightChanges?nodesToHighlight:[]);this._restoreScrollState();},_updateDataGri dHighlights:function(nodes)
2140 {for(var i=0,n=this._highlightedGridNodes.length;i<n;++i){var node=this._highlig htedGridNodes[i];node.element.removeStyleClass("canvas-grid-node-highlighted");}
2141 this._highlightedGridNodes=nodes;for(var i=0,n=this._highlightedGridNodes.length ;i<n;++i){var node=this._highlightedGridNodes[i];node.element.addStyleClass("can vas-grid-node-highlighted");node.reveal();}},_resourceKindId:function(resourceId )
2142 {var description=(resourceId&&this._resourceIdToDescription[resourceId])||"";ret urn description.replace(/\d+/g,"");},_forEachGridNode:function(callback)
2143 {function processRecursively(node,key)
2144 {for(var i=0,child;child=node.children[i];++i){var childKey=key+"#"+child.name;c allback(child,childKey);processRecursively(child,childKey);}}
2145 processRecursively(this._stateGrid.rootNode(),"");},_saveExpandedState:function( )
2146 {if(!this._currentResourceId)
2147 return;var expandedState={};var key=this._resourceKindId(this._currentResourceId );this._gridNodesExpandedState[key]=expandedState;function callback(node,key)
2148 {if(node.expanded)
2149 expandedState[key]=true;}
2150 this._forEachGridNode(callback);},_restoreExpandedState:function()
2151 {if(!this._currentResourceId)
2152 return;var key=this._resourceKindId(this._currentResourceId);var expandedState=t his._gridNodesExpandedState[key];if(!expandedState)
2153 return;function callback(node,key)
2154 {if(expandedState[key])
2155 node.expand();}
2156 this._forEachGridNode(callback);},_saveScrollState:function()
2157 {if(!this._currentResourceId)
2158 return;var key=this._resourceKindId(this._currentResourceId);this._gridScrollPos itions[key]={scrollTop:this._stateGrid.scrollContainer.scrollTop,scrollLeft:this ._stateGrid.scrollContainer.scrollLeft};},_restoreScrollState:function()
2159 {if(!this._currentResourceId)
2160 return;var key=this._resourceKindId(this._currentResourceId);var scrollState=thi s._gridScrollPositions[key];if(!scrollState)
2161 return;this._stateGrid.scrollContainer.scrollTop=scrollState.scrollTop;this._sta teGrid.scrollContainer.scrollLeft=scrollState.scrollLeft;},_createDataGridNode:f unction(descriptor)
2162 {var name=descriptor.name;var callArgument=descriptor.value;var valueElement=cal lArgument?WebInspector.CanvasProfileDataGridHelper.createCallArgumentElement(cal lArgument):"";var nameElement=name;if(typeof descriptor.enumValueForName!=="unde fined")
2163 nameElement=WebInspector.CanvasProfileDataGridHelper.createEnumValueElement(name ,+descriptor.enumValueForName);if(descriptor.isArray&&descriptor.values){if(type of nameElement==="string")
2164 nameElement+="["+descriptor.values.length+"]";else{var element=document.createEl ement("span");element.appendChild(nameElement);element.createTextChild("["+descr iptor.values.length+"]");nameElement=element;}}
2165 var data={};data[0]=nameElement;data[1]=valueElement;var node=new WebInspector.D ataGridNode(data);node.selectable=false;node.name=name;return node;},__proto__:W ebInspector.View.prototype};
OLDNEW
« no previous file with comments | « chrome_linux/resources/inspector/NetworkPanel.js ('k') | chrome_linux/resources/inspector/ResourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698