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

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

Issue 85333005: Update reference builds to Chrome 32.0.1700.19 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 const UserInitiatedProfileName="org.webkit.profiles.user-initiated";WebInspector .ProfileType=function(id,name) 1 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()
11 {return this._name;},buttonClicked:function() 11 {return this._name;},buttonClicked:function()
12 {return false;},get description() 12 {return false;},get description()
13 {return"";},isInstantProfile:function() 13 {return"";},isInstantProfile:function()
14 {return false;},isEnabled:function() 14 {return false;},isEnabled:function()
15 {return true;},getProfiles:function() 15 {return true;},getProfiles:function()
16 {return this._profiles.filter(function(profile){return!profile.isTemporary;});}, decorationElement:function() 16 {return this._profiles.filter(function(profile){return!profile.isTemporary;});}, decorationElement:function()
17 {return null;},getProfile:function(uid) 17 {return null;},getProfile:function(uid)
18 {return this._profilesIdMap[this._makeKey(uid)];},createTemporaryProfile:functio n(title) 18 {return this._profilesIdMap[this._makeKey(uid)];},createTemporaryProfile:functio n(title)
19 {throw new Error("Needs implemented.");},createProfile:function(profile) 19 {throw new Error("Needs implemented.");},createProfile:function(profile)
20 {throw new Error("Not supported for "+this._name+" profiles.");},_makeKey:functi on(id) 20 {throw new Error("Not supported for "+this._name+" profiles.");},_makeKey:functi on(id)
21 {return id+'/'+escape(this.id);},addProfile:function(profile) 21 {return id+'/'+escape(this.id);},addProfile:function(profile)
22 {this._profiles.push(profile);this._profilesIdMap[this._makeKey(profile.uid)]=pr ofile;this.dispatchEventToListeners(WebInspector.ProfileType.Events.AddProfileHe ader,profile);},removeProfile:function(profile) 22 {this._profiles.push(profile);this._profilesIdMap[this._makeKey(profile.uid)]=pr ofile;this.dispatchEventToListeners(WebInspector.ProfileType.Events.AddProfileHe ader,profile);},removeProfile:function(profile)
23 {for(var i=0;i<this._profiles.length;++i){if(this._profiles[i].uid===profile.uid ){this._profiles.splice(i,1);break;}} 23 {for(var i=0;i<this._profiles.length;++i){if(this._profiles[i].uid===profile.uid ){this._profiles.splice(i,1);break;}}
24 delete this._profilesIdMap[this._makeKey(profile.uid)];},findTemporaryProfile:fu nction() 24 delete this._profilesIdMap[this._makeKey(profile.uid)];},findTemporaryProfile:fu nction()
25 {for(var i=0;i<this._profiles.length;++i){if(this._profiles[i].isTemporary) 25 {for(var i=0;i<this._profiles.length;++i){if(this._profiles[i].isTemporary)
26 return this._profiles[i];} 26 return this._profiles[i];}
27 return null;},_reset:function() 27 return null;},_reset:function()
28 {var profiles=this._profiles.slice(0);for(var i=0;i<profiles.length;++i){var pro file=profiles[i];var view=profile.existingView();if(view){view.detach();if("disp ose"in view) 28 {var profiles=this._profiles.slice(0);for(var i=0;i<profiles.length;++i){var pro file=profiles[i];var view=profile.existingView();if(view){view.detach();if("disp ose"in view)
29 view.dispose();} 29 view.dispose();}
30 this.dispatchEventToListeners(WebInspector.ProfileType.Events.RemoveProfileHeade r,profile);} 30 this.dispatchEventToListeners(WebInspector.ProfileType.Events.RemoveProfileHeade r,profile);}
31 this.treeElement.removeChildren();this._profiles=[];this._profilesIdMap={};},_re questProfilesFromBackend:function(populateCallback) 31 this.treeElement.removeChildren();this._profiles=[];this._profilesIdMap={};},__p roto__:WebInspector.Object.prototype}
32 {},_populateProfiles:function()
33 {function populateCallback(error,profileHeaders){if(error)
34 return;profileHeaders.sort(function(a,b){return a.uid-b.uid;});var count=profile Headers.length;for(var i=0;i<count;++i)
35 this.addProfile(this.createProfile(profileHeaders[i]));}
36 this._requestProfilesFromBackend(populateCallback.bind(this));},__proto__:WebIns pector.Object.prototype}
37 WebInspector.ProfileHeader=function(profileType,title,uid) 32 WebInspector.ProfileHeader=function(profileType,title,uid)
38 {this._profileType=profileType;this.title=title;this.isTemporary=uid===undefined ;this.uid=this.isTemporary?-1:uid;this._fromFile=false;} 33 {this._profileType=profileType;this.title=title;this.isTemporary=uid===undefined ;this.uid=this.isTemporary?-1:uid;this._fromFile=false;}
39 WebInspector.ProfileHeader.prototype={profileType:function() 34 WebInspector.ProfileHeader._nextProfileFromFileUid=1;WebInspector.ProfileHeader. prototype={profileType:function()
40 {return this._profileType;},createSidebarTreeElement:function() 35 {return this._profileType;},createSidebarTreeElement:function()
41 {throw new Error("Needs implemented.");},existingView:function() 36 {throw new Error("Needs implemented.");},existingView:function()
42 {return this._view;},view:function(panel) 37 {return this._view;},view:function(panel)
43 {if(!this._view) 38 {if(!this._view)
44 this._view=this.createView(panel);return this._view;},createView:function(panel) 39 this._view=this.createView(panel);return this._view;},createView:function(panel)
45 {throw new Error("Not implemented.");},dispose:function() 40 {throw new Error("Not implemented.");},dispose:function()
46 {},load:function(callback) 41 {},load:function(callback)
47 {},canSaveToFile:function() 42 {},canSaveToFile:function()
48 {return false;},saveToFile:function() 43 {return false;},saveToFile:function()
49 {throw new Error("Needs implemented");},loadFromFile:function(file) 44 {throw new Error("Needs implemented");},loadFromFile:function(file)
50 {throw new Error("Needs implemented");},fromFile:function() 45 {throw new Error("Needs implemented");},fromFile:function()
51 {return this._fromFile;},setFromFile:function() 46 {return this._fromFile;},setFromFile:function()
52 {this._fromFile=true;this.uid=-2;}} 47 {this._fromFile=true;this.uid="From file #"+WebInspector.ProfileHeader._nextProf ileFromFileUid++;}}
53 WebInspector.ProfilesPanel=function(name,type) 48 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()) 49 {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.splitView.mainElement.addStyleClass( "vbox");this.splitView.sidebarElement.addStyleClass("vbox");this.profilesItemTre eElement=new WebInspector.ProfilesSidebarTreeElement(this);this.sidebarTree.appe ndChild(this.profilesItemTreeElement);this._singleProfileMode=singleProfileMode; this._profileTypesByIdMap={};this.profileViews=document.createElement("div");thi s.profileViews.id="profile-views";this.profileViews.addStyleClass("vbox");this.s plitView.mainElement.appendChild(this.profileViews);var statusBarContainer=this. splitView.mainElement.createChild("div","profiles-status-bar");this._statusBarEl ement=statusBarContainer.createChild("div","status-bar");var sidebarTreeBox=this .sidebarElement.createChild("div","profiles-sidebar-tree-box");sidebarTreeBox.ap pendChild(this.sidebarTreeElement);var statusBarContainerLeft=this.sidebarElemen t.createChild("div","profiles-status-bar");this._statusBarButtons=statusBarConta inerLeft.createChild("div","status-bar");this.recordButton=new WebInspector.Stat usBarButton("","record-profile-status-bar-item");this.recordButton.addEventListe ner("click",this.toggleRecordButton,this);this._statusBarButtons.appendChild(thi s.recordButton.element);this.clearResultsButton=new WebInspector.StatusBarButton (WebInspector.UIString("Clear all profiles."),"clear-status-bar-item");this.clea rResultsButton.addEventListener("click",this._clearProfiles,this);this._statusBa rButtons.appendChild(this.clearResultsButton.element);this._profileTypeStatusBar ItemsContainer=this._statusBarElement.createChild("div");this._profileViewStatus BarItemsContainer=this._statusBarElement.createChild("div");if(singleProfileMode ){this._launcherView=this._createLauncherView();this._registerProfileType((type) );this._selectedProfileType=type;this._updateProfileTypeSpecificUI();}else{this. _launcherView=new WebInspector.MultiProfileLauncherView(this);this._launcherView .addEventListener(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSe lected,this._onProfileTypeSelected,this);this._registerProfileType(new WebInspec tor.CPUProfileType());this._registerProfileType(new WebInspector.HeapSnapshotPro fileType());this._registerProfileType(new WebInspector.TrackingHeapSnapshotProfi leType(this));if(!WebInspector.WorkerManager.isWorkerFrontend()&&WebInspector.ex perimentsSettings.canvasInspection.isEnabled())
55 this._registerProfileType(new WebInspector.CanvasProfileType());} 50 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);this._configureCpuProfilerSamplingInterval();WebInspector.settings.highRes olutionCpuProfiling.addChangeListener(this._configureCpuProfilerSamplingInterval ,this);} 51 this._reset();this._createFileSelectorElement();this.element.addEventListener("c ontextmenu",this._handleContextMenuEvent.bind(this),true);this._registerShortcut s();WebInspector.ContextMenu.registerProvider(this);this._configureCpuProfilerSa mplingInterval();WebInspector.settings.highResolutionCpuProfiling.addChangeListe ner(this._configureCpuProfilerSamplingInterval,this);}
57 WebInspector.ProfilesPanel.prototype={_createFileSelectorElement:function() 52 WebInspector.ProfilesPanel.prototype={_createFileSelectorElement:function()
58 {if(this._fileSelectorElement) 53 {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() 54 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) 55 {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) 56 {for(var id in this._profileTypesByIdMap){var type=this._profileTypesByIdMap[id] ;var extension=type.fileExtension();if(!extension)
62 continue;if(fileName.endsWith(type.fileExtension())) 57 continue;if(fileName.endsWith(type.fileExtension()))
63 return type;} 58 return type;}
64 return null;},_registerShortcuts:function() 59 return null;},_registerShortcuts:function()
65 {this.registerShortcuts(WebInspector.ProfilesPanelDescriptor.ShortcutKeys.StartS topRecording,this.toggleRecordButton.bind(this));},_configureCpuProfilerSampling Interval:function() 60 {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) 61 {var intervalUs=WebInspector.settings.highResolutionCpuProfiling.get()?100:1000; ProfilerAgent.setSamplingInterval(intervalUs,didChangeInterval.bind(this));funct ion didChangeInterval(error)
67 {if(error) 62 {if(error)
68 WebInspector.showErrorMessage(error)}},_loadFromFile:function(file) 63 WebInspector.showErrorMessage(error)}},_loadFromFile:function(file)
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) 64 {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)
70 continue;extensions.push(extension);} 65 continue;extensions.push(extension);}
71 WebInspector.log(WebInspector.UIString("Can't load file. Only files with extensi ons '%s' can be loaded.",extensions.join("', '")));return;} 66 WebInspector.log(WebInspector.UIString("Can't load file. Only files with extensi ons '%s' can be loaded.",extensions.join("', '")));return;}
72 if(!!profileType.findTemporaryProfile()){WebInspector.log(WebInspector.UIString( "Can't load profile when other profile is recording."));return;} 67 if(!!profileType.findTemporaryProfile()){WebInspector.log(WebInspector.UIString( "Can't load profile when other profile is recording."));return;}
73 var temporaryProfile=profileType.createTemporaryProfile(WebInspector.ProfilesPan elDescriptor.UserInitiatedProfileName+"."+file.name);temporaryProfile.setFromFil e();profileType.addProfile(temporaryProfile);temporaryProfile.loadFromFile(file) ;},get statusBarItems() 68 var name=file.name;if(name.endsWith(profileType.fileExtension()))
74 {return this._statusBarButtons.select("element").concat(this._profileTypeStatusB arItemsContainer,this._profileViewStatusBarItemsContainer);},toggleRecordButton: function(event) 69 name=name.substr(0,name.length-profileType.fileExtension().length);var temporary Profile=profileType.createTemporaryProfile(name);temporaryProfile.setFromFile(); profileType.addProfile(temporaryProfile);temporaryProfile.loadFromFile(file);},t oggleRecordButton:function(event)
75 {var isProfiling=this._selectedProfileType.buttonClicked();this.setRecordingProf ile(this._selectedProfileType.id,isProfiling);return true;},_populateAllProfiles :function() 70 {var isProfiling=this._selectedProfileType.buttonClicked();this.setRecordingProf ile(this._selectedProfileType.id,isProfiling);return true;},_onProfileTypeSelect ed:function(event)
76 {if(this._profilesWereRequested)
77 return;this._profilesWereRequested=true;for(var typeId in this._profileTypesById Map)
78 this._profileTypesByIdMap[typeId]._populateProfiles();},wasShown:function()
79 {WebInspector.Panel.prototype.wasShown.call(this);this._populateAllProfiles();}, _onProfileTypeSelected:function(event)
80 {this._selectedProfileType=(event.data);this._updateProfileTypeSpecificUI();},_u pdateProfileTypeSpecificUI:function() 71 {this._selectedProfileType=(event.data);this._updateProfileTypeSpecificUI();},_u pdateProfileTypeSpecificUI:function()
81 {this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherV iew.updateProfileType(this._selectedProfileType);this._profileTypeStatusBarItems Container.removeChildren();var statusBarItems=this._selectedProfileType.statusBa rItems;if(statusBarItems){for(var i=0;i<statusBarItems.length;++i) 72 {this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherV iew.updateProfileType(this._selectedProfileType);this._profileTypeStatusBarItems Container.removeChildren();var statusBarItems=this._selectedProfileType.statusBa rItems;if(statusBarItems){for(var i=0;i<statusBarItems.length;++i)
82 this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]);} 73 this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]);}},_rese t:function()
83 this._resize(this.splitView.sidebarWidth());},_reset:function()
84 {WebInspector.Panel.prototype.reset.call(this);for(var typeId in this._profileTy pesByIdMap) 74 {WebInspector.Panel.prototype.reset.call(this);for(var typeId in this._profileTy pesByIdMap)
85 this._profileTypesByIdMap[typeId]._reset();delete this.visibleView;delete this.c urrentQuery;this.searchCanceled();this._profileGroups={};this.recordButton.toggl ed=false;if(this._selectedProfileType) 75 this._profileTypesByIdMap[typeId]._reset();delete this.visibleView;delete this.c urrentQuery;this.searchCanceled();this._profileGroups={};this.recordButton.toggl ed=false;if(this._selectedProfileType)
86 this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherVi ew.profileFinished();this.sidebarTreeElement.removeStyleClass("some-expandable") ;this.profileViews.removeChildren();this._profileViewStatusBarItemsContainer.rem oveChildren();this.removeAllListeners();this.recordButton.visible=true;this._pro fileViewStatusBarItemsContainer.removeStyleClass("hidden");this.clearResultsButt on.element.removeStyleClass("hidden");this.profilesItemTreeElement.select();this ._showLauncherView();},_showLauncherView:function() 76 this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherVi ew.profileFinished();this.sidebarTreeElement.removeStyleClass("some-expandable") ;this._launcherView.detach();this.profileViews.removeChildren();this._profileVie wStatusBarItemsContainer.removeChildren();this.removeAllListeners();this.recordB utton.visible=true;this._profileViewStatusBarItemsContainer.removeStyleClass("hi dden");this.clearResultsButton.element.removeStyleClass("hidden");this.profilesI temTreeElement.select();this._showLauncherView();},_showLauncherView:function()
87 {this.closeVisibleView();this._profileViewStatusBarItemsContainer.removeChildren ();this._launcherView.show(this.splitView.mainElement);this.visibleView=this._la uncherView;},_clearProfiles:function() 77 {this.closeVisibleView();this._profileViewStatusBarItemsContainer.removeChildren ();this._launcherView.show(this.profileViews);this.visibleView=this._launcherVie w;},_clearProfiles:function()
88 {ProfilerAgent.clearProfiles();HeapProfilerAgent.clearProfiles();this._reset();} ,_garbageCollectButtonClicked:function() 78 {ProfilerAgent.clearProfiles();HeapProfilerAgent.clearProfiles();this._reset();} ,_garbageCollectButtonClicked:function()
89 {HeapProfilerAgent.collectGarbage();},_registerProfileType:function(profileType) 79 {HeapProfilerAgent.collectGarbage();},_registerProfileType:function(profileType)
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) 80 {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)
91 {this._addProfileHeader(event.data);} 81 {this._addProfileHeader(event.data);}
92 function onRemoveProfileHeader(event) 82 function onRemoveProfileHeader(event)
93 {this._removeProfileHeader(event.data);} 83 {this._removeProfileHeader(event.data);}
94 function onProgressUpdated(event) 84 function onProgressUpdated(event)
95 {this._reportProfileProgress(event.data.profile,event.data.done,event.data.total );} 85 {this._reportProfileProgress(event.data.profile,event.data.done,event.data.total );}
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) 86 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)
97 {var element=event.srcElement;while(element&&!element.treeElement&&element!==thi s.element) 87 {var element=event.srcElement;while(element&&!element.treeElement&&element!==thi s.element)
98 element=element.parentElement;if(!element) 88 element=element.parentElement;if(!element)
99 return;if(element.treeElement&&element.treeElement.handleContextMenuEvent){eleme nt.treeElement.handleContextMenuEvent(event,this);return;} 89 return;if(element.treeElement&&element.treeElement.handleContextMenuEvent){eleme nt.treeElement.handleContextMenuEvent(event,this);return;}
100 var contextMenu=new WebInspector.ContextMenu(event);if(this.visibleView instance of WebInspector.HeapSnapshotView){this.visibleView.populateContextMenu(contextMe nu,event);} 90 var contextMenu=new WebInspector.ContextMenu(event);if(this.visibleView instance of WebInspector.HeapSnapshotView){this.visibleView.populateContextMenu(contextMe nu,event);}
101 if(element!==this.element||event.srcElement===this.sidebarElement){contextMenu.a ppendItem(WebInspector.UIString("Load\u2026"),this._fileSelectorElement.click.bi nd(this._fileSelectorElement));} 91 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) 92 contextMenu.show();},_makeTitleKey:function(text,profileTypeId)
103 {return escape(text)+'/'+escape(profileTypeId);},_addProfileHeader:function(prof ile) 93 {return escape(text)+'/'+escape(profileTypeId);},_addProfileHeader:function(prof ile)
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)) 94 {var profileType=profile.profileType();var typeId=profileType.id;var sidebarPare nt=profileType.treeElement;sidebarParent.hidden=false;var small=false;var altern ateTitle;if(!profile.fromFile()&&!profile.isTemporary){var profileTitleKey=this. _makeTitleKey(profile.title,typeId);if(!(profileTitleKey in this._profileGroups) )
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) 95 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)
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");} 96 group[0]._profilesTreeElement.revealAndSelect();group[0]._profilesTreeElement.sm all=true;group[0]._profilesTreeElement.mainTitle=WebInspector.UIString("Run %d", 1);this.sidebarTreeElement.addStyleClass("some-expandable");}
107 if(group.length>=2){sidebarParent=group._profilesTreeElement;alternateTitle=WebI nspector.UIString("Run %d",group.length);small=true;}} 97 if(group.length>=2){sidebarParent=group._profilesTreeElement;alternateTitle=WebI nspector.UIString("Run %d",group.length);small=true;}}
108 var profileTreeElement=profile.createSidebarTreeElement();profile.sidebarElement =profileTreeElement;profileTreeElement.small=small;if(alternateTitle) 98 var profileTreeElement=profile.createSidebarTreeElement();profile.sidebarElement =profileTreeElement;profileTreeElement.small=small;if(alternateTitle)
109 profileTreeElement.mainTitle=alternateTitle;profile._profilesTreeElement=profile TreeElement;var temporaryProfile=profileType.findTemporaryProfile();if(profile.i sTemporary||!temporaryProfile) 99 profileTreeElement.mainTitle=alternateTitle;profile._profilesTreeElement=profile TreeElement;var temporaryProfile=profileType.findTemporaryProfile();if(profile.i sTemporary||!temporaryProfile)
110 sidebarParent.appendChild(profileTreeElement);else{if(temporaryProfile){sidebarP arent.insertBeforeChild(profileTreeElement,temporaryProfile._profilesTreeElement );this._removeTemporaryProfile(profile.profileType().id);} 100 sidebarParent.appendChild(profileTreeElement);else{if(temporaryProfile){sidebarP arent.insertBeforeChild(profileTreeElement,temporaryProfile._profilesTreeElement );this._removeTemporaryProfile(profile.profileType().id);}
111 if(!this.visibleView||this.visibleView===this._launcherView) 101 if(!this.visibleView||this.visibleView===this._launcherView)
112 this._showProfile(profile);this.dispatchEventToListeners("profile added",{type:t ypeId});}},_removeProfileHeader:function(profile) 102 this._showProfile(profile);this.dispatchEventToListeners("profile added",{type:t ypeId});}},_removeProfileHeader:function(profile)
113 {profile.dispose();profile.profileType().removeProfile(profile);var sidebarParen t=profile.profileType().treeElement;var profileTitleKey=this._makeTitleKey(profi le.title,profile.profileType().id);var group=this._profileGroups[profileTitleKey ];if(group){group.splice(group.indexOf(profile),1);if(group.length===1){var inde x=sidebarParent.children.indexOf(group._profilesTreeElement);sidebarParent.inser tChild(group[0]._profilesTreeElement,index);group[0]._profilesTreeElement.small= false;group[0]._profilesTreeElement.mainTitle=group[0].title;sidebarParent.remov eChild(group._profilesTreeElement);} 103 {profile.dispose();profile.profileType().removeProfile(profile);var sidebarParen t=profile.profileType().treeElement;var profileTitleKey=this._makeTitleKey(profi le.title,profile.profileType().id);var group=this._profileGroups[profileTitleKey ];if(group){group.splice(group.indexOf(profile),1);if(group.length===1){var inde x=sidebarParent.children.indexOf(group._profilesTreeElement);sidebarParent.inser tChild(group[0]._profilesTreeElement,index);group[0]._profilesTreeElement.small= false;group[0]._profilesTreeElement.mainTitle=group[0].title;sidebarParent.remov eChild(group._profilesTreeElement);}
114 if(group.length!==0) 104 if(group.length!==0)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 profiles=profiles.concat(this._profileTypesByIdMap[typeId].getProfiles());return profiles;},_searchableViews:function() 157 profiles=profiles.concat(this._profileTypesByIdMap[typeId].getProfiles());return profiles;},_searchableViews:function()
168 {var profiles=this._getAllProfiles();var searchableViews=[];for(var i=0;i<profil es.length;++i){var view=profiles[i].view(this);if(view.performSearch) 158 {var profiles=this._getAllProfiles();var searchableViews=[];for(var i=0;i<profil es.length;++i){var view=profiles[i].view(this);if(view.performSearch)
169 searchableViews.push(view)} 159 searchableViews.push(view)}
170 var index=searchableViews.indexOf(this.visibleView);if(index>0){searchableViews[ index]=searchableViews[0];searchableViews[0]=this.visibleView;} 160 var index=searchableViews.indexOf(this.visibleView);if(index>0){searchableViews[ index]=searchableViews[0];searchableViews[0]=this.visibleView;}
171 return searchableViews;},searchMatchFound:function(view,matches) 161 return searchableViews;},searchMatchFound:function(view,matches)
172 {view.profile._profilesTreeElement.searchMatches=matches;},searchCanceled:functi on() 162 {view.profile._profilesTreeElement.searchMatches=matches;},searchCanceled:functi on()
173 {if(this._searchResults){for(var i=0;i<this._searchResults.length;++i){var view= this._searchResults[i];if(view.searchCanceled) 163 {if(this._searchResults){for(var i=0;i<this._searchResults.length;++i){var view= this._searchResults[i];if(view.searchCanceled)
174 view.searchCanceled();delete view.currentQuery;}} 164 view.searchCanceled();delete view.currentQuery;}}
175 WebInspector.Panel.prototype.searchCanceled.call(this);if(this._currentSearchChu nkIntervalIdentifier){clearInterval(this._currentSearchChunkIntervalIdentifier); delete this._currentSearchChunkIntervalIdentifier;} 165 WebInspector.Panel.prototype.searchCanceled.call(this);if(this._currentSearchChu nkIntervalIdentifier){clearInterval(this._currentSearchChunkIntervalIdentifier); delete this._currentSearchChunkIntervalIdentifier;}
176 this._totalSearchMatches=0;this._currentSearchResultIndex=0;this._searchResults= [];var profiles=this._getAllProfiles();for(var i=0;i<profiles.length;++i) 166 this._totalSearchMatches=0;this._currentSearchResultIndex=0;this._searchResults= [];var profiles=this._getAllProfiles();for(var i=0;i<profiles.length;++i)
177 profiles[i]._profilesTreeElement.searchMatches=0;},sidebarResized:function(event ) 167 profiles[i]._profilesTreeElement.searchMatches=0;},setRecordingProfile:function( profileType,isProfiling)
178 {var sidebarWidth=(event.data);this._resize(sidebarWidth);},onResize:function()
179 {this._resize(this.splitView.sidebarWidth());},_resize:function(sidebarWidth)
180 {var lastItemElement=this._statusBarButtons[this._statusBarButtons.length-1].ele ment;var left=lastItemElement.totalOffsetLeft()+lastItemElement.offsetWidth;this ._profileTypeStatusBarItemsContainer.style.left=left+"px";left+=this._profileTyp eStatusBarItemsContainer.offsetWidth-1;this._profileViewStatusBarItemsContainer. style.left=Math.max(left,sidebarWidth)+"px";},setRecordingProfile:function(profi leType,isProfiling)
181 {var profileTypeObject=this.getProfileType(profileType);this.recordButton.toggle d=isProfiling;this.recordButton.title=profileTypeObject.buttonTooltip;if(isProfi ling){this._launcherView.profileStarted();this._createTemporaryProfile(profileTy pe);if(profileTypeObject.hasTemporaryView()) 168 {var profileTypeObject=this.getProfileType(profileType);this.recordButton.toggle d=isProfiling;this.recordButton.title=profileTypeObject.buttonTooltip;if(isProfi ling){this._launcherView.profileStarted();this._createTemporaryProfile(profileTy pe);if(profileTypeObject.hasTemporaryView())
182 this._showProfile(profileTypeObject.findTemporaryProfile());}else 169 this._showProfile(profileTypeObject.findTemporaryProfile());}else
183 this._launcherView.profileFinished();},_reportProfileProgress:function(profile,d one,total) 170 this._launcherView.profileFinished();},_reportProfileProgress:function(profile,d one,total)
184 {profile.sidebarElement.subtitle=WebInspector.UIString("%.0f%",(done/total)*100) ;profile.sidebarElement.wait=true;},appendApplicableItems:function(event,context Menu,target) 171 {profile.sidebarElement.subtitle=WebInspector.UIString("%.0f%",(done/total)*100) ;profile.sidebarElement.wait=true;},appendApplicableItems:function(event,context Menu,target)
185 {if(WebInspector.inspectorView.currentPanel()!==this) 172 {if(WebInspector.inspectorView.currentPanel()!==this)
186 return;var object=(target);var objectId=object.objectId;if(!objectId) 173 return;var object=(target);var objectId=object.objectId;if(!objectId)
187 return;var heapProfiles=this.getProfileType(WebInspector.HeapSnapshotProfileType .TypeId).getProfiles();if(!heapProfiles.length) 174 return;var heapProfiles=this.getProfileType(WebInspector.HeapSnapshotProfileType .TypeId).getProfiles();if(!heapProfiles.length)
188 return;function revealInView(viewName) 175 return;function revealInView(viewName)
189 {HeapProfilerAgent.getHeapObjectId(objectId,didReceiveHeapObjectId.bind(this,vie wName));} 176 {HeapProfilerAgent.getHeapObjectId(objectId,didReceiveHeapObjectId.bind(this,vie wName));}
190 function didReceiveHeapObjectId(viewName,error,result) 177 function didReceiveHeapObjectId(viewName,error,result)
191 {if(WebInspector.inspectorView.currentPanel()!==this) 178 {if(WebInspector.inspectorView.currentPanel()!==this)
192 return;if(!error) 179 return;if(!error)
193 this.showObject(result,viewName);} 180 this.showObject(result,viewName);}
194 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInView.bind(th is,"Dominators"));contextMenu.appendItem(WebInspector.UIString(WebInspector.useL owerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealIn View.bind(this,"Summary"));},__proto__:WebInspector.Panel.prototype} 181 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInView.bind(th is,"Dominators"));contextMenu.appendItem(WebInspector.UIString(WebInspector.useL owerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealIn View.bind(this,"Summary"));},__proto__:WebInspector.Panel.prototype}
195 WebInspector.ProfileSidebarTreeElement=function(profile,titleFormat,className) 182 WebInspector.ProfileSidebarTreeElement=function(profile,titleFormat,className)
196 {this.profile=profile;this._titleFormat=titleFormat;if(WebInspector.ProfilesPane lDescriptor.isUserInitiatedProfile(this.profile.title)) 183 {this.profile=profile;this._titleFormat=titleFormat;WebInspector.SidebarTreeElem ent.call(this,className,"","",profile,false);this.refreshTitles();}
197 this._profileNumber=WebInspector.ProfilesPanelDescriptor.userInitiatedProfileInd ex(this.profile.title);WebInspector.SidebarTreeElement.call(this,className,"","" ,profile,false);this.refreshTitles();}
198 WebInspector.ProfileSidebarTreeElement.prototype={onselect:function() 184 WebInspector.ProfileSidebarTreeElement.prototype={onselect:function()
199 {if(!this._suppressOnSelect) 185 {if(!this._suppressOnSelect)
200 this.treeOutline.panel._showProfile(this.profile);},ondelete:function() 186 this.treeOutline.panel._showProfile(this.profile);},ondelete:function()
201 {this.treeOutline.panel._removeProfileHeader(this.profile);return true;},get mai nTitle() 187 {this.treeOutline.panel._removeProfileHeader(this.profile);return true;},get mai nTitle()
202 {if(this._mainTitle) 188 {if(this._mainTitle)
203 return this._mainTitle;if(WebInspector.ProfilesPanelDescriptor.isUserInitiatedPr ofile(this.profile.title)) 189 return this._mainTitle;return this.profile.title;},set mainTitle(x)
204 return WebInspector.UIString(this._titleFormat,this._profileNumber);return this. profile.title;},set mainTitle(x)
205 {this._mainTitle=x;this.refreshTitles();},set searchMatches(matches) 190 {this._mainTitle=x;this.refreshTitles();},set searchMatches(matches)
206 {if(!matches){if(!this.bubbleElement) 191 {if(!matches){if(!this.bubbleElement)
207 return;this.bubbleElement.removeStyleClass("search-matches");this.bubbleText=""; return;} 192 return;this.bubbleElement.removeStyleClass("search-matches");this.bubbleText=""; return;}
208 this.bubbleText=matches;this.bubbleElement.addStyleClass("search-matches");},han dleContextMenuEvent:function(event,panel) 193 this.bubbleText=matches;this.bubbleElement.addStyleClass("search-matches");},han dleContextMenuEvent:function(event,panel)
209 {var profile=this.profile;var contextMenu=new WebInspector.ContextMenu(event);co ntextMenu.appendItem(WebInspector.UIString("Load\u2026"),panel._fileSelectorElem ent.click.bind(panel._fileSelectorElement));if(profile.canSaveToFile()) 194 {var profile=this.profile;var contextMenu=new WebInspector.ContextMenu(event);co ntextMenu.appendItem(WebInspector.UIString("Load\u2026"),panel._fileSelectorElem ent.click.bind(panel._fileSelectorElement));if(profile.canSaveToFile())
210 contextMenu.appendItem(WebInspector.UIString("Save\u2026"),profile.saveToFile.bi nd(profile));contextMenu.appendItem(WebInspector.UIString("Delete"),this.ondelet e.bind(this));contextMenu.show();},__proto__:WebInspector.SidebarTreeElement.pro totype} 195 contextMenu.appendItem(WebInspector.UIString("Save\u2026"),profile.saveToFile.bi nd(profile));contextMenu.appendItem(WebInspector.UIString("Delete"),this.ondelet e.bind(this));contextMenu.show();},__proto__:WebInspector.SidebarTreeElement.pro totype}
211 WebInspector.ProfileGroupSidebarTreeElement=function(panel,title,subtitle) 196 WebInspector.ProfileGroupSidebarTreeElement=function(panel,title,subtitle)
212 {WebInspector.SidebarTreeElement.call(this,"profile-group-sidebar-tree-item",tit le,subtitle,null,true);this._panel=panel;} 197 {WebInspector.SidebarTreeElement.call(this,"profile-group-sidebar-tree-item",tit le,subtitle,null,true);this._panel=panel;}
213 WebInspector.ProfileGroupSidebarTreeElement.prototype={onselect:function() 198 WebInspector.ProfileGroupSidebarTreeElement.prototype={onselect:function()
214 {if(this.children.length>0) 199 {if(this.children.length>0)
(...skipping 10 matching lines...) Expand all
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);} 210 {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);}
226 WebInspector.HeapProfilerPanel.prototype={_createLauncherView:function() 211 WebInspector.HeapProfilerPanel.prototype={_createLauncherView:function()
227 {return new WebInspector.MultiProfileLauncherView(this);},__proto__:WebInspector .ProfilesPanel.prototype} 212 {return new WebInspector.MultiProfileLauncherView(this);},__proto__:WebInspector .ProfilesPanel.prototype}
228 WebInspector.CanvasProfilerPanel=function() 213 WebInspector.CanvasProfilerPanel=function()
229 {WebInspector.ProfilesPanel.call(this,"canvas-profiler",new WebInspector.CanvasP rofileType());} 214 {WebInspector.ProfilesPanel.call(this,"canvas-profiler",new WebInspector.CanvasP rofileType());}
230 WebInspector.CanvasProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel .prototype} 215 WebInspector.CanvasProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel .prototype}
231 WebInspector.ProfileDataGridNode=function(profileNode,owningTree,hasChildren) 216 WebInspector.ProfileDataGridNode=function(profileNode,owningTree,hasChildren)
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;} 217 {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;}
233 WebInspector.ProfileDataGridNode.prototype={get data() 218 WebInspector.ProfileDataGridNode.prototype={get data()
234 {function formatMilliseconds(time) 219 {function formatMilliseconds(time)
235 {return WebInspector.UIString("%.0f\u2009ms",time);} 220 {return WebInspector.UIString("%.1f\u2009ms",time);}
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 221 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()) 222 data["function"]=this.functionName;if(this.tree.profileView.showSelfTimeAsPercen t.get())
238 data["self"]=WebInspector.UIString("%.2f%",this.selfPercent);else 223 data["self"]=WebInspector.UIString("%.2f%",this.selfPercent);else
239 data["self"]=formatMilliseconds(this.selfTime);if(this.tree.profileView.showTota lTimeAsPercent.get()) 224 data["self"]=formatMilliseconds(this.selfTime);if(this.tree.profileView.showTota lTimeAsPercent.get())
240 data["total"]=WebInspector.UIString("%.2f%",this.totalPercent);else 225 data["total"]=WebInspector.UIString("%.2f%",this.totalPercent);else
241 data["total"]=formatMilliseconds(this.totalTime);return data;},createCell:functi on(columnIdentifier) 226 data["total"]=formatMilliseconds(this.totalTime);return data;},createCell:functi on(columnIdentifier)
242 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier==="self"&&this._searchMatchedSelfColumn) 227 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier==="self"&&this._searchMatchedSelfColumn)
243 cell.addStyleClass("highlight");else if(columnIdentifier==="total"&&this._search MatchedTotalColumn) 228 cell.addStyleClass("highlight");else if(columnIdentifier==="total"&&this._search MatchedTotalColumn)
244 cell.addStyleClass("highlight");if(columnIdentifier!=="function") 229 cell.addStyleClass("highlight");if(columnIdentifier!=="function")
245 return cell;if(this._deoptReason) 230 return cell;if(this._deoptReason)
246 cell.addStyleClass("not-optimized");if(this.profileNode._searchMatchedFunctionCo lumn) 231 cell.addStyleClass("not-optimized");if(this.profileNode._searchMatchedFunctionCo lumn)
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);} 232 cell.addStyleClass("highlight");if(this.profileNode.scriptId!=="0"){var lineNumb er=this.profileNode.lineNumber?this.profileNode.lineNumber-1:0;var columnNumber= this.profileNode.columnNumber?this.profileNode.columnNumber-1:0;var location=new WebInspector.DebuggerModel.Location(this.profileNode.scriptId,lineNumber,column Number);var urlElement=this.tree.profileView._linkifier.linkifyRawLocation(locat ion,"profile-node-file");if(!urlElement)
233 urlElement=this.tree.profileView._linkifier.linkifyLocation(this.profileNode.url ,lineNumber,columnNumber,"profile-node-file");urlElement.style.maxWidth="75%";ce ll.insertBefore(urlElement,cell.firstChild);}
248 return cell;},select:function(supressSelectedEvent) 234 return cell;},select:function(supressSelectedEvent)
249 {WebInspector.DataGridNode.prototype.select.call(this,supressSelectedEvent);this .tree.profileView._dataGridNodeSelected(this);},deselect:function(supressDeselec tedEvent) 235 {WebInspector.DataGridNode.prototype.select.call(this,supressSelectedEvent);this .tree.profileView._dataGridNodeSelected(this);},deselect:function(supressDeselec tedEvent)
250 {WebInspector.DataGridNode.prototype.deselect.call(this,supressDeselectedEvent); this.tree.profileView._dataGridNodeDeselected(this);},sort:function(comparator,f orce) 236 {WebInspector.DataGridNode.prototype.deselect.call(this,supressDeselectedEvent); this.tree.profileView._dataGridNodeDeselected(this);},sort:function(comparator,f orce)
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) 237 {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)
252 gridNode.shouldRefreshChildren=true;continue;} 238 gridNode.shouldRefreshChildren=true;continue;}
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) 239 gridNode.lastComparator=comparator;var children=gridNode.children;var childCount =children.length;if(childCount){children.sort(comparator);for(var childIndex=0;c hildIndex<childCount;++childIndex)
254 children[childIndex]._recalculateSiblings(childIndex);gridNodeGroups.push(childr en);}}}},insertChild:function(profileDataGridNode,index) 240 children[childIndex]._recalculateSiblings(childIndex);gridNodeGroups.push(childr en);}}}},insertChild:function(profileDataGridNode,index)
255 {WebInspector.DataGridNode.prototype.insertChild.call(this,profileDataGridNode,i ndex);this.childrenByCallUID[profileDataGridNode.callUID]=profileDataGridNode;}, removeChild:function(profileDataGridNode) 241 {WebInspector.DataGridNode.prototype.insertChild.call(this,profileDataGridNode,i ndex);this.childrenByCallUID[profileDataGridNode.callUID]=profileDataGridNode;}, removeChild:function(profileDataGridNode)
256 {WebInspector.DataGridNode.prototype.removeChild.call(this,profileDataGridNode); delete this.childrenByCallUID[profileDataGridNode.callUID];},removeChildren:func tion() 242 {WebInspector.DataGridNode.prototype.removeChild.call(this,profileDataGridNode); delete this.childrenByCallUID[profileDataGridNode.callUID];},removeChildren:func tion()
257 {WebInspector.DataGridNode.prototype.removeChildren.call(this);this.childrenByCa llUID={};},findChild:function(node) 243 {WebInspector.DataGridNode.prototype.removeChildren.call(this);this.childrenByCa llUID={};},findChild:function(node)
258 {if(!node) 244 {if(!node)
259 return null;return this.childrenByCallUID[node.callUID];},get selfPercent() 245 return null;return this.childrenByCallUID[node.callUID];},get selfPercent()
260 {return this.selfTime/this.tree.totalTime*100.0;},get totalPercent() 246 {return this.selfTime/this.tree.totalTime*100.0;},get totalPercent()
261 {return this.totalTime/this.tree.totalTime*100.0;},get _parent() 247 {return this.totalTime/this.tree.totalTime*100.0;},get _parent()
262 {return this.parent!==this.dataGrid?this.parent:this.tree;},populate:function() 248 {return this.parent!==this.dataGrid?this.parent:this.tree;},populate:function()
263 {if(this._populated) 249 {if(this._populated)
264 return;this._populated=true;this._sharedPopulate();if(this._parent){var currentC omparator=this._parent.lastComparator;if(currentComparator) 250 return;this._populated=true;this._sharedPopulate();var currentComparator=this.tr ee.lastComparator;if(currentComparator)
265 this.sort(currentComparator,true);}},_save:function() 251 this.sort(currentComparator,true);},_save:function()
266 {if(this._savedChildren) 252 {if(this._savedChildren)
267 return;this._savedSelfTime=this.selfTime;this._savedTotalTime=this.totalTime;thi s._savedChildren=this.children.slice();},_restore:function() 253 return;this._savedSelfTime=this.selfTime;this._savedTotalTime=this.totalTime;thi s._savedChildren=this.children.slice();},_restore:function()
268 {if(!this._savedChildren) 254 {if(!this._savedChildren)
269 return;this.selfTime=this._savedSelfTime;this.totalTime=this._savedTotalTime;thi s.removeChildren();var children=this._savedChildren;var count=children.length;fo r(var index=0;index<count;++index){children[index]._restore();this.appendChild(c hildren[index]);}},_merge:function(child,shouldAbsorb) 255 return;this.selfTime=this._savedSelfTime;this.totalTime=this._savedTotalTime;thi s.removeChildren();var children=this._savedChildren;var count=children.length;fo r(var index=0;index<count;++index){children[index]._restore();this.appendChild(c hildren[index]);}},_merge:function(child,shouldAbsorb)
270 {this.selfTime+=child.selfTime;if(!shouldAbsorb) 256 {this.selfTime+=child.selfTime;if(!shouldAbsorb)
271 this.totalTime+=child.totalTime;var children=this.children.slice();this.removeCh ildren();var count=children.length;for(var index=0;index<count;++index){if(!shou ldAbsorb||children[index]!==child) 257 this.totalTime+=child.totalTime;var children=this.children.slice();this.removeCh ildren();var count=children.length;for(var index=0;index<count;++index){if(!shou ldAbsorb||children[index]!==child)
272 this.appendChild(children[index]);} 258 this.appendChild(children[index]);}
273 children=child.children.slice();count=children.length;for(var index=0;index<coun t;++index){var orphanedChild=children[index],existingChild=this.childrenByCallUI D[orphanedChild.callUID];if(existingChild) 259 children=child.children.slice();count=children.length;for(var index=0;index<coun t;++index){var orphanedChild=children[index],existingChild=this.childrenByCallUI D[orphanedChild.callUID];if(existingChild)
274 existingChild._merge(orphanedChild,false);else 260 existingChild._merge(orphanedChild,false);else
275 this.appendChild(orphanedChild);}},__proto__:WebInspector.DataGridNode.prototype } 261 this.appendChild(orphanedChild);}},__proto__:WebInspector.DataGridNode.prototype }
(...skipping 12 matching lines...) Expand all
288 WebInspector.ProfileDataGridTree.propertyComparators=[{},{}];WebInspector.Profil eDataGridTree.propertyComparator=function(property,isAscending) 274 WebInspector.ProfileDataGridTree.propertyComparators=[{},{}];WebInspector.Profil eDataGridTree.propertyComparator=function(property,isAscending)
289 {var comparator=WebInspector.ProfileDataGridTree.propertyComparators[(isAscendin g?1:0)][property];if(!comparator){if(isAscending){comparator=function(lhs,rhs) 275 {var comparator=WebInspector.ProfileDataGridTree.propertyComparators[(isAscendin g?1:0)][property];if(!comparator){if(isAscending){comparator=function(lhs,rhs)
290 {if(lhs[property]<rhs[property]) 276 {if(lhs[property]<rhs[property])
291 return-1;if(lhs[property]>rhs[property]) 277 return-1;if(lhs[property]>rhs[property])
292 return 1;return 0;}}else{comparator=function(lhs,rhs) 278 return 1;return 0;}}else{comparator=function(lhs,rhs)
293 {if(lhs[property]>rhs[property]) 279 {if(lhs[property]>rhs[property])
294 return-1;if(lhs[property]<rhs[property]) 280 return-1;if(lhs[property]<rhs[property])
295 return 1;return 0;}} 281 return 1;return 0;}}
296 WebInspector.ProfileDataGridTree.propertyComparators[(isAscending?1:0)][property ]=comparator;} 282 WebInspector.ProfileDataGridTree.propertyComparators[(isAscending?1:0)][property ]=comparator;}
297 return comparator;};WebInspector.AllocationProfile=function(profile) 283 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);} 284 {this._strings=profile.strings;this._nextNodeId=1;this._idToFunctionInfo={};this ._idToNode={};this._collapsedTopNodeIdToFunctionInfo={};this._traceTops=null;thi s._buildAllocationFunctionInfos(profile);this._traceTree=this._buildInvertedAllo cationTree(profile);}
299 WebInspector.AllocationProfile.prototype={_buildAllocationFunctionInfos:function (rawInfos) 285 WebInspector.AllocationProfile.prototype={_buildAllocationFunctionInfos:function (profile)
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) 286 {var strings=this._strings;var functionInfoFields=profile.snapshot.meta.trace_fu nction_info_fields;var functionIdOffset=functionInfoFields.indexOf("function_id" );var functionNameOffset=functionInfoFields.indexOf("name");var scriptNameOffset =functionInfoFields.indexOf("script_name");var scriptIdOffset=functionInfoFields .indexOf("script_id");var lineOffset=functionInfoFields.indexOf("line");var colu mnOffset=functionInfoFields.indexOf("column");var functionInfoFieldCount=functio nInfoFields.length;var map=this._idToFunctionInfo;map[0]=new WebInspector.Functi onAllocationInfo("(root)","<unknown>",0,-1,-1);var rawInfos=profile.trace_functi on_infos;var infoLength=rawInfos.length;for(var i=0;i<infoLength;i+=functionInfo FieldCount){map[rawInfos[i+functionIdOffset]]=new WebInspector.FunctionAllocatio nInfo(strings[rawInfos[i+functionNameOffset]],strings[rawInfos[i+scriptNameOffse t]],rawInfos[i+scriptIdOffset],rawInfos[i+lineOffset],rawInfos[i+columnOffset]); }},_buildInvertedAllocationTree:function(profile)
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) 287 {var traceTreeRaw=profile.trace_tree;var idToFunctionInfo=this._idToFunctionInfo ;var traceNodeFields=profile.snapshot.meta.trace_node_fields;var nodeIdOffset=tr aceNodeFields.indexOf("id");var functionIdOffset=traceNodeFields.indexOf("functi on_id");var allocationCountOffset=traceNodeFields.indexOf("count");var allocatio nSizeOffset=traceNodeFields.indexOf("size");var childrenOffset=traceNodeFields.i ndexOf("children");var nodeFieldCount=traceNodeFields.length;function traverseNo de(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)); } 288 {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;} 289 return result;}
304 return traverseNode(traceTreeRaw,0,null);},serializeTraceTops:function() 290 return traverseNode(traceTreeRaw,0,null);},serializeTraceTops:function()
305 {if(this._traceTops) 291 {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) 292 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;} 293 continue;var nodeId=this._nextNodeId++;result.push(this._serializeNode(nodeId,in fo,info.totalCount,info.totalSize,true));this._collapsedTopNodeIdToFunctionInfo[ nodeId]=info;}
308 return result;},serializeCallers:function(nodeId) 294 result.sort(function(a,b){return b.size-a.size;});return result;},serializeCalle rs: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;} 295 {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()));} 296 var nodesWithSingleCaller=[];while(node.callers().length===1){node=node.callers( )[0];nodesWithSingleCaller.push(this._serializeCaller(node));}
311 return result;},_serializeNode:function(nodeId,functionName,count,size,hasChildr en) 297 var branchingCallers=[];var callers=node.callers();for(var i=0;i<callers.length; i++){branchingCallers.push(this._serializeCaller(callers[i]));}
312 {return{id:nodeId,name:functionName,count:count,size:size,hasChildren:hasChildre n};}} 298 return{nodesWithSingleCaller:nodesWithSingleCaller,branchingCallers:branchingCal lers};},_serializeCaller:function(node)
299 {var callerId=this._nextNodeId++;this._idToNode[callerId]=node;return this._seri alizeNode(callerId,node.functionInfo,node.allocationCount,node.allocationSize,no de.hasCallers());},_serializeNode:function(nodeId,functionInfo,count,size,hasChi ldren)
300 {return{id:nodeId,name:functionInfo.functionName,scriptName:functionInfo.scriptN ame,line:functionInfo.line,column:functionInfo.column,count:count,size:size,hasC hildren:hasChildren};}}
313 WebInspector.AllocationTraceNode=function(id,functionInfo,count,size,parent) 301 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=[];} 302 {this.id=id;this.functionInfo=functionInfo;this.allocationCount=count;this.alloc ationSize=size;this.parent=parent;this.children=[];}
315 WebInspector.AllocationBackTraceNode=function(functionInfo) 303 WebInspector.AllocationBackTraceNode=function(functionInfo)
316 {this.functionInfo=functionInfo;this.allocationCount=0;this.allocationSize=0;thi s._callers=[];} 304 {this.functionInfo=functionInfo;this.allocationCount=0;this.allocationSize=0;thi s._callers=[];}
317 WebInspector.AllocationBackTraceNode.prototype={addCaller:function(traceNode) 305 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;}} 306 {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);} 307 if(!result){result=new WebInspector.AllocationBackTraceNode(functionInfo);this._ callers.push(result);}
320 return result;},callers:function() 308 return result;},callers:function()
321 {return this._callers;},hasCallers:function() 309 {return this._callers;},hasCallers:function()
322 {return this._callers.length>0;}} 310 {return this._callers.length>0;}}
323 WebInspector.FunctionAllocationInfo=function(functionName,scriptName) 311 WebInspector.FunctionAllocationInfo=function(functionName,scriptName,scriptId,li ne,column)
324 {this.functionName=functionName;this.scriptName=scriptName;this.totalCount=0;thi s.totalSize=0;this._traceTops=[];} 312 {this.functionName=functionName;this.scriptName=scriptName;this.scriptId=scriptI d;this.line=line;this.column=column;this.totalCount=0;this.totalSize=0;this._tra ceTops=[];}
325 WebInspector.FunctionAllocationInfo.prototype={addTraceTopNode:function(node) 313 WebInspector.FunctionAllocationInfo.prototype={addTraceTopNode:function(node)
326 {if(node.allocationCount===0) 314 {if(node.allocationCount===0)
327 return;this._traceTops.push(node);this.totalCount+=node.allocationCount;this.tot alSize+=node.allocationSize;},tracesWithThisTop:function() 315 return;this._traceTops.push(node);this.totalCount+=node.allocationCount;this.tot alSize+=node.allocationSize;},tracesWithThisTop:function()
328 {if(!this._traceTops.length) 316 {if(!this._traceTops.length)
329 return null;if(!this._backTraceTree) 317 return null;if(!this._backTraceTree)
330 this._buildAllocationTraceTree();return this._backTraceTree;},_buildAllocationTr aceTree:function() 318 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;} 319 {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) 320 backTraceNode=backTraceNode.addCaller(node);}}}};WebInspector.BottomUpProfileDat aGridNode=function(profileNode,owningTree)
333 {WebInspector.ProfileDataGridNode.call(this,profileNode,owningTree,this._willHav eChildren(profileNode));this._remainingNodeInfos=[];} 321 {WebInspector.ProfileDataGridNode.call(this,profileNode,owningTree,this._willHav eChildren(profileNode));this._remainingNodeInfos=[];}
334 WebInspector.BottomUpProfileDataGridNode.prototype={_takePropertiesFromProfileDa taGridNode:function(profileDataGridNode) 322 WebInspector.BottomUpProfileDataGridNode.prototype={_takePropertiesFromProfileDa taGridNode:function(profileDataGridNode)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 {return(this._currentSearchResultIndex===0);},showingLastSearchResult:function() 422 {return(this._currentSearchResultIndex===0);},showingLastSearchResult:function()
435 {return(this._searchResults&&this._currentSearchResultIndex===(this._searchResul ts.length-1));},_jumpToSearchResult:function(index) 423 {return(this._searchResults&&this._currentSearchResultIndex===(this._searchResul ts.length-1));},_jumpToSearchResult:function(index)
436 {var searchResult=this._searchResults[index];if(!searchResult) 424 {var searchResult=this._searchResults[index];if(!searchResult)
437 return;var profileNode=searchResult.profileNode;profileNode.revealAndSelect();}, _ensureFlameChartCreated:function() 425 return;var profileNode=searchResult.profileNode;profileNode.revealAndSelect();}, _ensureFlameChartCreated:function()
438 {if(this._flameChart) 426 {if(this._flameChart)
439 return;this._flameChart=new WebInspector.FlameChart(this);this._flameChart.addEv entListener(WebInspector.FlameChart.Events.SelectedNode,this._onSelectedNode.bin d(this));},_onSelectedNode:function(event) 427 return;this._flameChart=new WebInspector.FlameChart(this);this._flameChart.addEv entListener(WebInspector.FlameChart.Events.SelectedNode,this._onSelectedNode.bin d(this));},_onSelectedNode:function(event)
440 {var node=event.data;if(!node||!node.scriptId) 428 {var node=event.data;if(!node||!node.scriptId)
441 return;var script=WebInspector.debuggerModel.scriptForId(node.scriptId) 429 return;var script=WebInspector.debuggerModel.scriptForId(node.scriptId)
442 if(!script) 430 if(!script)
443 return;var uiLocation=script.rawLocationToUILocation(node.lineNumber);if(!uiLoca tion) 431 return;var uiLocation=script.rawLocationToUILocation(node.lineNumber);if(!uiLoca tion)
444 return;WebInspector.showPanel("sources").showUILocation(uiLocation);},_changeVie w:function() 432 return;WebInspector.panel("sources").showUILocation(uiLocation);},_changeView:fu nction()
445 {if(!this.profile) 433 {if(!this.profile)
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;} 434 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;}
447 this._statusBarButtonsElement.enableStyleClass("hidden",false);if(this._flameCha rt) 435 this._statusBarButtonsElement.enableStyleClass("hidden",false);if(this._flameCha rt)
448 this._flameChart.detach();this.dataGrid.show(this.element);if(!this.currentQuery ||!this._searchFinishedCallback||!this._searchResults) 436 this._flameChart.detach();this.dataGrid.show(this.element);if(!this.currentQuery ||!this._searchFinishedCallback||!this._searchResults)
449 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_percentClicked:funct ion(event) 437 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_percentClicked:funct ion(event)
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() 438 {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()
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) 439 {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)
452 {if(!this.dataGrid.selectedNode) 440 {if(!this.dataGrid.selectedNode)
453 return;this.resetButton.visible=true;this.profileDataGridTree.focus(this.dataGri d.selectedNode);this.refresh();this.refreshVisibleData();},_excludeClicked:funct ion(event) 441 return;this.resetButton.visible=true;this.profileDataGridTree.focus(this.dataGri d.selectedNode);this.refresh();this.refreshVisibleData();},_excludeClicked:funct ion(event)
454 {var selectedNode=this.dataGrid.selectedNode 442 {var selectedNode=this.dataGrid.selectedNode
(...skipping 27 matching lines...) Expand all
482 {if(this._recording){this.stopRecordingProfile();return false;}else{this.startRe cordingProfile();return true;}},get treeItemTitle() 470 {if(this._recording){this.stopRecordingProfile();return false;}else{this.startRe cordingProfile();return true;}},get treeItemTitle()
483 {return WebInspector.UIString("CPU PROFILES");},get description() 471 {return WebInspector.UIString("CPU PROFILES");},get description()
484 {return WebInspector.UIString("CPU profiles show where the execution time is spe nt in your page's JavaScript functions.");},addProfileHeader:function(profileHea der) 472 {return WebInspector.UIString("CPU profiles show where the execution time is spe nt in your page's JavaScript functions.");},addProfileHeader:function(profileHea der)
485 {this.addProfile(this.createProfile(profileHeader));},isRecordingProfile:functio n() 473 {this.addProfile(this.createProfile(profileHeader));},isRecordingProfile:functio n()
486 {return this._recording;},startRecordingProfile:function() 474 {return this._recording;},startRecordingProfile:function()
487 {this._recording=true;WebInspector.userMetrics.ProfilesCPUProfileTaken.record(); ProfilerAgent.start();},stopRecordingProfile:function() 475 {this._recording=true;WebInspector.userMetrics.ProfilesCPUProfileTaken.record(); ProfilerAgent.start();},stopRecordingProfile:function()
488 {this._recording=false;ProfilerAgent.stop();},setRecordingProfile:function(isPro filing) 476 {this._recording=false;ProfilerAgent.stop();},setRecordingProfile:function(isPro filing)
489 {this._recording=isProfiling;},createTemporaryProfile:function(title) 477 {this._recording=isProfiling;},createTemporaryProfile:function(title)
490 {title=title||WebInspector.UIString("Recording\u2026");return new WebInspector.C PUProfileHeader(this,title);},createProfile:function(profile) 478 {title=title||WebInspector.UIString("Recording\u2026");return new WebInspector.C PUProfileHeader(this,title);},createProfile:function(profile)
491 {return new WebInspector.CPUProfileHeader(this,profile.title,profile.uid);},remo veProfile:function(profile) 479 {return new WebInspector.CPUProfileHeader(this,profile.title,profile.uid);},remo veProfile:function(profile)
492 {WebInspector.ProfileType.prototype.removeProfile.call(this,profile);if(!profile .isTemporary) 480 {WebInspector.ProfileType.prototype.removeProfile.call(this,profile);if(!profile .isTemporary&&!profile.fromFile())
493 ProfilerAgent.removeProfile(this.id,profile.uid);},_requestProfilesFromBackend:f unction(populateCallback) 481 ProfilerAgent.removeProfile(this.id,profile.uid);},resetProfiles:function()
494 {ProfilerAgent.getProfileHeaders(populateCallback);},resetProfiles:function()
495 {this._reset();},addHeapSnapshotChunk:function(uid,chunk) 482 {this._reset();},addHeapSnapshotChunk:function(uid,chunk)
496 {throw new Error("Never called");},finishHeapSnapshot:function(uid)
497 {throw new Error("Never called");},reportHeapSnapshotProgress:function(done,tota l) 483 {throw new Error("Never called");},reportHeapSnapshotProgress:function(done,tota l)
498 {throw new Error("Never called");},__proto__:WebInspector.ProfileType.prototype} 484 {throw new Error("Never called");},__proto__:WebInspector.ProfileType.prototype}
499 WebInspector.CPUProfileHeader=function(type,title,uid) 485 WebInspector.CPUProfileHeader=function(type,title,uid)
500 {WebInspector.ProfileHeader.call(this,type,title,uid);} 486 {WebInspector.ProfileHeader.call(this,type,title,uid);}
501 WebInspector.CPUProfileHeader.prototype={onTransferStarted:function() 487 WebInspector.CPUProfileHeader.prototype={onTransferStarted:function()
502 {this._jsonifiedProfile="";this.sidebarElement.subtitle=WebInspector.UIString("L oading\u2026 %s",Number.bytesToString(this._jsonifiedProfile.length));},onChunkT ransferred:function(reader) 488 {this._jsonifiedProfile="";this.sidebarElement.subtitle=WebInspector.UIString("L oading\u2026 %s",Number.bytesToString(this._jsonifiedProfile.length));},onChunkT ransferred:function(reader)
503 {this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026 %d\%",Number. bytesToString(this._jsonifiedProfile.length));},onTransferFinished:function() 489 {this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026 %d\%",Number. bytesToString(this._jsonifiedProfile.length));},onTransferFinished:function()
504 {this.sidebarElement.subtitle=WebInspector.UIString("Parsing\u2026");this._profi le=JSON.parse(this._jsonifiedProfile);this._jsonifiedProfile=null;this.sidebarEl ement.subtitle=WebInspector.UIString("Loaded");this.isTemporary=false;},onError: function(reader,e) 490 {this.sidebarElement.subtitle=WebInspector.UIString("Parsing\u2026");this._profi le=JSON.parse(this._jsonifiedProfile);this._jsonifiedProfile=null;this.sidebarEl ement.subtitle=WebInspector.UIString("Loaded");this.isTemporary=false;},onError: function(reader,e)
505 {switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:this.sidebarEleme nt.subtitle=WebInspector.UIString("'%s' not found.",reader.fileName());break;cas e e.target.error.NOT_READABLE_ERR:this.sidebarElement.subtitle=WebInspector.UISt ring("'%s' is not readable",reader.fileName());break;case e.target.error.ABORT_E RR:break;default:this.sidebarElement.subtitle=WebInspector.UIString("'%s' error %d",reader.fileName(),e.target.error.code);}},write:function(text) 491 {switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:this.sidebarEleme nt.subtitle=WebInspector.UIString("'%s' not found.",reader.fileName());break;cas e e.target.error.NOT_READABLE_ERR:this.sidebarElement.subtitle=WebInspector.UISt ring("'%s' is not readable",reader.fileName());break;case e.target.error.ABORT_E RR:break;default:this.sidebarElement.subtitle=WebInspector.UIString("'%s' error %d",reader.fileName(),e.target.error.code);}},write:function(text)
506 {this._jsonifiedProfile+=text;},close:function(){},createSidebarTreeElement:func tion() 492 {this._jsonifiedProfile+=text;},close:function(){},createSidebarTreeElement:func tion()
507 {return new WebInspector.ProfileSidebarTreeElement(this,WebInspector.UIString("P rofile %d"),"profile-sidebar-tree-item");},createView:function(profilesPanel) 493 {return new WebInspector.ProfileSidebarTreeElement(this,WebInspector.UIString("P rofile %d"),"profile-sidebar-tree-item");},createView:function(profilesPanel)
508 {return new WebInspector.CPUProfileView(this);},canSaveToFile:function() 494 {return new WebInspector.CPUProfileView(this);},canSaveToFile:function()
509 {return true;},saveToFile:function() 495 {return true;},saveToFile:function()
510 {var fileOutputStream=new WebInspector.FileOutputStream();function getCPUProfile Callback(error,profile) 496 {var fileOutputStream=new WebInspector.FileOutputStream();function getCPUProfile Callback(error,profile)
511 {if(error){fileOutputStream.close();return;} 497 {if(error){fileOutputStream.close();return;}
512 if(!profile.head){fileOutputStream.close();return;} 498 if(!profile.head){fileOutputStream.close();return;}
513 fileOutputStream.write(JSON.stringify(profile),fileOutputStream.close.bind(fileO utputStream));} 499 fileOutputStream.write(JSON.stringify(profile),fileOutputStream.close.bind(fileO utputStream));}
514 function onOpen() 500 function onOpen()
515 {ProfilerAgent.getCPUProfile(this.uid,getCPUProfileCallback.bind(this));} 501 {ProfilerAgent.getCPUProfile(this.uid,getCPUProfileCallback.bind(this));}
516 this._fileName=this._fileName||"CPU-"+new Date().toISO8601Compact()+this._profil eType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));}, loadFromFile:function(file) 502 this._fileName=this._fileName||"CPU-"+new Date().toISO8601Compact()+this._profil eType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));}, loadFromFile:function(file)
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) 503 {this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026");this.sideba rElement.wait=true;var fileReader=new WebInspector.ChunkedFileReader(file,100000 00,this);fileReader.start(this);},__proto__:WebInspector.ProfileHeader.prototype };WebInspector.FlameChart=function(cpuProfileView)
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) 504 {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._entryInfo=this._chartContainer.createCh ild("div","entry-info");this._cpuProfileView=cpuProfileView;this._windowLeft=0.0 ;this._windowRight=1.0;this._barHeight=15;this._minWidth=1;this._paddingLeft=15; this._canvas.addEventListener("mousewheel",this._onMouseWheel.bind(this),false); this._canvas.addEventListener("click",this._onClick.bind(this),false);this._link ifier=new WebInspector.Linkifier();this._highlightedEntryIndex=-1;if(!WebInspect or.FlameChart._colorGenerator)
519 WebInspector.FlameChart._colorGenerator=new WebInspector.FlameChart.ColorGenerat or();} 505 WebInspector.FlameChart._colorGenerator=new WebInspector.FlameChart.ColorGenerat or();}
520 WebInspector.FlameChart.Calculator=function() 506 WebInspector.FlameChart.Calculator=function()
521 {} 507 {}
522 WebInspector.FlameChart.Calculator.prototype={_updateBoundaries:function(flameCh art) 508 WebInspector.FlameChart.Calculator.prototype={_updateBoundaries:function(flameCh art)
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) 509 {function log10(x)
510 {return Math.log(x)/Math.LN10;}
511 this._decimalDigits=Math.max(0,-Math.floor(log10(flameChart._timelineGrid.gridSl iceTime*1.01)));this._minimumBoundaries=flameChart._windowLeft*flameChart._timel ineData.totalTime;this._maximumBoundaries=flameChart._windowRight*flameChart._ti melineData.totalTime;this.paddingLeft=flameChart._paddingLeft;this._width=flameC hart._canvas.width-this.paddingLeft;this._timeToPixel=this._width/this.boundaryS pan();},computePosition:function(time)
524 {return(time-this._minimumBoundaries)*this._timeToPixel+this.paddingLeft;},forma tTime:function(value) 512 {return(time-this._minimumBoundaries)*this._timeToPixel+this.paddingLeft;},forma tTime:function(value)
525 {return WebInspector.UIString("%s\u2009ms",Number.withThousandsSeparator(Math.ro und(value+this._minimumBoundaries)));},maximumBoundary:function() 513 {var format="%."+this._decimalDigits+"f\u2009ms";return WebInspector.UIString(fo rmat,value+this._minimumBoundaries);},maximumBoundary:function()
526 {return this._maximumBoundaries;},minimumBoundary:function() 514 {return this._maximumBoundaries;},minimumBoundary:function()
527 {return this._minimumBoundaries;},zeroTime:function() 515 {return this._minimumBoundaries;},zeroTime:function()
528 {return 0;},boundarySpan:function() 516 {return 0;},boundarySpan:function()
529 {return this._maximumBoundaries-this._minimumBoundaries;}} 517 {return this._maximumBoundaries-this._minimumBoundaries;}}
530 WebInspector.FlameChart.OverviewCalculator=function() 518 WebInspector.FlameChart.OverviewCalculator=function()
531 {} 519 {}
532 WebInspector.FlameChart.OverviewCalculator.prototype={_updateBoundaries:function (flameChart) 520 WebInspector.FlameChart.OverviewCalculator.prototype={_updateBoundaries:function (flameChart)
533 {this._minimumBoundaries=0;this._maximumBoundaries=flameChart._timelineData.tota lTime;this._xScaleFactor=flameChart._canvas.width/flameChart._timelineData.total Time;},computePosition:function(time) 521 {this._minimumBoundaries=0;this._maximumBoundaries=flameChart._timelineData.tota lTime;this._xScaleFactor=flameChart._canvas.width/flameChart._timelineData.total Time;},computePosition:function(time)
534 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue) 522 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue)
535 {return Number.secondsToString((value+this._minimumBoundaries)/1000);},maximumBo undary:function() 523 {return Number.secondsToString((value+this._minimumBoundaries)/1000);},maximumBo undary:function()
536 {return this._maximumBoundaries;},minimumBoundary:function() 524 {return this._maximumBoundaries;},minimumBoundary:function()
537 {return this._minimumBoundaries;},zeroTime:function() 525 {return this._minimumBoundaries;},zeroTime:function()
538 {return this._minimumBoundaries;},boundarySpan:function() 526 {return this._minimumBoundaries;},boundarySpan:function()
539 {return this._maximumBoundaries-this._minimumBoundaries;}} 527 {return this._maximumBoundaries-this._minimumBoundaries;}}
540 WebInspector.FlameChart.Events={SelectedNode:"SelectedNode"} 528 WebInspector.FlameChart.Events={SelectedNode:"SelectedNode"}
541 WebInspector.FlameChart.ColorGenerator=function() 529 WebInspector.FlameChart.ColorGenerator=function()
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);} 530 {this._colorPairs={};this._colorIndexes=[];this._currentColorIndex=0;this._color PairForID("(idle)::0",50);this._colorPairForID("(program)::0",50);this._colorPai rForID("(garbage collector)::0",50);}
543 WebInspector.FlameChart.ColorGenerator.prototype={_colorPairForID:function(id) 531 WebInspector.FlameChart.ColorGenerator.prototype={_colorPairForID:function(id,sa t)
544 {var colorPairs=this._colorPairs;var colorPair=colorPairs[id];if(!colorPair) 532 {if(typeof sat!=="number")
545 colorPairs[id]=colorPair=this._createPair(this._currentColorIndex++);return colo rPair;},_createPair:function(index,sat) 533 sat=100;var colorPairs=this._colorPairs;var colorPair=colorPairs[id];if(!colorPa ir){colorPairs[id]=colorPair=this._createPair(this._currentColorIndex++,sat);thi s._colorIndexes[colorPair.index]=colorPair;}
546 {var hue=(index*7+12*(index%2))%360;if(typeof sat!=="number") 534 return colorPair;},_colorPairForIndex:function(index)
547 sat=100;return{index:index,highlighted:"hsla("+hue+", "+sat+"%, 33%, 0.7)",norma l:"hsla("+hue+", "+sat+"%, 66%, 0.7)"}}} 535 {return this._colorIndexes[index];},_createPair:function(index,sat)
536 {var hue=(index*7+12*(index%2))%360;return{index:index,highlighted:"hsla("+hue+" , "+sat+"%, 33%, 0.7)",normal:"hsla("+hue+", "+sat+"%, 66%, 0.7)"}}}
548 WebInspector.FlameChart.Entry=function(colorPair,depth,duration,startTime,node) 537 WebInspector.FlameChart.Entry=function(colorPair,depth,duration,startTime,node)
549 {this.colorPair=colorPair;this.depth=depth;this.duration=duration;this.startTime =startTime;this.node=node;this.selfTime=0;} 538 {this.colorPair=colorPair;this.depth=depth;this.duration=duration;this.startTime =startTime;this.node=node;this.selfTime=0;}
550 WebInspector.FlameChart.prototype={selectRange:function(timeLeft,timeRight) 539 WebInspector.FlameChart.prototype={selectRange:function(timeLeft,timeRight)
551 {this._overviewGrid.setWindow(timeLeft/this._totalTime,timeRight/this._totalTime );},_onWindowChanged:function(event) 540 {this._overviewGrid.setWindow(timeLeft/this._totalTime,timeRight/this._totalTime );},_onWindowChanged:function(event)
552 {this._scheduleUpdate();},_startCanvasDragging:function(event) 541 {this._scheduleUpdate();},_startCanvasDragging:function(event)
553 {if(!this._timelineData) 542 {if(!this._timelineData)
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) 543 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)
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) 544 {var pixelShift=this._dragStartPoint-event.pageX;var windowShift=pixelShift/this ._totalPixels;var windowLeft=Math.max(0,this._dragStartWindowLeft+windowShift);i f(windowLeft===this._windowLeft)
556 return;windowShift=windowLeft-this._dragStartWindowLeft;var windowRight=Math.min (1,this._dragStartWindowRight+windowShift);if(windowRight===this._windowRight) 545 return;windowShift=windowLeft-this._dragStartWindowLeft;var windowRight=Math.min (1,this._dragStartWindowRight+windowShift);if(windowRight===this._windowRight)
557 return;windowShift=windowRight-this._dragStartWindowRight;this._overviewGrid.set Window(this._dragStartWindowLeft+windowShift,this._dragStartWindowRight+windowSh ift);this._wasDragged=true;},_endCanvasDragging:function() 546 return;windowShift=windowRight-this._dragStartWindowRight;this._overviewGrid.set Window(this._dragStartWindowLeft+windowShift,this._dragStartWindowRight+windowSh ift);this._wasDragged=true;},_endCanvasDragging:function()
558 {this._isDragging=false;},_calculateTimelineData:function() 547 {this._isDragging=false;},_calculateTimelineData:function()
559 {if(this._cpuProfileView.samples)
560 return this._calculateTimelineDataForSamples();if(this._timelineData)
561 return this._timelineData;if(!this._cpuProfileView.profileHead)
562 return null;var index=0;var entries=[];function appendReversedArray(toArray,from Array)
563 {for(var i=fromArray.length-1;i>=0;--i)
564 toArray.push(fromArray[i]);}
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);}
567 while(stack.length===levelExitIndexes[levelExitIndexes.length-1]){levelOffsets.p op();levelExitIndexes.pop();}}
568 this._timelineData={entries:entries,colorIndexEntryChains:colorIndexEntryChains, totalTime:this._cpuProfileView.profileHead.totalTime,}
569 return this._timelineData;},_calculateTimelineDataForSamples:function()
570 {if(this._timelineData) 548 {if(this._timelineData)
571 return this._timelineData;if(!this._cpuProfileView.profileHead) 549 return this._timelineData;if(!this._cpuProfileView.profileHead)
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;} 550 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 colorEntryIndexes=[];var maxDepth=5;var depth=0;for(var sampleIndex=0;sampleIndex<samplesCount;sampleIndex++){var node= idToNode[samples[sampleIndex]];stackTrace.length=0;while(node){stackTrace.push(n ode);node=node.parent;}
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;} 551 stackTrace.pop();maxDepth=Math.max(maxDepth,depth);depth=0;node=stackTrace.pop() ;var intervalIndex;if(node===gcNode){while(depth<openIntervals.length){intervalI ndex=openIntervals[depth].index;entries[intervalIndex].duration+=samplingInterva l;++depth;}
574 if(openIntervals.length>0&&openIntervals.peekLast().node===node){entries[interva lIndex].selfTime+=samplingInterval;continue;}} 552 if(openIntervals.length>0&&openIntervals.peekLast().node===node){entries[interva lIndex].selfTime+=samplingInterval;continue;}}
575 while(node&&depth<openIntervals.length&&node===openIntervals[depth].node){interv alIndex=openIntervals[depth].index;entries[intervalIndex].duration+=samplingInte rval;node=stackTrace.pop();++depth;} 553 while(node&&depth<openIntervals.length&&node===openIntervals[depth].node){interv alIndex=openIntervals[depth].index;entries[intervalIndex].duration+=samplingInte rval;node=stackTrace.pop();++depth;}
576 if(depth<openIntervals.length) 554 if(depth<openIntervals.length)
577 openIntervals.length=depth;if(!node){entries[intervalIndex].selfTime+=samplingIn terval;continue;} 555 openIntervals.length=depth;if(!node){entries[intervalIndex].selfTime+=samplingIn terval;continue;}
578 while(node){var colorPair=colorGenerator._colorPairForID(node.functionName+":"+n ode.url+":"+node.lineNumber);var colorIndexEntries=colorIndexEntryChains[colorPa ir.index];if(!colorIndexEntries) 556 while(node){var colorPair=colorGenerator._colorPairForID(node.functionName+":"+n ode.url+":"+node.lineNumber);var indexesForColor=colorEntryIndexes[colorPair.ind ex];if(!indexesForColor)
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;} 557 indexesForColor=colorEntryIndexes[colorPair.index]=[];var entry=new WebInspector .FlameChart.Entry(colorPair,depth,samplingInterval,sampleIndex*samplingInterval, node);indexesForColor.push(entries.length);entries.push(entry);openIntervals.pus h({node:node,index:index});++index;node=stackTrace.pop();++depth;}
580 entries[entries.length-1].selfTime+=samplingInterval;} 558 entries[entries.length-1].selfTime+=samplingInterval;}
581 this._timelineData={entries:entries,colorIndexEntryChains:colorIndexEntryChains, totalTime:this._cpuProfileView.profileHead.totalTime};return this._timelineData; },_onMouseMove:function(event) 559 this._maxStackDepth=Math.max(maxDepth,depth);var entryColorIndexes=new Uint16Arr ay(entries.length);var entryLevels=new Uint8Array(entries.length);var entryTotal Times=new Float32Array(entries.length);var entryOffsets=new Float32Array(entries .length);var entryTitles=new Array(entries.length);var entryDeoptFlags=new Uint8 Array(entries.length);for(var i=0;i<entries.length;++i){var entry=entries[i];ent ryColorIndexes[i]=colorPair.index;entryLevels[i]=entry.depth;entryTotalTimes[i]= entry.duration;entryOffsets[i]=entry.startTime;entryTitles[i]=entry.node.functio nName;var reason=entry.node.deoptReason;entryDeoptFlags[i]=(reason&&reason!=="no reason");}
560 this._timelineData={entries:entries,totalTime:this._cpuProfileView.profileHead.t otalTime,entryColorIndexes:entryColorIndexes,entryLevels:entryLevels,entryTotalT imes:entryTotalTimes,entryOffsets:entryOffsets,colorEntryIndexes:colorEntryIndex es,entryTitles:entryTitles,entryDeoptFlags:entryDeoptFlags};return this._timelin eData;},_onMouseMove:function(event)
582 {if(this._isDragging) 561 {if(this._isDragging)
583 return;var entryIndex=this._coordinatesToEntryIndex(event.offsetX,event.offsetY) ;if(this._highlightedEntryIndex===entryIndex) 562 return;var entryIndex=this._coordinatesToEntryIndex(event.offsetX,event.offsetY) ;if(this._highlightedEntryIndex===entryIndex)
584 return;if(entryIndex===-1||this._timelineData.entries[entryIndex].node.scriptId= =="0") 563 return;if(entryIndex===-1||this._timelineData.entries[entryIndex].node.scriptId= =="0")
585 this._canvas.style.cursor="default";else 564 this._canvas.style.cursor="default";else
586 this._canvas.style.cursor="pointer";this._highlightedEntryIndex=entryIndex;this. _scheduleUpdate();},_millisecondsToString:function(ms) 565 this._canvas.style.cursor="pointer";this._highlightedEntryIndex=entryIndex;this. _scheduleUpdate();},_millisecondsToString:function(ms)
587 {if(ms===0) 566 {if(ms===0)
588 return"0";if(ms<1000) 567 return"0";if(ms<1000)
589 return WebInspector.UIString("%.1f\u2009ms",ms);return Number.secondsToString(ms /1000,true);},_prepareHighlightedEntryInfo:function() 568 return WebInspector.UIString("%.1f\u2009ms",ms);return Number.secondsToString(ms /1000,true);},_prepareHighlightedEntryInfo:function()
590 {if(this._isDragging) 569 {if(this._isDragging)
591 return null;var entry=this._timelineData.entries[this._highlightedEntryIndex];if (!entry) 570 return null;var entry=this._timelineData.entries[this._highlightedEntryIndex];if (!entry)
592 return null;var node=entry.node;if(!node) 571 return null;var node=entry.node;if(!node)
593 return null;var entryInfo=[];function pushEntryInfoRow(title,text) 572 return null;var entryInfo=[];function pushEntryInfoRow(title,text)
594 {var row={};row.title=title;row.text=text;entryInfo.push(row);} 573 {var row={};row.title=title;row.text=text;entryInfo.push(row);}
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);} 574 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);}
596 if(node.url) 575 if(node.url)
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") 576 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")
598 pushEntryInfoRow(WebInspector.UIString("Not optimized"),node.deoptReason);return entryInfo;},_onClick:function(e) 577 pushEntryInfoRow(WebInspector.UIString("Not optimized"),node.deoptReason);return entryInfo;},_onClick:function(e)
599 {if(this._wasDragged) 578 {if(this._wasDragged)
600 return;if(this._highlightedEntryIndex===-1) 579 return;if(this._highlightedEntryIndex===-1)
601 return;var node=this._timelineData.entries[this._highlightedEntryIndex].node;thi s.dispatchEventToListeners(WebInspector.FlameChart.Events.SelectedNode,node);},_ onMouseWheel:function(e) 580 return;var node=this._timelineData.entries[this._highlightedEntryIndex].node;thi s.dispatchEventToListeners(WebInspector.FlameChart.Events.SelectedNode,node);},_ onMouseWheel:function(e)
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) 581 {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)
603 {var timelineData=this._timelineData;if(!timelineData) 582 {var timelineData=this._timelineData;if(!timelineData)
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) 583 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)
605 return-1;if(cursorTime<(timelineEntries[i].startTime+timelineEntries[i].duration )&&cursorLevel===timelineEntries[i].depth) 584 return-1;if(cursorTime<(timelineEntries[i].startTime+timelineEntries[i].duration )&&cursorLevel===timelineEntries[i].depth)
606 return i;} 585 return i;}
607 return-1;},onResize:function() 586 return-1;},onResize:function()
608 {this._updateOverviewCanvas=true;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height) 587 {this._updateOverviewCanvas=true;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height)
609 {if(!this._timelineData) 588 {if(!this._timelineData)
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);}} 589 return;var timelineEntries=this._timelineData.entries;var drawData=new Uint8Arra y(width);var scaleFactor=width/this._totalTime;for(var entryIndex=0;entryIndex<t imelineEntries.length;++entryIndex){var entry=timelineEntries[entryIndex];var st art=Math.floor(entry.startTime*scaleFactor);var finish=Math.floor((entry.startTi me+entry.duration)*scaleFactor);for(var x=start;x<finish;++x)
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) 590 drawData[x]=Math.max(drawData[x],entry.depth+1);}
591 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/(this._maxStackDepth*1.1);context.lineWidth=1;context.tran slate(0.5,0.5);context.strokeStyle="rgba(20,0,0,0.4)";context.fillStyle="rgba(21 4,225,254,0.8)";context.moveTo(-1,canvasHeight-1);if(drawData)
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);} 592 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);}
613 context.lineTo(canvasWidth+1,value);context.lineTo(canvasWidth+1,canvasHeight-1) ;context.fill();context.stroke();context.closePath();},_entryToAnchorBox:functio n(entry,anchorBox) 593 context.lineTo(canvasWidth+1,value);context.lineTo(canvasWidth+1,canvasHeight-1) ;context.fill();context.stroke();context.closePath();},draw:function(width,heigh t)
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;}
615 anchorBox.width=Number.constrain(anchorBox.width,0,this._canvas.width-anchorBox. x);},draw:function(width,height)
616 {var timelineData=this._calculateTimelineData();if(!timelineData) 594 {var timelineData=this._calculateTimelineData();if(!timelineData)
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) 595 return;var ratio=window.devicePixelRatio;this._canvas.width=width*ratio;this._ca nvas.height=height*ratio;this._canvas.style.width=width+"px";this._canvas.style. height=height+"px";var context=this._canvas.getContext("2d");context.scale(ratio ,ratio);var timeWindowRight=this._timeWindowRight;var timeToPixel=this._timeToPi xel;var pixelWindowLeft=this._pixelWindowLeft;var paddingLeft=this._paddingLeft; var minWidth=this._minWidth;var entryTotalTimes=this._timelineData.entryTotalTim es;var entryOffsets=this._timelineData.entryOffsets;var entryLevels=this._timeli neData.entryLevels;var colorEntryIndexes=this._timelineData.colorEntryIndexes;va r entryTitles=this._timelineData.entryTitles;var entryDeoptFlags=this._timelineD ata.entryDeoptFlags;var colorGenerator=WebInspector.FlameChart._colorGenerator;v ar titleIndexes=new Uint32Array(this._timelineData.entryTotalTimes);var lastTitl eIndex=0;var dotsWidth=context.measureText("\u2026").width;var textPaddingLeft=2 ;this._minTextWidth=context.measureText("\u2026").width+textPaddingLeft;var minT extWidth=this._minTextWidth;var marksField=[];for(var i=0;i<this._maxStackDepth; ++i)
618 {var anchorBox=new AnchorBox();for(var j=0;j<colorIndexEntryChains.length;++j){v ar entries=colorIndexEntryChains[j];if(!entries) 596 marksField.push(new Uint16Array(width));var barHeight=this._barHeight;var barX=0 ;var barWidth=0;var barRight=0;var barLevel=0;var bHeight=height-barHeight;conte xt.strokeStyle="black";var colorPair;var entryIndex=0;var entryOffset=0;for(var colorIndex=0;colorIndex<colorEntryIndexes.length;++colorIndex){colorPair=colorGe nerator._colorPairForIndex(colorIndex);context.fillStyle=colorPair.normal;var in dexes=colorEntryIndexes[colorIndex];if(!indexes)
619 continue;for(var i=0;i<entries.length;++i){var entry=entries[i];var startTime=en try.startTime;if(startTime>timeWindowRight) 597 continue;context.beginPath();for(var i=0;i<indexes.length;++i){entryIndex=indexe s[i];entryOffset=entryOffsets[entryIndex];if(entryOffset>timeWindowRight)
620 break;if((startTime+entry.duration)<visibleTimeLeft) 598 break;barX=Math.ceil(entryOffset*timeToPixel)-pixelWindowLeft+paddingLeft;barRig ht=Math.floor((entryOffset+entryTotalTimes[entryIndex])*timeToPixel)-pixelWindow Left+paddingLeft;if(barRight<0)
621 continue;flameChart._entryToAnchorBox(entry,anchorBox);callback(flameChart,conte xt,entry,anchorBox,flameChart._highlightedEntryIndex===i);}}} 599 continue;barWidth=(barRight-barX)||minWidth;barLevel=entryLevels[entryIndex];var marksRow=marksField[barLevel];if(barWidth<=marksRow[barX])
622 function drawBar(flameChart,context,entry,anchorBox,highlighted) 600 continue;marksRow[barX]=barWidth;if(entryIndex===this._highlightedEntryIndex){co ntext.fill();context.beginPath();context.fillStyle=colorPair.highlighted;}
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;} 601 context.rect(barX,bHeight-barLevel*barHeight,barWidth,barHeight);if(entryIndex== =this._highlightedEntryIndex){context.fill();context.beginPath();context.fillSty le=colorPair.normal;}
602 if(barWidth>minTextWidth)
603 titleIndexes[lastTitleIndex++]=entryIndex;}
624 context.fill();} 604 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) 605 var font=(barHeight-4)+"px "+window.getComputedStyle(this.element,null).getPrope rtyValue("font-family");var boldFont="bold "+font;var isBoldFontSelected=false;c ontext.font=font;context.textBaseline="alphabetic";context.fillStyle="#333";this ._dotsWidth=context.measureText("\u2026").width;var textBaseHeight=bHeight+barHe ight-4;for(var i=0;i<lastTitleIndex;++i){entryIndex=titleIndexes[i];if(isBoldFon tSelected){if(!entryDeoptFlags[entryIndex]){context.font=font;isBoldFontSelected =false;}}else{if(entryDeoptFlags[entryIndex]){context.font=boldFont;isBoldFontSe lected=true;}}
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;}} 606 entryOffset=entryOffsets[entryIndex];barX=Math.floor(entryOffset*timeToPixel)-pi xelWindowLeft+paddingLeft;barRight=Math.ceil((entryOffset+entryTotalTimes[entryI ndex])*timeToPixel)-pixelWindowLeft+paddingLeft;barWidth=(barRight-barX)||minWid th;var xText=Math.max(0,barX);var widthText=barWidth-textPaddingLeft+barX-xText; var title=this._prepareText(context,entryTitles[entryIndex],widthText);if(title)
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) 607 context.fillText(title,xText+textPaddingLeft,textBaseHeight-entryLevels[entryInd ex]*barHeight);}
628 context.fillText(title,xText+textPaddingLeft,anchorBox.y+barHeight-4);} 608 var entryInfo=this._prepareHighlightedEntryInfo();this._entryInfo.removeChildren ();if(entryInfo)
629 forEachEntry(this,drawText);var entryInfo=this._prepareHighlightedEntryInfo();if (entryInfo) 609 this._entryInfo.appendChild(this._buildEntryInfo(entryInfo));},_buildEntryInfo:f unction(entryInfo)
630 this._printEntryInfo(context,entryInfo,0,25,width);},_printEntryInfo:function(co ntext,entryInfo,x,y,width) 610 {var infoTable=document.createElement("table");infoTable.className="info-table"; for(var i=0;i<entryInfo.length;++i){var row=infoTable.createChild("tr");var titl eCell=row.createChild("td");titleCell.textContent=entryInfo[i].title;titleCell.c lassName="title";var textCell=row.createChild("td");textCell.textContent=entryIn fo[i].text;}
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) 611 return infoTable;},_prepareText:function(context,title,maxSize)
632 maxTitleWidth=Math.max(maxTitleWidth,context.measureText(entryInfo[i].title).wid th);var maxTextWidth=0;for(var i=0;i<entryInfo.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)
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)
635 {if(maxSize<this._dotsWidth) 612 {if(maxSize<this._dotsWidth)
636 return null;var titleWidth=context.measureText(title).width;if(maxSize>titleWidt h) 613 return null;var titleWidth=context.measureText(title).width;if(maxSize>titleWidt h)
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) 614 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)
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";} 615 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";}
639 while(match){var substring=title.substring(match.index+1);var width=context.meas ureText(substring).width;if(maxSize>width) 616 while(match){var substring=title.substring(match.index+1);var width=context.meas ureText(substring).width;if(maxSize>width)
640 return"\u2026"+substring;match=dotRegExp.exec(title);} 617 return"\u2026"+substring;match=dotRegExp.exec(title);}
641 var i=0;do{++i;}while(context.measureText(title.substring(0,i)).width<maxSize);r eturn title.substring(0,i-1)+"\u2026";},_scheduleUpdate:function() 618 var i=0;do{++i;}while(context.measureText(title.substring(0,i)).width<maxSize);r eturn title.substring(0,i-1)+"\u2026";},_scheduleUpdate:function()
642 {if(this._updateTimerId) 619 {if(this._updateTimerId)
643 return;this._updateTimerId=setTimeout(this.update.bind(this),10);},_updateBounda ries:function() 620 return;this._updateTimerId=setTimeout(this.update.bind(this),10);},_updateBounda ries:function()
644 {this._windowLeft=this._overviewGrid.windowLeft();this._windowRight=this._overvi ewGrid.windowRight();this._windowWidth=this._windowRight-this._windowLeft;this._ totalTime=this._timelineData.totalTime;this._timeWindowLeft=this._windowLeft*thi s._totalTime;this._timeWindowRight=this._windowRight*this._totalTime;this._pixel WindowWidth=this._chartContainer.clientWidth;this._totalPixels=Math.floor(this._ pixelWindowWidth/this._windowWidth);this._pixelWindowLeft=Math.floor(this._total Pixels*this._windowLeft);this._pixelWindowRight=Math.floor(this._totalPixels*thi s._windowRight);this._timeToPixel=this._totalPixels/this._totalTime;this._pixelT oTime=this._totalTime/this._totalPixels;this._paddingLeftTime=this._paddingLeft/ this._timeToPixel;},update:function() 621 {this._windowLeft=this._overviewGrid.windowLeft();this._windowRight=this._overvi ewGrid.windowRight();this._windowWidth=this._windowRight-this._windowLeft;this._ totalTime=this._timelineData.totalTime;this._timeWindowLeft=this._windowLeft*thi s._totalTime;this._timeWindowRight=this._windowRight*this._totalTime;this._pixel WindowWidth=this._chartContainer.clientWidth;this._totalPixels=Math.floor(this._ pixelWindowWidth/this._windowWidth);this._pixelWindowLeft=Math.floor(this._total Pixels*this._windowLeft);this._pixelWindowRight=Math.floor(this._totalPixels*thi s._windowRight);this._timeToPixel=this._totalPixels/this._totalTime;this._pixelT oTime=this._totalTime/this._totalPixels;this._paddingLeftTime=this._paddingLeft/ this._timeToPixel;},update:function()
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 {this._dispatcher=dispatcher;} 709 {this._dispatcher=dispatcher;}
733 WebInspector.HeapSnapshotProgress.Event={Update:"ProgressUpdate"};WebInspector.H eapSnapshotProgress.prototype={updateStatus:function(status) 710 WebInspector.HeapSnapshotProgress.Event={Update:"ProgressUpdate"};WebInspector.H eapSnapshotProgress.prototype={updateStatus:function(status)
734 {this._sendUpdateEvent(WebInspector.UIString(status));},updateProgress:function( title,value,total) 711 {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) 712 {var percentValue=((total?(value/total):0)*100).toFixed(0);this._sendUpdateEvent (WebInspector.UIString(title,percentValue));},_sendUpdateEvent:function(text)
736 {if(this._dispatcher) 713 {if(this._dispatcher)
737 this._dispatcher.sendEvent(WebInspector.HeapSnapshotProgress.Event.Update,text); }} 714 this._dispatcher.sendEvent(WebInspector.HeapSnapshotProgress.Event.Update,text); }}
738 WebInspector.HeapSnapshot=function(profile,progress) 715 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) 716 {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");}} 717 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() 718 WebInspector.HeapSnapshot.enableAllocationProfiler=false;function HeapSnapshotMe tainfo()
742 {this.node_fields=[];this.node_types=[];this.edge_fields=[];this.edge_types=[];t his.type_strings={};this.fields=[];this.types=[];} 719 {this.node_fields=[];this.node_types=[];this.edge_fields=[];this.edge_types=[];t his.trace_function_info_fields=[];this.trace_node_fields=[];this.type_strings={} ;}
743 function HeapSnapshotHeader() 720 function HeapSnapshotHeader()
744 {this.title="";this.uid=0;this.meta=new HeapSnapshotMetainfo();this.node_count=0 ;this.edge_count=0;} 721 {this.title="";this.uid=0;this.meta=new HeapSnapshotMetainfo();this.node_count=0 ;this.edge_count=0;}
745 WebInspector.HeapSnapshot.prototype={_init:function() 722 WebInspector.HeapSnapshot.prototype={_init: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() 723 {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()
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() 724 {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()
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) 725 {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 firstEdgeIndexes=this._firstEdgeIndexes;var nodeCount=this.nodeCount;for(var toNodeFieldIndex=edgeToNodeOffset,l=containmentEdges.length;toNodeFieldIndex<l;t oNodeFieldIndex+=edgeFieldsCount){var toNodeIndex=containmentEdges[toNodeFieldIn dex];if(toNodeIndex%nodeFieldCount)
749 throw new Error("Invalid toNodeIndex "+toNodeIndex);++firstRetainerIndex[toNodeI ndex/nodeFieldCount];} 726 throw new Error("Invalid toNodeIndex "+toNodeIndex);++firstRetainerIndex[toNodeI ndex/nodeFieldCount];}
750 for(var i=0,firstUnusedRetainerSlot=0;i<nodeCount;i++){var retainersCount=firstR etainerIndex[i];firstRetainerIndex[i]=firstUnusedRetainerSlot;retainingNodes[fir stUnusedRetainerSlot]=retainersCount;firstUnusedRetainerSlot+=retainersCount;} 727 for(var i=0,firstUnusedRetainerSlot=0;i<nodeCount;i++){var retainersCount=firstR etainerIndex[i];firstRetainerIndex[i]=firstUnusedRetainerSlot;retainingNodes[fir stUnusedRetainerSlot]=retainersCount;firstUnusedRetainerSlot+=retainersCount;}
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) 728 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)
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) 729 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)
753 {throw new Error("Not implemented");},createEdge:function(edges,edgeIndex) 730 {throw new Error("Not implemented");},createEdge:function(edges,edgeIndex)
754 {throw new Error("Not implemented");},createRetainingEdge:function(retainedNodeI ndex,retainerIndex) 731 {throw new Error("Not implemented");},createRetainingEdge:function(retainedNodeI ndex,retainerIndex)
755 {throw new Error("Not implemented");},dispose:function() 732 {throw new Error("Not implemented");},dispose:function()
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;} 733 {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;}
757 delete this._dominatedNodes;delete this._firstDominatedNodeIndex;delete this._no deDistances;delete this._dominatorsTree;},_allNodes:function() 734 delete this._dominatedNodes;delete this._firstDominatedNodeIndex;delete this._no deDistances;delete this._dominatorsTree;},_allNodes:function()
758 {return new WebInspector.HeapSnapshotNodeIterator(this.rootNode());},rootNode:fu nction() 735 {return new WebInspector.HeapSnapshotNodeIterator(this.rootNode());},rootNode:fu nction()
(...skipping 16 matching lines...) Expand all
775 this._aggregatesForDiff[className]={indexes:indexes,ids:ids,selfSizes:selfSizes} ;} 752 this._aggregatesForDiff[className]={indexes:indexes,ids:ids,selfSizes:selfSizes} ;}
776 return this._aggregatesForDiff;},_isUserRoot:function(node) 753 return this._aggregatesForDiff;},_isUserRoot:function(node)
777 {return true;},forEachRoot:function(action,userRootsOnly) 754 {return true;},forEachRoot:function(action,userRootsOnly)
778 {for(var iter=this.rootNode().edges();iter.hasNext();iter.next()){var node=iter. edge.node();if(!userRootsOnly||this._isUserRoot(node)) 755 {for(var iter=this.rootNode().edges();iter.hasNext();iter.next()){var node=iter. edge.node();if(!userRootsOnly||this._isUserRoot(node))
779 action(node);}},_calculateDistances:function() 756 action(node);}},_calculateDistances:function()
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) 757 {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)
781 distances[i]=noDistance;var nodesToVisit=new Uint32Array(this.nodeCount);var nod esToVisitLength=0;function enqueueNode(node) 758 distances[i]=noDistance;var nodesToVisit=new Uint32Array(this.nodeCount);var nod esToVisitLength=0;function enqueueNode(node)
782 {var ordinal=node._ordinal();if(distances[ordinal]!==noDistance) 759 {var ordinal=node._ordinal();if(distances[ordinal]!==noDistance)
783 return;distances[ordinal]=0;nodesToVisit[nodesToVisitLength++]=node.nodeIndex;} 760 return;distances[ordinal]=0;nodesToVisit[nodesToVisitLength++]=node.nodeIndex;}
784 this.forEachRoot(enqueueNode,true);this._bfs(nodesToVisit,nodesToVisitLength,dis tances);nodesToVisitLength=0;this.forEachRoot(enqueueNode);this._bfs(nodesToVisi t,nodesToVisitLength,distances);this._nodeDistances=distances;},_bfs:function(no desToVisit,nodesToVisitLength,distances) 761 this.forEachRoot(enqueueNode,true);this._bfs(nodesToVisit,nodesToVisitLength,dis tances);nodesToVisitLength=0;this.forEachRoot(enqueueNode);this._bfs(nodesToVisi t,nodesToVisitLength,distances);this._nodeDistances=distances;},_bfs:function(no desToVisit,nodesToVisitLength,distances)
785 {var edgeFieldsCount=this._edgeFieldsCount;var nodeFieldCount=this._nodeFieldCou nt;var containmentEdges=this._containmentEdges;var firstEdgeIndexes=this._firstE dgeIndexes;var edgeToNodeOffset=this._edgeToNodeOffset;var edgeTypeOffset=this._ edgeTypeOffset;var nodes=this._nodes;var nodeCount=this.nodeCount;var containmen tEdgesLength=containmentEdges.length;var edgeWeakType=this._edgeWeakType;var noD istance=this._noDistance;var index=0;while(index<nodesToVisitLength){var nodeInd ex=nodesToVisit[index++];var nodeOrdinal=nodeIndex/nodeFieldCount;var distance=d istances[nodeOrdinal]+1;var firstEdgeIndex=firstEdgeIndexes[nodeOrdinal];var edg esEnd=firstEdgeIndexes[nodeOrdinal+1];for(var edgeIndex=firstEdgeIndex;edgeIndex <edgesEnd;edgeIndex+=edgeFieldsCount){var edgeType=containmentEdges[edgeIndex+ed geTypeOffset];if(edgeType==edgeWeakType) 762 {var edgeFieldsCount=this._edgeFieldsCount;var nodeFieldCount=this._nodeFieldCou nt;var containmentEdges=this._containmentEdges;var firstEdgeIndexes=this._firstE dgeIndexes;var edgeToNodeOffset=this._edgeToNodeOffset;var edgeTypeOffset=this._ edgeTypeOffset;var nodeCount=this.nodeCount;var containmentEdgesLength=containme ntEdges.length;var edgeWeakType=this._edgeWeakType;var noDistance=this._noDistan ce;var index=0;while(index<nodesToVisitLength){var nodeIndex=nodesToVisit[index+ +];var nodeOrdinal=nodeIndex/nodeFieldCount;var distance=distances[nodeOrdinal]+ 1;var firstEdgeIndex=firstEdgeIndexes[nodeOrdinal];var edgesEnd=firstEdgeIndexes [nodeOrdinal+1];for(var edgeIndex=firstEdgeIndex;edgeIndex<edgesEnd;edgeIndex+=e dgeFieldsCount){var edgeType=containmentEdges[edgeIndex+edgeTypeOffset];if(edgeT ype==edgeWeakType)
786 continue;var childNodeIndex=containmentEdges[edgeIndex+edgeToNodeOffset];var chi ldNodeOrdinal=childNodeIndex/nodeFieldCount;if(distances[childNodeOrdinal]!==noD istance) 763 continue;var childNodeIndex=containmentEdges[edgeIndex+edgeToNodeOffset];var chi ldNodeOrdinal=childNodeIndex/nodeFieldCount;if(distances[childNodeOrdinal]!==noD istance)
787 continue;distances[childNodeOrdinal]=distance;nodesToVisit[nodesToVisitLength++] =childNodeIndex;}} 764 continue;distances[childNodeOrdinal]=distance;nodesToVisit[nodesToVisitLength++] =childNodeIndex;}}
788 if(nodesToVisitLength>nodeCount) 765 if(nodesToVisitLength>nodeCount)
789 throw new Error("BFS failed. Nodes to visit ("+nodesToVisitLength+") is more tha n nodes count ("+nodeCount+")");},_buildAggregates:function(filter) 766 throw new Error("BFS failed. Nodes to visit ("+nodesToVisitLength+") is more tha n nodes count ("+nodeCount+")");},_buildAggregates:function(filter)
790 {var aggregates={};var aggregatesByClassName={};var classIndexes=[];var nodes=th is._nodes;var mapAndFlag=this.userObjectsMapAndFlag();var flags=mapAndFlag?mapAn dFlag.map:null;var flag=mapAndFlag?mapAndFlag.flag:0;var nodesLength=nodes.lengt h;var nodeNativeType=this._nodeNativeType;var nodeFieldCount=this._nodeFieldCoun t;var selfSizeOffset=this._nodeSelfSizeOffset;var nodeTypeOffset=this._nodeTypeO ffset;var node=this.rootNode();var nodeDistances=this._nodeDistances;for(var nod eIndex=0;nodeIndex<nodesLength;nodeIndex+=nodeFieldCount){var nodeOrdinal=nodeIn dex/nodeFieldCount;if(flags&&!(flags[nodeOrdinal]&flag)) 767 {var aggregates={};var aggregatesByClassName={};var classIndexes=[];var nodes=th is._nodes;var mapAndFlag=this.userObjectsMapAndFlag();var flags=mapAndFlag?mapAn dFlag.map:null;var flag=mapAndFlag?mapAndFlag.flag:0;var nodesLength=nodes.lengt h;var nodeNativeType=this._nodeNativeType;var nodeFieldCount=this._nodeFieldCoun t;var selfSizeOffset=this._nodeSelfSizeOffset;var nodeTypeOffset=this._nodeTypeO ffset;var node=this.rootNode();var nodeDistances=this._nodeDistances;for(var nod eIndex=0;nodeIndex<nodesLength;nodeIndex+=nodeFieldCount){var nodeOrdinal=nodeIn dex/nodeFieldCount;if(flags&&!(flags[nodeOrdinal]&flag))
791 continue;node.nodeIndex=nodeIndex;if(filter&&!filter(node)) 768 continue;node.nodeIndex=nodeIndex;if(filter&&!filter(node))
792 continue;var selfSize=nodes[nodeIndex+selfSizeOffset];if(!selfSize&&nodes[nodeIn dex+nodeTypeOffset]!==nodeNativeType) 769 continue;var selfSize=nodes[nodeIndex+selfSizeOffset];if(!selfSize&&nodes[nodeIn dex+nodeTypeOffset]!==nodeNativeType)
793 continue;var classIndex=node.classIndex();if(!(classIndex in aggregates)){var no deType=node.type();var nameMatters=nodeType==="object"||nodeType==="native";var value={count:1,distance:nodeDistances[nodeOrdinal],self:selfSize,maxRet:0,type:n odeType,name:nameMatters?node.name():null,idxs:[nodeIndex]};aggregates[classInde x]=value;classIndexes.push(classIndex);aggregatesByClassName[node.className()]=v alue;}else{var clss=aggregates[classIndex];clss.distance=Math.min(clss.distance, nodeDistances[nodeOrdinal]);++clss.count;clss.self+=selfSize;clss.idxs.push(node Index);}} 770 continue;var classIndex=node.classIndex();if(!(classIndex in aggregates)){var no deType=node.type();var nameMatters=nodeType==="object"||nodeType==="native";var value={count:1,distance:nodeDistances[nodeOrdinal],self:selfSize,maxRet:0,type:n odeType,name:nameMatters?node.name():null,idxs:[nodeIndex]};aggregates[classInde x]=value;classIndexes.push(classIndex);aggregatesByClassName[node.className()]=v alue;}else{var clss=aggregates[classIndex];clss.distance=Math.min(clss.distance, nodeDistances[nodeOrdinal]);++clss.count;clss.self+=selfSize;clss.idxs.push(node Index);}}
794 for(var i=0,l=classIndexes.length;i<l;++i){var classIndex=classIndexes[i];aggreg ates[classIndex].idxs=aggregates[classIndex].idxs.slice();} 771 for(var i=0,l=classIndexes.length;i<l;++i){var classIndex=classIndexes[i];aggreg ates[classIndex].idxs=aggregates[classIndex].idxs.slice();}
795 return{aggregatesByClassName:aggregatesByClassName,aggregatesByClassIndex:aggreg ates};},_calculateClassesRetainedSize:function(aggregates,filter) 772 return{aggregatesByClassName:aggregatesByClassName,aggregatesByClassIndex:aggreg ates};},_calculateClassesRetainedSize:function(aggregates,filter)
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 {if(!this.snapshot){this._objectIdToSelect=id;return;} 1038 {if(!this.snapshot){this._objectIdToSelect=id;return;}
1062 function didGetDominators(dominatorIds) 1039 function didGetDominators(dominatorIds)
1063 {if(!dominatorIds){WebInspector.log(WebInspector.UIString("Cannot find correspon ding heap snapshot node"));return;} 1040 {if(!dominatorIds){WebInspector.log(WebInspector.UIString("Cannot find correspon ding heap snapshot node"));return;}
1064 var dominatorNode=this.rootNode();expandNextDominator.call(this,dominatorIds,dom inatorNode);} 1041 var dominatorNode=this.rootNode();expandNextDominator.call(this,dominatorIds,dom inatorNode);}
1065 function expandNextDominator(dominatorIds,dominatorNode) 1042 function expandNextDominator(dominatorIds,dominatorNode)
1066 {if(!dominatorNode){console.error("Cannot find dominator node");return;} 1043 {if(!dominatorNode){console.error("Cannot find dominator node");return;}
1067 if(!dominatorIds.length){this.highlightNode(dominatorNode);dominatorNode.element .scrollIntoViewIfNeeded(true);return;} 1044 if(!dominatorIds.length){this.highlightNode(dominatorNode);dominatorNode.element .scrollIntoViewIfNeeded(true);return;}
1068 var snapshotObjectId=dominatorIds.pop();dominatorNode.retrieveChildBySnapshotObj ectId(snapshotObjectId,expandNextDominator.bind(this,dominatorIds));} 1045 var snapshotObjectId=dominatorIds.pop();dominatorNode.retrieveChildBySnapshotObj ectId(snapshotObjectId,expandNextDominator.bind(this,dominatorIds));}
1069 this.snapshot.dominatorIdsForNode(parseInt(id,10),didGetDominators.bind(this));} ,__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype} 1046 this.snapshot.dominatorIdsForNode(parseInt(id,10),didGetDominators.bind(this));} ,__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
1070 WebInspector.AllocationDataGrid=function() 1047 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);} 1048 {var columns=[{id:"count",title:WebInspector.UIString("Count"),width:"72px",sort able:true,sort:WebInspector.DataGrid.Order.Descending},{id:"size",title:WebInspe ctor.UIString("Size"),width:"72px",sortable:true,sort:WebInspector.DataGrid.Orde r.Descending},{id:"name",title:WebInspector.UIString("Function"),disclosure:true ,sortable:true},];WebInspector.DataGrid.call(this,columns);this._linkifier=new W ebInspector.Linkifier();}
1072 WebInspector.AllocationDataGrid.prototype={setDataSource:function(snapshot) 1049 WebInspector.AllocationDataGrid.prototype={setDataSource:function(snapshot)
1073 {this._snapshot=snapshot;this._snapshot.allocationTracesTops(didReceiveAllocatio nTracesTops.bind(this));function didReceiveAllocationTracesTops(tops) 1050 {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++) 1051 {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} 1052 root.appendChild(new WebInspector.AllocationGridNode(this,tops[i]));}},__proto__ :WebInspector.DataGrid.prototype}
1076 WebInspector.AllocationGridNode=function(dataGrid,data) 1053 WebInspector.AllocationGridNode=function(dataGrid,data)
1077 {WebInspector.DataGridNode.call(this,data,data.hasChildren);this._dataGrid=dataG rid;} 1054 {WebInspector.DataGridNode.call(this,data,data.hasChildren);this._dataGrid=dataG rid;this._populated=false;}
1078 WebInspector.AllocationGridNode.prototype={populate:function() 1055 WebInspector.AllocationGridNode.prototype={populate:function()
1079 {this._dataGrid._snapshot.allocationNodeCallers(this.data.id,didReceiveCallers.b ind(this));function didReceiveCallers(callers) 1056 {if(this._populated)
1080 {for(var i=0;i<callers.length;i++) 1057 return;this._populated=true;this._dataGrid._snapshot.allocationNodeCallers(this. data.id,didReceiveCallers.bind(this));function didReceiveCallers(callers)
1081 this.appendChild(new WebInspector.AllocationGridNode(this._dataGrid,callers[i])) ;}},__proto__:WebInspector.DataGridNode.prototype};WebInspector.HeapSnapshotGrid Node=function(tree,hasChildren) 1058 {var callersChain=callers.nodesWithSingleCaller;var parentNode=this;for(var i=0; i<callersChain.length;i++){var child=new WebInspector.AllocationGridNode(this._d ataGrid,callersChain[i]);parentNode.appendChild(child);parentNode=child;parentNo de._populated=true;if(this.expanded)
1059 parentNode.expand();}
1060 var callersBranch=callers.branchingCallers;for(var i=0;i<callersBranch.length;i+ +)
1061 parentNode.appendChild(new WebInspector.AllocationGridNode(this._dataGrid,caller sBranch[i]));}},expand:function()
1062 {WebInspector.DataGridNode.prototype.expand.call(this);if(this.children.length== =1)
1063 this.children[0].expand();},createCell:function(columnIdentifier)
1064 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier!=="name")
1065 return cell;var functionInfo=this.data;if(functionInfo.scriptName){var urlElemen t=this._dataGrid._linkifier.linkifyLocation(functionInfo.scriptName,functionInfo .line-1,functionInfo.column-1,"profile-node-file");urlElement.style.maxWidth="75 %";cell.insertBefore(urlElement,cell.firstChild);}
1066 return cell;},__proto__:WebInspector.DataGridNode.prototype};WebInspector.HeapSn apshotGridNode=function(tree,hasChildren)
1082 {WebInspector.DataGridNode.call(this,null,hasChildren);this._dataGrid=tree;this. _instanceCount=0;this._savedChildren=null;this._retrievedChildrenRanges=[];} 1067 {WebInspector.DataGridNode.call(this,null,hasChildren);this._dataGrid=tree;this. _instanceCount=0;this._savedChildren=null;this._retrievedChildrenRanges=[];}
1083 WebInspector.HeapSnapshotGridNode.Events={PopulateComplete:"PopulateComplete"} 1068 WebInspector.HeapSnapshotGridNode.Events={PopulateComplete:"PopulateComplete"}
1084 WebInspector.HeapSnapshotGridNode.prototype={createProvider:function() 1069 WebInspector.HeapSnapshotGridNode.prototype={createProvider:function()
1085 {throw new Error("Needs implemented.");},_provider:function() 1070 {throw new Error("Needs implemented.");},_provider:function()
1086 {if(!this._providerObject) 1071 {if(!this._providerObject)
1087 this._providerObject=this.createProvider();return this._providerObject;},createC ell:function(columnIdentifier) 1072 this._providerObject=this.createProvider();return this._providerObject;},createC ell:function(columnIdentifier)
1088 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(this._searchMatched) 1073 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(this._searchMatched)
1089 cell.addStyleClass("highlight");return cell;},collapse:function() 1074 cell.addStyleClass("highlight");return cell;},collapse:function()
1090 {WebInspector.DataGridNode.prototype.collapse.call(this);this._dataGrid.updateVi sibleNodes();},dispose:function() 1075 {WebInspector.DataGridNode.prototype.collapse.call(this);this._dataGrid.updateVi sibleNodes();},dispose:function()
1091 {if(this._provider()) 1076 {if(this._provider())
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 return;this._snapshot.nodes=this._array;this._state="find-edges";this._array=nul l;break;} 1293 return;this._snapshot.nodes=this._array;this._state="find-edges";this._array=nul l;break;}
1309 case"find-edges":{var edgesToken="\"edges\"";var edgesTokenIndex=this._json.inde xOf(edgesToken);if(edgesTokenIndex===-1) 1294 case"find-edges":{var edgesToken="\"edges\"";var edgesTokenIndex=this._json.inde xOf(edgesToken);if(edgesTokenIndex===-1)
1310 return;var bracketIndex=this._json.indexOf("[",edgesTokenIndex);if(bracketIndex= ==-1) 1295 return;var bracketIndex=this._json.indexOf("[",edgesTokenIndex);if(bracketIndex= ==-1)
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;} 1296 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;}
1312 case"parse-edges":{var hasMoreData=this._parseUintArray();this._progress.updateP rogress("Loading edges\u2026 %d\%",this._arrayIndex,this._array.length);if(hasMo reData) 1297 case"parse-edges":{var hasMoreData=this._parseUintArray();this._progress.updateP rogress("Loading edges\u2026 %d\%",this._arrayIndex,this._array.length);if(hasMo reData)
1313 return;this._snapshot.edges=this._array;this._array=null;if(WebInspector.HeapSna pshot.enableAllocationProfiler) 1298 return;this._snapshot.edges=this._array;this._array=null;if(WebInspector.HeapSna pshot.enableAllocationProfiler)
1314 this._state="find-trace-function-infos";else 1299 this._state="find-trace-function-infos";else
1315 this._state="find-strings";break;} 1300 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) 1301 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) 1302 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;} 1303 return;this._json=this._json.slice(bracketIndex+1);var trace_function_info_field _count=this._snapshot.snapshot.meta.trace_function_info_fields.length;var trace_ function_info_length=this._snapshot.snapshot.trace_function_count*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()) 1304 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;} 1305 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) 1306 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) 1307 return;var bracketIndex=this._json.indexOf("[",tracesTokenIndex);if(bracketIndex ===-1)
1323 return;this._json=this._json.slice(bracketIndex);this._state="parse-trace-tree"; break;} 1308 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) 1309 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;} 1310 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;}
1326 case"find-strings":{var stringsToken="\"strings\"";var stringsTokenIndex=this._j son.indexOf(stringsToken);if(stringsTokenIndex===-1) 1311 case"find-strings":{var stringsToken="\"strings\"";var stringsTokenIndex=this._j son.indexOf(stringsToken);if(stringsTokenIndex===-1)
1327 return;var bracketIndex=this._json.indexOf("[",stringsTokenIndex);if(bracketInde x===-1) 1312 return;var bracketIndex=this._json.indexOf("[",stringsTokenIndex);if(bracketInde x===-1)
1328 return;this._json=this._json.slice(bracketIndex);this._state="accumulate-strings ";break;} 1313 return;this._json=this._json.slice(bracketIndex);this._state="accumulate-strings ";break;}
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 {this.callMethod(callback,"aggregatesForDiff");},calculateSnapshotDiff:function( baseSnapshotId,baseSnapshotAggregates,callback) 1398 {this.callMethod(callback,"aggregatesForDiff");},calculateSnapshotDiff:function( baseSnapshotId,baseSnapshotAggregates,callback)
1414 {this.callMethod(callback,"calculateSnapshotDiff",baseSnapshotId,baseSnapshotAgg regates);},nodeClassName:function(snapshotObjectId,callback) 1399 {this.callMethod(callback,"calculateSnapshotDiff",baseSnapshotId,baseSnapshotAgg regates);},nodeClassName:function(snapshotObjectId,callback)
1415 {this.callMethod(callback,"nodeClassName",snapshotObjectId);},dominatorIdsForNod e:function(nodeIndex,callback) 1400 {this.callMethod(callback,"nodeClassName",snapshotObjectId);},dominatorIdsForNod e:function(nodeIndex,callback)
1416 {this.callMethod(callback,"dominatorIdsForNode",nodeIndex);},createEdgesProvider :function(nodeIndex,showHiddenData) 1401 {this.callMethod(callback,"dominatorIdsForNode",nodeIndex);},createEdgesProvider :function(nodeIndex,showHiddenData)
1417 {return this.callFactoryMethod(null,"createEdgesProvider",WebInspector.HeapSnaps hotProviderProxy,nodeIndex,showHiddenData);},createRetainingEdgesProvider:functi on(nodeIndex,showHiddenData) 1402 {return this.callFactoryMethod(null,"createEdgesProvider",WebInspector.HeapSnaps hotProviderProxy,nodeIndex,showHiddenData);},createRetainingEdgesProvider:functi on(nodeIndex,showHiddenData)
1418 {return this.callFactoryMethod(null,"createRetainingEdgesProvider",WebInspector. HeapSnapshotProviderProxy,nodeIndex,showHiddenData);},createAddedNodesProvider:f unction(baseSnapshotId,className) 1403 {return this.callFactoryMethod(null,"createRetainingEdgesProvider",WebInspector. HeapSnapshotProviderProxy,nodeIndex,showHiddenData);},createAddedNodesProvider:f unction(baseSnapshotId,className)
1419 {return this.callFactoryMethod(null,"createAddedNodesProvider",WebInspector.Heap SnapshotProviderProxy,baseSnapshotId,className);},createDeletedNodesProvider:fun ction(nodeIndexes) 1404 {return this.callFactoryMethod(null,"createAddedNodesProvider",WebInspector.Heap SnapshotProviderProxy,baseSnapshotId,className);},createDeletedNodesProvider:fun ction(nodeIndexes)
1420 {return this.callFactoryMethod(null,"createDeletedNodesProvider",WebInspector.He apSnapshotProviderProxy,nodeIndexes);},createNodesProvider:function(filter) 1405 {return this.callFactoryMethod(null,"createDeletedNodesProvider",WebInspector.He apSnapshotProviderProxy,nodeIndexes);},createNodesProvider:function(filter)
1421 {return this.callFactoryMethod(null,"createNodesProvider",WebInspector.HeapSnaps hotProviderProxy,filter);},createNodesProviderForClass:function(className,aggreg atesKey) 1406 {return this.callFactoryMethod(null,"createNodesProvider",WebInspector.HeapSnaps hotProviderProxy,filter);},createNodesProviderForClass:function(className,aggreg atesKey)
1422 {return this.callFactoryMethod(null,"createNodesProviderForClass",WebInspector.H eapSnapshotProviderProxy,className,aggregatesKey);},createNodesProviderForDomina tor:function(nodeIndex) 1407 {return this.callFactoryMethod(null,"createNodesProviderForClass",WebInspector.H eapSnapshotProviderProxy,className,aggregatesKey);},createNodesProviderForDomina tor:function(nodeIndex)
1423 {return this.callFactoryMethod(null,"createNodesProviderForDominator",WebInspect or.HeapSnapshotProviderProxy,nodeIndex);},allocationTracesTops:function(callback ) 1408 {return this.callFactoryMethod(null,"createNodesProviderForDominator",WebInspect or.HeapSnapshotProviderProxy,nodeIndex);},maxJsNodeId:function(callback)
1409 {this.callMethod(callback,"maxJsNodeId");},allocationTracesTops:function(callbac k)
1424 {this.callMethod(callback,"allocationTracesTops");},allocationNodeCallers:functi on(nodeId,callback) 1410 {this.callMethod(callback,"allocationTracesTops");},allocationNodeCallers:functi on(nodeId,callback)
1425 {this.callMethod(callback,"allocationNodeCallers",nodeId);},dispose:function() 1411 {this.callMethod(callback,"allocationNodeCallers",nodeId);},dispose:function()
1426 {this.disposeWorker();},get nodeCount() 1412 {this.disposeWorker();},get nodeCount()
1427 {return this._staticData.nodeCount;},get rootNodeIndex() 1413 {return this._staticData.nodeCount;},get rootNodeIndex()
1428 {return this._staticData.rootNodeIndex;},updateStaticData:function(callback) 1414 {return this._staticData.rootNodeIndex;},updateStaticData:function(callback)
1429 {function dataReceived(staticData) 1415 {function dataReceived(staticData)
1430 {this._staticData=staticData;callback(this);} 1416 {this._staticData=staticData;callback(this);}
1431 this.callMethod(dataReceived.bind(this),"updateStaticData");},get totalSize() 1417 this.callMethod(dataReceived.bind(this),"updateStaticData");},get totalSize()
1432 {return this._staticData.totalSize;},get uid() 1418 {return this._staticData.totalSize;},get uid()
1433 {return this._staticData.uid;},__proto__:WebInspector.HeapSnapshotProxyObject.pr ototype} 1419 {return this._staticData.uid;},__proto__:WebInspector.HeapSnapshotProxyObject.pr ototype}
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 return;span.node=row._dataGridNode;return span;},_resolveObjectForPopover:functi on(element,showCallback,objectGroupName) 1523 return;span.node=row._dataGridNode;return span;},_resolveObjectForPopover:functi on(element,showCallback,objectGroupName)
1538 {if(this.profile.fromFile()) 1524 {if(this.profile.fromFile())
1539 return;element.node.queryObjectContent(showCallback,objectGroupName);},_startRet ainersHeaderDragging:function(event) 1525 return;element.node.queryObjectContent(showCallback,objectGroupName);},_startRet ainersHeaderDragging:function(event)
1540 {if(!this.isShowing()) 1526 {if(!this.isShowing())
1541 return false;this._previousDragPosition=event.pageY;return true;},_retainersHead erDragging:function(event) 1527 return false;this._previousDragPosition=event.pageY;return true;},_retainersHead erDragging:function(event)
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) 1528 {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)
1543 {delete this._previousDragPosition;event.consume();},_updateRetainmentViewHeight :function(height) 1529 {delete this._previousDragPosition;event.consume();},_updateRetainmentViewHeight :function(height)
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) 1530 {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)
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() 1531 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()
1546 {var list=this._profiles();if(this.baseSelect.size()===list.length) 1532 {var list=this._profiles();if(this.baseSelect.size()===list.length)
1547 return;for(var i=this.baseSelect.size(),n=list.length;i<n;++i){var title=list[i] .title;if(WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title)) 1533 return;for(var i=this.baseSelect.size(),n=list.length;i<n;++i){var title=list[i] .title;this.baseSelect.createOption(title);}},_updateFilterOptions:function()
1548 title=WebInspector.UIString("Snapshot %d",WebInspector.ProfilesPanelDescriptor.u serInitiatedProfileIndex(title));this.baseSelect.createOption(title);}},_updateF ilterOptions:function()
1549 {var list=this._profiles();if(this.filterSelect.size()-1===list.length) 1534 {var list=this._profiles();if(this.filterSelect.size()-1===list.length)
1550 return;if(!this.filterSelect.size()) 1535 return;if(!this.filterSelect.size())
1551 this.filterSelect.createOption(WebInspector.UIString("All objects"));if(this.pro file.fromFile()) 1536 this.filterSelect.createOption(WebInspector.UIString("All objects"));for(var i=t his.filterSelect.size()-1,n=list.length;i<n;++i){var title=list[i].title;if(!i)
1552 return;for(var i=this.filterSelect.size()-1,n=list.length;i<n;++i){var profile=l ist[i];var title=list[i].title;if(WebInspector.ProfilesPanelDescriptor.isUserIni tiatedProfile(title)){var profileIndex=WebInspector.ProfilesPanelDescriptor.user InitiatedProfileIndex(title);if(!i) 1537 title=WebInspector.UIString("Objects allocated before %s",title);else
1553 title=WebInspector.UIString("Objects allocated before Snapshot %d",profileIndex) ;else 1538 title=WebInspector.UIString("Objects allocated between %s and %s",list[i-1].titl e,title);this.filterSelect.createOption(title);}},_onProfileHeaderAdded:function (event)
1554 title=WebInspector.UIString("Objects allocated between Snapshots %d and %d",prof ileIndex-1,profileIndex);}
1555 this.filterSelect.createOption(title);}},_onProfileHeaderAdded:function(event)
1556 {if(!event.data||event.data.type!==this._profileTypeId) 1539 {if(!event.data||event.data.type!==this._profileTypeId)
1557 return;this._updateBaseOptions();this._updateFilterOptions();},__proto__:WebInsp ector.View.prototype} 1540 return;this._updateBaseOptions();this._updateFilterOptions();},__proto__:WebInsp ector.View.prototype}
1558 WebInspector.HeapProfilerDispatcher=function() 1541 WebInspector.HeapProfilerDispatcher=function()
1559 {this._dispatchers=[];InspectorBackend.registerHeapProfilerDispatcher(this);} 1542 {this._dispatchers=[];InspectorBackend.registerHeapProfilerDispatcher(this);}
1560 WebInspector.HeapProfilerDispatcher.prototype={register:function(dispatcher) 1543 WebInspector.HeapProfilerDispatcher.prototype={register:function(dispatcher)
1561 {this._dispatchers.push(dispatcher);},_genericCaller:function(eventName) 1544 {this._dispatchers.push(dispatcher);},_genericCaller:function(eventName)
1562 {var args=Array.prototype.slice.call(arguments.callee.caller.arguments);for(var i=0;i<this._dispatchers.length;++i) 1545 {var args=Array.prototype.slice.call(arguments.callee.caller.arguments);for(var i=0;i<this._dispatchers.length;++i)
1563 this._dispatchers[i][eventName].apply(this._dispatchers[i],args);},heapStatsUpda te:function(samples) 1546 this._dispatchers[i][eventName].apply(this._dispatchers[i],args);},heapStatsUpda te:function(samples)
1564 {this._genericCaller("heapStatsUpdate");},lastSeenObjectId:function(lastSeenObje ctId,timestamp) 1547 {this._genericCaller("heapStatsUpdate");},lastSeenObjectId:function(lastSeenObje ctId,timestamp)
1565 {this._genericCaller("lastSeenObjectId");},addProfileHeader:function(profileHead er) 1548 {this._genericCaller("lastSeenObjectId");},addProfileHeader:function(profileHead er)
1566 {this._genericCaller("addProfileHeader");},addHeapSnapshotChunk:function(uid,chu nk) 1549 {this._genericCaller("addProfileHeader");},addHeapSnapshotChunk:function(uid,chu nk)
1567 {this._genericCaller("addHeapSnapshotChunk");},finishHeapSnapshot:function(uid) 1550 {this._genericCaller("addHeapSnapshotChunk");},reportHeapSnapshotProgress:functi on(done,total)
1568 {this._genericCaller("finishHeapSnapshot");},reportHeapSnapshotProgress:function (done,total)
1569 {this._genericCaller("reportHeapSnapshotProgress");},resetProfiles:function() 1551 {this._genericCaller("reportHeapSnapshotProgress");},resetProfiles:function()
1570 {this._genericCaller("resetProfiles");}} 1552 {this._genericCaller("resetProfiles");}}
1571 WebInspector.HeapProfilerDispatcher._dispatcher=new WebInspector.HeapProfilerDis patcher();WebInspector.HeapSnapshotProfileType=function() 1553 WebInspector.HeapProfilerDispatcher._dispatcher=new WebInspector.HeapProfilerDis patcher();WebInspector.HeapSnapshotProfileType=function()
1572 {WebInspector.ProfileType.call(this,WebInspector.HeapSnapshotProfileType.TypeId, WebInspector.UIString("Take Heap Snapshot"));WebInspector.HeapProfilerDispatcher ._dispatcher.register(this);} 1554 {WebInspector.ProfileType.call(this,WebInspector.HeapSnapshotProfileType.TypeId, WebInspector.UIString("Take Heap Snapshot"));WebInspector.HeapProfilerDispatcher ._dispatcher.register(this);}
1573 WebInspector.HeapSnapshotProfileType.TypeId="HEAP";WebInspector.HeapSnapshotProf ileType.SnapshotReceived="SnapshotReceived";WebInspector.HeapSnapshotProfileType .prototype={fileExtension:function() 1555 WebInspector.HeapSnapshotProfileType.TypeId="HEAP";WebInspector.HeapSnapshotProf ileType.SnapshotReceived="SnapshotReceived";WebInspector.HeapSnapshotProfileType .prototype={fileExtension:function()
1574 {return".heapsnapshot";},get buttonTooltip() 1556 {return".heapsnapshot";},get buttonTooltip()
1575 {return WebInspector.UIString("Take heap snapshot.");},isInstantProfile:function () 1557 {return WebInspector.UIString("Take heap snapshot.");},isInstantProfile:function ()
1576 {return true;},buttonClicked:function() 1558 {return true;},buttonClicked:function()
1577 {this._takeHeapSnapshot(function(){});WebInspector.userMetrics.ProfilesHeapProfi leTaken.record();return false;},heapStatsUpdate:function(samples) 1559 {this._takeHeapSnapshot(function(){});WebInspector.userMetrics.ProfilesHeapProfi leTaken.record();return false;},heapStatsUpdate:function(samples)
1578 {},lastSeenObjectId:function(lastSeenObjectId,timestamp) 1560 {},lastSeenObjectId:function(lastSeenObjectId,timestamp)
1579 {},get treeItemTitle() 1561 {},get treeItemTitle()
1580 {return WebInspector.UIString("HEAP SNAPSHOTS");},get description() 1562 {return WebInspector.UIString("HEAP SNAPSHOTS");},get description()
1581 {return WebInspector.UIString("Heap snapshot profiles show memory distribution a mong your page's JavaScript objects and related DOM nodes.");},createTemporaryPr ofile:function(title) 1563 {return WebInspector.UIString("Heap snapshot profiles show memory distribution a mong your page's JavaScript objects and related DOM nodes.");},createTemporaryPr ofile:function(title)
1582 {title=title||WebInspector.UIString("Snapshotting\u2026");return new WebInspecto r.HeapProfileHeader(this,title);},createProfile:function(profile) 1564 {title=title||WebInspector.UIString("Snapshotting\u2026");return new WebInspecto r.HeapProfileHeader(this,title);},createProfile:function(profile)
1583 {return new WebInspector.HeapProfileHeader(this,profile.title,profile.uid,profil e.maxJSObjectId||0);},_takeHeapSnapshot:function(callback) 1565 {return new WebInspector.HeapProfileHeader(this,profile.title,profile.uid,profil e.maxJSObjectId||0);},_takeHeapSnapshot:function(callback)
1584 {var temporaryProfile=this.findTemporaryProfile();if(!temporaryProfile) 1566 {var temporaryProfile=this.findTemporaryProfile();if(!temporaryProfile)
1585 this.addProfile(this.createTemporaryProfile());HeapProfilerAgent.takeHeapSnapsho t(true,callback);},addProfileHeader:function(profileHeader) 1567 this.addProfile(this.createTemporaryProfile());HeapProfilerAgent.takeHeapSnapsho t(true,callback);},addProfileHeader:function(profileHeader)
1586 {if(!this.findTemporaryProfile()) 1568 {if(!this.findTemporaryProfile())
1587 return;var profile=this.createProfile(profileHeader);profile._profileSamples=thi s._profileSamples;this._profileSamples=null;this.addProfile(profile);},addHeapSn apshotChunk:function(uid,chunk) 1569 return;var profile=this.createProfile(profileHeader);profile._profileSamples=thi s._profileSamples;this._profileSamples=null;this.addProfile(profile);},addHeapSn apshotChunk:function(uid,chunk)
1588 {var profile=this._profilesIdMap[this._makeKey(uid)];if(profile) 1570 {var profile=this._profilesIdMap[this._makeKey(uid)];if(profile)
1589 profile.transferChunk(chunk);},finishHeapSnapshot:function(uid) 1571 profile.transferChunk(chunk);},reportHeapSnapshotProgress:function(done,total)
1590 {var profile=this._profilesIdMap[this._makeKey(uid)];if(profile)
1591 profile.finishHeapSnapshot();},reportHeapSnapshotProgress:function(done,total)
1592 {var profile=this.findTemporaryProfile();if(profile) 1572 {var profile=this.findTemporaryProfile();if(profile)
1593 this.dispatchEventToListeners(WebInspector.ProfileType.Events.ProgressUpdated,{" profile":profile,"done":done,"total":total});},resetProfiles:function() 1573 this.dispatchEventToListeners(WebInspector.ProfileType.Events.ProgressUpdated,{" profile":profile,"done":done,"total":total});},resetProfiles:function()
1594 {this._reset();},removeProfile:function(profile) 1574 {this._reset();},removeProfile:function(profile)
1595 {WebInspector.ProfileType.prototype.removeProfile.call(this,profile);if(!profile .isTemporary) 1575 {WebInspector.ProfileType.prototype.removeProfile.call(this,profile);if(!profile .isTemporary&&!profile.fromFile())
1596 HeapProfilerAgent.removeProfile(profile.uid);},_requestProfilesFromBackend:funct ion(populateCallback) 1576 HeapProfilerAgent.removeProfile(profile.uid);},_snapshotReceived:function(profil e)
1597 {HeapProfilerAgent.getProfileHeaders(populateCallback);},_snapshotReceived:funct ion(profile)
1598 {this.dispatchEventToListeners(WebInspector.HeapSnapshotProfileType.SnapshotRece ived,profile);},__proto__:WebInspector.ProfileType.prototype} 1577 {this.dispatchEventToListeners(WebInspector.HeapSnapshotProfileType.SnapshotRece ived,profile);},__proto__:WebInspector.ProfileType.prototype}
1599 WebInspector.TrackingHeapSnapshotProfileType=function(profilesPanel) 1578 WebInspector.TrackingHeapSnapshotProfileType=function(profilesPanel)
1600 {WebInspector.ProfileType.call(this,WebInspector.TrackingHeapSnapshotProfileType .TypeId,WebInspector.UIString("Record Heap Allocations"));this._profilesPanel=pr ofilesPanel;WebInspector.HeapProfilerDispatcher._dispatcher.register(this);} 1579 {WebInspector.ProfileType.call(this,WebInspector.TrackingHeapSnapshotProfileType .TypeId,WebInspector.UIString("Record Heap Allocations"));this._profilesPanel=pr ofilesPanel;WebInspector.HeapProfilerDispatcher._dispatcher.register(this);}
1601 WebInspector.TrackingHeapSnapshotProfileType.TypeId="HEAP-RECORD";WebInspector.T rackingHeapSnapshotProfileType.HeapStatsUpdate="HeapStatsUpdate";WebInspector.Tr ackingHeapSnapshotProfileType.TrackingStarted="TrackingStarted";WebInspector.Tra ckingHeapSnapshotProfileType.TrackingStopped="TrackingStopped";WebInspector.Trac kingHeapSnapshotProfileType.prototype={heapStatsUpdate:function(samples) 1580 WebInspector.TrackingHeapSnapshotProfileType.TypeId="HEAP-RECORD";WebInspector.T rackingHeapSnapshotProfileType.HeapStatsUpdate="HeapStatsUpdate";WebInspector.Tr ackingHeapSnapshotProfileType.TrackingStarted="TrackingStarted";WebInspector.Tra ckingHeapSnapshotProfileType.TrackingStopped="TrackingStopped";WebInspector.Trac kingHeapSnapshotProfileType.prototype={heapStatsUpdate:function(samples)
1602 {if(!this._profileSamples) 1581 {if(!this._profileSamples)
1603 return;var index;for(var i=0;i<samples.length;i+=3){index=samples[i];var count=s amples[i+1];var size=samples[i+2];this._profileSamples.sizes[index]=size;if(!thi s._profileSamples.max[index]||size>this._profileSamples.max[index]) 1582 return;var index;for(var i=0;i<samples.length;i+=3){index=samples[i];var count=s amples[i+1];var size=samples[i+2];this._profileSamples.sizes[index]=size;if(!thi s._profileSamples.max[index]||size>this._profileSamples.max[index])
1604 this._profileSamples.max[index]=size;} 1583 this._profileSamples.max[index]=size;}
1605 this._lastUpdatedIndex=index;},lastSeenObjectId:function(lastSeenObjectId,timest amp) 1584 this._lastUpdatedIndex=index;},lastSeenObjectId:function(lastSeenObjectId,timest amp)
1606 {var profileSamples=this._profileSamples;if(!profileSamples) 1585 {var profileSamples=this._profileSamples;if(!profileSamples)
1607 return;var currentIndex=Math.max(profileSamples.ids.length,profileSamples.max.le ngth-1);profileSamples.ids[currentIndex]=lastSeenObjectId;if(!profileSamples.max [currentIndex]){profileSamples.max[currentIndex]=0;profileSamples.sizes[currentI ndex]=0;} 1586 return;var currentIndex=Math.max(profileSamples.ids.length,profileSamples.max.le ngth-1);profileSamples.ids[currentIndex]=lastSeenObjectId;if(!profileSamples.max [currentIndex]){profileSamples.max[currentIndex]=0;profileSamples.sizes[currentI ndex]=0;}
1608 profileSamples.timestamps[currentIndex]=timestamp;if(profileSamples.totalTime<ti mestamp-profileSamples.timestamps[0]) 1587 profileSamples.timestamps[currentIndex]=timestamp;if(profileSamples.totalTime<ti mestamp-profileSamples.timestamps[0])
1609 profileSamples.totalTime*=2;this.dispatchEventToListeners(WebInspector.TrackingH eapSnapshotProfileType.HeapStatsUpdate,this._profileSamples);var profile=this.fi ndTemporaryProfile();profile.sidebarElement.wait=true;if(profile.sidebarElement& &!profile.sidebarElement.wait) 1588 profileSamples.totalTime*=2;this.dispatchEventToListeners(WebInspector.TrackingH eapSnapshotProfileType.HeapStatsUpdate,this._profileSamples);var profile=this.fi ndTemporaryProfile();profile.sidebarElement.wait=true;if(profile.sidebarElement& &!profile.sidebarElement.wait)
1610 profile.sidebarElement.wait=true;},hasTemporaryView:function() 1589 profile.sidebarElement.wait=true;},hasTemporaryView:function()
1611 {return true;},get buttonTooltip() 1590 {return true;},get buttonTooltip()
1612 {return this._recording?WebInspector.UIString("Stop recording heap profile."):We bInspector.UIString("Start recording heap profile.");},isInstantProfile:function () 1591 {return this._recording?WebInspector.UIString("Stop recording heap profile."):We bInspector.UIString("Start recording heap profile.");},isInstantProfile:function ()
1613 {return false;},buttonClicked:function() 1592 {return false;},buttonClicked:function()
1614 {return this._toggleRecording();},_startRecordingProfile:function() 1593 {return this._toggleRecording();},_startRecordingProfile:function()
1615 {this._lastSeenIndex=-1;this._profileSamples={'sizes':[],'ids':[],'timestamps':[ ],'max':[],'totalTime':30000};this._recording=true;HeapProfilerAgent.startTracki ngHeapObjects();this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotP rofileType.TrackingStarted);},_stopRecordingProfile:function() 1594 {this._lastSeenIndex=-1;this._profileSamples={'sizes':[],'ids':[],'timestamps':[ ],'max':[],'totalTime':30000};this._recording=true;HeapProfilerAgent.startTracki ngHeapObjects();this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotP rofileType.TrackingStarted);},_stopRecordingProfile:function()
1616 {HeapProfilerAgent.stopTrackingHeapObjects();HeapProfilerAgent.takeHeapSnapshot( true);this._recording=false;this.dispatchEventToListeners(WebInspector.TrackingH eapSnapshotProfileType.TrackingStopped);},_toggleRecording:function() 1595 {HeapProfilerAgent.stopTrackingHeapObjects();HeapProfilerAgent.takeHeapSnapshot( true);this._recording=false;this.dispatchEventToListeners(WebInspector.TrackingH eapSnapshotProfileType.TrackingStopped);},_toggleRecording:function()
1617 {if(this._recording) 1596 {if(this._recording)
1618 this._stopRecordingProfile();else 1597 this._stopRecordingProfile();else
1619 this._startRecordingProfile();return this._recording;},get treeItemTitle() 1598 this._startRecordingProfile();return this._recording;},get treeItemTitle()
1620 {return WebInspector.UIString("HEAP TIMELINES");},get description() 1599 {return WebInspector.UIString("HEAP TIMELINES");},get description()
1621 {return WebInspector.UIString("Record JavaScript object allocations over time. U se this profile type to isolate memory leaks.");},_reset:function() 1600 {return WebInspector.UIString("Record JavaScript object allocations over time. U se this profile type to isolate memory leaks.");},_reset:function()
1622 {WebInspector.HeapSnapshotProfileType.prototype._reset.call(this);if(this._recor ding) 1601 {WebInspector.HeapSnapshotProfileType.prototype._reset.call(this);if(this._recor ding)
1623 this._stopRecordingProfile();this._profileSamples=null;this._lastSeenIndex=-1;}, createTemporaryProfile:function(title) 1602 this._stopRecordingProfile();this._profileSamples=null;this._lastSeenIndex=-1;}, createTemporaryProfile:function(title)
1624 {title=title||WebInspector.UIString("Recording\u2026");return new WebInspector.H eapProfileHeader(this,title);},_requestProfilesFromBackend:function(populateCall back) 1603 {title=title||WebInspector.UIString("Recording\u2026");return new WebInspector.H eapProfileHeader(this,title);},__proto__:WebInspector.HeapSnapshotProfileType.pr ototype}
1625 {},__proto__:WebInspector.HeapSnapshotProfileType.prototype}
1626 WebInspector.HeapProfileHeader=function(type,title,uid,maxJSObjectId) 1604 WebInspector.HeapProfileHeader=function(type,title,uid,maxJSObjectId)
1627 {WebInspector.ProfileHeader.call(this,type,title,uid);this.maxJSObjectId=maxJSOb jectId;this._receiver=null;this._snapshotProxy=null;this._totalNumberOfChunks=0; this._transferHandler=null;} 1605 {WebInspector.ProfileHeader.call(this,type,title,uid);this.maxJSObjectId=maxJSOb jectId;this._receiver=null;this._snapshotProxy=null;this._totalNumberOfChunks=0; this._transferHandler=null;}
1628 WebInspector.HeapProfileHeader.prototype={createSidebarTreeElement:function() 1606 WebInspector.HeapProfileHeader.prototype={createSidebarTreeElement:function()
1629 {return new WebInspector.ProfileSidebarTreeElement(this,WebInspector.UIString("S napshot %d"),"heap-snapshot-sidebar-tree-item");},createView:function(profilesPa nel) 1607 {return new WebInspector.ProfileSidebarTreeElement(this,WebInspector.UIString("S napshot %d"),"heap-snapshot-sidebar-tree-item");},createView:function(profilesPa nel)
1630 {return new WebInspector.HeapSnapshotView(profilesPanel,this);},load:function(ca llback) 1608 {return new WebInspector.HeapSnapshotView(profilesPanel,this);},load:function(ca llback)
1631 {if(this.uid===-1) 1609 {if(this.uid===-1)
1632 return;if(this._snapshotProxy){callback(this._snapshotProxy);return;} 1610 return;if(this._snapshotProxy){callback(this._snapshotProxy);return;}
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();} 1611 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._transf erSnapshot();}
1634 var loaderProxy=(this._receiver);loaderProxy.addConsumer(callback);},startSnapsh otTransfer:function() 1612 var loaderProxy=(this._receiver);loaderProxy.addConsumer(callback);},_transferSn apshot:function()
1635 {HeapProfilerAgent.getHeapSnapshot(this.uid);},snapshotConstructorName:function( ) 1613 {function finishTransfer()
1614 {if(this._transferHandler){this._transferHandler.finishTransfer();this._totalNum berOfChunks=this._transferHandler._totalNumberOfChunks;}}
1615 HeapProfilerAgent.getHeapSnapshot(this.uid,finishTransfer.bind(this));},snapshot ConstructorName:function()
1636 {return"JSHeapSnapshot";},snapshotProxyConstructor:function() 1616 {return"JSHeapSnapshot";},snapshotProxyConstructor:function()
1637 {return WebInspector.HeapSnapshotProxy;},_setupWorker:function() 1617 {return WebInspector.HeapSnapshotProxy;},_setupWorker:function()
1638 {function setProfileWait(event) 1618 {function setProfileWait(event)
1639 {this.sidebarElement.wait=event.data;} 1619 {this.sidebarElement.wait=event.data;}
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) 1620 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) 1621 {if(WebInspector.HeapSnapshotProgress.Event.Update!==eventName)
1642 return;this._updateSubtitle(data);},dispose:function() 1622 return;this._updateSubtitle(data);},dispose:function()
1643 {if(this._receiver) 1623 {if(this._receiver)
1644 this._receiver.close();else if(this._snapshotProxy) 1624 this._receiver.close();else if(this._snapshotProxy)
1645 this._snapshotProxy.dispose();if(this._view){var view=this._view;this._view=null ;view.dispose();}},_updateSubtitle:function(value) 1625 this._snapshotProxy.dispose();if(this._view){var view=this._view;this._view=null ;view.dispose();}},_updateSubtitle:function(value)
1646 {this.sidebarElement.subtitle=value;},_didCompleteSnapshotTransfer:function() 1626 {this.sidebarElement.subtitle=value;},_didCompleteSnapshotTransfer:function()
1647 {this.sidebarElement.subtitle=Number.bytesToString(this._snapshotProxy.totalSize );this.sidebarElement.wait=false;},transferChunk:function(chunk) 1627 {this.sidebarElement.subtitle=Number.bytesToString(this._snapshotProxy.totalSize );this.sidebarElement.wait=false;},transferChunk:function(chunk)
1648 {this._transferHandler.transferChunk(chunk);},_snapshotReceived:function(snapsho tProxy) 1628 {this._transferHandler.transferChunk(chunk);},_snapshotReceived:function(snapsho tProxy)
1649 {this._receiver=null;if(snapshotProxy) 1629 {this._receiver=null;if(snapshotProxy)
1650 this._snapshotProxy=snapshotProxy;this._didCompleteSnapshotTransfer();var worker =(this._snapshotProxy.worker);this.isTemporary=false;worker.startCheckingForLong RunningCalls();this.notifySnapshotReceived();},notifySnapshotReceived:function() 1630 this._snapshotProxy=snapshotProxy;this._didCompleteSnapshotTransfer();var worker =(this._snapshotProxy.worker);this.isTemporary=false;worker.startCheckingForLong RunningCalls();this.notifySnapshotReceived();if(this.fromFile()){function didGet MaxNodeId(id)
1651 {this._profileType._snapshotReceived(this);},finishHeapSnapshot:function() 1631 {this.maxJSObjectId=id;}
1652 {if(this._transferHandler){this._transferHandler.finishTransfer();this._totalNum berOfChunks=this._transferHandler._totalNumberOfChunks;}},_wasShown:function() 1632 snapshotProxy.maxJsNodeId(didGetMaxNodeId.bind(this));}},notifySnapshotReceived: function()
1633 {this._profileType._snapshotReceived(this);},_wasShown:function()
1653 {},canSaveToFile:function() 1634 {},canSaveToFile:function()
1654 {return!this.fromFile()&&!!this._snapshotProxy&&!this._receiver;},saveToFile:fun ction() 1635 {return!this.fromFile()&&!!this._snapshotProxy&&!this._receiver;},saveToFile:fun ction()
1655 {var fileOutputStream=new WebInspector.FileOutputStream();function onOpen() 1636 {var fileOutputStream=new WebInspector.FileOutputStream();function onOpen()
1656 {this._receiver=fileOutputStream;this._transferHandler=new WebInspector.SaveSnap shotHandler(this);HeapProfilerAgent.getHeapSnapshot(this.uid);} 1637 {this._receiver=fileOutputStream;this._transferHandler=new WebInspector.SaveSnap shotHandler(this);this._transferSnapshot();}
1657 this._fileName=this._fileName||"Heap-"+new Date().toISO8601Compact()+this._profi leType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));} ,loadFromFile:function(file) 1638 this._fileName=this._fileName||"Heap-"+new Date().toISO8601Compact()+this._profi leType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));} ,loadFromFile:function(file)
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) 1639 {this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026");this.sideba rElement.wait=true;this._setupWorker();var delegate=new WebInspector.HeapSnapsho tLoadFromFileDelegate(this);var fileReader=this._createFileReader(file,delegate) ;fileReader.start(this._receiver);},_createFileReader:function(file,delegate)
1659 {return new WebInspector.ChunkedFileReader(file,10000000,delegate);},__proto__:W ebInspector.ProfileHeader.prototype} 1640 {return new WebInspector.ChunkedFileReader(file,10000000,delegate);},__proto__:W ebInspector.ProfileHeader.prototype}
1660 WebInspector.SnapshotTransferHandler=function(header,title) 1641 WebInspector.SnapshotTransferHandler=function(header,title)
1661 {this._numberOfChunks=0;this._savedChunks=0;this._header=header;this._totalNumbe rOfChunks=0;this._title=title;} 1642 {this._numberOfChunks=0;this._savedChunks=0;this._header=header;this._totalNumbe rOfChunks=0;this._title=title;}
1662 WebInspector.SnapshotTransferHandler.prototype={transferChunk:function(chunk) 1643 WebInspector.SnapshotTransferHandler.prototype={transferChunk:function(chunk)
1663 {++this._numberOfChunks;this._header._receiver.write(chunk,this._didTransferChun k.bind(this));},finishTransfer:function() 1644 {++this._numberOfChunks;this._header._receiver.write(chunk,this._didTransferChun k.bind(this));},finishTransfer:function()
1664 {},_didTransferChunk:function() 1645 {},_didTransferChunk:function()
1665 {this._updateProgress(++this._savedChunks,this._totalNumberOfChunks);},_updatePr ogress:function(value,total) 1646 {this._updateProgress(++this._savedChunks,this._totalNumberOfChunks);},_updatePr ogress:function(value,total)
1666 {}} 1647 {}}
1667 WebInspector.SaveSnapshotHandler=function(header) 1648 WebInspector.SaveSnapshotHandler=function(header)
1668 {WebInspector.SnapshotTransferHandler.call(this,header,"Saving\u2026 %d\%");this ._totalNumberOfChunks=header._totalNumberOfChunks;this._updateProgress(0,this._t otalNumberOfChunks);} 1649 {WebInspector.SnapshotTransferHandler.call(this,header,"Saving\u2026 %d\%");this ._totalNumberOfChunks=header._totalNumberOfChunks;this._updateProgress(0,this._t otalNumberOfChunks);}
(...skipping 18 matching lines...) Expand all
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) 1668 {this._profileType.removeEventListener(WebInspector.TrackingHeapSnapshotProfileT ype.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.removeEventL istener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onSto pTracking,this);},_onHeapStatsUpdate:function(event)
1688 {this._profileSamples=event.data;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height) 1669 {this._profileSamples=event.data;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height)
1689 {if(!this._profileSamples) 1670 {if(!this._profileSamples)
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) 1671 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)
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) 1672 {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)
1692 callback(currentX,size);size=0;currentX=x;} 1673 callback(currentX,size);size=0;currentX=x;}
1693 size+=sizes[i];} 1674 size+=sizes[i];}
1694 callback(currentX,size);} 1675 callback(currentX,size);}
1695 function maxSizeCallback(x,size) 1676 function maxSizeCallback(x,size)
1696 {maxSize=Math.max(maxSize,size);} 1677 {maxSize=Math.max(maxSize,size);}
1697 aggregateAndCall(sizes,maxSizeCallback);var yScaleFactor=this._yScale.nextScale( maxSize?height/(maxSize*1.1):0.0);this._overviewCanvas.width=width*window.device PixelRatio;this._overviewCanvas.height=height*window.devicePixelRatio;this._over viewCanvas.style.width=width+"px";this._overviewCanvas.style.height=height+"px"; var context=this._overviewCanvas.getContext("2d");context.scale(window.devicePix elRatio,window.devicePixelRatio);context.beginPath();context.lineWidth=2;context .strokeStyle="rgba(192, 192, 192, 0.6)";var currentX=(endTime-startTime)*scaleFa ctor;context.moveTo(currentX,height-1);context.lineTo(currentX,0);context.stroke ();context.closePath();var gridY;var gridValue;var gridLabelHeight=14;if(yScaleF actor){const maxGridValue=(height-gridLabelHeight)/yScaleFactor;gridValue=Math.p ow(1024,Math.floor(Math.log(maxGridValue)/Math.log(1024)));gridValue*=Math.pow(1 0,Math.floor(Math.log(maxGridValue/gridValue)/Math.log(10)));if(gridValue*5<=max GridValue) 1678 aggregateAndCall(sizes,maxSizeCallback);var yScaleFactor=this._yScale.nextScale( maxSize?height/(maxSize*1.1):0.0);this._overviewCanvas.width=width*window.device PixelRatio;this._overviewCanvas.height=height*window.devicePixelRatio;this._over viewCanvas.style.width=width+"px";this._overviewCanvas.style.height=height+"px"; var context=this._overviewCanvas.getContext("2d");context.scale(window.devicePix elRatio,window.devicePixelRatio);context.beginPath();context.lineWidth=2;context .strokeStyle="rgba(192, 192, 192, 0.6)";var currentX=(endTime-startTime)*scaleFa ctor;context.moveTo(currentX,height-1);context.lineTo(currentX,0);context.stroke ();context.closePath();var gridY;var gridValue;var gridLabelHeight=14;if(yScaleF actor){const maxGridValue=(height-gridLabelHeight)/yScaleFactor;gridValue=Math.p ow(1024,Math.floor(Math.log(maxGridValue)/Math.log(1024)));gridValue*=Math.pow(1 0,Math.floor(Math.log(maxGridValue/gridValue)/Math.LN10));if(gridValue*5<=maxGri dValue)
1698 gridValue*=5;gridY=Math.round(height-gridValue*yScaleFactor-0.5)+0.5;context.beg inPath();context.lineWidth=1;context.strokeStyle="rgba(0, 0, 0, 0.2)";context.mo veTo(0,gridY);context.lineTo(width,gridY);context.stroke();context.closePath();} 1679 gridValue*=5;gridY=Math.round(height-gridValue*yScaleFactor-0.5)+0.5;context.beg inPath();context.lineWidth=1;context.strokeStyle="rgba(0, 0, 0, 0.2)";context.mo veTo(0,gridY);context.lineTo(width,gridY);context.stroke();context.closePath();}
1699 function drawBarCallback(x,size) 1680 function drawBarCallback(x,size)
1700 {context.moveTo(x,height-1);context.lineTo(x,Math.round(height-size*yScaleFactor -1));} 1681 {context.moveTo(x,height-1);context.lineTo(x,Math.round(height-size*yScaleFactor -1));}
1701 context.beginPath();context.lineWidth=2;context.strokeStyle="rgba(192, 192, 192, 0.6)";aggregateAndCall(topSizes,drawBarCallback);context.stroke();context.close Path();context.beginPath();context.lineWidth=2;context.strokeStyle="rgba(0, 0, 1 92, 0.8)";aggregateAndCall(sizes,drawBarCallback);context.stroke();context.close Path();if(gridValue){var label=Number.bytesToString(gridValue);var labelPadding= 4;var labelX=0;var labelY=gridY-0.5;var labelWidth=2*labelPadding+context.measur eText(label).width;context.beginPath();context.textBaseline="bottom";context.fon t="10px "+window.getComputedStyle(this.element,null).getPropertyValue("font-fami ly");context.fillStyle="rgba(255, 255, 255, 0.75)";context.fillRect(labelX,label Y-gridLabelHeight,labelWidth,gridLabelHeight);context.fillStyle="rgb(64, 64, 64) ";context.fillText(label,labelX+labelPadding,labelY);context.fill();context.clos ePath();}},onResize:function() 1682 context.beginPath();context.lineWidth=2;context.strokeStyle="rgba(192, 192, 192, 0.6)";aggregateAndCall(topSizes,drawBarCallback);context.stroke();context.close Path();context.beginPath();context.lineWidth=2;context.strokeStyle="rgba(0, 0, 1 92, 0.8)";aggregateAndCall(sizes,drawBarCallback);context.stroke();context.close Path();if(gridValue){var label=Number.bytesToString(gridValue);var labelPadding= 4;var labelX=0;var labelY=gridY-0.5;var labelWidth=2*labelPadding+context.measur eText(label).width;context.beginPath();context.textBaseline="bottom";context.fon t="10px "+window.getComputedStyle(this.element,null).getPropertyValue("font-fami ly");context.fillStyle="rgba(255, 255, 255, 0.75)";context.fillRect(labelX,label Y-gridLabelHeight,labelWidth,gridLabelHeight);context.fillStyle="rgb(64, 64, 64) ";context.fillText(label,labelX+labelPadding,labelY);context.fill();context.clos ePath();}},onResize:function()
1702 {this._updateOverviewCanvas=true;this._scheduleUpdate();},_onWindowChanged:funct ion() 1683 {this._updateOverviewCanvas=true;this._scheduleUpdate();},_onWindowChanged:funct ion()
1703 {if(!this._updateGridTimerId) 1684 {if(!this._updateGridTimerId)
1704 this._updateGridTimerId=setTimeout(this._updateGrid.bind(this),10);},_scheduleUp date:function() 1685 this._updateGridTimerId=setTimeout(this._updateGrid.bind(this),10);},_scheduleUp date:function()
1705 {if(this._updateTimerId) 1686 {if(this._updateTimerId)
1706 return;this._updateTimerId=setTimeout(this.update.bind(this),10);},_updateBounda ries:function() 1687 return;this._updateTimerId=setTimeout(this.update.bind(this),10);},_updateBounda ries:function()
1707 {this._windowLeft=this._overviewGrid.windowLeft();this._windowRight=this._overvi ewGrid.windowRight();this._windowWidth=this._windowRight-this._windowLeft;},upda te:function() 1688 {this._windowLeft=this._overviewGrid.windowLeft();this._windowRight=this._overvi ewGrid.windowRight();this._windowWidth=this._windowRight-this._windowLeft;},upda te:function()
(...skipping 25 matching lines...) Expand all
1733 {this._postMessage({eventName:name,data:data});},dispatchMessage:function(event) 1714 {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;} 1715 {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;}
1735 case"dispose":{delete this._objects[data.objectId];break;} 1716 case"dispose":{delete this._objects[data.objectId];break;}
1736 case"getter":{var object=this._objects[data.objectId];var result=object[data.met hodName];response.result=result;break;} 1717 case"getter":{var object=this._objects[data.objectId];var result=object[data.met hodName];response.result=result;break;}
1737 case"factory":{var object=this._objects[data.objectId];var result=object[data.me thodName].apply(object,data.methodArguments);if(result) 1718 case"factory":{var object=this._objects[data.objectId];var result=object[data.me thodName].apply(object,data.methodArguments);if(result)
1738 this._objects[data.newObjectId]=result;response.result=!!result;break;} 1719 this._objects[data.newObjectId]=result;response.result=!!result;break;}
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) 1720 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)
1740 response.errorMethodName=data.methodName;} 1721 response.errorMethodName=data.methodName;}
1741 this._postMessage(response);}};;WebInspector.JSHeapSnapshot=function(profile,pro gress) 1722 this._postMessage(response);}};;WebInspector.JSHeapSnapshot=function(profile,pro gress)
1742 {this._nodeFlags={canBeQueried:1,detachedDOMTreeNode:2,pageObject:4,visitedMarke rMask:0x0ffff,visitedMarker:0x10000};this._lazyStringCache={};WebInspector.HeapS napshot.call(this,profile,progress);} 1723 {this._nodeFlags={canBeQueried:1,detachedDOMTreeNode:2,pageObject:4,visitedMarke rMask:0x0ffff,visitedMarker:0x10000};this._lazyStringCache={};WebInspector.HeapS napshot.call(this,profile,progress);}
1743 WebInspector.JSHeapSnapshot.prototype={createNode:function(nodeIndex) 1724 WebInspector.JSHeapSnapshot.prototype={maxJsNodeId:function()
1725 {var nodeFieldCount=this._nodeFieldCount;var nodes=this._nodes;var nodesLength=n odes.length;var id=0;for(var nodeIndex=this._nodeIdOffset;nodeIndex<nodesLength; nodeIndex+=nodeFieldCount){var nextId=nodes[nodeIndex];if(nextId%2===0)
1726 continue;if(id<nodes[nodeIndex])
1727 id=nodes[nodeIndex];}
1728 return id;},createNode:function(nodeIndex)
1744 {return new WebInspector.JSHeapSnapshotNode(this,nodeIndex);},createEdge:functio n(edges,edgeIndex) 1729 {return new WebInspector.JSHeapSnapshotNode(this,nodeIndex);},createEdge:functio n(edges,edgeIndex)
1745 {return new WebInspector.JSHeapSnapshotEdge(this,edges,edgeIndex);},createRetain ingEdge:function(retainedNodeIndex,retainerIndex) 1730 {return new WebInspector.JSHeapSnapshotEdge(this,edges,edgeIndex);},createRetain ingEdge:function(retainedNodeIndex,retainerIndex)
1746 {return new WebInspector.JSHeapSnapshotRetainerEdge(this,retainedNodeIndex,retai nerIndex);},classNodesFilter:function() 1731 {return new WebInspector.JSHeapSnapshotRetainerEdge(this,retainedNodeIndex,retai nerIndex);},classNodesFilter:function()
1747 {function filter(node) 1732 {function filter(node)
1748 {return node.isUserObject();} 1733 {return node.isUserObject();}
1749 return filter;},containmentEdgesFilter:function(showHiddenData) 1734 return filter;},containmentEdgesFilter:function(showHiddenData)
1750 {function filter(edge){if(edge.isInvisible()) 1735 {function filter(edge){if(edge.isInvisible())
1751 return false;if(showHiddenData) 1736 return false;if(showHiddenData)
1752 return true;return!edge.isHidden()&&!edge.node().isHidden();} 1737 return true;return!edge.isHidden()&&!edge.node().isHidden();}
1753 return filter;},retainingEdgesFilter:function(showHiddenData) 1738 return filter;},retainingEdgesFilter:function(showHiddenData)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 WebInspector.JSHeapSnapshotRetainerEdge.prototype={clone:function() 1830 WebInspector.JSHeapSnapshotRetainerEdge.prototype={clone:function()
1846 {return new WebInspector.JSHeapSnapshotRetainerEdge(this._snapshot,this._retaine dNodeIndex,this.retainerIndex());},isHidden:function() 1831 {return new WebInspector.JSHeapSnapshotRetainerEdge(this._snapshot,this._retaine dNodeIndex,this.retainerIndex());},isHidden:function()
1847 {return this._edge().isHidden();},isInternal:function() 1832 {return this._edge().isHidden();},isInternal:function()
1848 {return this._edge().isInternal();},isInvisible:function() 1833 {return this._edge().isInternal();},isInvisible:function()
1849 {return this._edge().isInvisible();},isShortcut:function() 1834 {return this._edge().isInvisible();},isShortcut:function()
1850 {return this._edge().isShortcut();},isWeak:function() 1835 {return this._edge().isShortcut();},isWeak:function()
1851 {return this._edge().isWeak();},__proto__:WebInspector.HeapSnapshotRetainerEdge. prototype};WebInspector.ProfileLauncherView=function(profilesPanel) 1836 {return this._edge().isWeak();},__proto__:WebInspector.HeapSnapshotRetainerEdge. prototype};WebInspector.ProfileLauncherView=function(profilesPanel)
1852 {WebInspector.View.call(this);this._panel=profilesPanel;this.element.addStyleCla ss("profile-launcher-view");this.element.addStyleClass("panel-enabler-view");thi s._contentElement=this.element.createChild("div","profile-launcher-view-content" );this._innerContentElement=this._contentElement.createChild("div");this._contro lButton=this._contentElement.createChild("button","control-profiling");this._con trolButton.addEventListener("click",this._controlButtonClicked.bind(this),false) ;} 1837 {WebInspector.View.call(this);this._panel=profilesPanel;this.element.addStyleCla ss("profile-launcher-view");this.element.addStyleClass("panel-enabler-view");thi s._contentElement=this.element.createChild("div","profile-launcher-view-content" );this._innerContentElement=this._contentElement.createChild("div");this._contro lButton=this._contentElement.createChild("button","control-profiling");this._con trolButton.addEventListener("click",this._controlButtonClicked.bind(this),false) ;}
1853 WebInspector.ProfileLauncherView.prototype={addProfileType:function(profileType) 1838 WebInspector.ProfileLauncherView.prototype={addProfileType:function(profileType)
1854 {var descriptionElement=this._innerContentElement.createChild("h1");descriptionE lement.textContent=profileType.description;var decorationElement=profileType.dec orationElement();if(decorationElement) 1839 {var descriptionElement=this._innerContentElement.createChild("h1");descriptionE lement.textContent=profileType.description;var decorationElement=profileType.dec orationElement();if(decorationElement)
1855 this._innerContentElement.appendChild(decorationElement);this._isInstantProfile= profileType.isInstantProfile();this._isEnabled=profileType.isEnabled();},_contro lButtonClicked:function() 1840 this._innerContentElement.appendChild(decorationElement);this._isInstantProfile= profileType.isInstantProfile();this._isEnabled=profileType.isEnabled();this._pro fileTypeId=profileType.id;},_controlButtonClicked:function()
1856 {this._panel.toggleRecordButton();},_updateControls:function() 1841 {this._panel.toggleRecordButton();},_updateControls:function()
1857 {if(this._isEnabled) 1842 {if(this._isEnabled)
1858 this._controlButton.removeAttribute("disabled");else 1843 this._controlButton.removeAttribute("disabled");else
1859 this._controlButton.setAttribute("disabled","");if(this._isInstantProfile){this. _controlButton.removeStyleClass("running");this._controlButton.textContent=WebIn spector.UIString("Take Snapshot");}else if(this._isProfiling){this._controlButto n.addStyleClass("running");this._controlButton.textContent=WebInspector.UIString ("Stop");}else{this._controlButton.removeStyleClass("running");this._controlButt on.textContent=WebInspector.UIString("Start");}},profileStarted:function() 1844 this._controlButton.setAttribute("disabled","");if(this._isInstantProfile){this. _controlButton.removeStyleClass("running");this._controlButton.textContent=WebIn spector.UIString("Take Snapshot");}else if(this._isProfiling){this._controlButto n.addStyleClass("running");this._controlButton.textContent=WebInspector.UIString ("Stop");}else{this._controlButton.removeStyleClass("running");this._controlButt on.textContent=WebInspector.UIString("Start");}},profileStarted:function()
1860 {this._isProfiling=true;this._updateControls();},profileFinished:function() 1845 {this._isProfiling=true;WebInspector.profileManager.notifyStarted(this._profileT ypeId);this._updateControls();},profileFinished:function()
1861 {this._isProfiling=false;this._updateControls();},updateProfileType:function(pro fileType) 1846 {this._isProfiling=false;WebInspector.profileManager.notifyStoped(this._profileT ypeId);this._updateControls();},updateProfileType:function(profileType)
1862 {this._isInstantProfile=profileType.isInstantProfile();this._isEnabled=profileTy pe.isEnabled();this._updateControls();},__proto__:WebInspector.View.prototype} 1847 {this._isInstantProfile=profileType.isInstantProfile();this._isEnabled=profileTy pe.isEnabled();this._profileTypeId=profileType.id;this._updateControls();},__pro to__:WebInspector.View.prototype}
1863 WebInspector.MultiProfileLauncherView=function(profilesPanel) 1848 WebInspector.MultiProfileLauncherView=function(profilesPanel)
1864 {WebInspector.ProfileLauncherView.call(this,profilesPanel);var header=this._inne rContentElement.createChild("h1");header.textContent=WebInspector.UIString("Sele ct profiling type");this._profileTypeSelectorForm=this._innerContentElement.crea teChild("form");this._innerContentElement.createChild("div","flexible-space");} 1849 {WebInspector.ProfileLauncherView.call(this,profilesPanel);var header=this._inne rContentElement.createChild("h1");header.textContent=WebInspector.UIString("Sele ct profiling type");this._profileTypeSelectorForm=this._innerContentElement.crea teChild("form");this._innerContentElement.createChild("div","flexible-space");}
1865 WebInspector.MultiProfileLauncherView.EventTypes={ProfileTypeSelected:"profile-t ype-selected"} 1850 WebInspector.MultiProfileLauncherView.EventTypes={ProfileTypeSelected:"profile-t ype-selected"}
1866 WebInspector.MultiProfileLauncherView.prototype={addProfileType:function(profile Type) 1851 WebInspector.MultiProfileLauncherView.prototype={addProfileType:function(profile Type)
1867 {var checked=!this._profileTypeSelectorForm.children.length;var labelElement=thi s._profileTypeSelectorForm.createChild("label");labelElement.textContent=profile Type.name;var optionElement=document.createElement("input");labelElement.insertB efore(optionElement,labelElement.firstChild);optionElement.type="radio";optionEl ement.name="profile-type";optionElement.style.hidden=true;if(checked){optionElem ent.checked=checked;this.dispatchEventToListeners(WebInspector.MultiProfileLaunc herView.EventTypes.ProfileTypeSelected,profileType);} 1852 {var checked=!this._profileTypeSelectorForm.children.length;var labelElement=thi s._profileTypeSelectorForm.createChild("label");labelElement.textContent=profile Type.name;var optionElement=document.createElement("input");labelElement.insertB efore(optionElement,labelElement.firstChild);optionElement.type="radio";optionEl ement.name="profile-type";optionElement.style.hidden=true;if(checked){optionElem ent.checked=checked;this.dispatchEventToListeners(WebInspector.MultiProfileLaunc herView.EventTypes.ProfileTypeSelected,profileType);}
1868 optionElement.addEventListener("change",this._profileTypeChanged.bind(this,profi leType),false);var descriptionElement=labelElement.createChild("p");descriptionE lement.textContent=profileType.description;var decorationElement=profileType.dec orationElement();if(decorationElement) 1853 optionElement.addEventListener("change",this._profileTypeChanged.bind(this,profi leType),false);var descriptionElement=labelElement.createChild("p");descriptionE lement.textContent=profileType.description;var decorationElement=profileType.dec orationElement();if(decorationElement)
1869 labelElement.appendChild(decorationElement);},_controlButtonClicked:function() 1854 labelElement.appendChild(decorationElement);},_controlButtonClicked:function()
1870 {this._panel.toggleRecordButton();},_updateControls:function() 1855 {this._panel.toggleRecordButton();},_updateControls:function()
1871 {WebInspector.ProfileLauncherView.prototype._updateControls.call(this);var items =this._profileTypeSelectorForm.elements;for(var i=0;i<items.length;++i){if(items [i].type==="radio") 1856 {WebInspector.ProfileLauncherView.prototype._updateControls.call(this);var items =this._profileTypeSelectorForm.elements;for(var i=0;i<items.length;++i){if(items [i].type==="radio")
1872 items[i].disabled=this._isProfiling;}},_profileTypeChanged:function(profileType, event) 1857 items[i].disabled=this._isProfiling;}},_profileTypeChanged:function(profileType, event)
1873 {this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes. ProfileTypeSelected,profileType);this._isInstantProfile=profileType.isInstantPro file();this._isEnabled=profileType.isEnabled();this._updateControls();},profileS tarted:function() 1858 {this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes. ProfileTypeSelected,profileType);this._isInstantProfile=profileType.isInstantPro file();this._isEnabled=profileType.isEnabled();this._profileTypeId=profileType.i d;this._updateControls();},profileStarted:function()
1874 {this._isProfiling=true;this._updateControls();},profileFinished:function() 1859 {this._isProfiling=true;WebInspector.profileManager.notifyStarted(this._profileT ypeId);this._updateControls();},profileFinished:function()
1875 {this._isProfiling=false;this._updateControls();},__proto__:WebInspector.Profile LauncherView.prototype};WebInspector.TopDownProfileDataGridNode=function(profile Node,owningTree) 1860 {this._isProfiling=false;WebInspector.profileManager.notifyStoped(this._profileT ypeId);this._updateControls();},__proto__:WebInspector.ProfileLauncherView.proto type};WebInspector.TopDownProfileDataGridNode=function(profileNode,owningTree)
1876 {var hasChildren=!!(profileNode.children&&profileNode.children.length);WebInspec tor.ProfileDataGridNode.call(this,profileNode,owningTree,hasChildren);this._rema iningChildren=profileNode.children;} 1861 {var hasChildren=!!(profileNode.children&&profileNode.children.length);WebInspec tor.ProfileDataGridNode.call(this,profileNode,owningTree,hasChildren);this._rema iningChildren=profileNode.children;}
1877 WebInspector.TopDownProfileDataGridNode.prototype={_sharedPopulate:function() 1862 WebInspector.TopDownProfileDataGridNode.prototype={_sharedPopulate:function()
1878 {var children=this._remainingChildren;var childrenLength=children.length;for(var i=0;i<childrenLength;++i) 1863 {var children=this._remainingChildren;var childrenLength=children.length;for(var i=0;i<childrenLength;++i)
1879 this.appendChild(new WebInspector.TopDownProfileDataGridNode(children[i],this.tr ee));this._remainingChildren=null;},_exclude:function(aCallUID) 1864 this.appendChild(new WebInspector.TopDownProfileDataGridNode(children[i],this.tr ee));this._remainingChildren=null;},_exclude:function(aCallUID)
1880 {if(this._remainingChildren) 1865 {if(this._remainingChildren)
1881 this.populate();this._save();var children=this.children;var index=this.children. length;while(index--) 1866 this.populate();this._save();var children=this.children;var index=this.children. length;while(index--)
1882 children[index]._exclude(aCallUID);var child=this.childrenByCallUID[aCallUID];if (child) 1867 children[index]._exclude(aCallUID);var child=this.childrenByCallUID[aCallUID];if (child)
1883 this._merge(child,true);},__proto__:WebInspector.ProfileDataGridNode.prototype} 1868 this._merge(child,true);},__proto__:WebInspector.ProfileDataGridNode.prototype}
1884 WebInspector.TopDownProfileDataGridTree=function(profileView,rootProfileNode) 1869 WebInspector.TopDownProfileDataGridTree=function(profileView,rootProfileNode)
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);} 1870 {WebInspector.ProfileDataGridTree.call(this,profileView,rootProfileNode);this._r emainingChildren=rootProfileNode.children;var any=(this);var node=(any);WebInspe ctor.TopDownProfileDataGridNode.prototype.populate.call(node);}
1886 WebInspector.TopDownProfileDataGridTree.prototype={focus:function(profileDataGri dNode) 1871 WebInspector.TopDownProfileDataGridTree.prototype={focus:function(profileDataGri dNode)
1887 {if(!profileDataGridNode) 1872 {if(!profileDataGridNode)
1888 return;this._save();profileDataGridNode.savePosition();this.children=[profileDat aGridNode];this.totalTime=profileDataGridNode.totalTime;},exclude:function(profi leDataGridNode) 1873 return;this._save();profileDataGridNode.savePosition();this.children=[profileDat aGridNode];this.totalTime=profileDataGridNode.totalTime;},exclude:function(profi leDataGridNode)
1889 {if(!profileDataGridNode) 1874 {if(!profileDataGridNode)
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) 1875 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)
1891 this.sort(this.lastComparator,true);},restore:function() 1876 this.sort(this.lastComparator,true);},restore:function()
1892 {if(!this._savedChildren) 1877 {if(!this._savedChildren)
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) 1878 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)
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);} 1879 {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("img","canvas-replay-ima ge");this._debugInfoElement=replayImageContainer.createChild("div","canvas-debug -info hidden");this._spinnerIcon=replayImageContainer.createChild("img","canvas- spinner-icon hidden");var replayLogContainer=this._imageSplitView.secondElement( );var controlsContainer=replayLogContainer.createChild("div","status-bar");var l ogGridContainer=replayLogContainer.createChild("div","canvas-replay-log");this._ createControlButton(controlsContainer,"canvas-replay-first-step",WebInspector.UI String("First call."),this._onReplayFirstStepClick.bind(this));this._createContr olButton(controlsContainer,"canvas-replay-prev-step",WebInspector.UIString("Prev ious call."),this._onReplayStepClick.bind(this,false));this._createControlButton (controlsContainer,"canvas-replay-next-step",WebInspector.UIString("Next call.") ,this._onReplayStepClick.bind(this,true));this._createControlButton(controlsCont ainer,"canvas-replay-prev-draw",WebInspector.UIString("Previous drawing call."), this._onReplayDrawingCallClick.bind(this,false));this._createControlButton(contr olsContainer,"canvas-replay-next-draw",WebInspector.UIString("Next drawing call. "),this._onReplayDrawingCallClick.bind(this,true));this._createControlButton(con trolsContainer,"canvas-replay-last-step",WebInspector.UIString("Last call."),thi s._onReplayLastStepClick.bind(this));this._replayContextSelector=new WebInspecto r.StatusBarComboBox(this._onReplayContextChanged.bind(this));this._replayContext Selector.createOption(WebInspector.UIString("<screenshot auto>"),WebInspector.UI String("Show screenshot of the last replayed resource."),"");controlsContainer.a ppendChild(this._replayContextSelector.element);this._installReplayInfoSidebarWi dgets(controlsContainer);this._replayStateView=new WebInspector.CanvasReplayStat eView(this._traceLogPlayer);this._replayStateView.show(this._replayInfoSplitView .secondElement());this._replayContexts={};var columns=[{title:"#",sortable:false ,width:"5%"},{title:WebInspector.UIString("Call"),sortable:false,width:"75%",dis closure:true},{title:WebInspector.UIString("Location"),sortable:false,width:"20% "}];this._logGrid=new WebInspector.DataGrid(columns);this._logGrid.element.addSt yleClass("fill");this._logGrid.show(logGridContainer);this._logGrid.addEventList ener(WebInspector.DataGrid.Events.SelectedNode,this._replayTraceLog,this);this.e lement.addEventListener("mousedown",this._onMouseClick.bind(this),true);this._po poverHelper=new WebInspector.ObjectPopoverHelper(this.element,this._popoverAncho r.bind(this),this._resolveObjectForPopover.bind(this),this._onHidePopover.bind(t his),true);this._popoverHelper.setRemoteObjectFormatter(this._hexNumbersFormatte r.bind(this));this._requestTraceLog(0);}
1895 WebInspector.CanvasProfileView.TraceLogPollingInterval=500;WebInspector.CanvasPr ofileView.prototype={dispose:function() 1880 WebInspector.CanvasProfileView.TraceLogPollingInterval=500;WebInspector.CanvasPr ofileView.prototype={dispose:function()
1896 {this._linkifier.reset();},get statusBarItems() 1881 {this._linkifier.reset();},get statusBarItems()
1897 {return[];},get profile() 1882 {return[];},get profile()
1898 {return this._profile;},elementsToRestoreScrollPositionsFor:function() 1883 {return this._profile;},elementsToRestoreScrollPositionsFor:function()
1899 {return[this._logGrid.scrollContainer];},_installReplayInfoSidebarWidgets:functi on(controlsContainer) 1884 {return[this._logGrid.scrollContainer];},_installReplayInfoSidebarWidgets:functi on(controlsContainer)
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() 1885 {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()
1901 {this._enableReplayInfoSidebar(this._toggleReplayStateSidebarButton.state==="lef t");}},_enableReplayInfoSidebar:function(show) 1886 {this._enableReplayInfoSidebar(this._toggleReplayStateSidebarButton.state==="lef t");}},_enableReplayInfoSidebar:function(show)
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();} 1887 {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();}
1903 this._replayInfoResizeWidgetElement.enableStyleClass("hidden",!show);},_onMouseC lick:function(event) 1888 this._replayInfoResizeWidgetElement.enableStyleClass("hidden",!show);},_onMouseC lick:function(event)
1904 {var resourceLinkElement=event.target.enclosingNodeOrSelfWithClass("canvas-forma tted-resource");if(resourceLinkElement){this._enableReplayInfoSidebar(true);this ._replayStateView.selectResource(resourceLinkElement.__resourceId);event.consume (true);return;} 1889 {var resourceLinkElement=event.target.enclosingNodeOrSelfWithClass("canvas-forma tted-resource");if(resourceLinkElement){this._enableReplayInfoSidebar(true);this ._replayStateView.selectResource(resourceLinkElement.__resourceId);event.consume (true);return;}
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 this._forEachGridNode(callback);},_saveScrollState:function() 2141 this._forEachGridNode(callback);},_saveScrollState:function()
2157 {if(!this._currentResourceId) 2142 {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() 2143 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) 2144 {if(!this._currentResourceId)
2160 return;var key=this._resourceKindId(this._currentResourceId);var scrollState=thi s._gridScrollPositions[key];if(!scrollState) 2145 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) 2146 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") 2147 {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") 2148 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;}} 2149 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}; 2150 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_linux64/resources/inspector/NetworkPanel.js ('k') | chrome_linux64/resources/inspector/ResourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698