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

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

Issue 310483004: Roll reference builds to 35.0.1916.114. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 WebInspector.ProfileType=function(id,name) 1 WebInspector.ProfileType=function(id,name)
2 {this._id=id;this._name=name;this._profiles=[];this.treeElement=null;this._profi leBeingRecorded=null;window.addEventListener("unload",this._clearTempStorage.bin d(this),false);} 2 {WebInspector.Object.call(this);this._id=id;this._name=name;this._profiles=[];th is._profileBeingRecorded=null;this._nextProfileUid=1;window.addEventListener("un load",this._clearTempStorage.bind(this),false);}
3 WebInspector.ProfileType.Events={AddProfileHeader:"add-profile-header",RemovePro fileHeader:"remove-profile-header",ViewUpdated:"view-updated"} 3 WebInspector.ProfileType.Events={AddProfileHeader:"add-profile-header",RemovePro fileHeader:"remove-profile-header",ViewUpdated:"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 {function isFinished(profile) 16 {function isFinished(profile)
17 {return this._profileBeingRecorded!==profile;} 17 {return this._profileBeingRecorded!==profile;}
18 return this._profiles.filter(isFinished.bind(this));},decorationElement:function () 18 return this._profiles.filter(isFinished.bind(this));},decorationElement:function ()
19 {return null;},getProfile:function(uid) 19 {return null;},getProfile:function(uid)
20 {for(var i=0;i<this._profiles.length;++i){if(this._profiles[i].uid===uid) 20 {for(var i=0;i<this._profiles.length;++i){if(this._profiles[i].uid===uid)
21 return this._profiles[i];} 21 return this._profiles[i];}
22 return null;},loadFromFile:function(file) 22 return null;},loadFromFile:function(file)
23 {var name=file.name;if(name.endsWith(this.fileExtension())) 23 {var name=file.name;if(name.endsWith(this.fileExtension()))
24 name=name.substr(0,name.length-this.fileExtension().length);var profile=this.cre ateProfileLoadedFromFile(name);profile.setFromFile();this._profileBeingRecorded= profile;this.addProfile(profile);profile.loadFromFile(file);},createProfileLoade dFromFile:function(title) 24 name=name.substr(0,name.length-this.fileExtension().length);var profile=this.cre ateProfileLoadedFromFile(name);profile.setFromFile();this._profileBeingRecorded= profile;this.addProfile(profile);profile.loadFromFile(file);},createProfileLoade dFromFile:function(title)
25 {throw new Error("Needs implemented.");},addProfile:function(profile) 25 {throw new Error("Needs implemented.");},addProfile:function(profile)
26 {this._profiles.push(profile);this.dispatchEventToListeners(WebInspector.Profile Type.Events.AddProfileHeader,profile);},removeProfile:function(profile) 26 {this._profiles.push(profile);this.dispatchEventToListeners(WebInspector.Profile Type.Events.AddProfileHeader,profile);},removeProfile:function(profile)
27 {if(this._profileBeingRecorded===profile) 27 {var index=this._profiles.indexOf(profile);if(index===-1)
28 this._profileBeingRecorded=null;for(var i=0;i<this._profiles.length;++i){if(this ._profiles[i].uid===profile.uid){this._profiles.splice(i,1);break;}}},_clearTemp Storage:function() 28 return;this._profiles.splice(index,1);this._disposeProfile(profile);},_clearTemp Storage:function()
29 {for(var i=0;i<this._profiles.length;++i) 29 {for(var i=0;i<this._profiles.length;++i)
30 this._profiles[i].removeTempFile();},profileBeingRecorded:function() 30 this._profiles[i].removeTempFile();},profileBeingRecorded:function()
31 {return this._profileBeingRecorded;},_reset:function() 31 {return this._profileBeingRecorded;},profileBeingRecordedRemoved:function()
32 {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) 32 {},_reset:function()
33 view.dispose();} 33 {var profiles=this._profiles.slice(0);for(var i=0;i<profiles.length;++i)
34 this.dispatchEventToListeners(WebInspector.ProfileType.Events.RemoveProfileHeade r,profile);} 34 this._disposeProfile(profiles[i]);this._profiles=[];this._nextProfileUid=1;},_di sposeProfile:function(profile)
35 this.treeElement.removeChildren();this._profiles=[];},__proto__:WebInspector.Obj ect.prototype} 35 {this.dispatchEventToListeners(WebInspector.ProfileType.Events.RemoveProfileHead er,profile);profile.dispose();if(this._profileBeingRecorded===profile){this.prof ileBeingRecordedRemoved();this._profileBeingRecorded=null;}},__proto__:WebInspec tor.Object.prototype}
36 WebInspector.ProfileHeader=function(profileType,title,uid) 36 WebInspector.ProfileHeader=function(profileType,title)
37 {this._profileType=profileType;this.title=title;this.uid=(uid===undefined)?-1:ui d;this._fromFile=false;} 37 {this._profileType=profileType;this.title=title;this.uid=profileType._nextProfil eUid++;this._fromFile=false;}
38 WebInspector.ProfileHeader._nextProfileFromFileUid=1;WebInspector.ProfileHeader. prototype={profileType:function() 38 WebInspector.ProfileHeader.StatusUpdate=function(subtitle,wait)
39 {return this._profileType;},createSidebarTreeElement:function() 39 {this.subtitle=subtitle;this.wait=wait;}
40 {throw new Error("Needs implemented.");},existingView:function() 40 WebInspector.ProfileHeader.Events={UpdateStatus:"UpdateStatus",ProfileReceived:" ProfileReceived"}
41 {return this._view;},view:function(panel) 41 WebInspector.ProfileHeader.prototype={profileType:function()
42 {if(!this._view) 42 {return this._profileType;},updateStatus:function(subtitle,wait)
43 this._view=this.createView(panel);return this._view;},createView:function(panel) 43 {this.dispatchEventToListeners(WebInspector.ProfileHeader.Events.UpdateStatus,ne w WebInspector.ProfileHeader.StatusUpdate(subtitle,wait));},createSidebarTreeEle ment:function()
44 {throw new Error("Needs implemented.");},createView:function()
44 {throw new Error("Not implemented.");},removeTempFile:function() 45 {throw new Error("Not implemented.");},removeTempFile:function()
45 {if(this._tempFile) 46 {if(this._tempFile)
46 this._tempFile.remove();},dispose:function() 47 this._tempFile.remove();},dispose:function()
47 {},load:function(callback) 48 {},load:function(callback)
48 {},canSaveToFile:function() 49 {},canSaveToFile:function()
49 {return false;},saveToFile:function() 50 {return false;},saveToFile:function()
50 {throw new Error("Needs implemented");},loadFromFile:function(file) 51 {throw new Error("Needs implemented");},loadFromFile:function(file)
51 {throw new Error("Needs implemented");},fromFile:function() 52 {throw new Error("Needs implemented");},fromFile:function()
52 {return this._fromFile;},setFromFile:function() 53 {return this._fromFile;},setFromFile:function()
53 {this._fromFile=true;this.uid="From file #"+WebInspector.ProfileHeader._nextProf ileFromFileUid++;}} 54 {this._fromFile=true;},__proto__:WebInspector.Object.prototype}
54 WebInspector.ProfilesPanel=function(name,type) 55 WebInspector.ProfilesPanel=function()
55 {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().classList.ad d("vbox");this.splitView.sidebarElement().classList.add("vbox");this._searchable View=new WebInspector.SearchableView(this);this.splitView.setMainView(this._sear chableView);this.profilesItemTreeElement=new WebInspector.ProfilesSidebarTreeEle ment(this);this.sidebarTree.appendChild(this.profilesItemTreeElement);this._sing leProfileMode=singleProfileMode;this._profileTypesByIdMap={};this.profileViews=d ocument.createElement("div");this.profileViews.id="profile-views";this.profileVi ews.classList.add("vbox");this._searchableView.element.appendChild(this.profileV iews);var statusBarContainer=this.splitView.mainElement().createChild("div","pro files-status-bar");this._statusBarElement=statusBarContainer.createChild("div"," status-bar");var sidebarTreeBox=this.splitView.sidebarElement().createChild("div ","profiles-sidebar-tree-box");sidebarTreeBox.appendChild(this.sidebarTreeElemen t);var statusBarContainerLeft=this.splitView.sidebarElement().createChild("div", "profiles-status-bar");this._statusBarButtons=statusBarContainerLeft.createChild ("div","status-bar");this.recordButton=new WebInspector.StatusBarButton("","reco rd-profile-status-bar-item");this.recordButton.addEventListener("click",this.tog gleRecordButton,this);this._statusBarButtons.appendChild(this.recordButton.eleme nt);this.clearResultsButton=new WebInspector.StatusBarButton(WebInspector.UIStri ng("Clear all profiles."),"clear-status-bar-item");this.clearResultsButton.addEv entListener("click",this._clearProfiles,this);this._statusBarButtons.appendChild (this.clearResultsButton.element);this._profileTypeStatusBarItemsContainer=this. _statusBarElement.createChild("div");this._profileViewStatusBarItemsContainer=th is._statusBarElement.createChild("div");if(singleProfileMode){this._launcherView =this._createLauncherView();this._registerProfileType((type));this._selectedProf ileType=type;this._updateProfileTypeSpecificUI();}else{this._launcherView=new We bInspector.MultiProfileLauncherView(this);this._launcherView.addEventListener(We bInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,this._onProfi leTypeSelected,this);this._registerProfileType(new WebInspector.CPUProfileType() );this._registerProfileType(new WebInspector.HeapSnapshotProfileType());this._re gisterProfileType(new WebInspector.TrackingHeapSnapshotProfileType(this));if(!We bInspector.WorkerManager.isWorkerFrontend()&&WebInspector.experimentsSettings.ca nvasInspection.isEnabled()) 56 {WebInspector.PanelWithSidebarTree.call(this,"profiles");this.registerRequiredCS S("panelEnablerView.css");this.registerRequiredCSS("heapProfiler.css");this.regi sterRequiredCSS("profilesPanel.css");this._searchableView=new WebInspector.Searc hableView(this);var mainView=new WebInspector.VBox();this._searchableView.show(m ainView.element);mainView.show(this.mainElement());this.profilesItemTreeElement= new WebInspector.ProfilesSidebarTreeElement(this);this.sidebarTree.appendChild(t his.profilesItemTreeElement);this.profileViews=document.createElement("div");thi s.profileViews.id="profile-views";this.profileViews.classList.add("vbox");this._ searchableView.element.appendChild(this.profileViews);var statusBarContainer=doc ument.createElementWithClass("div","profiles-status-bar");mainView.element.inser tBefore(statusBarContainer,mainView.element.firstChild);this._statusBarElement=s tatusBarContainer.createChild("div","status-bar");this.sidebarElement().classLis t.add("profiles-sidebar-tree-box");var statusBarContainerLeft=document.createEle mentWithClass("div","profiles-status-bar");this.sidebarElement().insertBefore(st atusBarContainerLeft,this.sidebarElement().firstChild);this._statusBarButtons=st atusBarContainerLeft.createChild("div","status-bar");this.recordButton=new WebIn spector.StatusBarButton("","record-profile-status-bar-item");this.recordButton.a ddEventListener("click",this.toggleRecordButton,this);this._statusBarButtons.app endChild(this.recordButton.element);this.clearResultsButton=new WebInspector.Sta tusBarButton(WebInspector.UIString("Clear all profiles."),"clear-status-bar-item ");this.clearResultsButton.addEventListener("click",this._reset,this);this._stat usBarButtons.appendChild(this.clearResultsButton.element);this._profileTypeStatu sBarItemsContainer=this._statusBarElement.createChild("div");this._profileViewSt atusBarItemsContainer=this._statusBarElement.createChild("div");this._profileGro ups={};this._launcherView=new WebInspector.MultiProfileLauncherView(this);this._ launcherView.addEventListener(WebInspector.MultiProfileLauncherView.EventTypes.P rofileTypeSelected,this._onProfileTypeSelected,this);this._profileToView=[];this ._typeIdToSidebarSection={};var types=WebInspector.ProfileTypeRegistry.instance. profileTypes();for(var i=0;i<types.length;i++)
56 this._registerProfileType(new WebInspector.CanvasProfileType());this._launcherVi ew.restoreSelectedProfileType();} 57 this._registerProfileType(types[i]);this._launcherView.restoreSelectedProfileTyp e();this.profilesItemTreeElement.select();this._showLauncherView();this._createF ileSelectorElement();this.element.addEventListener("contextmenu",this._handleCon textMenuEvent.bind(this),true);this._registerShortcuts();this._configureCpuProfi lerSamplingInterval();WebInspector.settings.highResolutionCpuProfiling.addChange Listener(this._configureCpuProfilerSamplingInterval,this);}
57 this._reset();this._createFileSelectorElement();this.element.addEventListener("c ontextmenu",this._handleContextMenuEvent.bind(this),true);this._registerShortcut s();this._configureCpuProfilerSamplingInterval();WebInspector.settings.highResol utionCpuProfiling.addChangeListener(this._configureCpuProfilerSamplingInterval,t his);} 58 WebInspector.ProfileTypeRegistry=function(){this._profileTypes=[];this.cpuProfil eType=new WebInspector.CPUProfileType();this._addProfileType(this.cpuProfileType );this.heapSnapshotProfileType=new WebInspector.HeapSnapshotProfileType();this._ addProfileType(this.heapSnapshotProfileType);this.trackingHeapSnapshotProfileTyp e=new WebInspector.TrackingHeapSnapshotProfileType();this._addProfileType(this.t rackingHeapSnapshotProfileType);HeapProfilerAgent.enable();if(Capabilities.isMai nFrontend&&WebInspector.experimentsSettings.canvasInspection.isEnabled()){this.c anvasProfileType=new WebInspector.CanvasProfileType();this._addProfileType(this. canvasProfileType);}}
59 WebInspector.ProfileTypeRegistry.prototype={_addProfileType:function(profileType )
60 {this._profileTypes.push(profileType);},profileTypes:function()
61 {return this._profileTypes;}}
58 WebInspector.ProfilesPanel.prototype={searchableView:function() 62 WebInspector.ProfilesPanel.prototype={searchableView:function()
59 {return this._searchableView;},_createFileSelectorElement:function() 63 {return this._searchableView;},_createFileSelectorElement:function()
60 {if(this._fileSelectorElement) 64 {if(this._fileSelectorElement)
61 this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=We bInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element .appendChild(this._fileSelectorElement);},_createLauncherView:function() 65 this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=We bInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element .appendChild(this._fileSelectorElement);},_findProfileTypeByExtension:function(f ileName)
62 {return new WebInspector.ProfileLauncherView(this);},_findProfileTypeByExtension :function(fileName) 66 {var types=WebInspector.ProfileTypeRegistry.instance.profileTypes();for(var i=0; i<types.length;i++){var type=types[i];var extension=type.fileExtension();if(!ext ension)
63 {for(var id in this._profileTypesByIdMap){var type=this._profileTypesByIdMap[id] ;var extension=type.fileExtension();if(!extension)
64 continue;if(fileName.endsWith(type.fileExtension())) 67 continue;if(fileName.endsWith(type.fileExtension()))
65 return type;} 68 return type;}
66 return null;},_registerShortcuts:function() 69 return null;},_registerShortcuts:function()
67 {this.registerShortcuts(WebInspector.ShortcutsScreen.ProfilesPanelShortcuts.Star tStopRecording,this.toggleRecordButton.bind(this));},_configureCpuProfilerSampli ngInterval:function() 70 {this.registerShortcuts(WebInspector.ShortcutsScreen.ProfilesPanelShortcuts.Star tStopRecording,this.toggleRecordButton.bind(this));},_configureCpuProfilerSampli ngInterval:function()
68 {var intervalUs=WebInspector.settings.highResolutionCpuProfiling.get()?100:1000; ProfilerAgent.setSamplingInterval(intervalUs,didChangeInterval.bind(this));funct ion didChangeInterval(error) 71 {var intervalUs=WebInspector.settings.highResolutionCpuProfiling.get()?100:1000; ProfilerAgent.setSamplingInterval(intervalUs,didChangeInterval);function didChan geInterval(error)
69 {if(error) 72 {if(error)
70 WebInspector.showErrorMessage(error)}},_loadFromFile:function(file) 73 WebInspector.console.showErrorMessage(error);}},_loadFromFile:function(file)
71 {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) 74 {this._createFileSelectorElement();var profileType=this._findProfileTypeByExtens ion(file.name);if(!profileType){var extensions=[];var types=WebInspector.Profile TypeRegistry.instance.profileTypes();for(var i=0;i<types.length;i++){var extensi on=types[i].fileExtension();if(!extension)
72 continue;extensions.push(extension);} 75 continue;extensions.push(extension);}
73 WebInspector.log(WebInspector.UIString("Can't load file. Only files with extensi ons '%s' can be loaded.",extensions.join("', '")));return;} 76 WebInspector.console.log(WebInspector.UIString("Can't load file. Only files with extensions '%s' can be loaded.",extensions.join("', '")));return;}
74 if(!!profileType.profileBeingRecorded()){WebInspector.log(WebInspector.UIString( "Can't load profile when other profile is recording."));return;} 77 if(!!profileType.profileBeingRecorded()){WebInspector.console.log(WebInspector.U IString("Can't load profile when other profile is recording."));return;}
75 profileType.loadFromFile(file);},toggleRecordButton:function() 78 profileType.loadFromFile(file);},toggleRecordButton:function()
76 {var type=this._selectedProfileType;var isProfiling=type.buttonClicked();this.re cordButton.toggled=isProfiling;this.recordButton.title=type.buttonTooltip;if(isP rofiling){this._launcherView.profileStarted();if(type.hasTemporaryView()) 79 {var type=this._selectedProfileType;var isProfiling=type.buttonClicked();this.re cordButton.toggled=isProfiling;this.recordButton.title=type.buttonTooltip;if(isP rofiling){this._launcherView.profileStarted();if(type.hasTemporaryView())
77 this._showProfile(type.profileBeingRecorded());}else{this._launcherView.profileF inished();} 80 this.showProfile(type.profileBeingRecorded());}else{this._launcherView.profileFi nished();}
78 return true;},_profileBeingRecordedRemoved:function() 81 return true;},_profileBeingRecordedRemoved:function()
79 {this.recordButton.toggled=false;this.recordButton.title=this._selectedProfileTy pe.buttonTooltip;this._launcherView.profileFinished();},_onProfileTypeSelected:f unction(event) 82 {this.recordButton.toggled=false;this.recordButton.title=this._selectedProfileTy pe.buttonTooltip;this._launcherView.profileFinished();},_onProfileTypeSelected:f unction(event)
80 {this._selectedProfileType=(event.data);this._updateProfileTypeSpecificUI();},_u pdateProfileTypeSpecificUI:function() 83 {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) 84 {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]);}},_rese t:function() 85 this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]);}},_rese t:function()
83 {WebInspector.Panel.prototype.reset.call(this);for(var typeId in this._profileTy pesByIdMap) 86 {WebInspector.Panel.prototype.reset.call(this);var types=WebInspector.ProfileTyp eRegistry.instance.profileTypes();for(var i=0;i<types.length;i++)
84 this._profileTypesByIdMap[typeId]._reset();delete this.visibleView;delete this.c urrentQuery;this.searchCanceled();this._profileGroups={};this.recordButton.toggl ed=false;if(this._selectedProfileType) 87 types[i]._reset();delete this.visibleView;delete this.currentQuery;this.searchCa nceled();this._profileGroups={};this.recordButton.toggled=false;if(this._selecte dProfileType)
85 this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherVi ew.profileFinished();this.sidebarTreeElement.classList.remove("some-expandable") ;this._launcherView.detach();this.profileViews.removeChildren();this._profileVie wStatusBarItemsContainer.removeChildren();this.removeAllListeners();this.recordB utton.visible=true;this._profileViewStatusBarItemsContainer.classList.remove("hi dden");this.clearResultsButton.element.classList.remove("hidden");this.profilesI temTreeElement.select();this._showLauncherView();},_showLauncherView:function() 88 this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherVi ew.profileFinished();this.sidebarTree.element.classList.remove("some-expandable" );this._launcherView.detach();this.profileViews.removeChildren();this._profileVi ewStatusBarItemsContainer.removeChildren();this.removeAllListeners();this.record Button.visible=true;this._profileViewStatusBarItemsContainer.classList.remove("h idden");this.clearResultsButton.element.classList.remove("hidden");this.profiles ItemTreeElement.select();this._showLauncherView();},_showLauncherView:function()
86 {this.closeVisibleView();this._profileViewStatusBarItemsContainer.removeChildren ();this._launcherView.show(this.profileViews);this.visibleView=this._launcherVie w;},_clearProfiles:function() 89 {this.closeVisibleView();this._profileViewStatusBarItemsContainer.removeChildren ();this._launcherView.show(this.profileViews);this.visibleView=this._launcherVie w;},_garbageCollectButtonClicked:function()
87 {HeapProfilerAgent.clearProfiles();this._reset();},_garbageCollectButtonClicked: function()
88 {HeapProfilerAgent.collectGarbage();},_registerProfileType:function(profileType) 90 {HeapProfilerAgent.collectGarbage();},_registerProfileType:function(profileType)
89 {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._launcherView.addProfileType(profileType);var profileTypeSection=new WebIn spector.ProfileTypeSidebarSection(profileType);this._typeIdToSidebarSection[prof ileType.id]=profileTypeSection
92 this.sidebarTree.appendChild(profileTypeSection);profileTypeSection.childrenList Element.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),t rue);function onAddProfileHeader(event)
90 {this._addProfileHeader(event.data);} 93 {this._addProfileHeader(event.data);}
91 function onRemoveProfileHeader(event) 94 function onRemoveProfileHeader(event)
92 {this._removeProfileHeader(event.data);} 95 {this._removeProfileHeader(event.data);}
93 profileType.addEventListener(WebInspector.ProfileType.Events.ViewUpdated,this._u pdateProfileTypeSpecificUI,this);profileType.addEventListener(WebInspector.Profi leType.Events.AddProfileHeader,onAddProfileHeader,this);profileType.addEventList ener(WebInspector.ProfileType.Events.RemoveProfileHeader,onRemoveProfileHeader,t his);},_handleContextMenuEvent:function(event) 96 profileType.addEventListener(WebInspector.ProfileType.Events.ViewUpdated,this._u pdateProfileTypeSpecificUI,this);profileType.addEventListener(WebInspector.Profi leType.Events.AddProfileHeader,onAddProfileHeader,this);profileType.addEventList ener(WebInspector.ProfileType.Events.RemoveProfileHeader,onRemoveProfileHeader,t his);var profiles=profileType.getProfiles();for(var i=0;i<profiles.length;i++)
97 this._addProfileHeader(profiles[i]);},_handleContextMenuEvent:function(event)
94 {var element=event.srcElement;while(element&&!element.treeElement&&element!==thi s.element) 98 {var element=event.srcElement;while(element&&!element.treeElement&&element!==thi s.element)
95 element=element.parentElement;if(!element) 99 element=element.parentElement;if(!element)
96 return;if(element.treeElement&&element.treeElement.handleContextMenuEvent){eleme nt.treeElement.handleContextMenuEvent(event,this);return;} 100 return;if(element.treeElement&&element.treeElement.handleContextMenuEvent){eleme nt.treeElement.handleContextMenuEvent(event,this);return;}
97 var contextMenu=new WebInspector.ContextMenu(event);if(this.visibleView instance of WebInspector.HeapSnapshotView){this.visibleView.populateContextMenu(contextMe nu,event);} 101 var contextMenu=new WebInspector.ContextMenu(event);if(this.visibleView instance of WebInspector.HeapSnapshotView){this.visibleView.populateContextMenu(contextMe nu,event);}
98 if(element!==this.element||event.srcElement===this.splitView.sidebarElement()){c ontextMenu.appendItem(WebInspector.UIString("Load\u2026"),this._fileSelectorElem ent.click.bind(this._fileSelectorElement));} 102 if(element!==this.element||event.srcElement===this.sidebarElement()){contextMenu .appendItem(WebInspector.UIString("Load\u2026"),this._fileSelectorElement.click. bind(this._fileSelectorElement));}
99 contextMenu.show();},_makeTitleKey:function(text,profileTypeId) 103 contextMenu.show();},showLoadFromFileDialog:function()
100 {return escape(text)+'/'+escape(profileTypeId);},_addProfileHeader:function(prof ile) 104 {this._fileSelectorElement.click();},_addProfileHeader:function(profile)
101 {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.profileType().profileBeingRecorded()!== profile){var profileTitleKey=this._makeTitleKey(profile.title,typeId);if(!(profi leTitleKey in this._profileGroups)) 105 {var profileType=profile.profileType();var typeId=profileType.id;this._typeIdToS idebarSection[typeId].addProfileHeader(profile);;if(!this.visibleView||this.visi bleView===this._launcherView)
102 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 this.showProfile(profile);},_removeProfileHeader:function(profile)
103 group[0]._profilesTreeElement.revealAndSelect();group[0]._profilesTreeElement.sm all=true;group[0]._profilesTreeElement.mainTitle=WebInspector.UIString("Run %d", 1);this.sidebarTreeElement.classList.add("some-expandable");}
104 if(group.length>=2){sidebarParent=group._profilesTreeElement;alternateTitle=WebI nspector.UIString("Run %d",group.length);small=true;}}
105 var profileTreeElement=profile.createSidebarTreeElement();profile.sidebarElement =profileTreeElement;profileTreeElement.small=small;if(alternateTitle)
106 profileTreeElement.mainTitle=alternateTitle;profile._profilesTreeElement=profile TreeElement;sidebarParent.appendChild(profileTreeElement);if(!this.visibleView|| this.visibleView===this._launcherView)
107 this._showProfile(profile);},_removeProfileHeader:function(profile)
108 {if(profile.profileType()._profileBeingRecorded===profile) 107 {if(profile.profileType()._profileBeingRecorded===profile)
109 this._profileBeingRecordedRemoved();profile.dispose();profile.profileType().remo veProfile(profile);var sidebarParent=profile.profileType().treeElement;var profi leTitleKey=this._makeTitleKey(profile.title,profile.profileType().id);var group= this._profileGroups[profileTitleKey];if(group){group.splice(group.indexOf(profil e),1);if(group.length===1){var index=sidebarParent.children.indexOf(group._profi lesTreeElement);sidebarParent.insertChild(group[0]._profilesTreeElement,index);g roup[0]._profilesTreeElement.small=false;group[0]._profilesTreeElement.mainTitle =group[0].title;sidebarParent.removeChild(group._profilesTreeElement);} 108 this._profileBeingRecordedRemoved();var i=this._indexOfViewForProfile(profile);i f(i!==-1)
110 if(group.length!==0) 109 this._profileToView.splice(i,1);var profileType=profile.profileType();var typeId =profileType.id;var sectionIsEmpty=this._typeIdToSidebarSection[typeId].removePr ofileHeader(profile);if(sectionIsEmpty){this.profilesItemTreeElement.select();th is._showLauncherView();}},showProfile:function(profile)
111 sidebarParent=group._profilesTreeElement;else
112 delete this._profileGroups[profileTitleKey];}
113 sidebarParent.removeChild(profile._profilesTreeElement);if(!sidebarParent.childr en.length){this.profilesItemTreeElement.select();this._showLauncherView();sideba rParent.hidden=!this._singleProfileMode;}},_showProfile:function(profile)
114 {if(!profile||(profile.profileType().profileBeingRecorded()===profile)&&!profile .profileType().hasTemporaryView()) 110 {if(!profile||(profile.profileType().profileBeingRecorded()===profile)&&!profile .profileType().hasTemporaryView())
115 return null;var view=profile.view(this);if(view===this.visibleView) 111 return null;var view=this._viewForProfile(profile);if(view===this.visibleView)
116 return view;this.closeVisibleView();view.show(this.profileViews);profile._profil esTreeElement._suppressOnSelect=true;profile._profilesTreeElement.revealAndSelec t();delete profile._profilesTreeElement._suppressOnSelect;this.visibleView=view; this._profileViewStatusBarItemsContainer.removeChildren();var statusBarItems=vie w.statusBarItems;if(statusBarItems) 112 return view;this.closeVisibleView();view.show(this.profileViews);this.visibleVie w=view;var profileTypeSection=this._typeIdToSidebarSection[profile.profileType() .id];var sidebarElement=profileTypeSection.sidebarElementForProfile(profile);sid ebarElement.revealAndSelect();this._profileViewStatusBarItemsContainer.removeChi ldren();var statusBarItems=view.statusBarItems;if(statusBarItems)
117 for(var i=0;i<statusBarItems.length;++i) 113 for(var i=0;i<statusBarItems.length;++i)
118 this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);return v iew;},showObject:function(snapshotObjectId,viewName) 114 this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);return v iew;},showObject:function(snapshotObjectId,perspectiveName)
119 {var heapProfiles=this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeI d).getProfiles();for(var i=0;i<heapProfiles.length;i++){var profile=heapProfiles [i];if(profile.maxJSObjectId>=snapshotObjectId){this._showProfile(profile);var v iew=profile.view(this);view.changeView(viewName,function(){function didHighlight Object(found){if(!found) 115 {var heapProfiles=WebInspector.ProfileTypeRegistry.instance.heapSnapshotProfileT ype.getProfiles();for(var i=0;i<heapProfiles.length;i++){var profile=heapProfile s[i];if(profile.maxJSObjectId>=snapshotObjectId){this.showProfile(profile);var v iew=this._viewForProfile(profile);view.highlightLiveObject(perspectiveName,snaps hotObjectId);break;}}},_viewForProfile:function(profile)
120 WebInspector.log("Cannot find corresponding heap snapshot node",WebInspector.Con soleMessage.MessageLevel.Error,true);} 116 {var index=this._indexOfViewForProfile(profile);if(index!==-1)
121 view.dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId,didHighlightObjec t.bind(this));});break;}}},getProfile:function(typeId,uid) 117 return this._profileToView[index].view;var view=profile.createView();view.elemen t.classList.add("profile-view");this._profileToView.push({profile:profile,view:v iew});return view;},_indexOfViewForProfile:function(profile)
122 {return this.getProfileType(typeId).getProfile(uid);},showView:function(view) 118 {for(var i=0;i<this._profileToView.length;i++){if(this._profileToView[i].profile ===profile)
123 {this._showProfile(view.profile);},getProfileType:function(typeId) 119 return i;}
124 {return this._profileTypesByIdMap[typeId];},showProfile:function(typeId,uid) 120 return-1;},closeVisibleView:function()
125 {return this._showProfile(this.getProfile(typeId,Number(uid)));},closeVisibleVie w:function()
126 {if(this.visibleView) 121 {if(this.visibleView)
127 this.visibleView.detach();delete this.visibleView;},performSearch:function(query ,shouldJump) 122 this.visibleView.detach();delete this.visibleView;},performSearch:function(query ,shouldJump)
128 {this.searchCanceled();var visibleView=this.visibleView;if(!visibleView) 123 {this.searchCanceled();var visibleView=this.visibleView;if(!visibleView)
129 return;function finishedCallback(view,searchMatches) 124 return;function finishedCallback(view,searchMatches)
130 {if(!searchMatches) 125 {if(!searchMatches)
131 return;this._searchableView.updateSearchMatchesCount(searchMatches);this._search ResultsView=view;if(shouldJump){view.jumpToFirstSearchResult();this._searchableV iew.updateCurrentMatchIndex(view.currentSearchResultIndex());}} 126 return;this._searchableView.updateSearchMatchesCount(searchMatches);this._search ResultsView=view;if(shouldJump){view.jumpToFirstSearchResult();this._searchableV iew.updateCurrentMatchIndex(view.currentSearchResultIndex());}}
132 visibleView.currentQuery=query;visibleView.performSearch(query,finishedCallback. bind(this));},jumpToNextSearchResult:function() 127 visibleView.currentQuery=query;visibleView.performSearch(query,finishedCallback. bind(this));},jumpToNextSearchResult:function()
133 {if(!this._searchResultsView) 128 {if(!this._searchResultsView)
134 return;if(this._searchResultsView!==this.visibleView) 129 return;if(this._searchResultsView!==this.visibleView)
135 return;this._searchResultsView.jumpToNextSearchResult();this._searchableView.upd ateCurrentMatchIndex(this._searchResultsView.currentSearchResultIndex());},jumpT oPreviousSearchResult:function() 130 return;this._searchResultsView.jumpToNextSearchResult();this._searchableView.upd ateCurrentMatchIndex(this._searchResultsView.currentSearchResultIndex());},jumpT oPreviousSearchResult:function()
136 {if(!this._searchResultsView) 131 {if(!this._searchResultsView)
137 return;if(this._searchResultsView!==this.visibleView) 132 return;if(this._searchResultsView!==this.visibleView)
138 return;this._searchResultsView.jumpToPreviousSearchResult();this._searchableView .updateCurrentMatchIndex(this._searchResultsView.currentSearchResultIndex());},_ getAllProfiles:function() 133 return;this._searchResultsView.jumpToPreviousSearchResult();this._searchableView .updateCurrentMatchIndex(this._searchResultsView.currentSearchResultIndex());},s earchCanceled:function()
139 {var profiles=[];for(var typeId in this._profileTypesByIdMap)
140 profiles=profiles.concat(this._profileTypesByIdMap[typeId].getProfiles());return profiles;},searchCanceled:function()
141 {if(this._searchResultsView){if(this._searchResultsView.searchCanceled) 134 {if(this._searchResultsView){if(this._searchResultsView.searchCanceled)
142 this._searchResultsView.searchCanceled();this._searchResultsView.currentQuery=nu ll;this._searchResultsView=null;} 135 this._searchResultsView.searchCanceled();this._searchResultsView.currentQuery=nu ll;this._searchResultsView=null;}
143 this._searchableView.updateSearchMatchesCount(0);},_reportProfileProgress:functi on(profile,done,total) 136 this._searchableView.updateSearchMatchesCount(0);},appendApplicableItems:functio n(event,contextMenu,target)
144 {profile.sidebarElement.subtitle=WebInspector.UIString("%.0f%",(done/total)*100) ;profile.sidebarElement.wait=true;},appendApplicableItems:function(event,context Menu,target)
145 {if(!(target instanceof WebInspector.RemoteObject)) 137 {if(!(target instanceof WebInspector.RemoteObject))
146 return;if(WebInspector.inspectorView.currentPanel()!==this) 138 return;if(WebInspector.inspectorView.currentPanel()!==this)
147 return;var object=(target);var objectId=object.objectId;if(!objectId) 139 return;var object=(target);var objectId=object.objectId;if(!objectId)
148 return;var heapProfiles=this.getProfileType(WebInspector.HeapSnapshotProfileType .TypeId).getProfiles();if(!heapProfiles.length) 140 return;var heapProfiles=WebInspector.ProfileTypeRegistry.instance.heapSnapshotPr ofileType.getProfiles();if(!heapProfiles.length)
149 return;function revealInView(viewName) 141 return;function revealInView(viewName)
150 {HeapProfilerAgent.getHeapObjectId(objectId,didReceiveHeapObjectId.bind(this,vie wName));} 142 {HeapProfilerAgent.getHeapObjectId(objectId,didReceiveHeapObjectId.bind(this,vie wName));}
151 function didReceiveHeapObjectId(viewName,error,result) 143 function didReceiveHeapObjectId(viewName,error,result)
152 {if(WebInspector.inspectorView.currentPanel()!==this) 144 {if(WebInspector.inspectorView.currentPanel()!==this)
153 return;if(!error) 145 return;if(!error)
154 this.showObject(result,viewName);} 146 this.showObject(result,viewName);}
155 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} 147 if(WebInspector.settings.showAdvancedHeapSnapshotProperties.get())
148 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.PanelWithSidebarTree.prototy pe}
149 WebInspector.ProfileTypeSidebarSection=function(profileType)
150 {WebInspector.SidebarSectionTreeElement.call(this,profileType.treeItemTitle,null ,true);this._profileTreeElements=[];this._profileGroups={};this.hidden=true;}
151 WebInspector.ProfileTypeSidebarSection.ProfileGroup=function()
152 {this.profileSidebarTreeElements=[];this.sidebarTreeElement=null;}
153 WebInspector.ProfileTypeSidebarSection.prototype={addProfileHeader:function(prof ile)
154 {this.hidden=false;var profileType=profile.profileType();var sidebarParent=this; var profileTreeElement=profile.createSidebarTreeElement();this._profileTreeEleme nts.push(profileTreeElement);if(!profile.fromFile()&&profileType.profileBeingRec orded()!==profile){var profileTitle=profile.title;var group=this._profileGroups[ profileTitle];if(!group){group=new WebInspector.ProfileTypeSidebarSection.Profil eGroup();this._profileGroups[profileTitle]=group;}
155 group.profileSidebarTreeElements.push(profileTreeElement);var groupSize=group.pr ofileSidebarTreeElements.length;if(groupSize===2){group.sidebarTreeElement=new W ebInspector.ProfileGroupSidebarTreeElement(profile.title);var firstProfileTreeEl ement=group.profileSidebarTreeElements[0];var index=this.children.indexOf(firstP rofileTreeElement);this.insertChild(group.sidebarTreeElement,index);var selected =firstProfileTreeElement.selected;this.removeChild(firstProfileTreeElement);grou p.sidebarTreeElement.appendChild(firstProfileTreeElement);if(selected)
156 firstProfileTreeElement.revealAndSelect();firstProfileTreeElement.small=true;fir stProfileTreeElement.mainTitle=WebInspector.UIString("Run %d",1);this.treeOutlin e.element.classList.add("some-expandable");}
157 if(groupSize>=2){sidebarParent=group.sidebarTreeElement;profileTreeElement.small =true;profileTreeElement.mainTitle=WebInspector.UIString("Run %d",groupSize);}}
158 sidebarParent.appendChild(profileTreeElement);},removeProfileHeader:function(pro file)
159 {var index=this._sidebarElementIndex(profile);if(index===-1)
160 return false;var profileTreeElement=this._profileTreeElements[index];this._profi leTreeElements.splice(index,1);var sidebarParent=this;var group=this._profileGro ups[profile.title];if(group){var groupElements=group.profileSidebarTreeElements; groupElements.splice(groupElements.indexOf(profileTreeElement),1);if(groupElemen ts.length===1){var pos=sidebarParent.children.indexOf(group.sidebarTreeElement); this.insertChild(groupElements[0],pos);groupElements[0].small=false;groupElement s[0].mainTitle=group.sidebarTreeElement.title;this.removeChild(group.sidebarTree Element);}
161 if(groupElements.length!==0)
162 sidebarParent=group.sidebarTreeElement;}
163 sidebarParent.removeChild(profileTreeElement);profileTreeElement.dispose();if(th is.children.length)
164 return false;this.hidden=true;return true;},sidebarElementForProfile:function(pr ofile)
165 {var index=this._sidebarElementIndex(profile);return index===-1?null:this._profi leTreeElements[index];},_sidebarElementIndex:function(profile)
166 {var elements=this._profileTreeElements;for(var i=0;i<elements.length;i++){if(el ements[i].profile===profile)
167 return i;}
168 return-1;},__proto__:WebInspector.SidebarSectionTreeElement.prototype}
156 WebInspector.ProfilesPanel.ContextMenuProvider=function() 169 WebInspector.ProfilesPanel.ContextMenuProvider=function()
157 {} 170 {}
158 WebInspector.ProfilesPanel.ContextMenuProvider.prototype={appendApplicableItems: function(event,contextMenu,target) 171 WebInspector.ProfilesPanel.ContextMenuProvider.prototype={appendApplicableItems: function(event,contextMenu,target)
159 {WebInspector.panel("profiles").appendApplicableItems(event,contextMenu,target); }} 172 {WebInspector.inspectorView.panel("profiles").appendApplicableItems(event,contex tMenu,target);}}
160 WebInspector.ProfileSidebarTreeElement=function(profile,className) 173 WebInspector.ProfileSidebarTreeElement=function(profile,className)
161 {this.profile=profile;WebInspector.SidebarTreeElement.call(this,className,"","", profile,false);this.refreshTitles();} 174 {this.profile=profile;WebInspector.SidebarTreeElement.call(this,className,profil e.title,"",profile,false);this.refreshTitles();profile.addEventListener(WebInspe ctor.ProfileHeader.Events.UpdateStatus,this._updateStatus,this);if(profile.canSa veToFile())
162 WebInspector.ProfileSidebarTreeElement.prototype={onselect:function() 175 this._createSaveLink();else
163 {if(!this._suppressOnSelect) 176 profile.addEventListener(WebInspector.ProfileHeader.Events.ProfileReceived,this. _onProfileReceived,this);}
164 this.treeOutline.panel._showProfile(this.profile);},ondelete:function() 177 WebInspector.ProfileSidebarTreeElement.prototype={_createSaveLink:function()
165 {this.treeOutline.panel._removeProfileHeader(this.profile);return true;},get mai nTitle() 178 {this._saveLinkElement=this.titleContainer.createChild("span","save-link");this. _saveLinkElement.textContent=WebInspector.UIString("Save");this._saveLinkElement .addEventListener("click",this._saveProfile.bind(this),false);},_onProfileReceiv ed:function(event)
166 {if(this._mainTitle) 179 {this._createSaveLink();},_updateStatus:function(event)
167 return this._mainTitle;return this.profile.title;},set mainTitle(x) 180 {var statusUpdate=event.data;if(statusUpdate.subtitle!==null)
168 {this._mainTitle=x;this.refreshTitles();},handleContextMenuEvent:function(event, panel) 181 this.subtitle=statusUpdate.subtitle;if(typeof statusUpdate.wait==="boolean")
182 this.wait=statusUpdate.wait;this.refreshTitles();},dispose:function()
183 {this.profile.removeEventListener(WebInspector.ProfileHeader.Events.UpdateStatus ,this._updateStatus,this);this.profile.removeEventListener(WebInspector.ProfileH eader.Events.ProfileReceived,this._onProfileReceived,this);},onselect:function()
184 {WebInspector.panels.profiles.showProfile(this.profile);},ondelete:function()
185 {this.profile.profileType().removeProfile(this.profile);return true;},handleCont extMenuEvent:function(event,panel)
169 {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()) 186 {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())
170 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} 187 contextMenu.appendItem(WebInspector.UIString("Save\u2026"),profile.saveToFile.bi nd(profile));contextMenu.appendItem(WebInspector.UIString("Delete"),this.ondelet e.bind(this));contextMenu.show();},_saveProfile:function(event)
171 WebInspector.ProfileGroupSidebarTreeElement=function(panel,title,subtitle) 188 {this.profile.saveToFile();},__proto__:WebInspector.SidebarTreeElement.prototype }
172 {WebInspector.SidebarTreeElement.call(this,"profile-group-sidebar-tree-item",tit le,subtitle,null,true);this._panel=panel;} 189 WebInspector.ProfileGroupSidebarTreeElement=function(title,subtitle)
190 {WebInspector.SidebarTreeElement.call(this,"profile-group-sidebar-tree-item",tit le,subtitle,null,true);}
173 WebInspector.ProfileGroupSidebarTreeElement.prototype={onselect:function() 191 WebInspector.ProfileGroupSidebarTreeElement.prototype={onselect:function()
174 {if(this.children.length>0) 192 {if(this.children.length>0)
175 this._panel._showProfile(this.children[this.children.length-1].profile);},__prot o__:WebInspector.SidebarTreeElement.prototype} 193 WebInspector.panels.profiles.showProfile(this.children[this.children.length-1].p rofile);},__proto__:WebInspector.SidebarTreeElement.prototype}
176 WebInspector.ProfilesSidebarTreeElement=function(panel) 194 WebInspector.ProfilesSidebarTreeElement=function(panel)
177 {this._panel=panel;this.small=false;WebInspector.SidebarTreeElement.call(this,"p rofile-launcher-view-tree-item",WebInspector.UIString("Profiles"),"",null,false) ;} 195 {this._panel=panel;this.small=false;WebInspector.SidebarTreeElement.call(this,"p rofile-launcher-view-tree-item",WebInspector.UIString("Profiles"),"",null,false) ;}
178 WebInspector.ProfilesSidebarTreeElement.prototype={onselect:function() 196 WebInspector.ProfilesSidebarTreeElement.prototype={onselect:function()
179 {this._panel._showLauncherView();},get selectable() 197 {this._panel._showLauncherView();},get selectable()
180 {return true;},__proto__:WebInspector.SidebarTreeElement.prototype} 198 {return true;},__proto__:WebInspector.SidebarTreeElement.prototype}
181 WebInspector.CPUProfilerPanel=function()
182 {WebInspector.ProfilesPanel.call(this,"cpu-profiler",new WebInspector.CPUProfile Type());}
183 WebInspector.CPUProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel.pr ototype}
184 WebInspector.HeapProfilerPanel=function()
185 {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);}
186 WebInspector.HeapProfilerPanel.prototype={_createLauncherView:function()
187 {return new WebInspector.MultiProfileLauncherView(this);},__proto__:WebInspector .ProfilesPanel.prototype}
188 WebInspector.CanvasProfilerPanel=function()
189 {WebInspector.ProfilesPanel.call(this,"canvas-profiler",new WebInspector.CanvasP rofileType());}
190 WebInspector.CanvasProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel .prototype}
191 WebInspector.ProfileDataGridNode=function(profileNode,owningTree,hasChildren) 199 WebInspector.ProfileDataGridNode=function(profileNode,owningTree,hasChildren)
192 {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;} 200 {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;}
193 WebInspector.ProfileDataGridNode.prototype={get data() 201 WebInspector.ProfileDataGridNode.prototype={get data()
194 {function formatMilliseconds(time) 202 {function formatMilliseconds(time)
195 {return WebInspector.UIString("%.1f\u2009ms",time);} 203 {return WebInspector.UIString("%.1f\u2009ms",time);}
196 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 204 var data={};if(this._deoptReason){var content=document.createDocumentFragment(); var marker=content.createChild("span","profile-warn-marker");marker.title=WebIns pector.UIString("Not optimized: %s",this._deoptReason);content.createTextChild(t his.functionName);data["function"]=content;}else
197 data["function"]=this.functionName;if(this.tree.profileView.showSelfTimeAsPercen t.get()) 205 data["function"]=this.functionName;if(this.tree.profileView.showSelfTimeAsPercen t.get())
198 data["self"]=WebInspector.UIString("%.2f%",this.selfPercent);else 206 data["self"]=WebInspector.UIString("%.2f%",this.selfPercent);else
199 data["self"]=formatMilliseconds(this.selfTime);if(this.tree.profileView.showTota lTimeAsPercent.get()) 207 data["self"]=formatMilliseconds(this.selfTime);if(this.tree.profileView.showTota lTimeAsPercent.get())
200 data["total"]=WebInspector.UIString("%.2f%",this.totalPercent);else 208 data["total"]=WebInspector.UIString("%.2f%",this.totalPercent);else
201 data["total"]=formatMilliseconds(this.totalTime);return data;},createCell:functi on(columnIdentifier) 209 data["total"]=formatMilliseconds(this.totalTime);return data;},createCell:functi on(columnIdentifier)
202 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier==="self"&&this._searchMatchedSelfColumn) 210 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier==="self"&&this._searchMatchedSelfColumn)
203 cell.classList.add("highlight");else if(columnIdentifier==="total"&&this._search MatchedTotalColumn) 211 cell.classList.add("highlight");else if(columnIdentifier==="total"&&this._search MatchedTotalColumn)
204 cell.classList.add("highlight");if(columnIdentifier!=="function") 212 cell.classList.add("highlight");if(columnIdentifier!=="function")
205 return cell;if(this._deoptReason) 213 return cell;if(this._deoptReason)
206 cell.classList.add("not-optimized");if(this.profileNode._searchMatchedFunctionCo lumn) 214 cell.classList.add("not-optimized");if(this.profileNode._searchMatchedFunctionCo lumn)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 var any=(this);var node=(any);WebInspector.BottomUpProfileDataGridNode.prototype .populate.call(node);return this;} 291 var any=(this);var node=(any);WebInspector.BottomUpProfileDataGridNode.prototype .populate.call(node);return this;}
284 WebInspector.BottomUpProfileDataGridTree.prototype={focus:function(profileDataGr idNode) 292 WebInspector.BottomUpProfileDataGridTree.prototype={focus:function(profileDataGr idNode)
285 {if(!profileDataGridNode) 293 {if(!profileDataGridNode)
286 return;this._save();var currentNode=profileDataGridNode;var focusNode=profileDat aGridNode;while(currentNode.parent&&(currentNode instanceof WebInspector.Profile DataGridNode)){currentNode._takePropertiesFromProfileDataGridNode(profileDataGri dNode);focusNode=currentNode;currentNode=currentNode.parent;if(currentNode insta nceof WebInspector.ProfileDataGridNode) 294 return;this._save();var currentNode=profileDataGridNode;var focusNode=profileDat aGridNode;while(currentNode.parent&&(currentNode instanceof WebInspector.Profile DataGridNode)){currentNode._takePropertiesFromProfileDataGridNode(profileDataGri dNode);focusNode=currentNode;currentNode=currentNode.parent;if(currentNode insta nceof WebInspector.ProfileDataGridNode)
287 currentNode._keepOnlyChild(focusNode);} 295 currentNode._keepOnlyChild(focusNode);}
288 this.children=[focusNode];this.totalTime=profileDataGridNode.totalTime;},exclude :function(profileDataGridNode) 296 this.children=[focusNode];this.totalTime=profileDataGridNode.totalTime;},exclude :function(profileDataGridNode)
289 {if(!profileDataGridNode) 297 {if(!profileDataGridNode)
290 return;this._save();var excludedCallUID=profileDataGridNode.callUID;var excluded TopLevelChild=this.childrenByCallUID[excludedCallUID];if(excludedTopLevelChild) 298 return;this._save();var excludedCallUID=profileDataGridNode.callUID;var excluded TopLevelChild=this.childrenByCallUID[excludedCallUID];if(excludedTopLevelChild)
291 this.children.remove(excludedTopLevelChild);var children=this.children;var count =children.length;for(var index=0;index<count;++index) 299 this.children.remove(excludedTopLevelChild);var children=this.children;var count =children.length;for(var index=0;index<count;++index)
292 children[index]._exclude(excludedCallUID);if(this.lastComparator) 300 children[index]._exclude(excludedCallUID);if(this.lastComparator)
293 this.sort(this.lastComparator,true);},_sharedPopulate:WebInspector.BottomUpProfi leDataGridNode.prototype._sharedPopulate,__proto__:WebInspector.ProfileDataGridT ree.prototype};WebInspector.CPUProfileView=function(profileHeader) 301 this.sort(this.lastComparator,true);},_sharedPopulate:WebInspector.BottomUpProfi leDataGridNode.prototype._sharedPopulate,__proto__:WebInspector.ProfileDataGridT ree.prototype};WebInspector.CPUProfileFlameChart=function(dataProvider)
294 {WebInspector.View.call(this);this.element.classList.add("profile-view");this.sh owSelfTimeAsPercent=WebInspector.settings.createSetting("cpuProfilerShowSelfTime AsPercent",true);this.showTotalTimeAsPercent=WebInspector.settings.createSetting ("cpuProfilerShowTotalTimeAsPercent",true);this.showAverageTimeAsPercent=WebInsp ector.settings.createSetting("cpuProfilerShowAverageTimeAsPercent",true);this._v iewType=WebInspector.settings.createSetting("cpuProfilerView",WebInspector.CPUPr ofileView._TypeHeavy);var columns=[];columns.push({id:"self",title:WebInspector. UIString("Self"),width:"72px",sort:WebInspector.DataGrid.Order.Descending,sortab le:true});columns.push({id:"total",title:WebInspector.UIString("Total"),width:"7 2px",sortable:true});columns.push({id:"function",title:WebInspector.UIString("Fu nction"),disclosure:true,sortable:true});this.dataGrid=new WebInspector.DataGrid (columns);this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingCha nged,this._sortProfile,this);this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this),true);this.dataGrid.show(this.element);this .viewSelectComboBox=new WebInspector.StatusBarComboBox(this._changeView.bind(thi s));var options={};options[WebInspector.CPUProfileView._TypeFlame]=this.viewSele ctComboBox.createOption(WebInspector.UIString("Flame Chart"),"",WebInspector.CPU ProfileView._TypeFlame);options[WebInspector.CPUProfileView._TypeHeavy]=this.vie wSelectComboBox.createOption(WebInspector.UIString("Heavy (Bottom Up)"),"",WebIn spector.CPUProfileView._TypeHeavy);options[WebInspector.CPUProfileView._TypeTree ]=this.viewSelectComboBox.createOption(WebInspector.UIString("Tree (Top Down)"), "",WebInspector.CPUProfileView._TypeTree);var optionName=this._viewType.get()||W ebInspector.CPUProfileView._TypeFlame;var option=options[optionName]||options[We bInspector.CPUProfileView._TypeFlame];this.viewSelectComboBox.select(option);thi s._statusBarButtonsElement=document.createElement("span");this.percentButton=new WebInspector.StatusBarButton("","percent-time-status-bar-item");this.percentBut ton.addEventListener("click",this._percentClicked,this);this._statusBarButtonsEl ement.appendChild(this.percentButton.element);this.focusButton=new WebInspector. StatusBarButton(WebInspector.UIString("Focus selected function."),"focus-profile -node-status-bar-item");this.focusButton.setEnabled(false);this.focusButton.addE ventListener("click",this._focusClicked,this);this._statusBarButtonsElement.appe ndChild(this.focusButton.element);this.excludeButton=new WebInspector.StatusBarB utton(WebInspector.UIString("Exclude selected function."),"exclude-profile-node- status-bar-item");this.excludeButton.setEnabled(false);this.excludeButton.addEve ntListener("click",this._excludeClicked,this);this._statusBarButtonsElement.appe ndChild(this.excludeButton.element);this.resetButton=new WebInspector.StatusBarB utton(WebInspector.UIString("Restore all functions."),"reset-profile-status-bar- item");this.resetButton.visible=false;this.resetButton.addEventListener("click", this._resetClicked,this);this._statusBarButtonsElement.appendChild(this.resetBut ton.element);this.profileHead=(null);this.profile=profileHeader;this._linkifier= new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));if(t his.profile._profile) 302 {WebInspector.VBox.call(this);this.registerRequiredCSS("flameChart.css");this.el ement.id="cpu-flame-chart";this._overviewPane=new WebInspector.CPUProfileFlameCh art.OverviewPane(dataProvider);this._overviewPane.show(this.element);this._mainP ane=new WebInspector.FlameChart(dataProvider,this._overviewPane,true,false);this ._mainPane.show(this.element);this._mainPane.addEventListener(WebInspector.Flame Chart.Events.EntrySelected,this._onEntrySelected,this);this._overviewPane._overv iewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,this._on WindowChanged,this);}
303 WebInspector.CPUProfileFlameChart.prototype={_onWindowChanged:function(event)
304 {this._mainPane.changeWindow(this._overviewPane._overviewGrid.windowLeft(),this. _overviewPane._overviewGrid.windowRight());},selectRange:function(timeLeft,timeR ight)
305 {this._overviewPane._selectRange(timeLeft,timeRight);},_onEntrySelected:function (event)
306 {this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelected,even t.data);},update:function()
307 {this._overviewPane.update();this._mainPane.update();},__proto__:WebInspector.VB ox.prototype};WebInspector.CPUProfileFlameChart.OverviewCalculator=function()
308 {}
309 WebInspector.CPUProfileFlameChart.OverviewCalculator.prototype={paddingLeft:func tion()
310 {return 0;},_updateBoundaries:function(overviewPane)
311 {this._minimumBoundaries=0;var totalTime=overviewPane._dataProvider.totalTime(); this._maximumBoundaries=totalTime;this._xScaleFactor=overviewPane._overviewCanva s.width/totalTime;},computePosition:function(time)
312 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue,precision)
313 {return Number.secondsToString((value+this._minimumBoundaries)/1000);},maximumBo undary:function()
314 {return this._maximumBoundaries;},minimumBoundary:function()
315 {return this._minimumBoundaries;},zeroTime:function()
316 {return this._minimumBoundaries;},boundarySpan:function()
317 {return this._maximumBoundaries-this._minimumBoundaries;}}
318 WebInspector.CPUProfileFlameChart.ColorGenerator=function()
319 {this._colors={};this._currentColorIndex=0;}
320 WebInspector.CPUProfileFlameChart.ColorGenerator.prototype={setColorForID:functi on(id,color)
321 {this._colors[id]=color;},colorForID:function(id,sat)
322 {if(typeof sat!=="number")
323 sat=100;var color=this._colors[id];if(!color){color=this._createColor(this._curr entColorIndex++,sat);this._colors[id]=color;}
324 return color;},_createColor:function(index,sat)
325 {var hue=(index*7+12*(index%2))%360;return"hsla("+hue+", "+sat+"%, 66%, 0.7)";}}
326 WebInspector.CPUProfileFlameChart.OverviewPane=function(dataProvider)
327 {WebInspector.VBox.call(this);this.element.classList.add("flame-chart-overview-p ane");this._overviewContainer=this.element.createChild("div","overview-container ");this._overviewGrid=new WebInspector.OverviewGrid("flame-chart");this._overvie wGrid.element.classList.add("fill");this._overviewCanvas=this._overviewContainer .createChild("canvas","flame-chart-overview-canvas");this._overviewContainer.app endChild(this._overviewGrid.element);this._overviewCalculator=new WebInspector.C PUProfileFlameChart.OverviewCalculator();this._dataProvider=dataProvider;}
328 WebInspector.CPUProfileFlameChart.OverviewPane.prototype={requestWindowTimes:fun ction(windowStartTime,windowEndTime)
329 {this._overviewGrid.setWindow(windowStartTime/this._dataProvider.totalTime(),win dowEndTime/this._dataProvider.totalTime());},_selectRange:function(timeLeft,time Right)
330 {this._overviewGrid.setWindow(timeLeft/this._dataProvider.totalTime(),timeRight/ this._dataProvider.totalTime());},_timelineData:function()
331 {return this._dataProvider.timelineData();},onResize:function()
332 {this._scheduleUpdate();},_scheduleUpdate:function()
333 {if(this._updateTimerId)
334 return;this._updateTimerId=requestAnimationFrame(this.update.bind(this));},updat e:function()
335 {this._updateTimerId=0;var timelineData=this._timelineData();if(!timelineData)
336 return;this._resetCanvas(this._overviewContainer.clientWidth,this._overviewConta iner.clientHeight-WebInspector.FlameChart.DividersBarHeight);this._overviewCalcu lator._updateBoundaries(this);this._overviewGrid.updateDividers(this._overviewCa lculator);WebInspector.CPUProfileFlameChart.OverviewPane.drawOverviewCanvas(this ._dataProvider,timelineData,this._overviewCanvas.getContext("2d"),this._overview Container.clientWidth,this._overviewContainer.clientHeight-WebInspector.FlameCha rt.DividersBarHeight);},_resetCanvas:function(width,height)
337 {var ratio=window.devicePixelRatio;this._overviewCanvas.width=width*ratio;this._ overviewCanvas.height=height*ratio;},__proto__:WebInspector.VBox.prototype}
338 WebInspector.CPUProfileFlameChart.OverviewPane.calculateDrawData=function(dataPr ovider,timelineData,width)
339 {var entryOffsets=timelineData.entryOffsets;var entryTotalTimes=timelineData.ent ryTotalTimes;var entryLevels=timelineData.entryLevels;var length=entryOffsets.le ngth;var drawData=new Uint8Array(width);var scaleFactor=width/dataProvider.total Time();for(var entryIndex=0;entryIndex<length;++entryIndex){var start=Math.floor (entryOffsets[entryIndex]*scaleFactor);var finish=Math.floor((entryOffsets[entry Index]+entryTotalTimes[entryIndex])*scaleFactor);for(var x=start;x<=finish;++x)
340 drawData[x]=Math.max(drawData[x],entryLevels[entryIndex]+1);}
341 return drawData;}
342 WebInspector.CPUProfileFlameChart.OverviewPane.drawOverviewCanvas=function(dataP rovider,timelineData,context,width,height)
343 {var ratio=window.devicePixelRatio;var canvasWidth=width*ratio;var canvasHeight= height*ratio;var drawData=WebInspector.CPUProfileFlameChart.OverviewPane.calcula teDrawData(dataProvider,timelineData,canvasWidth);if(!drawData)
344 return;var yScaleFactor=canvasHeight/(dataProvider.maxStackDepth()*1.1);context. lineWidth=1;context.translate(0.5,0.5);context.strokeStyle="rgba(20,0,0,0.4)";co ntext.fillStyle="rgba(214,225,254,0.8)";context.moveTo(-1,canvasHeight-1);contex t.lineTo(-1,Math.round(canvasHeight-drawData[0]*yScaleFactor-1));var value;for(v ar x=0;x<canvasWidth;++x){value=Math.round(canvasHeight-drawData[x]*yScaleFactor -1);context.lineTo(x,value);}
345 context.lineTo(canvasWidth+1,value);context.lineTo(canvasWidth+1,canvasHeight-1) ;context.fill();context.stroke();context.closePath();};WebInspector.CPUProfileVi ew=function(profileHeader)
346 {WebInspector.VBox.call(this);this.element.classList.add("cpu-profile-view");thi s.showSelfTimeAsPercent=WebInspector.settings.createSetting("cpuProfilerShowSelf TimeAsPercent",true);this.showTotalTimeAsPercent=WebInspector.settings.createSet ting("cpuProfilerShowTotalTimeAsPercent",true);this.showAverageTimeAsPercent=Web Inspector.settings.createSetting("cpuProfilerShowAverageTimeAsPercent",true);thi s._viewType=WebInspector.settings.createSetting("cpuProfilerView",WebInspector.C PUProfileView._TypeHeavy);var columns=[];columns.push({id:"self",title:WebInspec tor.UIString("Self"),width:"72px",sort:WebInspector.DataGrid.Order.Descending,so rtable:true});columns.push({id:"total",title:WebInspector.UIString("Total"),widt h:"72px",sortable:true});columns.push({id:"function",title:WebInspector.UIString ("Function"),disclosure:true,sortable:true});this.dataGrid=new WebInspector.Data Grid(columns);this.dataGrid.addEventListener(WebInspector.DataGrid.Events.Sortin gChanged,this._sortProfile,this);this.dataGrid.element.addEventListener("mousedo wn",this._mouseDownInDataGrid.bind(this),true);this.dataGrid.show(this.element); this.viewSelectComboBox=new WebInspector.StatusBarComboBox(this._changeView.bind (this));var options={};options[WebInspector.CPUProfileView._TypeFlame]=this.view SelectComboBox.createOption(WebInspector.UIString("Chart"),"",WebInspector.CPUPr ofileView._TypeFlame);options[WebInspector.CPUProfileView._TypeHeavy]=this.viewS electComboBox.createOption(WebInspector.UIString("Heavy (Bottom Up)"),"",WebInsp ector.CPUProfileView._TypeHeavy);options[WebInspector.CPUProfileView._TypeTree]= this.viewSelectComboBox.createOption(WebInspector.UIString("Tree (Top Down)"),"" ,WebInspector.CPUProfileView._TypeTree);var optionName=this._viewType.get()||Web Inspector.CPUProfileView._TypeFlame;var option=options[optionName]||options[WebI nspector.CPUProfileView._TypeFlame];this.viewSelectComboBox.select(option);this. _statusBarButtonsElement=document.createElement("span");this.percentButton=new W ebInspector.StatusBarButton("","percent-time-status-bar-item");this.percentButto n.addEventListener("click",this._percentClicked,this);this._statusBarButtonsElem ent.appendChild(this.percentButton.element);this.focusButton=new WebInspector.St atusBarButton(WebInspector.UIString("Focus selected function."),"focus-profile-n ode-status-bar-item");this.focusButton.setEnabled(false);this.focusButton.addEve ntListener("click",this._focusClicked,this);this._statusBarButtonsElement.append Child(this.focusButton.element);this.excludeButton=new WebInspector.StatusBarBut ton(WebInspector.UIString("Exclude selected function."),"exclude-profile-node-st atus-bar-item");this.excludeButton.setEnabled(false);this.excludeButton.addEvent Listener("click",this._excludeClicked,this);this._statusBarButtonsElement.append Child(this.excludeButton.element);this.resetButton=new WebInspector.StatusBarBut ton(WebInspector.UIString("Restore all functions."),"reset-profile-status-bar-it em");this.resetButton.visible=false;this.resetButton.addEventListener("click",th is._resetClicked,this);this._statusBarButtonsElement.appendChild(this.resetButto n.element);this.profileHead=(null);this.profile=profileHeader;this._linkifier=ne w WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));if(thi s.profile._profile)
295 this._processProfileData(this.profile._profile);else 347 this._processProfileData(this.profile._profile);else
296 this._processProfileData(this.profile.protocolProfile());} 348 this._processProfileData(this.profile.protocolProfile());}
297 WebInspector.CPUProfileView._TypeFlame="Flame";WebInspector.CPUProfileView._Type Tree="Tree";WebInspector.CPUProfileView._TypeHeavy="Heavy";WebInspector.CPUProfi leView.prototype={selectRange:function(timeLeft,timeRight) 349 WebInspector.CPUProfileView._TypeFlame="Flame";WebInspector.CPUProfileView._Type Tree="Tree";WebInspector.CPUProfileView._TypeHeavy="Heavy";WebInspector.CPUProfi leView.prototype={selectRange:function(timeLeft,timeRight)
298 {if(!this._flameChart) 350 {if(!this._flameChart)
299 return;this._flameChart.selectRange(timeLeft,timeRight);},_revealProfilerNode:fu nction(event) 351 return;this._flameChart.selectRange(timeLeft,timeRight);},_processProfileData:fu nction(profile)
300 {var current=this.profileDataGridTree.children[0];while(current&&current.profile Node!==event.data)
301 current=current.traverseNextNode(false,null,false);if(current)
302 current.revealAndSelect();},_processProfileData:function(profile)
303 {this.profileHead=profile.head;this.samples=profile.samples;this._calculateTimes (profile);this._assignParentsInProfile();if(this.samples) 352 {this.profileHead=profile.head;this.samples=profile.samples;this._calculateTimes (profile);this._assignParentsInProfile();if(this.samples)
304 this._buildIdToNodeMap();this._changeView();this._updatePercentButton();if(this. _flameChart) 353 this._buildIdToNodeMap();this._changeView();this._updatePercentButton();if(this. _flameChart)
305 this._flameChart.update();},get statusBarItems() 354 this._flameChart.update();},get statusBarItems()
306 {return[this.viewSelectComboBox.element,this._statusBarButtonsElement];},_getBot tomUpProfileDataGridTree:function() 355 {return[this.viewSelectComboBox.element,this._statusBarButtonsElement];},_getBot tomUpProfileDataGridTree:function()
307 {if(!this._bottomUpProfileDataGridTree) 356 {if(!this._bottomUpProfileDataGridTree)
308 this._bottomUpProfileDataGridTree=new WebInspector.BottomUpProfileDataGridTree(t his,(this.profileHead));return this._bottomUpProfileDataGridTree;},_getTopDownPr ofileDataGridTree:function() 357 this._bottomUpProfileDataGridTree=new WebInspector.BottomUpProfileDataGridTree(t his,(this.profileHead));return this._bottomUpProfileDataGridTree;},_getTopDownPr ofileDataGridTree:function()
309 {if(!this._topDownProfileDataGridTree) 358 {if(!this._topDownProfileDataGridTree)
310 this._topDownProfileDataGridTree=new WebInspector.TopDownProfileDataGridTree(thi s,(this.profileHead));return this._topDownProfileDataGridTree;},willHide:functio n() 359 this._topDownProfileDataGridTree=new WebInspector.TopDownProfileDataGridTree(thi s,(this.profileHead));return this._topDownProfileDataGridTree;},willHide:functio n()
311 {this._currentSearchResultIndex=-1;},refresh:function() 360 {this._currentSearchResultIndex=-1;},refresh:function()
312 {var selectedProfileNode=this.dataGrid.selectedNode?this.dataGrid.selectedNode.p rofileNode:null;this.dataGrid.rootNode().removeChildren();var children=this.prof ileDataGridTree.children;var count=children.length;for(var index=0;index<count;+ +index) 361 {var selectedProfileNode=this.dataGrid.selectedNode?this.dataGrid.selectedNode.p rofileNode:null;this.dataGrid.rootNode().removeChildren();var children=this.prof ileDataGridTree.children;var count=children.length;for(var index=0;index<count;+ +index)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 return;if(++this._currentSearchResultIndex>=this._searchResults.length) 401 return;if(++this._currentSearchResultIndex>=this._searchResults.length)
353 this._currentSearchResultIndex=0;this._jumpToSearchResult(this._currentSearchRes ultIndex);},jumpToPreviousSearchResult:function() 402 this._currentSearchResultIndex=0;this._jumpToSearchResult(this._currentSearchRes ultIndex);},jumpToPreviousSearchResult:function()
354 {if(!this._searchResults||!this._searchResults.length) 403 {if(!this._searchResults||!this._searchResults.length)
355 return;if(--this._currentSearchResultIndex<0) 404 return;if(--this._currentSearchResultIndex<0)
356 this._currentSearchResultIndex=(this._searchResults.length-1);this._jumpToSearch Result(this._currentSearchResultIndex);},showingFirstSearchResult:function() 405 this._currentSearchResultIndex=(this._searchResults.length-1);this._jumpToSearch Result(this._currentSearchResultIndex);},showingFirstSearchResult:function()
357 {return(this._currentSearchResultIndex===0);},showingLastSearchResult:function() 406 {return(this._currentSearchResultIndex===0);},showingLastSearchResult:function()
358 {return(this._searchResults&&this._currentSearchResultIndex===(this._searchResul ts.length-1));},currentSearchResultIndex:function(){return this._currentSearchRe sultIndex;},_jumpToSearchResult:function(index) 407 {return(this._searchResults&&this._currentSearchResultIndex===(this._searchResul ts.length-1));},currentSearchResultIndex:function(){return this._currentSearchRe sultIndex;},_jumpToSearchResult:function(index)
359 {var searchResult=this._searchResults[index];if(!searchResult) 408 {var searchResult=this._searchResults[index];if(!searchResult)
360 return;var profileNode=searchResult.profileNode;profileNode.revealAndSelect();}, _ensureFlameChartCreated:function() 409 return;var profileNode=searchResult.profileNode;profileNode.revealAndSelect();}, _ensureFlameChartCreated:function()
361 {if(this._flameChart) 410 {if(this._flameChart)
362 return;var dataProvider=new WebInspector.CPUFlameChartDataProvider(this);this._f lameChart=new WebInspector.FlameChart(dataProvider);this._flameChart.addEventLis tener(WebInspector.FlameChart.Events.EntrySelected,this._onEntrySelected.bind(th is));},_onEntrySelected:function(event) 411 return;this._dataProvider=new WebInspector.CPUFlameChartDataProvider(this);this. _flameChart=new WebInspector.CPUProfileFlameChart(this._dataProvider);this._flam eChart.addEventListener(WebInspector.FlameChart.Events.EntrySelected,this._onEnt rySelected.bind(this));},_onEntrySelected:function(event)
363 {var node=event.data;if(!node||!node.scriptId) 412 {var entryIndex=event.data;var node=this._dataProvider._entryNodes[entryIndex];i f(!node||!node.scriptId)
364 return;var script=WebInspector.debuggerModel.scriptForId(node.scriptId) 413 return;var script=WebInspector.debuggerModel.scriptForId(node.scriptId)
365 if(!script) 414 if(!script)
366 return;var uiLocation=script.rawLocationToUILocation(node.lineNumber);if(!uiLoca tion) 415 return;WebInspector.Revealer.reveal(script.rawLocationToUILocation(node.lineNumb er));},_changeView:function()
367 return;WebInspector.panel("sources").showUILocation(uiLocation);},_changeView:fu nction()
368 {if(!this.profile) 416 {if(!this.profile)
369 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;} 417 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.classList.toggle("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;}
370 this._statusBarButtonsElement.enableStyleClass("hidden",false);if(this._flameCha rt) 418 this._statusBarButtonsElement.classList.toggle("hidden",false);if(this._flameCha rt)
371 this._flameChart.detach();this.dataGrid.show(this.element);if(!this.currentQuery ||!this._searchFinishedCallback||!this._searchResults) 419 this._flameChart.detach();this.dataGrid.show(this.element);if(!this.currentQuery ||!this._searchFinishedCallback||!this._searchResults)
372 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_percentClicked:funct ion(event) 420 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_percentClicked:funct ion(event)
373 {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() 421 {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()
374 {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) 422 {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)
375 {if(!this.dataGrid.selectedNode) 423 {if(!this.dataGrid.selectedNode)
376 return;this.resetButton.visible=true;this.profileDataGridTree.focus(this.dataGri d.selectedNode);this.refresh();this.refreshVisibleData();},_excludeClicked:funct ion(event) 424 return;this.resetButton.visible=true;this.profileDataGridTree.focus(this.dataGri d.selectedNode);this.refresh();this.refreshVisibleData();},_excludeClicked:funct ion(event)
377 {var selectedNode=this.dataGrid.selectedNode 425 {var selectedNode=this.dataGrid.selectedNode
378 if(!selectedNode) 426 if(!selectedNode)
379 return;selectedNode.deselect();this.resetButton.visible=true;this.profileDataGri dTree.exclude(selectedNode);this.refresh();this.refreshVisibleData();},_resetCli cked:function(event) 427 return;selectedNode.deselect();this.resetButton.visible=true;this.profileDataGri dTree.exclude(selectedNode);this.refresh();this.refreshVisibleData();},_resetCli cked:function(event)
380 {this.resetButton.visible=false;this.profileDataGridTree.restore();this._linkifi er.reset();this.refresh();this.refreshVisibleData();},_dataGridNodeSelected:func tion(node) 428 {this.resetButton.visible=false;this.profileDataGridTree.restore();this._linkifi er.reset();this.refresh();this.refreshVisibleData();},_dataGridNodeSelected:func tion(node)
381 {this.focusButton.setEnabled(true);this.excludeButton.setEnabled(true);},_dataGr idNodeDeselected:function(node) 429 {this.focusButton.setEnabled(true);this.excludeButton.setEnabled(true);},_dataGr idNodeDeselected:function(node)
382 {this.focusButton.setEnabled(false);this.excludeButton.setEnabled(false);},_sort Profile:function() 430 {this.focusButton.setEnabled(false);this.excludeButton.setEnabled(false);},_sort Profile:function()
383 {var sortAscending=this.dataGrid.isSortOrderAscending();var sortColumnIdentifier =this.dataGrid.sortColumnIdentifier();var sortProperty={"self":"selfTime","total ":"totalTime","function":"functionName"}[sortColumnIdentifier];this.profileDataG ridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator(sortProperty,so rtAscending));this.refresh();},_mouseDownInDataGrid:function(event) 431 {var sortAscending=this.dataGrid.isSortOrderAscending();var sortColumnIdentifier =this.dataGrid.sortColumnIdentifier();var sortProperty={"self":"selfTime","total ":"totalTime","function":"functionName"}[sortColumnIdentifier];this.profileDataG ridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator(sortProperty,so rtAscending));this.refresh();},_mouseDownInDataGrid:function(event)
384 {if(event.detail<2) 432 {if(event.detail<2)
385 return;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell||(!c ell.classList.contains("total-column")&&!cell.classList.contains("self-column")& &!cell.classList.contains("average-column"))) 433 return;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell||(!c ell.classList.contains("total-column")&&!cell.classList.contains("self-column")& &!cell.classList.contains("average-column")))
386 return;if(cell.classList.contains("total-column")) 434 return;if(cell.classList.contains("total-column"))
387 this.showTotalTimeAsPercent.set(!this.showTotalTimeAsPercent.get());else if(cell .classList.contains("self-column")) 435 this.showTotalTimeAsPercent.set(!this.showTotalTimeAsPercent.get());else if(cell .classList.contains("self-column"))
388 this.showSelfTimeAsPercent.set(!this.showSelfTimeAsPercent.get());else if(cell.c lassList.contains("average-column")) 436 this.showSelfTimeAsPercent.set(!this.showSelfTimeAsPercent.get());else if(cell.c lassList.contains("average-column"))
389 this.showAverageTimeAsPercent.set(!this.showAverageTimeAsPercent.get());this.ref reshShowAsPercents();event.consume(true);},_calculateTimes:function(profile) 437 this.showAverageTimeAsPercent.set(!this.showAverageTimeAsPercent.get());this.ref reshShowAsPercents();event.consume(true);},_calculateTimes:function(profile)
390 {function totalHitCount(node){var result=node.hitCount;for(var i=0;i<node.childr en.length;i++) 438 {function totalHitCount(node){var result=node.hitCount;for(var i=0;i<node.childr en.length;i++)
391 result+=totalHitCount(node.children[i]);return result;} 439 result+=totalHitCount(node.children[i]);return result;}
392 profile.totalHitCount=totalHitCount(profile.head);var durationMs=1000*(profile.e ndTime-profile.startTime);var samplingInterval=durationMs/profile.totalHitCount; this.samplingIntervalMs=samplingInterval;function calculateTimesForNode(node){no de.selfTime=node.hitCount*samplingInterval;var totalHitCount=node.hitCount;for(v ar i=0;i<node.children.length;i++) 440 profile.totalHitCount=totalHitCount(profile.head);var durationMs=1000*(profile.e ndTime-profile.startTime);var samplingInterval=durationMs/profile.totalHitCount; this.samplingIntervalMs=samplingInterval;function calculateTimesForNode(node){no de.selfTime=node.hitCount*samplingInterval;var totalHitCount=node.hitCount;for(v ar i=0;i<node.children.length;i++)
393 totalHitCount+=calculateTimesForNode(node.children[i]);node.totalTime=totalHitCo unt*samplingInterval;return totalHitCount;} 441 totalHitCount+=calculateTimesForNode(node.children[i]);node.totalTime=totalHitCo unt*samplingInterval;return totalHitCount;}
394 calculateTimesForNode(profile.head);},_assignParentsInProfile:function() 442 calculateTimesForNode(profile.head);},_assignParentsInProfile:function()
395 {var head=this.profileHead;head.parent=null;head.head=null;var nodesToTraverse=[ {parent:head,children:head.children}];while(nodesToTraverse.length>0){var pair=n odesToTraverse.pop();var parent=pair.parent;var children=pair.children;var lengt h=children.length;for(var i=0;i<length;++i){children[i].head=head;children[i].pa rent=parent;if(children[i].children.length>0) 443 {var head=this.profileHead;head.parent=null;head.head=null;var nodesToTraverse=[ head];while(nodesToTraverse.length){var parent=nodesToTraverse.pop();var childre n=parent.children;var length=children.length;for(var i=0;i<length;++i){var child =children[i];child.head=head;child.parent=parent;if(child.children.length)
396 nodesToTraverse.push({parent:children[i],children:children[i].children});}}},_bu ildIdToNodeMap:function() 444 nodesToTraverse.push(child);}}},_buildIdToNodeMap:function()
397 {var idToNode=this._idToNode={};var stack=[this.profileHead];while(stack.length) {var node=stack.pop();idToNode[node.id]=node;for(var i=0;i<node.children.length; i++) 445 {var idToNode=this._idToNode={};var stack=[this.profileHead];while(stack.length) {var node=stack.pop();idToNode[node.id]=node;for(var i=0;i<node.children.length; i++)
398 stack.push(node.children[i]);} 446 stack.push(node.children[i]);}
399 var topLevelNodes=this.profileHead.children;for(var i=0;i<topLevelNodes.length;i ++){var node=topLevelNodes[i];if(node.functionName=="(garbage collector)"){this. _gcNode=node;break;}}},__proto__:WebInspector.View.prototype} 447 var topLevelNodes=this.profileHead.children;for(var i=0;i<topLevelNodes.length;i ++){var node=topLevelNodes[i];if(node.functionName==="(garbage collector)"){this ._gcNode=node;break;}}},__proto__:WebInspector.VBox.prototype}
400 WebInspector.CPUProfileType=function() 448 WebInspector.CPUProfileType=function()
401 {WebInspector.ProfileType.call(this,WebInspector.CPUProfileType.TypeId,WebInspec tor.UIString("Collect JavaScript CPU Profile"));this._recording=false;this._next ProfileId=1;this._nextAnonymousConsoleProfileNumber=1;this._anonymousConsoleProf ileIdToTitle={};WebInspector.CPUProfileType.instance=this;WebInspector.cpuProfil erModel.setDelegate(this);} 449 {WebInspector.ProfileType.call(this,WebInspector.CPUProfileType.TypeId,WebInspec tor.UIString("Collect JavaScript CPU Profile"));this._recording=false;this._next AnonymousConsoleProfileNumber=1;this._anonymousConsoleProfileIdToTitle={};WebIns pector.CPUProfileType.instance=this;WebInspector.cpuProfilerModel.setDelegate(th is);}
402 WebInspector.CPUProfileType.TypeId="CPU";WebInspector.CPUProfileType.prototype={ fileExtension:function() 450 WebInspector.CPUProfileType.TypeId="CPU";WebInspector.CPUProfileType.prototype={ fileExtension:function()
403 {return".cpuprofile";},get buttonTooltip() 451 {return".cpuprofile";},get buttonTooltip()
404 {return this._recording?WebInspector.UIString("Stop CPU profiling."):WebInspecto r.UIString("Start CPU profiling.");},buttonClicked:function() 452 {return this._recording?WebInspector.UIString("Stop CPU profiling."):WebInspecto r.UIString("Start CPU profiling.");},buttonClicked:function()
405 {if(this._recording){this.stopRecordingProfile();return false;}else{this.startRe cordingProfile();return true;}},get treeItemTitle() 453 {if(this._recording){this.stopRecordingProfile();return false;}else{this.startRe cordingProfile();return true;}},get treeItemTitle()
406 {return WebInspector.UIString("CPU PROFILES");},get description() 454 {return WebInspector.UIString("CPU PROFILES");},get description()
407 {return WebInspector.UIString("CPU profiles show where the execution time is spe nt in your page's JavaScript functions.");},consoleProfileStarted:function(id,sc riptLocation,title) 455 {return WebInspector.UIString("CPU profiles show where the execution time is spe nt in your page's JavaScript functions.");},consoleProfileStarted:function(id,sc riptLocation,title)
408 {var resolvedTitle=title;if(!resolvedTitle){resolvedTitle=WebInspector.UIString( "Profile %s",this._nextAnonymousConsoleProfileNumber++);this._anonymousConsolePr ofileIdToTitle[id]=resolvedTitle;} 456 {var resolvedTitle=title;if(!resolvedTitle){resolvedTitle=WebInspector.UIString( "Profile %s",this._nextAnonymousConsoleProfileNumber++);this._anonymousConsolePr ofileIdToTitle[id]=resolvedTitle;}
409 this._addMessageToConsole(WebInspector.ConsoleMessage.MessageType.Profile,script Location,resolvedTitle);},consoleProfileFinished:function(protocolId,scriptLocat ion,cpuProfile,title) 457 this._addMessageToConsole(WebInspector.ConsoleMessage.MessageType.Profile,script Location,WebInspector.UIString("Profile '%s' started.",resolvedTitle));},console ProfileFinished:function(protocolId,scriptLocation,cpuProfile,title)
410 {var resolvedTitle=title;if(typeof title==="undefined"){resolvedTitle=this._anon ymousConsoleProfileIdToTitle[protocolId];delete this._anonymousConsoleProfileIdT oTitle[protocolId];} 458 {var resolvedTitle=title;if(typeof title==="undefined"){resolvedTitle=this._anon ymousConsoleProfileIdToTitle[protocolId];delete this._anonymousConsoleProfileIdT oTitle[protocolId];}
411 var id=this._nextProfileId++;var profile=new WebInspector.CPUProfileHeader(this, resolvedTitle,id);profile.setProtocolProfile(cpuProfile);this.addProfile(profile );resolvedTitle+="#"+id;this._addMessageToConsole(WebInspector.ConsoleMessage.Me ssageType.ProfileEnd,scriptLocation,resolvedTitle);},_addMessageToConsole:functi on(type,scriptLocation,title) 459 var profile=new WebInspector.CPUProfileHeader(this,resolvedTitle);profile.setPro tocolProfile(cpuProfile);this.addProfile(profile);this._addMessageToConsole(WebI nspector.ConsoleMessage.MessageType.ProfileEnd,scriptLocation,WebInspector.UIStr ing("Profile '%s' finished.",resolvedTitle));},_addMessageToConsole:function(typ e,scriptLocation,messageText)
412 {var rawLocation=new WebInspector.DebuggerModel.Location(scriptLocation.scriptId ,scriptLocation.lineNumber,scriptLocation.columnNumber||0);var uiLocation=WebIns pector.debuggerModel.rawLocationToUILocation(rawLocation);var url;if(uiLocation) 460 {var script=WebInspector.debuggerModel.scriptForId(scriptLocation.scriptId);var message=new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSourc e.ConsoleAPI,WebInspector.ConsoleMessage.MessageLevel.Debug,messageText,type,und efined,undefined,undefined,undefined,undefined,[{functionName:"",scriptId:script Location.scriptId,url:script?script.contentURL():"",lineNumber:scriptLocation.li neNumber,columnNumber:scriptLocation.columnNumber||0}]);WebInspector.console.add Message(message);},isRecordingProfile:function()
413 url=uiLocation.url();var message=WebInspector.ConsoleMessage.create(WebInspector .ConsoleMessage.MessageSource.ConsoleAPI,WebInspector.ConsoleMessage.MessageLeve l.Debug,title,type,url||undefined,scriptLocation.lineNumber,scriptLocation.colum nNumber);WebInspector.console.addMessage(message);},isRecordingProfile:function( )
414 {return this._recording;},startRecordingProfile:function() 461 {return this._recording;},startRecordingProfile:function()
415 {if(this._profileBeingRecorded) 462 {if(this._profileBeingRecorded)
416 return;var id=this._nextProfileId++;this._profileBeingRecorded=new WebInspector. CPUProfileHeader(this,WebInspector.UIString("Recording\u2026"),id);this.addProfi le(this._profileBeingRecorded);this._recording=true;WebInspector.cpuProfilerMode l.setRecording(true);WebInspector.userMetrics.ProfilesCPUProfileTaken.record();P rofilerAgent.start();},stopRecordingProfile:function() 463 return;this._profileBeingRecorded=new WebInspector.CPUProfileHeader(this);this.a ddProfile(this._profileBeingRecorded);this._profileBeingRecorded.updateStatus(We bInspector.UIString("Recording\u2026"));this._recording=true;WebInspector.cpuPro filerModel.setRecording(true);WebInspector.userMetrics.ProfilesCPUProfileTaken.r ecord();ProfilerAgent.start();},stopRecordingProfile:function()
417 {this._recording=false;WebInspector.cpuProfilerModel.setRecording(false);functio n didStopProfiling(error,profile) 464 {this._recording=false;WebInspector.cpuProfilerModel.setRecording(false);functio n didStopProfiling(error,profile)
418 {if(!this._profileBeingRecorded) 465 {if(!this._profileBeingRecorded)
419 return;this._profileBeingRecorded.setProtocolProfile(profile);var title=WebInspe ctor.UIString("Profile %d",this._profileBeingRecorded.uid);this._profileBeingRec orded.title=title;this._profileBeingRecorded.sidebarElement.mainTitle=title;var recordedProfile=this._profileBeingRecorded;this._profileBeingRecorded=null;WebIn spector.panels.profiles._showProfile(recordedProfile);} 466 return;this._profileBeingRecorded.setProtocolProfile(profile);this._profileBeing Recorded.updateStatus("");var recordedProfile=this._profileBeingRecorded;this._p rofileBeingRecorded=null;WebInspector.panels.profiles.showProfile(recordedProfil e);}
420 ProfilerAgent.stop(didStopProfiling.bind(this));},createProfileLoadedFromFile:fu nction(title) 467 ProfilerAgent.stop(didStopProfiling.bind(this));},createProfileLoadedFromFile:fu nction(title)
421 {return new WebInspector.CPUProfileHeader(this,title);},removeProfile:function(p rofile) 468 {return new WebInspector.CPUProfileHeader(this,title);},profileBeingRecordedRemo ved:function()
422 {if(this._profileBeingRecorded===profile) 469 {this.stopRecordingProfile();},__proto__:WebInspector.ProfileType.prototype}
423 this.stopRecordingProfile();WebInspector.ProfileType.prototype.removeProfile.cal l(this,profile);},__proto__:WebInspector.ProfileType.prototype} 470 WebInspector.CPUProfileHeader=function(type,title)
424 WebInspector.CPUProfileHeader=function(type,title,uid) 471 {WebInspector.ProfileHeader.call(this,type,title||WebInspector.UIString("Profile %d",type._nextProfileUid));this._tempFile=null;}
425 {WebInspector.ProfileHeader.call(this,type,title,uid);this._tempFile=null;}
426 WebInspector.CPUProfileHeader.prototype={onTransferStarted:function() 472 WebInspector.CPUProfileHeader.prototype={onTransferStarted:function()
427 {this._jsonifiedProfile="";this.sidebarElement.subtitle=WebInspector.UIString("L oading\u2026 %s",Number.bytesToString(this._jsonifiedProfile.length));},onChunkT ransferred:function(reader) 473 {this._jsonifiedProfile="";this.updateStatus(WebInspector.UIString("Loading\u202 6 %s",Number.bytesToString(this._jsonifiedProfile.length)),true);},onChunkTransf erred:function(reader)
428 {this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026 %d\%",Number. bytesToString(this._jsonifiedProfile.length));},onTransferFinished:function() 474 {this.updateStatus(WebInspector.UIString("Loading\u2026 %d\%",Number.bytesToStri ng(this._jsonifiedProfile.length)));},onTransferFinished:function()
429 {this.sidebarElement.subtitle=WebInspector.UIString("Parsing\u2026");this._profi le=JSON.parse(this._jsonifiedProfile);this._jsonifiedProfile=null;this.sidebarEl ement.subtitle=WebInspector.UIString("Loaded");if(this._profileType._profileBein gRecorded===this) 475 {this.updateStatus(WebInspector.UIString("Parsing\u2026"),true);this._profile=JS ON.parse(this._jsonifiedProfile);this._jsonifiedProfile=null;this.updateStatus(W ebInspector.UIString("Loaded"),false);if(this._profileType._profileBeingRecorded ===this)
430 this._profileType._profileBeingRecorded=null;},onError:function(reader,e) 476 this._profileType._profileBeingRecorded=null;},onError:function(reader,e)
431 {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) 477 {var subtitle;switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:subt itle=WebInspector.UIString("'%s' not found.",reader.fileName());break;case e.tar get.error.NOT_READABLE_ERR:subtitle=WebInspector.UIString("'%s' is not readable" ,reader.fileName());break;case e.target.error.ABORT_ERR:return;default:subtitle= WebInspector.UIString("'%s' error %d",reader.fileName(),e.target.error.code);}
478 this.updateStatus(subtitle);},write:function(text)
432 {this._jsonifiedProfile+=text;},close:function(){},dispose:function() 479 {this._jsonifiedProfile+=text;},close:function(){},dispose:function()
433 {this.removeTempFile();},createSidebarTreeElement:function() 480 {this.removeTempFile();},createSidebarTreeElement:function()
434 {return new WebInspector.ProfileSidebarTreeElement(this,"profile-sidebar-tree-it em");},createView:function(profilesPanel) 481 {return new WebInspector.ProfileSidebarTreeElement(this,"profile-sidebar-tree-it em");},createView:function()
435 {return new WebInspector.CPUProfileView(this);},canSaveToFile:function() 482 {return new WebInspector.CPUProfileView(this);},canSaveToFile:function()
436 {return!!this._tempFile;},saveToFile:function() 483 {return!this.fromFile()&&this._protocolProfile;},saveToFile:function()
437 {var fileOutputStream=new WebInspector.FileOutputStream();function onOpenForSave (accepted) 484 {var fileOutputStream=new WebInspector.FileOutputStream();function onOpenForSave (accepted)
438 {if(!accepted) 485 {if(!accepted)
439 return;function didRead(data) 486 return;function didRead(data)
440 {if(data) 487 {if(data)
441 fileOutputStream.write(data,fileOutputStream.close.bind(fileOutputStream));else 488 fileOutputStream.write(data,fileOutputStream.close.bind(fileOutputStream));else
442 fileOutputStream.close();} 489 fileOutputStream.close();}
443 this._tempFile.read(didRead.bind(this));} 490 if(this._failedToCreateTempFile){WebInspector.console.log("Failed to open temp f ile with heap snapshot",WebInspector.ConsoleMessage.MessageLevel.Error);fileOutp utStream.close();}else if(this._tempFile){this._tempFile.read(didRead);}else{thi s._onTempFileReady=onOpenForSave.bind(this,accepted);}}
444 this._fileName=this._fileName||"CPU-"+new Date().toISO8601Compact()+this._profil eType.fileExtension();fileOutputStream.open(this._fileName,onOpenForSave.bind(th is));},loadFromFile:function(file) 491 this._fileName=this._fileName||"CPU-"+new Date().toISO8601Compact()+this._profil eType.fileExtension();fileOutputStream.open(this._fileName,onOpenForSave.bind(th is));},loadFromFile:function(file)
445 {this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026");this.sideba rElement.wait=true;var fileReader=new WebInspector.ChunkedFileReader(file,100000 00,this);fileReader.start(this);},protocolProfile:function() 492 {this.updateStatus(WebInspector.UIString("Loading\u2026"),true);var fileReader=n ew WebInspector.ChunkedFileReader(file,10000000,this);fileReader.start(this);},p rotocolProfile:function()
446 {return this._protocolProfile;},setProtocolProfile:function(cpuProfile) 493 {return this._protocolProfile;},setProtocolProfile:function(cpuProfile)
447 {this._protocolProfile=cpuProfile;this._saveProfileDataToTempFile(cpuProfile);}, _saveProfileDataToTempFile:function(data) 494 {this._protocolProfile=cpuProfile;this._saveProfileDataToTempFile(cpuProfile);if (this.canSaveToFile())
495 this.dispatchEventToListeners(WebInspector.ProfileHeader.Events.ProfileReceived) ;},_saveProfileDataToTempFile:function(data)
448 {var serializedData=JSON.stringify(data);function didCreateTempFile(tempFile) 496 {var serializedData=JSON.stringify(data);function didCreateTempFile(tempFile)
449 {this._writeToTempFile(tempFile,serializedData);} 497 {this._writeToTempFile(tempFile,serializedData);}
450 new WebInspector.TempFile("cpu-profiler",this.uid,didCreateTempFile.bind(this)); },_writeToTempFile:function(tempFile,serializedData) 498 new WebInspector.TempFile("cpu-profiler",this.uid,didCreateTempFile.bind(this)); },_writeToTempFile:function(tempFile,serializedData)
451 {this._tempFile=tempFile;if(tempFile) 499 {this._tempFile=tempFile;if(!tempFile){this._failedToCreateTempFile=true;this._n otifyTempFileReady();return;}
452 tempFile.write(serializedData,tempFile.finishWriting.bind(tempFile));},__proto__ :WebInspector.ProfileHeader.prototype} 500 function didWriteToTempFile(success)
501 {if(!success)
502 this._failedToCreateTempFile=true;tempFile.finishWriting();this._notifyTempFileR eady();}
503 tempFile.write(serializedData,didWriteToTempFile.bind(this));},_notifyTempFileRe ady:function()
504 {if(this._onTempFileReady){this._onTempFileReady();this._onTempFileReady=null;}} ,__proto__:WebInspector.ProfileHeader.prototype}
505 WebInspector.CPUProfileView.colorGenerator=function()
506 {if(!WebInspector.CPUProfileView._colorGenerator){var colorGenerator=new WebInsp ector.CPUProfileFlameChart.ColorGenerator();colorGenerator.colorForID("(idle)::0 ",50);colorGenerator.colorForID("(program)::0",50);colorGenerator.colorForID("(g arbage collector)::0",50);WebInspector.CPUProfileView._colorGenerator=colorGener ator;}
507 return WebInspector.CPUProfileView._colorGenerator;}
453 WebInspector.CPUFlameChartDataProvider=function(cpuProfileView) 508 WebInspector.CPUFlameChartDataProvider=function(cpuProfileView)
454 {WebInspector.FlameChartDataProvider.call(this);this._cpuProfileView=cpuProfileV iew;} 509 {WebInspector.FlameChartDataProvider.call(this);this._cpuProfileView=cpuProfileV iew;this._colorGenerator=WebInspector.CPUProfileView.colorGenerator();}
455 WebInspector.CPUFlameChartDataProvider.prototype={timelineData:function(colorGen erator) 510 WebInspector.CPUFlameChartDataProvider.prototype={barHeight:function()
456 {return this._timelineData||this._calculateTimelineData(colorGenerator);},_calcu lateTimelineData:function(colorGenerator) 511 {return 15;},textBaseline:function()
512 {return 4;},textPadding:function()
513 {return 2;},dividerOffsets:function(startTime,endTime)
514 {return null;},zeroTime:function()
515 {return 0;},totalTime:function()
516 {return this._cpuProfileView.profileHead.totalTime;},maxStackDepth:function()
517 {return this._maxStackDepth;},timelineData:function()
518 {return this._timelineData||this._calculateTimelineData();},_calculateTimelineDa ta:function()
457 {if(!this._cpuProfileView.profileHead) 519 {if(!this._cpuProfileView.profileHead)
458 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 openIntervals=[];var stackTrace=[];var colorEntryIndexes=[];var maxDepth=5 ;var depth=0;function ChartEntry(colorPair,depth,duration,startTime,node) 520 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 openIntervals=[];var stackTrace=[];var maxDepth=5;var depth=0;function Cha rtEntry(depth,duration,startTime,node)
459 {this.colorPair=colorPair;this.depth=depth;this.duration=duration;this.startTime =startTime;this.node=node;this.selfTime=0;} 521 {this.depth=depth;this.duration=duration;this.startTime=startTime;this.node=node ;this.selfTime=0;}
460 var entries=([]);for(var sampleIndex=0;sampleIndex<samplesCount;sampleIndex++){v ar node=idToNode[samples[sampleIndex]];stackTrace.length=0;while(node){stackTrac e.push(node);node=node.parent;} 522 var entries=([]);for(var sampleIndex=0;sampleIndex<samplesCount;sampleIndex++){v ar node=idToNode[samples[sampleIndex]];stackTrace.length=0;while(node){stackTrac e.push(node);node=node.parent;}
461 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;} 523 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;}
462 if(openIntervals.length>0&&openIntervals.peekLast().node===node){entries[interva lIndex].selfTime+=samplingInterval;continue;}} 524 if(openIntervals.length>0&&openIntervals.peekLast().node===node){entries[interva lIndex].selfTime+=samplingInterval;continue;}}
463 while(node&&depth<openIntervals.length&&node===openIntervals[depth].node){interv alIndex=openIntervals[depth].index;entries[intervalIndex].duration+=samplingInte rval;node=stackTrace.pop();++depth;} 525 while(node&&depth<openIntervals.length&&node===openIntervals[depth].node){interv alIndex=openIntervals[depth].index;entries[intervalIndex].duration+=samplingInte rval;node=stackTrace.pop();++depth;}
464 if(depth<openIntervals.length) 526 if(depth<openIntervals.length)
465 openIntervals.length=depth;if(!node){entries[intervalIndex].selfTime+=samplingIn terval;continue;} 527 openIntervals.length=depth;if(!node){entries[intervalIndex].selfTime+=samplingIn terval;continue;}
466 while(node){var colorPair=colorGenerator._colorPairForID(node.functionName+":"+n ode.url+":"+node.lineNumber);var indexesForColor=colorEntryIndexes[colorPair.ind ex];if(!indexesForColor) 528 var colorGenerator=this._colorGenerator;var color="";while(node){entries.push(ne w ChartEntry(depth,samplingInterval,sampleIndex*samplingInterval,node));openInte rvals.push({node:node,index:index});++index;node=stackTrace.pop();++depth;}
467 indexesForColor=colorEntryIndexes[colorPair.index]=[];var entry=new ChartEntry(c olorPair,depth,samplingInterval,sampleIndex*samplingInterval,node);indexesForCol or.push(entries.length);entries.push(entry);openIntervals.push({node:node,index: index});++index;node=stackTrace.pop();++depth;}
468 entries[entries.length-1].selfTime+=samplingInterval;} 529 entries[entries.length-1].selfTime+=samplingInterval;}
469 var entryNodes=new Array(entries.length);var entryColorIndexes=new Uint16Array(e ntries.length);var entryLevels=new Uint8Array(entries.length);var entryTotalTime s=new Float32Array(entries.length);var entrySelfTimes=new Float32Array(entries.l ength);var entryOffsets=new Float32Array(entries.length);var entryTitles=new Arr ay(entries.length);var entryDeoptFlags=new Uint8Array(entries.length);for(var i= 0;i<entries.length;++i){var entry=entries[i];entryNodes[i]=entry.node;entryColor Indexes[i]=colorPair.index;entryLevels[i]=entry.depth;entryTotalTimes[i]=entry.d uration;entrySelfTimes[i]=entry.selfTime;entryOffsets[i]=entry.startTime;entryTi tles[i]=entry.node.functionName;var reason=entry.node.deoptReason;entryDeoptFlag s[i]=(reason&&reason!=="no reason");} 530 var entryNodes=new Array(entries.length);var entryLevels=new Uint8Array(entries. length);var entryTotalTimes=new Float32Array(entries.length);var entrySelfTimes= new Float32Array(entries.length);var entryOffsets=new Float32Array(entries.lengt h);for(var i=0;i<entries.length;++i){var entry=entries[i];entryNodes[i]=entry.no de;entryLevels[i]=entry.depth;entryTotalTimes[i]=entry.duration;entryOffsets[i]= entry.startTime;entrySelfTimes[i]=entry.selfTime;}
470 this._timelineData={maxStackDepth:Math.max(maxDepth,depth),totalTime:this._cpuPr ofileView.profileHead.totalTime,entryNodes:entryNodes,entryColorIndexes:entryCol orIndexes,entryLevels:entryLevels,entryTotalTimes:entryTotalTimes,entrySelfTimes :entrySelfTimes,entryOffsets:entryOffsets,colorEntryIndexes:colorEntryIndexes,en tryTitles:entryTitles,entryDeoptFlags:entryDeoptFlags};return this._timelineData ;},_millisecondsToString:function(ms) 531 this._maxStackDepth=Math.max(maxDepth,depth);this._timelineData={entryLevels:ent ryLevels,entryTotalTimes:entryTotalTimes,entryOffsets:entryOffsets,};this._entry Nodes=entryNodes;this._entrySelfTimes=entrySelfTimes;return(this._timelineData); },_millisecondsToString:function(ms)
471 {if(ms===0) 532 {if(ms===0)
472 return"0";if(ms<1000) 533 return"0";if(ms<1000)
473 return WebInspector.UIString("%.1f\u2009ms",ms);return Number.secondsToString(ms /1000,true);},prepareHighlightedEntryInfo:function(entryIndex) 534 return WebInspector.UIString("%.1f\u2009ms",ms);return Number.secondsToString(ms /1000,true);},prepareHighlightedEntryInfo:function(entryIndex)
474 {var timelineData=this._timelineData;var node=timelineData.entryNodes[entryIndex ];if(!node) 535 {var timelineData=this._timelineData;var node=this._entryNodes[entryIndex];if(!n ode)
475 return null;var entryInfo=[];function pushEntryInfoRow(title,text) 536 return null;var entryInfo=[];function pushEntryInfoRow(title,text)
476 {var row={};row.title=title;row.text=text;entryInfo.push(row);} 537 {var row={};row.title=title;row.text=text;entryInfo.push(row);}
477 pushEntryInfoRow(WebInspector.UIString("Name"),timelineData.entryTitles[entryInd ex]);var selfTime=this._millisecondsToString(timelineData.entrySelfTimes[entryIn dex]);var totalTime=this._millisecondsToString(timelineData.entryTotalTimes[entr yIndex]);pushEntryInfoRow(WebInspector.UIString("Self time"),selfTime);pushEntry InfoRow(WebInspector.UIString("Total time"),totalTime);if(node.url) 538 pushEntryInfoRow(WebInspector.UIString("Name"),node.functionName);var selfTime=t his._millisecondsToString(this._entrySelfTimes[entryIndex]);var totalTime=this._ millisecondsToString(timelineData.entryTotalTimes[entryIndex]);pushEntryInfoRow( WebInspector.UIString("Self time"),selfTime);pushEntryInfoRow(WebInspector.UIStr ing("Total time"),totalTime);var text=WebInspector.Linkifier.liveLocationText(no de.scriptId,node.lineNumber,node.columnNumber);pushEntryInfoRow(WebInspector.UIS tring("URL"),text);pushEntryInfoRow(WebInspector.UIString("Aggregated self time" ),Number.secondsToString(node.selfTime/1000,true));pushEntryInfoRow(WebInspector .UIString("Aggregated total time"),Number.secondsToString(node.totalTime/1000,tr ue));if(node.deoptReason&&node.deoptReason!=="no reason")
478 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")
479 pushEntryInfoRow(WebInspector.UIString("Not optimized"),node.deoptReason);return entryInfo;},canJumpToEntry:function(entryIndex) 539 pushEntryInfoRow(WebInspector.UIString("Not optimized"),node.deoptReason);return entryInfo;},canJumpToEntry:function(entryIndex)
480 {return this._timelineData.entryNodes[entryIndex].scriptId!=="0";},entryData:fun ction(entryIndex) 540 {return this._entryNodes[entryIndex].scriptId!=="0";},entryTitle:function(entryI ndex)
481 {return this._timelineData.entryNodes[entryIndex];}};WebInspector.HeapSnapshotPr ogressEvent={Update:"ProgressUpdate"};WebInspector.HeapSnapshotCommon={} 541 {var node=this._entryNodes[entryIndex];return node.functionName;},entryFont:func tion(entryIndex)
482 WebInspector.HeapSnapshotCommon.AllocationNodeCallers=function() 542 {if(!this._font){this._font=(this.barHeight()-4)+"px "+WebInspector.fontFamily() ;this._boldFont="bold "+this._font;}
483 {this.nodesWithSingleCaller;this.branchingCallers;} 543 var node=this._entryNodes[entryIndex];var reason=node.deoptReason;return(reason& &reason!=="no reason")?this._boldFont:this._font;},entryColor:function(entryInde x)
544 {var node=this._entryNodes[entryIndex];return this._colorGenerator.colorForID(no de.functionName+":"+node.url+":"+node.lineNumber);},decorateEntry:function(entry Index,context,text,barX,barY,barWidth,barHeight,offsetToPosition)
545 {return false;},forceDecoration:function(entryIndex)
546 {return false;},highlightTimeRange:function(entryIndex)
547 {var startTimeOffset=this._timelineData.entryOffsets[entryIndex];return{startTim eOffset:startTimeOffset,endTimeOffset:startTimeOffset+this._timelineData.entryTo talTimes[entryIndex]};},paddingLeft:function()
548 {return 15;},textColor:function(entryIndex)
549 {return"#333";}};WebInspector.HeapSnapshotProgressEvent={Update:"ProgressUpdate" };WebInspector.HeapSnapshotCommon={}
550 WebInspector.HeapSnapshotCommon.AllocationNodeCallers=function(nodesWithSingleCa ller,branchingCallers)
551 {this.nodesWithSingleCaller=nodesWithSingleCaller;this.branchingCallers=branchin gCallers;}
552 WebInspector.HeapSnapshotCommon.SerializedAllocationNode=function(nodeId,functio nName,scriptName,line,column,count,size,liveCount,liveSize,hasChildren)
553 {this.id=nodeId;this.name=functionName;this.scriptName=scriptName;this.line=line ;this.column=column;this.count=count;this.size=size;this.liveCount=liveCount;thi s.liveSize=liveSize;this.hasChildren=hasChildren;}
484 WebInspector.HeapSnapshotCommon.Aggregate=function() 554 WebInspector.HeapSnapshotCommon.Aggregate=function()
485 {this.count;this.distance;this.self;this.maxRet;this.type;this.name;this.idxs;} 555 {this.count;this.distance;this.self;this.maxRet;this.type;this.name;this.idxs;}
556 WebInspector.HeapSnapshotCommon.AggregateForDiff=function(){this.indexes=[];this .ids=[];this.selfSizes=[];}
557 WebInspector.HeapSnapshotCommon.Diff=function()
558 {this.addedCount=0;this.removedCount=0;this.addedSize=0;this.removedSize=0;this. deletedIndexes=[];this.addedIndexes=[];}
486 WebInspector.HeapSnapshotCommon.DiffForClass=function() 559 WebInspector.HeapSnapshotCommon.DiffForClass=function()
487 {this.addedCount;this.removedCount;this.addedSize;this.removedSize;this.deletedI ndexes;this.addedIndexes;this.countDelta;this.sizeDelta;} 560 {this.addedCount;this.removedCount;this.addedSize;this.removedSize;this.deletedI ndexes;this.addedIndexes;this.countDelta;this.sizeDelta;}
488 WebInspector.HeapSnapshotCommon.ComparatorConfig=function() 561 WebInspector.HeapSnapshotCommon.ComparatorConfig=function()
489 {this.fieldName1;this.ascending1;this.fieldName2;this.ascending2;} 562 {this.fieldName1;this.ascending1;this.fieldName2;this.ascending2;}
490 WebInspector.HeapSnapshotCommon.WorkerCommand=function() 563 WebInspector.HeapSnapshotCommon.WorkerCommand=function()
491 {this.callId;this.disposition;this.objectId;this.newObjectId;this.methodName;thi s.methodArguments;this.source;};WebInspector.HeapSnapshotWorkerProxy=function(ev entHandler) 564 {this.callId;this.disposition;this.objectId;this.newObjectId;this.methodName;thi s.methodArguments;this.source;}
492 {this._eventHandler=eventHandler;this._nextObjectId=1;this._nextCallId=1;this._c allbacks=[];this._previousCallbacks=[];this._worker=new Worker("HeapSnapshotWork er.js");this._worker.onmessage=this._messageReceived.bind(this);if(WebInspector. HeapSnapshotView.allocationProfilerEnabled) 565 WebInspector.HeapSnapshotCommon.ItemsRange=function(startPosition,endPosition,to talLength,items)
493 this._postMessage({disposition:"enableAllocationProfiler"});} 566 {this.startPosition=startPosition;this.endPosition=endPosition;this.totalLength= totalLength;this.items=items;}
494 WebInspector.HeapSnapshotWorkerProxy.prototype={createLoader:function(snapshotCo nstructorName,proxyConstructor) 567 WebInspector.HeapSnapshotCommon.StaticData=function(nodeCount,rootNodeIndex,tota lSize,maxJSObjectId)
495 {var objectId=this._nextObjectId++;var proxy=new WebInspector.HeapSnapshotLoader Proxy(this,objectId,snapshotConstructorName,proxyConstructor);this._postMessage( {callId:this._nextCallId++,disposition:"create",objectId:objectId,methodName:"We bInspector.HeapSnapshotLoader"});return proxy;},dispose:function() 568 {this.nodeCount=nodeCount;this.rootNodeIndex=rootNodeIndex;this.totalSize=totalS ize;this.maxJSObjectId=maxJSObjectId;}
569 WebInspector.HeapSnapshotCommon.Statistics=function()
570 {this.total;this.v8heap;this.native;this.code;this.jsArrays;this.strings;}
571 WebInspector.HeapSnapshotCommon.NodeFilter=function(minNodeId,maxNodeId)
572 {this.minNodeId=minNodeId;this.maxNodeId=maxNodeId;this.allocationNodeId;}
573 WebInspector.HeapSnapshotCommon.NodeFilter.prototype={equals:function(o)
574 {return this.minNodeId===o.minNodeId&&this.maxNodeId===o.maxNodeId&&this.allocat ionNodeId===o.allocationNodeId;}};WebInspector.HeapSnapshotWorkerProxy=function( eventHandler)
575 {this._eventHandler=eventHandler;this._nextObjectId=1;this._nextCallId=1;this._c allbacks=[];this._previousCallbacks=[];this._worker=new Worker("HeapSnapshotWork er.js");this._worker.onmessage=this._messageReceived.bind(this);}
576 WebInspector.HeapSnapshotWorkerProxy.prototype={createLoader:function(profileUid ,snapshotReceivedCallback)
577 {var objectId=this._nextObjectId++;var proxy=new WebInspector.HeapSnapshotLoader Proxy(this,objectId,profileUid,snapshotReceivedCallback);this._postMessage({call Id:this._nextCallId++,disposition:"create",objectId:objectId,methodName:"WebInsp ector.HeapSnapshotLoader"});return proxy;},dispose:function()
496 {this._worker.terminate();if(this._interval) 578 {this._worker.terminate();if(this._interval)
497 clearInterval(this._interval);},disposeObject:function(objectId) 579 clearInterval(this._interval);},disposeObject:function(objectId)
498 {this._postMessage({callId:this._nextCallId++,disposition:"dispose",objectId:obj ectId});},evaluateForTest:function(script,callback) 580 {this._postMessage({callId:this._nextCallId++,disposition:"dispose",objectId:obj ectId});},evaluateForTest:function(script,callback)
499 {var callId=this._nextCallId++;this._callbacks[callId]=callback;this._postMessag e({callId:callId,disposition:"evaluateForTest",source:script});},callGetter:func tion(callback,objectId,getterName) 581 {var callId=this._nextCallId++;this._callbacks[callId]=callback;this._postMessag e({callId:callId,disposition:"evaluateForTest",source:script});},callFactoryMeth od:function(callback,objectId,methodName,proxyConstructor)
500 {var callId=this._nextCallId++;this._callbacks[callId]=callback;this._postMessag e({callId:callId,disposition:"getter",objectId:objectId,methodName:getterName}); },callFactoryMethod:function(callback,objectId,methodName,proxyConstructor)
501 {var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(ar guments,4);var newObjectId=this._nextObjectId++;function wrapCallback(remoteResu lt) 582 {var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(ar guments,4);var newObjectId=this._nextObjectId++;function wrapCallback(remoteResu lt)
502 {callback(remoteResult?new proxyConstructor(this,newObjectId):null);} 583 {callback(remoteResult?new proxyConstructor(this,newObjectId):null);}
503 if(callback){this._callbacks[callId]=wrapCallback.bind(this);this._postMessage({ callId:callId,disposition:"factory",objectId:objectId,methodName:methodName,meth odArguments:methodArguments,newObjectId:newObjectId});return null;}else{this._po stMessage({callId:callId,disposition:"factory",objectId:objectId,methodName:meth odName,methodArguments:methodArguments,newObjectId:newObjectId});return new prox yConstructor(this,newObjectId);}},callMethod:function(callback,objectId,methodNa me) 584 if(callback){this._callbacks[callId]=wrapCallback.bind(this);this._postMessage({ callId:callId,disposition:"factory",objectId:objectId,methodName:methodName,meth odArguments:methodArguments,newObjectId:newObjectId});return null;}else{this._po stMessage({callId:callId,disposition:"factory",objectId:objectId,methodName:meth odName,methodArguments:methodArguments,newObjectId:newObjectId});return new prox yConstructor(this,newObjectId);}},callMethod:function(callback,objectId,methodNa me)
504 {var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(ar guments,3);if(callback) 585 {var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(ar guments,3);if(callback)
505 this._callbacks[callId]=callback;this._postMessage({callId:callId,disposition:"m ethod",objectId:objectId,methodName:methodName,methodArguments:methodArguments}) ;},startCheckingForLongRunningCalls:function() 586 this._callbacks[callId]=callback;this._postMessage({callId:callId,disposition:"m ethod",objectId:objectId,methodName:methodName,methodArguments:methodArguments}) ;},startCheckingForLongRunningCalls:function()
506 {if(this._interval) 587 {if(this._interval)
507 return;this._checkLongRunningCalls();this._interval=setInterval(this._checkLongR unningCalls.bind(this),300);},_checkLongRunningCalls:function() 588 return;this._checkLongRunningCalls();this._interval=setInterval(this._checkLongR unningCalls.bind(this),300);},_checkLongRunningCalls:function()
508 {for(var callId in this._previousCallbacks) 589 {for(var callId in this._previousCallbacks)
509 if(!(callId in this._callbacks)) 590 if(!(callId in this._callbacks))
510 delete this._previousCallbacks[callId];var hasLongRunningCalls=false;for(callId in this._previousCallbacks){hasLongRunningCalls=true;break;} 591 delete this._previousCallbacks[callId];var hasLongRunningCalls=false;for(callId in this._previousCallbacks){hasLongRunningCalls=true;break;}
511 this.dispatchEventToListeners("wait",hasLongRunningCalls);for(callId in this._ca llbacks) 592 this.dispatchEventToListeners("wait",hasLongRunningCalls);for(callId in this._ca llbacks)
512 this._previousCallbacks[callId]=true;},_findFunction:function(name) 593 this._previousCallbacks[callId]=true;},_messageReceived:function(event)
513 {var path=name.split(".");var result=window;for(var i=0;i<path.length;++i)
514 result=result[path[i]];return result;},_messageReceived:function(event)
515 {var data=event.data;if(data.eventName){if(this._eventHandler) 594 {var data=event.data;if(data.eventName){if(this._eventHandler)
516 this._eventHandler(data.eventName,data.data);return;} 595 this._eventHandler(data.eventName,data.data);return;}
517 if(data.error){if(data.errorMethodName) 596 if(data.error){if(data.errorMethodName)
518 WebInspector.log(WebInspector.UIString("An error happened when a call for method '%s' was requested",data.errorMethodName));WebInspector.log(data["errorCallStac k"]);delete this._callbacks[data.callId];return;} 597 WebInspector.console.log(WebInspector.UIString("An error happened when a call fo r method '%s' was requested",data.errorMethodName));WebInspector.console.log(dat a["errorCallStack"]);delete this._callbacks[data.callId];return;}
519 if(!this._callbacks[data.callId]) 598 if(!this._callbacks[data.callId])
520 return;var callback=this._callbacks[data.callId];delete this._callbacks[data.cal lId];callback(data.result);},_postMessage:function(message) 599 return;var callback=this._callbacks[data.callId];delete this._callbacks[data.cal lId];callback(data.result);},_postMessage:function(message)
521 {this._worker.postMessage(message);},__proto__:WebInspector.Object.prototype} 600 {this._worker.postMessage(message);},__proto__:WebInspector.Object.prototype}
522 WebInspector.HeapSnapshotProxyObject=function(worker,objectId) 601 WebInspector.HeapSnapshotProxyObject=function(worker,objectId)
523 {this._worker=worker;this._objectId=objectId;} 602 {this._worker=worker;this._objectId=objectId;}
524 WebInspector.HeapSnapshotProxyObject.prototype={_callWorker:function(workerMetho dName,args) 603 WebInspector.HeapSnapshotProxyObject.prototype={_callWorker:function(workerMetho dName,args)
525 {args.splice(1,0,this._objectId);return this._worker[workerMethodName].apply(thi s._worker,args);},dispose:function() 604 {args.splice(1,0,this._objectId);return this._worker[workerMethodName].apply(thi s._worker,args);},dispose:function()
526 {this._worker.disposeObject(this._objectId);},disposeWorker:function() 605 {this._worker.disposeObject(this._objectId);},disposeWorker:function()
527 {this._worker.dispose();},callFactoryMethod:function(callback,methodName,proxyCo nstructor,var_args) 606 {this._worker.dispose();},callFactoryMethod:function(callback,methodName,proxyCo nstructor,var_args)
528 {return this._callWorker("callFactoryMethod",Array.prototype.slice.call(argument s,0));},callGetter:function(callback,getterName) 607 {return this._callWorker("callFactoryMethod",Array.prototype.slice.call(argument s,0));},callMethod:function(callback,methodName,var_args)
529 {return this._callWorker("callGetter",Array.prototype.slice.call(arguments,0));} ,callMethod:function(callback,methodName,var_args) 608 {return this._callWorker("callMethod",Array.prototype.slice.call(arguments,0));} };WebInspector.HeapSnapshotLoaderProxy=function(worker,objectId,profileUid,snaps hotReceivedCallback)
530 {return this._callWorker("callMethod",Array.prototype.slice.call(arguments,0));} ,get worker(){return this._worker;}};WebInspector.HeapSnapshotLoaderProxy=functi on(worker,objectId,snapshotConstructorName,proxyConstructor) 609 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);this._profileUi d=profileUid;this._snapshotReceivedCallback=snapshotReceivedCallback;}
531 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);this._snapshotC onstructorName=snapshotConstructorName;this._proxyConstructor=proxyConstructor;t his._pendingSnapshotConsumers=[];} 610 WebInspector.HeapSnapshotLoaderProxy.prototype={write:function(chunk,callback)
532 WebInspector.HeapSnapshotLoaderProxy.prototype={addConsumer:function(callback)
533 {this._pendingSnapshotConsumers.push(callback);},write:function(chunk,callback)
534 {this.callMethod(callback,"write",chunk);},close:function(callback) 611 {this.callMethod(callback,"write",chunk);},close:function(callback)
535 {function buildSnapshot() 612 {function buildSnapshot()
536 {if(callback) 613 {if(callback)
537 callback();this.callFactoryMethod(updateStaticData.bind(this),"buildSnapshot",th is._proxyConstructor,this._snapshotConstructorName);} 614 callback();var showHiddenData=WebInspector.settings.showAdvancedHeapSnapshotProp erties.get();this.callFactoryMethod(updateStaticData.bind(this),"buildSnapshot", WebInspector.HeapSnapshotProxy,showHiddenData);}
538 function updateStaticData(snapshotProxy) 615 function updateStaticData(snapshotProxy)
539 {this.dispose();snapshotProxy.updateStaticData(notifyPendingConsumers.bind(this) );} 616 {this.dispose();snapshotProxy.setProfileUid(this._profileUid);snapshotProxy.upda teStaticData(this._snapshotReceivedCallback.bind(this));}
540 function notifyPendingConsumers(snapshotProxy)
541 {for(var i=0;i<this._pendingSnapshotConsumers.length;++i)
542 this._pendingSnapshotConsumers[i](snapshotProxy);this._pendingSnapshotConsumers= [];}
543 this.callMethod(buildSnapshot.bind(this),"close");},__proto__:WebInspector.HeapS napshotProxyObject.prototype} 617 this.callMethod(buildSnapshot.bind(this),"close");},__proto__:WebInspector.HeapS napshotProxyObject.prototype}
544 WebInspector.HeapSnapshotProxy=function(worker,objectId) 618 WebInspector.HeapSnapshotProxy=function(worker,objectId)
545 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);} 619 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);this._staticDat a=null;}
546 WebInspector.HeapSnapshotProxy.prototype={aggregates:function(sortedIndexes,key, filter,callback) 620 WebInspector.HeapSnapshotProxy.prototype={aggregatesWithFilter:function(filter,c allback)
547 {this.callMethod(callback,"aggregates",sortedIndexes,key,filter);},aggregatesFor Diff:function(callback) 621 {this.callMethod(callback,"aggregatesWithFilter",filter);},aggregatesForDiff:fun ction(callback)
548 {this.callMethod(callback,"aggregatesForDiff");},calculateSnapshotDiff:function( baseSnapshotId,baseSnapshotAggregates,callback) 622 {this.callMethod(callback,"aggregatesForDiff");},calculateSnapshotDiff:function( baseSnapshotId,baseSnapshotAggregates,callback)
549 {this.callMethod(callback,"calculateSnapshotDiff",baseSnapshotId,baseSnapshotAgg regates);},nodeClassName:function(snapshotObjectId,callback) 623 {this.callMethod(callback,"calculateSnapshotDiff",baseSnapshotId,baseSnapshotAgg regates);},nodeClassName:function(snapshotObjectId,callback)
550 {this.callMethod(callback,"nodeClassName",snapshotObjectId);},dominatorIdsForNod e:function(nodeIndex,callback) 624 {this.callMethod(callback,"nodeClassName",snapshotObjectId);},dominatorIdsForNod e:function(nodeIndex,callback)
551 {this.callMethod(callback,"dominatorIdsForNode",nodeIndex);},createEdgesProvider :function(nodeIndex,showHiddenData) 625 {this.callMethod(callback,"dominatorIdsForNode",nodeIndex);},createEdgesProvider :function(nodeIndex)
552 {return this.callFactoryMethod(null,"createEdgesProvider",WebInspector.HeapSnaps hotProviderProxy,nodeIndex,showHiddenData);},createRetainingEdgesProvider:functi on(nodeIndex,showHiddenData) 626 {return this.callFactoryMethod(null,"createEdgesProvider",WebInspector.HeapSnaps hotProviderProxy,nodeIndex);},createRetainingEdgesProvider:function(nodeIndex)
553 {return this.callFactoryMethod(null,"createRetainingEdgesProvider",WebInspector. HeapSnapshotProviderProxy,nodeIndex,showHiddenData);},createAddedNodesProvider:f unction(baseSnapshotId,className) 627 {return this.callFactoryMethod(null,"createRetainingEdgesProvider",WebInspector. HeapSnapshotProviderProxy,nodeIndex);},createAddedNodesProvider:function(baseSna pshotId,className)
554 {return this.callFactoryMethod(null,"createAddedNodesProvider",WebInspector.Heap SnapshotProviderProxy,baseSnapshotId,className);},createDeletedNodesProvider:fun ction(nodeIndexes) 628 {return this.callFactoryMethod(null,"createAddedNodesProvider",WebInspector.Heap SnapshotProviderProxy,baseSnapshotId,className);},createDeletedNodesProvider:fun ction(nodeIndexes)
555 {return this.callFactoryMethod(null,"createDeletedNodesProvider",WebInspector.He apSnapshotProviderProxy,nodeIndexes);},createNodesProvider:function(filter) 629 {return this.callFactoryMethod(null,"createDeletedNodesProvider",WebInspector.He apSnapshotProviderProxy,nodeIndexes);},createNodesProvider:function(filter)
556 {return this.callFactoryMethod(null,"createNodesProvider",WebInspector.HeapSnaps hotProviderProxy,filter);},createNodesProviderForClass:function(className,aggreg atesKey) 630 {return this.callFactoryMethod(null,"createNodesProvider",WebInspector.HeapSnaps hotProviderProxy,filter);},createNodesProviderForClass:function(className,nodeFi lter)
557 {return this.callFactoryMethod(null,"createNodesProviderForClass",WebInspector.H eapSnapshotProviderProxy,className,aggregatesKey);},createNodesProviderForDomina tor:function(nodeIndex) 631 {return this.callFactoryMethod(null,"createNodesProviderForClass",WebInspector.H eapSnapshotProviderProxy,className,nodeFilter);},createNodesProviderForDominator :function(nodeIndex)
558 {return this.callFactoryMethod(null,"createNodesProviderForDominator",WebInspect or.HeapSnapshotProviderProxy,nodeIndex);},maxJsNodeId:function(callback) 632 {return this.callFactoryMethod(null,"createNodesProviderForDominator",WebInspect or.HeapSnapshotProviderProxy,nodeIndex);},allocationTracesTops:function(callback )
559 {this.callMethod(callback,"maxJsNodeId");},allocationTracesTops:function(callbac k)
560 {this.callMethod(callback,"allocationTracesTops");},allocationNodeCallers:functi on(nodeId,callback) 633 {this.callMethod(callback,"allocationTracesTops");},allocationNodeCallers:functi on(nodeId,callback)
561 {this.callMethod(callback,"allocationNodeCallers",nodeId);},dispose:function() 634 {this.callMethod(callback,"allocationNodeCallers",nodeId);},dispose:function()
562 {this.disposeWorker();},get nodeCount() 635 {throw new Error("Should never be called");},get nodeCount()
563 {return this._staticData.nodeCount;},get rootNodeIndex() 636 {return this._staticData.nodeCount;},get rootNodeIndex()
564 {return this._staticData.rootNodeIndex;},updateStaticData:function(callback) 637 {return this._staticData.rootNodeIndex;},updateStaticData:function(callback)
565 {function dataReceived(staticData) 638 {function dataReceived(staticData)
566 {this._staticData=staticData;callback(this);} 639 {this._staticData=staticData;callback(this);}
567 this.callMethod(dataReceived.bind(this),"updateStaticData");},get totalSize() 640 this.callMethod(dataReceived.bind(this),"updateStaticData");},getStatistics:func tion(callback)
641 {this.callMethod(callback,"getStatistics");},get totalSize()
568 {return this._staticData.totalSize;},get uid() 642 {return this._staticData.totalSize;},get uid()
569 {return this._staticData.uid;},__proto__:WebInspector.HeapSnapshotProxyObject.pr ototype} 643 {return this._profileUid;},setProfileUid:function(profileUid)
644 {this._profileUid=profileUid;},maxJSObjectId:function()
645 {return this._staticData.maxJSObjectId;},__proto__:WebInspector.HeapSnapshotProx yObject.prototype}
570 WebInspector.HeapSnapshotProviderProxy=function(worker,objectId) 646 WebInspector.HeapSnapshotProviderProxy=function(worker,objectId)
571 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);} 647 {WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);}
572 WebInspector.HeapSnapshotProviderProxy.prototype={nodePosition:function(snapshot ObjectId,callback) 648 WebInspector.HeapSnapshotProviderProxy.prototype={nodePosition:function(snapshot ObjectId,callback)
573 {this.callMethod(callback,"nodePosition",snapshotObjectId);},isEmpty:function(ca llback) 649 {this.callMethod(callback,"nodePosition",snapshotObjectId);},isEmpty:function(ca llback)
574 {this.callMethod(callback,"isEmpty");},serializeItemsRange:function(startPositio n,endPosition,callback) 650 {this.callMethod(callback,"isEmpty");},serializeItemsRange:function(startPositio n,endPosition,callback)
575 {this.callMethod(callback,"serializeItemsRange",startPosition,endPosition);},sor tAndRewind:function(comparator,callback) 651 {this.callMethod(callback,"serializeItemsRange",startPosition,endPosition);},sor tAndRewind:function(comparator,callback)
576 {this.callMethod(callback,"sortAndRewind",comparator);},__proto__:WebInspector.H eapSnapshotProxyObject.prototype};WebInspector.HeapSnapshotSortableDataGrid=func tion(columns) 652 {this.callMethod(callback,"sortAndRewind",comparator);},__proto__:WebInspector.H eapSnapshotProxyObject.prototype};WebInspector.HeapSnapshotSortableDataGrid=func tion(columns)
577 {WebInspector.DataGrid.call(this,columns);this._recursiveSortingDepth=0;this._hi ghlightedNode=null;this._populatedAndSorted=false;this.addEventListener("sorting complete",this._sortingComplete,this);this.addEventListener(WebInspector.DataGr id.Events.SortingChanged,this.sortingChanged,this);} 653 {WebInspector.DataGrid.call(this,columns);this._recursiveSortingDepth=0;this._hi ghlightedNode=null;this._populatedAndSorted=false;this._nameFilter="";this.addEv entListener(WebInspector.HeapSnapshotSortableDataGrid.Events.SortingComplete,thi s._sortingComplete,this);this.addEventListener(WebInspector.DataGrid.Events.Sort ingChanged,this.sortingChanged,this);}
578 WebInspector.HeapSnapshotSortableDataGrid.Events={ContentShown:"ContentShown"} 654 WebInspector.HeapSnapshotSortableDataGrid.Events={ContentShown:"ContentShown",Re setFilter:"ResetFilter",SortingComplete:"SortingComplete"}
579 WebInspector.HeapSnapshotSortableDataGrid.prototype={defaultPopulateCount:functi on() 655 WebInspector.HeapSnapshotSortableDataGrid.prototype={defaultPopulateCount:functi on()
580 {return 100;},dispose:function() 656 {return 100;},_disposeAllNodes:function()
581 {var children=this.topLevelNodes();for(var i=0,l=children.length;i<l;++i) 657 {var children=this.topLevelNodes();for(var i=0,l=children.length;i<l;++i)
582 children[i].dispose();},wasShown:function() 658 children[i].dispose();},wasShown:function()
583 {if(this._populatedAndSorted) 659 {if(this._populatedAndSorted)
584 this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.C ontentShown,this);},_sortingComplete:function() 660 this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.C ontentShown,this);},_sortingComplete:function()
585 {this.removeEventListener("sorting complete",this._sortingComplete,this);this._p opulatedAndSorted=true;this.dispatchEventToListeners(WebInspector.HeapSnapshotSo rtableDataGrid.Events.ContentShown,this);},willHide:function() 661 {this.removeEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.Sorti ngComplete,this._sortingComplete,this);this._populatedAndSorted=true;this.dispat chEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown ,this);},willHide:function()
586 {this._clearCurrentHighlight();},populateContextMenu:function(profilesPanel,cont extMenu,event) 662 {this._clearCurrentHighlight();},populateContextMenu:function(contextMenu,event)
587 {var td=event.target.enclosingNodeOrSelfWithNodeName("td");if(!td) 663 {var td=event.target.enclosingNodeOrSelfWithNodeName("td");if(!td)
588 return;var node=td.heapSnapshotNode;function revealInDominatorsView() 664 return;var node=td.heapSnapshotNode;function revealInDominatorsView()
589 {profilesPanel.showObject(node.snapshotNodeId,"Dominators");} 665 {WebInspector.panels.profiles.showObject(node.snapshotNodeId,"Dominators");}
590 function revealInSummaryView() 666 function revealInSummaryView()
591 {profilesPanel.showObject(node.snapshotNodeId,"Summary");} 667 {WebInspector.panels.profiles.showObject(node.snapshotNodeId,"Summary");}
592 if(node&&node.showRetainingEdges){contextMenu.appendItem(WebInspector.UIString(W ebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView.bind(this));contextMenu.appendItem(WebInspector.UISt ring(WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal i n Dominators View"),revealInDominatorsView.bind(this));} 668 if(node&&node.showRetainingEdges){contextMenu.appendItem(WebInspector.UIString(W ebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView);contextMenu.appendItem(WebInspector.UIString(WebIns pector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Dominator s View"),revealInDominatorsView);}
593 else if(node instanceof WebInspector.HeapSnapshotInstanceNode||node instanceof W ebInspector.HeapSnapshotObjectNode){contextMenu.appendItem(WebInspector.UIString (WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Do minators View"),revealInDominatorsView.bind(this));}else if(node instanceof WebI nspector.HeapSnapshotDominatorObjectNode){contextMenu.appendItem(WebInspector.UI String(WebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView.bind(this));}},resetSortingCache:function() 669 else if(node instanceof WebInspector.HeapSnapshotInstanceNode||node instanceof W ebInspector.HeapSnapshotObjectNode){contextMenu.appendItem(WebInspector.UIString (WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Do minators View"),revealInDominatorsView);}else if(node instanceof WebInspector.He apSnapshotDominatorObjectNode){contextMenu.appendItem(WebInspector.UIString(WebI nspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary Vi ew"),revealInSummaryView);}},resetSortingCache:function()
594 {delete this._lastSortColumnIdentifier;delete this._lastSortAscending;},topLevel Nodes:function() 670 {delete this._lastSortColumnIdentifier;delete this._lastSortAscending;},topLevel Nodes:function()
595 {return this.rootNode().children;},highlightObjectByHeapSnapshotId:function(heap SnapshotObjectId,callback) 671 {return this.rootNode().children;},highlightObjectByHeapSnapshotId:function(heap SnapshotObjectId,callback)
596 {},highlightNode:function(node) 672 {},highlightNode:function(node)
597 {var prevNode=this._highlightedNode;this._clearCurrentHighlight();this._highligh tedNode=node;this._highlightedNode.element.classList.add("highlighted-row");if(n ode===prevNode){var element=node.element;var parent=element.parentElement;var ne xtSibling=element.nextSibling;parent.removeChild(element);parent.insertBefore(el ement,nextSibling);}},nodeWasDetached:function(node) 673 {var prevNode=this._highlightedNode;this._clearCurrentHighlight();this._highligh tedNode=node;WebInspector.runCSSAnimationOnce(this._highlightedNode.element,"hig hlighted-row");},nodeWasDetached:function(node)
598 {if(this._highlightedNode===node) 674 {if(this._highlightedNode===node)
599 this._clearCurrentHighlight();},_clearCurrentHighlight:function() 675 this._clearCurrentHighlight();},_clearCurrentHighlight:function()
600 {if(!this._highlightedNode) 676 {if(!this._highlightedNode)
601 return 677 return
602 this._highlightedNode.element.classList.remove("highlighted-row");this._highligh tedNode=null;},changeNameFilter:function(filter) 678 this._highlightedNode.element.classList.remove("highlighted-row");this._highligh tedNode=null;},resetNameFilter:function(callback)
603 {filter=filter.toLowerCase();var children=this.topLevelNodes();for(var i=0,l=chi ldren.length;i<l;++i){var node=children[i];if(node.depth===0) 679 {this._callbackAfterFilterChange=callback;this.dispatchEventToListeners(WebInspe ctor.HeapSnapshotSortableDataGrid.Events.ResetFilter);},changeNameFilter:functio n(filter)
604 node.revealed=node._name.toLowerCase().indexOf(filter)!==-1;} 680 {this._nameFilter=filter.toLowerCase();this.updateVisibleNodes(true);if(this._ca llbackAfterFilterChange){this._callbackAfterFilterChange();this._callbackAfterFi lterChange=null;}},sortingChanged:function()
605 this.updateVisibleNodes();},sortingChanged:function()
606 {var sortAscending=this.isSortOrderAscending();var sortColumnIdentifier=this.sor tColumnIdentifier();if(this._lastSortColumnIdentifier===sortColumnIdentifier&&th is._lastSortAscending===sortAscending) 681 {var sortAscending=this.isSortOrderAscending();var sortColumnIdentifier=this.sor tColumnIdentifier();if(this._lastSortColumnIdentifier===sortColumnIdentifier&&th is._lastSortAscending===sortAscending)
607 return;this._lastSortColumnIdentifier=sortColumnIdentifier;this._lastSortAscendi ng=sortAscending;var sortFields=this._sortFields(sortColumnIdentifier,sortAscend ing);function SortByTwoFields(nodeA,nodeB) 682 return;this._lastSortColumnIdentifier=sortColumnIdentifier;this._lastSortAscendi ng=sortAscending;var sortFields=this._sortFields(sortColumnIdentifier,sortAscend ing);function SortByTwoFields(nodeA,nodeB)
608 {var field1=nodeA[sortFields[0]];var field2=nodeB[sortFields[0]];var result=fiel d1<field2?-1:(field1>field2?1:0);if(!sortFields[1]) 683 {var field1=nodeA[sortFields[0]];var field2=nodeB[sortFields[0]];var result=fiel d1<field2?-1:(field1>field2?1:0);if(!sortFields[1])
609 result=-result;if(result!==0) 684 result=-result;if(result!==0)
610 return result;field1=nodeA[sortFields[2]];field2=nodeB[sortFields[2]];result=fie ld1<field2?-1:(field1>field2?1:0);if(!sortFields[3]) 685 return result;field1=nodeA[sortFields[2]];field2=nodeB[sortFields[2]];result=fie ld1<field2?-1:(field1>field2?1:0);if(!sortFields[3])
611 result=-result;return result;} 686 result=-result;return result;}
612 this._performSorting(SortByTwoFields);},_performSorting:function(sortFunction) 687 this._performSorting(SortByTwoFields);},_performSorting:function(sortFunction)
613 {this.recursiveSortingEnter();var children=this._topLevelNodes;this.rootNode().r emoveChildren();children.sort(sortFunction);for(var i=0,l=children.length;i<l;++ i){var child=children[i];this.appendChildAfterSorting(child);if(child.expanded) 688 {this.recursiveSortingEnter();var children=this.allChildren(this.rootNode());thi s.rootNode().removeChildren();children.sort(sortFunction);for(var i=0,l=children .length;i<l;++i){var child=children[i];this.appendChildAfterSorting(child);if(ch ild.expanded)
614 child.sort();} 689 child.sort();}
615 this.updateVisibleNodes();this.recursiveSortingLeave();},appendChildAfterSorting :function(child) 690 this.recursiveSortingLeave();},appendChildAfterSorting:function(child)
616 {var revealed=child.revealed;this.rootNode().appendChild(child);child.revealed=r evealed;},updateVisibleNodes:function() 691 {var revealed=child.revealed;this.rootNode().appendChild(child);child.revealed=r evealed;},recursiveSortingEnter:function()
617 {},recursiveSortingEnter:function()
618 {++this._recursiveSortingDepth;},recursiveSortingLeave:function() 692 {++this._recursiveSortingDepth;},recursiveSortingLeave:function()
619 {if(!this._recursiveSortingDepth) 693 {if(!this._recursiveSortingDepth)
620 return;if(!--this._recursiveSortingDepth) 694 return;if(--this._recursiveSortingDepth)
621 this.dispatchEventToListeners("sorting complete");},__proto__:WebInspector.DataG rid.prototype} 695 return;this.updateVisibleNodes(true);this.dispatchEventToListeners(WebInspector. HeapSnapshotSortableDataGrid.Events.SortingComplete);},updateVisibleNodes:functi on(force)
696 {},allChildren:function(parent)
697 {return parent.children;},insertChild:function(parent,node,index)
698 {parent.insertChild(node,index);},removeChildByIndex:function(parent,index)
699 {parent.removeChild(parent.children[index]);},removeAllChildren:function(parent)
700 {parent.removeChildren();},__proto__:WebInspector.DataGrid.prototype}
622 WebInspector.HeapSnapshotViewportDataGrid=function(columns) 701 WebInspector.HeapSnapshotViewportDataGrid=function(columns)
623 {WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);this.scrollContain er.addEventListener("scroll",this._onScroll.bind(this),true);this._topLevelNodes =[];this._topPadding=new WebInspector.HeapSnapshotPaddingNode();this._bottomPadd ing=new WebInspector.HeapSnapshotPaddingNode();this._nodeToHighlightAfterScroll= null;} 702 {WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);this.scrollContain er.addEventListener("scroll",this._onScroll.bind(this),true);this._nodeToHighlig htAfterScroll=null;this._topPadding=new WebInspector.HeapSnapshotPaddingNode();t his._topPaddingHeight=0;this.dataTableBody.insertBefore(this._topPadding.element ,this.dataTableBody.firstChild);this._bottomPadding=new WebInspector.HeapSnapsho tPaddingNode();this._bottomPaddingHeight=0;this.dataTableBody.insertBefore(this. _bottomPadding.element,this.dataTableBody.lastChild);}
624 WebInspector.HeapSnapshotViewportDataGrid.prototype={topLevelNodes:function() 703 WebInspector.HeapSnapshotViewportDataGrid.prototype={topLevelNodes:function()
625 {return this._topLevelNodes;},appendChildAfterSorting:function(child) 704 {return this.allChildren(this.rootNode());},appendChildAfterSorting:function(chi ld)
626 {},updateVisibleNodes:function() 705 {},updateVisibleNodes:function(force,pathToReveal)
627 {var scrollTop=this.scrollContainer.scrollTop;var children=this._topLevelNodes;v ar i=0;var topPadding=0;while(i<children.length){if(children[i].revealed){var ne wTop=topPadding+children[i].nodeHeight();if(newTop>scrollTop) 706 {var guardZoneHeight=40;var scrollHeight=this.scrollContainer.scrollHeight;var s crollTop=this.scrollContainer.scrollTop;var scrollBottom=scrollHeight-scrollTop- this.scrollContainer.offsetHeight;scrollTop=Math.max(0,scrollTop-guardZoneHeight );scrollBottom=Math.max(0,scrollBottom-guardZoneHeight);var viewPortHeight=scrol lHeight-scrollTop-scrollBottom;if(!pathToReveal){if(!force&&scrollTop>=this._top PaddingHeight&&scrollBottom>=this._bottomPaddingHeight)
707 return;var hysteresisHeight=500;scrollTop-=hysteresisHeight;viewPortHeight+=2*hy steresisHeight;}
708 var selectedNode=this.selectedNode;this.rootNode().removeChildren();this._topPad dingHeight=0;this._bottomPaddingHeight=0;this._addVisibleNodes(this.rootNode(),s crollTop,scrollTop+viewPortHeight,pathToReveal||null);this._topPadding.setHeight (this._topPaddingHeight);this._bottomPadding.setHeight(this._bottomPaddingHeight );if(selectedNode){if(selectedNode.parent)
709 selectedNode.select(true);else
710 this.selectedNode=selectedNode;}},_addVisibleNodes:function(parentNode,topBound, bottomBound,pathToReveal)
711 {if(!parentNode.expanded)
712 return 0;var nodeToReveal=pathToReveal?pathToReveal[0]:null;var restPathToReveal =pathToReveal&&pathToReveal.length>1?pathToReveal.slice(1):null;var children=thi s.allChildren(parentNode);var topPadding=0;for(var i=0;i<children.length;++i){va r child=children[i];if(child.filteredOut&&child.filteredOut())
713 continue;var newTop=topPadding+this._nodeHeight(child);if(nodeToReveal===child|| (!nodeToReveal&&newTop>topBound))
628 break;topPadding=newTop;} 714 break;topPadding=newTop;}
629 ++i;} 715 var position=topPadding;for(;i<children.length&&(nodeToReveal||position<bottomBo und);++i){var child=children[i];if(child.filteredOut&&child.filteredOut())
630 this._addVisibleNodes(i,scrollTop-topPadding,topPadding);},_addVisibleNodes:func tion(firstVisibleNodeIndex,firstNodeHiddenHeight,topPadding) 716 continue;var hasChildren=child.hasChildren;child.removeChildren();child.hasChild ren=hasChildren;child.revealed=true;parentNode.appendChild(child);position+=chil d.nodeSelfHeight();position+=this._addVisibleNodes(child,topBound-position,botto mBound-position,restPathToReveal);if(nodeToReveal===child)
631 {var viewPortHeight=this.scrollContainer.offsetHeight;this._removePaddingRows(); var children=this._topLevelNodes;var selectedNode=this.selectedNode;this.rootNod e().removeChildren();var heightToFill=viewPortHeight+firstNodeHiddenHeight;var f illedHeight=0;var i=firstVisibleNodeIndex;while(i<children.length&&filledHeight< heightToFill){if(children[i].revealed){this.rootNode().appendChild(children[i]); filledHeight+=children[i].nodeHeight();} 717 break;}
632 ++i;} 718 var bottomPadding=0;for(;i<children.length;++i){var child=children[i];if(child.f ilteredOut&&child.filteredOut())
633 var bottomPadding=0;while(i<children.length){bottomPadding+=children[i].nodeHeig ht();++i;} 719 continue;bottomPadding+=this._nodeHeight(child);}
634 this._addPaddingRows(topPadding,bottomPadding);if(selectedNode){if(selectedNode. parent){selectedNode.select(true);}else{this.selectedNode=selectedNode;}}},_reve alTopLevelNode:function(nodeToReveal) 720 this._topPaddingHeight+=topPadding;this._bottomPaddingHeight+=bottomPadding;retu rn position+bottomPadding;},_nodeHeight:function(node)
635 {var children=this._topLevelNodes;var i=0;var topPadding=0;while(i<children.leng th){if(children[i]===nodeToReveal) 721 {if(!node.revealed)
636 break;if(children[i].revealed){var newTop=topPadding+children[i].nodeHeight();to pPadding=newTop;} 722 return 0;var result=node.nodeSelfHeight();if(!node.expanded)
637 ++i;} 723 return result;var children=this.allChildren(node);for(var i=0;i<children.length; i++)
638 this._addVisibleNodes(i,0,topPadding);},appendTopLevelNode:function(node) 724 result+=this._nodeHeight(children[i]);return result;},defaultAttachLocation:func tion()
639 {this._topLevelNodes.push(node);},removeTopLevelNodes:function() 725 {return this._bottomPadding.element;},revealTreeNode:function(pathToReveal)
640 {this.rootNode().removeChildren();this._topLevelNodes=[];},highlightNode:functio n(node) 726 {this.updateVisibleNodes(true,pathToReveal);},allChildren:function(parent)
641 {if(this._isScrolledIntoView(node.element)) 727 {return parent._allChildren||(parent._allChildren=[]);},appendNode:function(pare nt,node)
642 WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this,node );else{node.element.scrollIntoViewIfNeeded(true);this._nodeToHighlightAfterScrol l=node;}},_isScrolledIntoView:function(element) 728 {this.allChildren(parent).push(node);},insertChild:function(parent,node,index)
729 {this.allChildren(parent).splice(index,0,node);},removeChildByIndex:function(par ent,index)
730 {this.allChildren(parent).splice(index,1);},removeAllChildren:function(parent)
731 {parent._allChildren=[];},removeTopLevelNodes:function()
732 {this._disposeAllNodes();this.rootNode().removeChildren();this.rootNode()._allCh ildren=[];},highlightNode:function(node)
733 {if(this._isScrolledIntoView(node.element)){this.updateVisibleNodes(true);WebIns pector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this,node);}els e{node.element.scrollIntoViewIfNeeded(true);this._nodeToHighlightAfterScroll=nod e;}},_isScrolledIntoView:function(element)
643 {var viewportTop=this.scrollContainer.scrollTop;var viewportBottom=viewportTop+t his.scrollContainer.clientHeight;var elemTop=element.offsetTop 734 {var viewportTop=this.scrollContainer.scrollTop;var viewportBottom=viewportTop+t his.scrollContainer.clientHeight;var elemTop=element.offsetTop
644 var elemBottom=elemTop+element.offsetHeight;return elemBottom<=viewportBottom&&e lemTop>=viewportTop;},_addPaddingRows:function(top,bottom) 735 var elemBottom=elemTop+element.offsetHeight;return elemBottom<=viewportBottom&&e lemTop>=viewportTop;},onResize:function()
645 {if(this._topPadding.element.parentNode!==this.dataTableBody) 736 {WebInspector.HeapSnapshotSortableDataGrid.prototype.onResize.call(this);this.up dateVisibleNodes(false);},_onScroll:function(event)
646 this.dataTableBody.insertBefore(this._topPadding.element,this.dataTableBody.firs tChild);if(this._bottomPadding.element.parentNode!==this.dataTableBody) 737 {this.updateVisibleNodes(false);if(this._nodeToHighlightAfterScroll){WebInspecto r.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this,this._nodeToHig hlightAfterScroll);this._nodeToHighlightAfterScroll=null;}},__proto__:WebInspect or.HeapSnapshotSortableDataGrid.prototype}
647 this.dataTableBody.insertBefore(this._bottomPadding.element,this.dataTableBody.l astChild);this._topPadding.setHeight(top);this._bottomPadding.setHeight(bottom); },_removePaddingRows:function()
648 {this._bottomPadding.removeFromTable();this._topPadding.removeFromTable();},onRe size:function()
649 {WebInspector.HeapSnapshotSortableDataGrid.prototype.onResize.call(this);this.up dateVisibleNodes();},_onScroll:function(event)
650 {this.updateVisibleNodes();if(this._nodeToHighlightAfterScroll){WebInspector.Hea pSnapshotSortableDataGrid.prototype.highlightNode.call(this,this._nodeToHighligh tAfterScroll);this._nodeToHighlightAfterScroll=null;}},__proto__:WebInspector.He apSnapshotSortableDataGrid.prototype}
651 WebInspector.HeapSnapshotPaddingNode=function() 738 WebInspector.HeapSnapshotPaddingNode=function()
652 {this.element=document.createElement("tr");this.element.classList.add("revealed" );} 739 {this.element=document.createElement("tr");this.element.classList.add("revealed" );}
653 WebInspector.HeapSnapshotPaddingNode.prototype={setHeight:function(height) 740 WebInspector.HeapSnapshotPaddingNode.prototype={setHeight:function(height)
654 {this.element.style.height=height+"px";},removeFromTable:function() 741 {this.element.style.height=height+"px";},removeFromTable:function()
655 {var parent=this.element.parentNode;if(parent) 742 {var parent=this.element.parentNode;if(parent)
656 parent.removeChild(this.element);}} 743 parent.removeChild(this.element);}}
657 WebInspector.HeapSnapshotContainmentDataGrid=function(columns) 744 WebInspector.HeapSnapshotContainmentDataGrid=function(columns)
658 {columns=columns||[{id:"object",title:WebInspector.UIString("Object"),disclosure :true,sortable:true},{id:"distance",title:WebInspector.UIString("Distance"),widt h:"80px",sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shallow S ize"),width:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UIStrin g("Retained Size"),width:"120px",sortable:true,sort:WebInspector.DataGrid.Order. Descending}];WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);} 745 {columns=columns||[{id:"object",title:WebInspector.UIString("Object"),disclosure :true,sortable:true},{id:"distance",title:WebInspector.UIString("Distance"),widt h:"80px",sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shallow S ize"),width:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UIStrin g("Retained Size"),width:"120px",sortable:true,sort:WebInspector.DataGrid.Order. Descending}];WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);}
659 WebInspector.HeapSnapshotContainmentDataGrid.prototype={setDataSource:function(s napshot,nodeIndex) 746 WebInspector.HeapSnapshotContainmentDataGrid.prototype={setDataSource:function(s napshot,nodeIndex)
660 {this.snapshot=snapshot;var node={nodeIndex:nodeIndex||snapshot.rootNodeIndex};v ar fakeEdge={node:node};this.setRootNode(new WebInspector.HeapSnapshotObjectNode (this,false,fakeEdge,null));this.rootNode().sort();},sortingChanged:function() 747 {this.snapshot=snapshot;var node={nodeIndex:nodeIndex||snapshot.rootNodeIndex};v ar fakeEdge={node:node};this.setRootNode(new WebInspector.HeapSnapshotObjectNode (this,snapshot,fakeEdge,null));this.rootNode().sort();},sortingChanged:function( )
661 {this.rootNode().sort();},__proto__:WebInspector.HeapSnapshotSortableDataGrid.pr ototype} 748 {var rootNode=this.rootNode();if(rootNode.hasChildren)
749 rootNode.sort();},__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
662 WebInspector.HeapSnapshotRetainmentDataGrid=function() 750 WebInspector.HeapSnapshotRetainmentDataGrid=function()
663 {this.showRetainingEdges=true;var columns=[{id:"object",title:WebInspector.UIStr ing("Object"),disclosure:true,sortable:true},{id:"distance",title:WebInspector.U IString("Distance"),width:"80px",sortable:true,sort:WebInspector.DataGrid.Order. Ascending},{id:"shallowSize",title:WebInspector.UIString("Shallow Size"),width:" 120px",sortable:true},{id:"retainedSize",title:WebInspector.UIString("Retained S ize"),width:"120px",sortable:true}];WebInspector.HeapSnapshotContainmentDataGrid .call(this,columns);} 751 {this.showRetainingEdges=true;var columns=[{id:"object",title:WebInspector.UIStr ing("Object"),disclosure:true,sortable:true},{id:"distance",title:WebInspector.U IString("Distance"),width:"80px",sortable:true,sort:WebInspector.DataGrid.Order. Ascending},{id:"shallowSize",title:WebInspector.UIString("Shallow Size"),width:" 120px",sortable:true},{id:"retainedSize",title:WebInspector.UIString("Retained S ize"),width:"120px",sortable:true}];WebInspector.HeapSnapshotContainmentDataGrid .call(this,columns);}
664 WebInspector.HeapSnapshotRetainmentDataGrid.Events={ExpandRetainersComplete:"Exp andRetainersComplete"} 752 WebInspector.HeapSnapshotRetainmentDataGrid.Events={ExpandRetainersComplete:"Exp andRetainersComplete"}
665 WebInspector.HeapSnapshotRetainmentDataGrid.prototype={_sortFields:function(sort Column,sortAscending) 753 WebInspector.HeapSnapshotRetainmentDataGrid.prototype={_sortFields:function(sort Column,sortAscending)
666 {return{object:["_name",sortAscending,"_count",false],count:["_count",sortAscend ing,"_name",true],shallowSize:["_shallowSize",sortAscending,"_name",true],retain edSize:["_retainedSize",sortAscending,"_name",true],distance:["_distance",sortAs cending,"_name",true]}[sortColumn];},reset:function() 754 {return{object:["_name",sortAscending,"_count",false],count:["_count",sortAscend ing,"_name",true],shallowSize:["_shallowSize",sortAscending,"_name",true],retain edSize:["_retainedSize",sortAscending,"_name",true],distance:["_distance",sortAs cending,"_name",true]}[sortColumn];},reset:function()
667 {this.rootNode().removeChildren();this.resetSortingCache();},setDataSource:funct ion(snapshot,nodeIndex) 755 {this.rootNode().removeChildren();this.resetSortingCache();},setDataSource:funct ion(snapshot,nodeIndex)
668 {WebInspector.HeapSnapshotContainmentDataGrid.prototype.setDataSource.call(this, snapshot,nodeIndex);var dataGrid=this;var maxExpandLevels=20;function populateCo mplete() 756 {WebInspector.HeapSnapshotContainmentDataGrid.prototype.setDataSource.call(this, snapshot,nodeIndex);var dataGrid=this;var maxExpandLevels=20;function populateCo mplete()
669 {this.removeEventListener(WebInspector.HeapSnapshotGridNode.Events.PopulateCompl ete,populateComplete,this);this.expand();if(--maxExpandLevels>0&&this.children.l ength>0){var retainer=this.children[0];if(retainer._distance>1){retainer.addEven tListener(WebInspector.HeapSnapshotGridNode.Events.PopulateComplete,populateComp lete,retainer);retainer.populate();return;}} 757 {this.removeEventListener(WebInspector.HeapSnapshotGridNode.Events.PopulateCompl ete,populateComplete,this);this.expand();if(--maxExpandLevels>0&&this.children.l ength>0){var retainer=this.children[0];if(retainer._distance>1){retainer.addEven tListener(WebInspector.HeapSnapshotGridNode.Events.PopulateComplete,populateComp lete,retainer);retainer.populate();return;}}
670 dataGrid.dispatchEventToListeners(WebInspector.HeapSnapshotRetainmentDataGrid.Ev ents.ExpandRetainersComplete);} 758 dataGrid.dispatchEventToListeners(WebInspector.HeapSnapshotRetainmentDataGrid.Ev ents.ExpandRetainersComplete);}
671 this.rootNode().addEventListener(WebInspector.HeapSnapshotGridNode.Events.Popula teComplete,populateComplete,this.rootNode());},__proto__:WebInspector.HeapSnapsh otContainmentDataGrid.prototype} 759 this.rootNode().addEventListener(WebInspector.HeapSnapshotGridNode.Events.Popula teComplete,populateComplete,this.rootNode());},__proto__:WebInspector.HeapSnapsh otContainmentDataGrid.prototype}
672 WebInspector.HeapSnapshotConstructorsDataGrid=function() 760 WebInspector.HeapSnapshotConstructorsDataGrid=function()
673 {var columns=[{id:"object",title:WebInspector.UIString("Constructor"),disclosure :true,sortable:true},{id:"distance",title:WebInspector.UIString("Distance"),widt h:"90px",sortable:true},{id:"count",title:WebInspector.UIString("Objects Count") ,width:"90px",sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shal low Size"),width:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UI String("Retained Size"),width:"120px",sort:WebInspector.DataGrid.Order.Descendin g,sortable:true}];WebInspector.HeapSnapshotViewportDataGrid.call(this,columns);t his._profileIndex=-1;this._topLevelNodes=[];this._objectIdToSelect=null;} 761 {var columns=[{id:"object",title:WebInspector.UIString("Constructor"),disclosure :true,sortable:true},{id:"distance",title:WebInspector.UIString("Distance"),widt h:"90px",sortable:true},{id:"count",title:WebInspector.UIString("Objects Count") ,width:"90px",sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shal low Size"),width:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UI String("Retained Size"),width:"120px",sort:WebInspector.DataGrid.Order.Descendin g,sortable:true}];WebInspector.HeapSnapshotViewportDataGrid.call(this,columns);t his._profileIndex=-1;this._objectIdToSelect=null;}
674 WebInspector.HeapSnapshotConstructorsDataGrid.Request=function(minNodeId,maxNode Id)
675 {if(typeof minNodeId==="number"){this.key=minNodeId+".."+maxNodeId;this.filter=" function(node) { var id = node.id(); return id > "+minNodeId+" && id <= "+maxNod eId+"; }";}else{this.key="allObjects";this.filter=null;}}
676 WebInspector.HeapSnapshotConstructorsDataGrid.prototype={_sortFields:function(so rtColumn,sortAscending) 762 WebInspector.HeapSnapshotConstructorsDataGrid.prototype={_sortFields:function(so rtColumn,sortAscending)
677 {return{object:["_name",sortAscending,"_count",false],distance:["_distance",sort Ascending,"_retainedSize",true],count:["_count",sortAscending,"_name",true],shal lowSize:["_shallowSize",sortAscending,"_name",true],retainedSize:["_retainedSize ",sortAscending,"_name",true]}[sortColumn];},highlightObjectByHeapSnapshotId:fun ction(id,callback) 763 {return{object:["_name",sortAscending,"_count",false],distance:["_distance",sort Ascending,"_retainedSize",true],count:["_count",sortAscending,"_name",true],shal lowSize:["_shallowSize",sortAscending,"_name",true],retainedSize:["_retainedSize ",sortAscending,"_name",true]}[sortColumn];},highlightObjectByHeapSnapshotId:fun ction(id,callback)
678 {if(!this.snapshot){this._objectIdToSelect=id;return;} 764 {if(!this.snapshot){this._objectIdToSelect=id;return;}
679 function didGetClassName(className) 765 function didGetClassName(className)
680 {if(!className){callback(false);return;} 766 {if(!className){callback(false);return;}
681 var constructorNodes=this.topLevelNodes();for(var i=0;i<constructorNodes.length; i++){var parent=constructorNodes[i];if(parent._name===className){if(!parent.data Grid){this._revealTopLevelNode(parent);} 767 var constructorNodes=this.topLevelNodes();for(var i=0;i<constructorNodes.length; i++){var parent=constructorNodes[i];if(parent._name===className){parent.revealNo deBySnapshotObjectId(parseInt(id,10),callback);return;}}}
682 parent.revealNodeBySnapshotObjectId(parseInt(id,10),callback);return;}}} 768 this.snapshot.nodeClassName(parseInt(id,10),didGetClassName.bind(this));},clear: function()
683 this.snapshot.nodeClassName(parseInt(id,10),didGetClassName.bind(this));},setDat aSource:function(snapshot) 769 {this._nextRequestedFilter=null;this._lastFilter=null;this.removeTopLevelNodes() ;},setDataSource:function(snapshot)
684 {this.snapshot=snapshot;if(this._profileIndex===-1) 770 {this.snapshot=snapshot;if(this._profileIndex===-1)
685 this._populateChildren();if(this._objectIdToSelect){this.highlightObjectByHeapSn apshotId(this._objectIdToSelect,function(found){});this._objectIdToSelect=null;} },setSelectionRange:function(minNodeId,maxNodeId) 771 this._populateChildren();if(this._objectIdToSelect){this.highlightObjectByHeapSn apshotId(this._objectIdToSelect,function(found){});this._objectIdToSelect=null;} },setSelectionRange:function(minNodeId,maxNodeId)
686 {this._populateChildren(new WebInspector.HeapSnapshotConstructorsDataGrid.Reques t(minNodeId,maxNodeId));},_aggregatesReceived:function(key,aggregates) 772 {this._populateChildren(new WebInspector.HeapSnapshotCommon.NodeFilter(minNodeId ,maxNodeId));},setAllocationNodeId:function(allocationNodeId)
687 {this._requestInProgress=null;if(this._nextRequest){this.snapshot.aggregates(fal se,this._nextRequest.key,this._nextRequest.filter,this._aggregatesReceived.bind( this,this._nextRequest.key));this._requestInProgress=this._nextRequest;this._nex tRequest=null;} 773 {var filter=new WebInspector.HeapSnapshotCommon.NodeFilter();filter.allocationNo deId=allocationNodeId;this._populateChildren(filter);},_aggregatesReceived:funct ion(nodeFilter,aggregates)
688 this.dispose();this.removeTopLevelNodes();this.resetSortingCache();for(var const ructor in aggregates) 774 {this._filterInProgress=null;if(this._nextRequestedFilter){this.snapshot.aggrega tesWithFilter(this._nextRequestedFilter,this._aggregatesReceived.bind(this,this. _nextRequestedFilter));this._filterInProgress=this._nextRequestedFilter;this._ne xtRequestedFilter=null;}
689 this.appendTopLevelNode(new WebInspector.HeapSnapshotConstructorNode(this,constr uctor,aggregates[constructor],key));this.sortingChanged();this._lastKey=key;},_p opulateChildren:function(request) 775 this.removeTopLevelNodes();this.resetSortingCache();for(var constructor in aggre gates)
690 {request=request||new WebInspector.HeapSnapshotConstructorsDataGrid.Request();if (this._requestInProgress){this._nextRequest=this._requestInProgress.key===reques t.key?null:request;return;} 776 this.appendNode(this.rootNode(),new WebInspector.HeapSnapshotConstructorNode(thi s,constructor,aggregates[constructor],nodeFilter));this.sortingChanged();this._l astFilter=nodeFilter;},_populateChildren:function(nodeFilter)
691 if(this._lastKey===request.key) 777 {nodeFilter=nodeFilter||new WebInspector.HeapSnapshotCommon.NodeFilter();if(this ._filterInProgress){this._nextRequestedFilter=this._filterInProgress.equals(node Filter)?null:nodeFilter;return;}
692 return;this._requestInProgress=request;this.snapshot.aggregates(false,request.ke y,request.filter,this._aggregatesReceived.bind(this,request.key));},filterSelect IndexChanged:function(profiles,profileIndex) 778 if(this._lastFilter&&this._lastFilter.equals(nodeFilter))
693 {this._profileIndex=profileIndex;var request=null;if(profileIndex!==-1){var minN odeId=profileIndex>0?profiles[profileIndex-1].maxJSObjectId:0;var maxNodeId=prof iles[profileIndex].maxJSObjectId;request=new WebInspector.HeapSnapshotConstructo rsDataGrid.Request(minNodeId,maxNodeId)} 779 return;this._filterInProgress=nodeFilter;this.snapshot.aggregatesWithFilter(node Filter,this._aggregatesReceived.bind(this,nodeFilter));},filterSelectIndexChange d:function(profiles,profileIndex)
694 this._populateChildren(request);},__proto__:WebInspector.HeapSnapshotViewportDat aGrid.prototype} 780 {this._profileIndex=profileIndex;var nodeFilter;if(profileIndex!==-1){var minNod eId=profileIndex>0?profiles[profileIndex-1].maxJSObjectId:0;var maxNodeId=profil es[profileIndex].maxJSObjectId;nodeFilter=new WebInspector.HeapSnapshotCommon.No deFilter(minNodeId,maxNodeId)}
781 this._populateChildren(nodeFilter);},__proto__:WebInspector.HeapSnapshotViewport DataGrid.prototype}
695 WebInspector.HeapSnapshotDiffDataGrid=function() 782 WebInspector.HeapSnapshotDiffDataGrid=function()
696 {var columns=[{id:"object",title:WebInspector.UIString("Constructor"),disclosure :true,sortable:true},{id:"addedCount",title:WebInspector.UIString("# New"),width :"72px",sortable:true},{id:"removedCount",title:WebInspector.UIString("# Deleted "),width:"72px",sortable:true},{id:"countDelta",title:WebInspector.UIString("# D elta"),width:"64px",sortable:true},{id:"addedSize",title:WebInspector.UIString(" Alloc. Size"),width:"72px",sortable:true,sort:WebInspector.DataGrid.Order.Descen ding},{id:"removedSize",title:WebInspector.UIString("Freed Size"),width:"72px",s ortable:true},{id:"sizeDelta",title:WebInspector.UIString("Size Delta"),width:"7 2px",sortable:true}];WebInspector.HeapSnapshotViewportDataGrid.call(this,columns );} 783 {var columns=[{id:"object",title:WebInspector.UIString("Constructor"),disclosure :true,sortable:true},{id:"addedCount",title:WebInspector.UIString("# New"),width :"72px",sortable:true},{id:"removedCount",title:WebInspector.UIString("# Deleted "),width:"72px",sortable:true},{id:"countDelta",title:WebInspector.UIString("# D elta"),width:"64px",sortable:true},{id:"addedSize",title:WebInspector.UIString(" Alloc. Size"),width:"72px",sortable:true,sort:WebInspector.DataGrid.Order.Descen ding},{id:"removedSize",title:WebInspector.UIString("Freed Size"),width:"72px",s ortable:true},{id:"sizeDelta",title:WebInspector.UIString("Size Delta"),width:"7 2px",sortable:true}];WebInspector.HeapSnapshotViewportDataGrid.call(this,columns );}
697 WebInspector.HeapSnapshotDiffDataGrid.prototype={defaultPopulateCount:function() 784 WebInspector.HeapSnapshotDiffDataGrid.prototype={defaultPopulateCount:function()
698 {return 50;},_sortFields:function(sortColumn,sortAscending) 785 {return 50;},_sortFields:function(sortColumn,sortAscending)
699 {return{object:["_name",sortAscending,"_count",false],addedCount:["_addedCount", sortAscending,"_name",true],removedCount:["_removedCount",sortAscending,"_name", true],countDelta:["_countDelta",sortAscending,"_name",true],addedSize:["_addedSi ze",sortAscending,"_name",true],removedSize:["_removedSize",sortAscending,"_name ",true],sizeDelta:["_sizeDelta",sortAscending,"_name",true]}[sortColumn];},setDa taSource:function(snapshot) 786 {return{object:["_name",sortAscending,"_count",false],addedCount:["_addedCount", sortAscending,"_name",true],removedCount:["_removedCount",sortAscending,"_name", true],countDelta:["_countDelta",sortAscending,"_name",true],addedSize:["_addedSi ze",sortAscending,"_name",true],removedSize:["_removedSize",sortAscending,"_name ",true],sizeDelta:["_sizeDelta",sortAscending,"_name",true]}[sortColumn];},setDa taSource:function(snapshot)
700 {this.snapshot=snapshot;},setBaseDataSource:function(baseSnapshot) 787 {this.snapshot=snapshot;},setBaseDataSource:function(baseSnapshot)
701 {this.baseSnapshot=baseSnapshot;this.dispose();this.removeTopLevelNodes();this.r esetSortingCache();if(this.baseSnapshot===this.snapshot){this.dispatchEventToLis teners("sorting complete");return;} 788 {this.baseSnapshot=baseSnapshot;this.removeTopLevelNodes();this.resetSortingCach e();if(this.baseSnapshot===this.snapshot){this.dispatchEventToListeners(WebInspe ctor.HeapSnapshotSortableDataGrid.Events.SortingComplete);return;}
702 this._populateChildren();},_populateChildren:function() 789 this._populateChildren();},_populateChildren:function()
703 {function aggregatesForDiffReceived(aggregatesForDiff) 790 {function aggregatesForDiffReceived(aggregatesForDiff)
704 {this.snapshot.calculateSnapshotDiff(this.baseSnapshot.uid,aggregatesForDiff,did CalculateSnapshotDiff.bind(this));function didCalculateSnapshotDiff(diffByClassN ame) 791 {this.snapshot.calculateSnapshotDiff(this.baseSnapshot.uid,aggregatesForDiff,did CalculateSnapshotDiff.bind(this));function didCalculateSnapshotDiff(diffByClassN ame)
705 {for(var className in diffByClassName){var diff=diffByClassName[className];this. appendTopLevelNode(new WebInspector.HeapSnapshotDiffNode(this,className,diff));} 792 {for(var className in diffByClassName){var diff=diffByClassName[className];this. appendNode(this.rootNode(),new WebInspector.HeapSnapshotDiffNode(this,className, diff));}
706 this.sortingChanged();}} 793 this.sortingChanged();}}
707 this.baseSnapshot.aggregatesForDiff(aggregatesForDiffReceived.bind(this));},__pr oto__:WebInspector.HeapSnapshotViewportDataGrid.prototype} 794 this.baseSnapshot.aggregatesForDiff(aggregatesForDiffReceived.bind(this));},__pr oto__:WebInspector.HeapSnapshotViewportDataGrid.prototype}
708 WebInspector.HeapSnapshotDominatorsDataGrid=function() 795 WebInspector.HeapSnapshotDominatorsDataGrid=function()
709 {var columns=[{id:"object",title:WebInspector.UIString("Object"),disclosure:true ,sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shallow Size"),wi dth:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UIString("Retai ned Size"),width:"120px",sort:WebInspector.DataGrid.Order.Descending,sortable:tr ue}];WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);this._objectId ToSelect=null;} 796 {var columns=[{id:"object",title:WebInspector.UIString("Object"),disclosure:true ,sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shallow Size"),wi dth:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UIString("Retai ned Size"),width:"120px",sort:WebInspector.DataGrid.Order.Descending,sortable:tr ue}];WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);this._objectId ToSelect=null;}
710 WebInspector.HeapSnapshotDominatorsDataGrid.prototype={defaultPopulateCount:func tion() 797 WebInspector.HeapSnapshotDominatorsDataGrid.prototype={defaultPopulateCount:func tion()
711 {return 25;},setDataSource:function(snapshot) 798 {return 25;},setDataSource:function(snapshot)
712 {this.snapshot=snapshot;var fakeNode={nodeIndex:this.snapshot.rootNodeIndex};thi s.setRootNode(new WebInspector.HeapSnapshotDominatorObjectNode(this,fakeNode));t his.rootNode().sort();if(this._objectIdToSelect){this.highlightObjectByHeapSnaps hotId(this._objectIdToSelect,function(found){});this._objectIdToSelect=null;}},s ortingChanged:function() 799 {this.snapshot=snapshot;var fakeNode={nodeIndex:this.snapshot.rootNodeIndex};thi s.setRootNode(new WebInspector.HeapSnapshotDominatorObjectNode(this,fakeNode));t his.rootNode().sort();if(this._objectIdToSelect){this.highlightObjectByHeapSnaps hotId(this._objectIdToSelect,function(found){});this._objectIdToSelect=null;}},s ortingChanged:function()
713 {this.rootNode().sort();},highlightObjectByHeapSnapshotId:function(id,callback) 800 {this.rootNode().sort();},highlightObjectByHeapSnapshotId:function(id,callback)
714 {if(!this.snapshot){this._objectIdToSelect=id;callback(false);return;} 801 {if(!this.snapshot){this._objectIdToSelect=id;callback(false);return;}
715 function didGetDominators(dominatorIds) 802 function didGetDominators(dominatorIds)
716 {if(!dominatorIds){WebInspector.log(WebInspector.UIString("Cannot find correspon ding heap snapshot node"));callback(false);return;} 803 {if(!dominatorIds){WebInspector.console.log(WebInspector.UIString("Cannot find c orresponding heap snapshot node"));callback(false);return;}
717 var dominatorNode=this.rootNode();expandNextDominator.call(this,dominatorIds,dom inatorNode);} 804 var dominatorNode=this.rootNode();expandNextDominator.call(this,dominatorIds,dom inatorNode);}
718 function expandNextDominator(dominatorIds,dominatorNode) 805 function expandNextDominator(dominatorIds,dominatorNode)
719 {if(!dominatorNode){console.error("Cannot find dominator node");callback(false); return;} 806 {if(!dominatorNode){console.error("Cannot find dominator node");callback(false); return;}
720 if(!dominatorIds.length){this.highlightNode(dominatorNode);dominatorNode.element .scrollIntoViewIfNeeded(true);callback(true);return;} 807 if(!dominatorIds.length){this.highlightNode(dominatorNode);dominatorNode.element .scrollIntoViewIfNeeded(true);callback(true);return;}
721 var snapshotObjectId=dominatorIds.pop();dominatorNode.retrieveChildBySnapshotObj ectId(snapshotObjectId,expandNextDominator.bind(this,dominatorIds));} 808 var snapshotObjectId=dominatorIds.pop();dominatorNode.retrieveChildBySnapshotObj ectId(snapshotObjectId,expandNextDominator.bind(this,dominatorIds));}
722 this.snapshot.dominatorIdsForNode(parseInt(id,10),didGetDominators.bind(this));} ,__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype} 809 this.snapshot.dominatorIdsForNode(parseInt(id,10),didGetDominators.bind(this));} ,__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
723 WebInspector.AllocationDataGrid=function() 810 WebInspector.AllocationDataGrid=function()
724 {var columns=[{id:"count",title:WebInspector.UIString("Count"),width:"72px",sort able:true},{id:"size",title:WebInspector.UIString("Size"),width:"72px",sortable: true,sort:WebInspector.DataGrid.Order.Descending},{id:"name",title:WebInspector. UIString("Function"),disclosure:true,sortable:true},];WebInspector.DataGrid.call (this,columns);this._linkifier=new WebInspector.Linkifier();} 811 {var columns=[{id:"liveCount",title:WebInspector.UIString("Live Count"),width:"7 2px",sortable:true},{id:"count",title:WebInspector.UIString("Count"),width:"72px ",sortable:true},{id:"liveSize",title:WebInspector.UIString("Live Size"),width:" 72px",sortable:true},{id:"size",title:WebInspector.UIString("Size"),width:"72px" ,sortable:true,sort:WebInspector.DataGrid.Order.Descending},{id:"name",title:Web Inspector.UIString("Function"),disclosure:true,sortable:true},];WebInspector.Dat aGrid.call(this,columns);this._linkifier=new WebInspector.Linkifier();this.addEv entListener(WebInspector.DataGrid.Events.SortingChanged,this._sortingChanged,thi s);}
725 WebInspector.AllocationDataGrid.prototype={setDataSource:function(snapshot) 812 WebInspector.AllocationDataGrid.prototype={setDataSource:function(snapshot)
726 {this._snapshot=snapshot;this._snapshot.allocationTracesTops(didReceiveAllocatio nTracesTops.bind(this));function didReceiveAllocationTracesTops(tops) 813 {this.snapshot=snapshot;this.snapshot.allocationTracesTops(didReceiveAllocationT racesTops.bind(this));function didReceiveAllocationTracesTops(tops)
727 {var root=this.rootNode();for(var i=0;i<tops.length;i++) 814 {this._topNodes=tops;this._populateChildren();}},_populateChildren:function()
728 root.appendChild(new WebInspector.AllocationGridNode(this,tops[i]));}},__proto__ :WebInspector.DataGrid.prototype} 815 {var root=this.rootNode();var tops=this._topNodes;for(var i=0;i<tops.length;i++)
729 WebInspector.AllocationGridNode=function(dataGrid,data) 816 root.appendChild(new WebInspector.AllocationGridNode(this,tops[i]));},_sortingCh anged:function()
730 {WebInspector.DataGridNode.call(this,data,data.hasChildren);this._dataGrid=dataG rid;this._populated=false;} 817 {this._topNodes.sort(this._createComparator());this.rootNode().removeChildren(); this._populateChildren();},_createComparator:function()
731 WebInspector.AllocationGridNode.prototype={populate:function() 818 {var fieldName=this.sortColumnIdentifier();var compareResult=(this.sortOrder()== =WebInspector.DataGrid.Order.Ascending)?+1:-1;function compare(a,b)
732 {if(this._populated) 819 {if(a[fieldName]>b[fieldName])
733 return;this._populated=true;this._dataGrid._snapshot.allocationNodeCallers(this. data.id,didReceiveCallers.bind(this));function didReceiveCallers(callers) 820 return compareResult;if(a[fieldName]<b[fieldName])
734 {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) 821 return-compareResult;return 0;}
735 parentNode.expand();} 822 return compare;},__proto__:WebInspector.DataGrid.prototype};WebInspector.HeapSna pshotGridNode=function(tree,hasChildren)
736 var callersBranch=callers.branchingCallers;for(var i=0;i<callersBranch.length;i+ +) 823 {WebInspector.DataGridNode.call(this,null,hasChildren);this._dataGrid=tree;this. _instanceCount=0;this._savedChildren=null;this._retrievedChildrenRanges=[];this. _providerObject=null;}
737 parentNode.appendChild(new WebInspector.AllocationGridNode(this._dataGrid,caller sBranch[i]));}},expand:function()
738 {WebInspector.DataGridNode.prototype.expand.call(this);if(this.children.length== =1)
739 this.children[0].expand();},createCell:function(columnIdentifier)
740 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier!=="name")
741 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);}
742 return cell;},__proto__:WebInspector.DataGridNode.prototype};WebInspector.HeapSn apshotGridNode=function(tree,hasChildren)
743 {WebInspector.DataGridNode.call(this,null,hasChildren);this._dataGrid=tree;this. _instanceCount=0;this._savedChildren=null;this._retrievedChildrenRanges=[];}
744 WebInspector.HeapSnapshotGridNode.Events={PopulateComplete:"PopulateComplete"} 824 WebInspector.HeapSnapshotGridNode.Events={PopulateComplete:"PopulateComplete"}
745 WebInspector.HeapSnapshotGridNode.createComparator=function(fieldNames) 825 WebInspector.HeapSnapshotGridNode.createComparator=function(fieldNames)
746 {return{fieldName1:fieldNames[0],ascending1:fieldNames[1],fieldName2:fieldNames[ 2],ascending2:fieldNames[3]};} 826 {return({fieldName1:fieldNames[0],ascending1:fieldNames[1],fieldName2:fieldNames [2],ascending2:fieldNames[3]});}
827 WebInspector.HeapSnapshotGridNode.ChildrenProvider=function(){}
828 WebInspector.HeapSnapshotGridNode.ChildrenProvider.prototype={dispose:function() {},nodePosition:function(snapshotObjectId,callback){},isEmpty:function(callback) {},serializeItemsRange:function(startPosition,endPosition,callback){},sortAndRew ind:function(comparator,callback){}}
747 WebInspector.HeapSnapshotGridNode.prototype={createProvider:function() 829 WebInspector.HeapSnapshotGridNode.prototype={createProvider:function()
748 {throw new Error("Needs implemented.");},_provider:function() 830 {throw new Error("Not implemented.");},retainersDataSource:function()
831 {return null;},_provider:function()
749 {if(!this._providerObject) 832 {if(!this._providerObject)
750 this._providerObject=this.createProvider();return this._providerObject;},createC ell:function(columnIdentifier) 833 this._providerObject=this.createProvider();return this._providerObject;},createC ell:function(columnIdentifier)
751 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(this._searchMatched) 834 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(this._searchMatched)
752 cell.classList.add("highlight");return cell;},collapse:function() 835 cell.classList.add("highlight");return cell;},collapse:function()
753 {WebInspector.DataGridNode.prototype.collapse.call(this);this._dataGrid.updateVi sibleNodes();},dispose:function() 836 {WebInspector.DataGridNode.prototype.collapse.call(this);this._dataGrid.updateVi sibleNodes(true);},expand:function()
754 {if(this._provider()) 837 {WebInspector.DataGridNode.prototype.expand.call(this);this._dataGrid.updateVisi bleNodes(true);},dispose:function()
755 this._provider().dispose();for(var node=this.children[0];node;node=node.traverse NextNode(true,this,true)) 838 {if(this._providerObject)
839 this._providerObject.dispose();for(var node=this.children[0];node;node=node.trav erseNextNode(true,this,true))
756 if(node.dispose) 840 if(node.dispose)
757 node.dispose();},_reachableFromWindow:false,queryObjectContent:function(callback ) 841 node.dispose();},_reachableFromWindow:false,queryObjectContent:function(callback )
758 {},wasDetached:function() 842 {},wasDetached:function()
759 {this._dataGrid.nodeWasDetached(this);},_toPercentString:function(num) 843 {this._dataGrid.nodeWasDetached(this);},_toPercentString:function(num)
760 {return num.toFixed(0)+"\u2009%";},childForPosition:function(nodePosition) 844 {return num.toFixed(0)+"\u2009%";},allChildren:function()
761 {var indexOfFirsChildInRange=0;for(var i=0;i<this._retrievedChildrenRanges.lengt h;i++){var range=this._retrievedChildrenRanges[i];if(range.from<=nodePosition&&n odePosition<range.to){var childIndex=indexOfFirsChildInRange+nodePosition-range. from;return this.children[childIndex];} 845 {return this._dataGrid.allChildren(this);},removeChildByIndex:function(index)
762 indexOfFirsChildInRange+=range.to-range.from+1;} 846 {this._dataGrid.removeChildByIndex(this,index);},childForPosition:function(nodeP osition)
847 {var indexOfFirstChildInRange=0;for(var i=0;i<this._retrievedChildrenRanges.leng th;i++){var range=this._retrievedChildrenRanges[i];if(range.from<=nodePosition&& nodePosition<range.to){var childIndex=indexOfFirstChildInRange+nodePosition-rang e.from;return this.allChildren()[childIndex];}
848 indexOfFirstChildInRange+=range.to-range.from+1;}
763 return null;},_createValueCell:function(columnIdentifier) 849 return null;},_createValueCell:function(columnIdentifier)
764 {var cell=document.createElement("td");cell.className=columnIdentifier+"-column" ;if(this.dataGrid.snapshot.totalSize!==0){var div=document.createElement("div"); var valueSpan=document.createElement("span");valueSpan.textContent=this.data[col umnIdentifier];div.appendChild(valueSpan);var percentColumn=columnIdentifier+"-p ercent";if(percentColumn in this.data){var percentSpan=document.createElement("s pan");percentSpan.className="percent-column";percentSpan.textContent=this.data[p ercentColumn];div.appendChild(percentSpan);div.classList.add("heap-snapshot-mult iple-values");} 850 {var cell=document.createElement("td");cell.className=columnIdentifier+"-column" ;if(this.dataGrid.snapshot.totalSize!==0){var div=document.createElement("div"); var valueSpan=document.createElement("span");valueSpan.textContent=this.data[col umnIdentifier];div.appendChild(valueSpan);var percentColumn=columnIdentifier+"-p ercent";if(percentColumn in this.data){var percentSpan=document.createElement("s pan");percentSpan.className="percent-column";percentSpan.textContent=this.data[p ercentColumn];div.appendChild(percentSpan);div.classList.add("heap-snapshot-mult iple-values");}
765 cell.appendChild(div);} 851 cell.appendChild(div);}
766 return cell;},populate:function(event) 852 return cell;},populate:function(event)
767 {if(this._populated) 853 {if(this._populated)
768 return;this._populated=true;function sorted() 854 return;this._populated=true;function sorted()
769 {this._populateChildren();} 855 {this._populateChildren();}
770 this._provider().sortAndRewind(this.comparator(),sorted.bind(this));},expandWith outPopulate:function(callback) 856 this._provider().sortAndRewind(this.comparator(),sorted.bind(this));},expandWith outPopulate:function(callback)
771 {this._populated=true;this.expand();this._provider().sortAndRewind(this.comparat or(),callback);},_populateChildren:function(fromPosition,toPosition,afterPopulat e) 857 {this._populated=true;this.expand();this._provider().sortAndRewind(this.comparat or(),callback);},_populateChildren:function(fromPosition,toPosition,afterPopulat e)
772 {fromPosition=fromPosition||0;toPosition=toPosition||fromPosition+this._dataGrid .defaultPopulateCount();var firstNotSerializedPosition=fromPosition;function ser ializeNextChunk() 858 {fromPosition=fromPosition||0;toPosition=toPosition||fromPosition+this._dataGrid .defaultPopulateCount();var firstNotSerializedPosition=fromPosition;function ser ializeNextChunk()
773 {if(firstNotSerializedPosition>=toPosition) 859 {if(firstNotSerializedPosition>=toPosition)
774 return;var end=Math.min(firstNotSerializedPosition+this._dataGrid.defaultPopulat eCount(),toPosition);this._provider().serializeItemsRange(firstNotSerializedPosi tion,end,childrenRetrieved.bind(this));firstNotSerializedPosition=end;} 860 return;var end=Math.min(firstNotSerializedPosition+this._dataGrid.defaultPopulat eCount(),toPosition);this._provider().serializeItemsRange(firstNotSerializedPosi tion,end,childrenRetrieved.bind(this));firstNotSerializedPosition=end;}
775 function insertRetrievedChild(item,insertionIndex) 861 function insertRetrievedChild(item,insertionIndex)
776 {if(this._savedChildren){var hash=this._childHashForEntity(item);if(hash in this ._savedChildren){this.insertChild(this._savedChildren[hash],insertionIndex);retu rn;}} 862 {if(this._savedChildren){var hash=this._childHashForEntity(item);if(hash in this ._savedChildren){this._dataGrid.insertChild(this,this._savedChildren[hash],inser tionIndex);return;}}
777 this.insertChild(this._createChildNode(item),insertionIndex);} 863 this._dataGrid.insertChild(this,this._createChildNode(item),insertionIndex);}
778 function insertShowMoreButton(from,to,insertionIndex) 864 function insertShowMoreButton(from,to,insertionIndex)
779 {var button=new WebInspector.ShowMoreDataGridNode(this._populateChildren.bind(th is),from,to,this._dataGrid.defaultPopulateCount());this.insertChild(button,inser tionIndex);} 865 {var button=new WebInspector.ShowMoreDataGridNode(this._populateChildren.bind(th is),from,to,this._dataGrid.defaultPopulateCount());this._dataGrid.insertChild(th is,button,insertionIndex);}
780 function childrenRetrieved(items) 866 function childrenRetrieved(itemsRange)
781 {var itemIndex=0;var itemPosition=items.startPosition;var insertionIndex=0;if(!t his._retrievedChildrenRanges.length){if(items.startPosition>0){this._retrievedCh ildrenRanges.push({from:0,to:0});insertShowMoreButton.call(this,0,items.startPos ition,insertionIndex++);} 867 {var itemIndex=0;var itemPosition=itemsRange.startPosition;var items=itemsRange. items;var insertionIndex=0;if(!this._retrievedChildrenRanges.length){if(itemsRan ge.startPosition>0){this._retrievedChildrenRanges.push({from:0,to:0});insertShow MoreButton.call(this,0,itemsRange.startPosition,insertionIndex++);}
782 this._retrievedChildrenRanges.push({from:items.startPosition,to:items.endPositio n});for(var i=0,l=items.length;i<l;++i) 868 this._retrievedChildrenRanges.push({from:itemsRange.startPosition,to:itemsRange. endPosition});for(var i=0,l=items.length;i<l;++i)
783 insertRetrievedChild.call(this,items[i],insertionIndex++);if(items.endPosition<i tems.totalLength) 869 insertRetrievedChild.call(this,items[i],insertionIndex++);if(itemsRange.endPosit ion<itemsRange.totalLength)
784 insertShowMoreButton.call(this,items.endPosition,items.totalLength,insertionInde x++);}else{var rangeIndex=0;var found=false;var range;while(rangeIndex<this._ret rievedChildrenRanges.length){range=this._retrievedChildrenRanges[rangeIndex];if( range.to>=itemPosition){found=true;break;} 870 insertShowMoreButton.call(this,itemsRange.endPosition,itemsRange.totalLength,ins ertionIndex++);}else{var rangeIndex=0;var found=false;var range;while(rangeIndex <this._retrievedChildrenRanges.length){range=this._retrievedChildrenRanges[range Index];if(range.to>=itemPosition){found=true;break;}
785 insertionIndex+=range.to-range.from;if(range.to<items.totalLength) 871 insertionIndex+=range.to-range.from;if(range.to<itemsRange.totalLength)
786 insertionIndex+=1;++rangeIndex;} 872 insertionIndex+=1;++rangeIndex;}
787 if(!found||items.startPosition<range.from){this.children[insertionIndex-1].setEn dPosition(items.startPosition);insertShowMoreButton.call(this,items.startPositio n,found?range.from:items.totalLength,insertionIndex);range={from:items.startPosi tion,to:items.startPosition};if(!found) 873 if(!found||itemsRange.startPosition<range.from){this.allChildren()[insertionInde x-1].setEndPosition(itemsRange.startPosition);insertShowMoreButton.call(this,ite msRange.startPosition,found?range.from:itemsRange.totalLength,insertionIndex);ra nge={from:itemsRange.startPosition,to:itemsRange.startPosition};if(!found)
788 rangeIndex=this._retrievedChildrenRanges.length;this._retrievedChildrenRanges.sp lice(rangeIndex,0,range);}else{insertionIndex+=itemPosition-range.from;} 874 rangeIndex=this._retrievedChildrenRanges.length;this._retrievedChildrenRanges.sp lice(rangeIndex,0,range);}else{insertionIndex+=itemPosition-range.from;}
789 while(range.to<items.endPosition){var skipCount=range.to-itemPosition;insertionI ndex+=skipCount;itemIndex+=skipCount;itemPosition=range.to;var nextRange=this._r etrievedChildrenRanges[rangeIndex+1];var newEndOfRange=nextRange?nextRange.from: items.totalLength;if(newEndOfRange>items.endPosition) 875 while(range.to<itemsRange.endPosition){var skipCount=range.to-itemPosition;inser tionIndex+=skipCount;itemIndex+=skipCount;itemPosition=range.to;var nextRange=th is._retrievedChildrenRanges[rangeIndex+1];var newEndOfRange=nextRange?nextRange. from:itemsRange.totalLength;if(newEndOfRange>itemsRange.endPosition)
790 newEndOfRange=items.endPosition;while(itemPosition<newEndOfRange){insertRetrieve dChild.call(this,items[itemIndex++],insertionIndex++);++itemPosition;} 876 newEndOfRange=itemsRange.endPosition;while(itemPosition<newEndOfRange){insertRet rievedChild.call(this,items[itemIndex++],insertionIndex++);++itemPosition;}
791 if(nextRange&&newEndOfRange===nextRange.from){range.to=nextRange.to;this.removeC hild(this.children[insertionIndex]);this._retrievedChildrenRanges.splice(rangeIn dex+1,1);}else{range.to=newEndOfRange;if(newEndOfRange===items.totalLength) 877 if(nextRange&&newEndOfRange===nextRange.from){range.to=nextRange.to;this.removeC hildByIndex(insertionIndex);this._retrievedChildrenRanges.splice(rangeIndex+1,1) ;}else{range.to=newEndOfRange;if(newEndOfRange===itemsRange.totalLength)
792 this.removeChild(this.children[insertionIndex]);else 878 this.removeChildByIndex(insertionIndex);else
793 this.children[insertionIndex].setStartPosition(items.endPosition);}}} 879 this.allChildren()[insertionIndex].setStartPosition(itemsRange.endPosition);}}}
794 this._instanceCount+=items.length;if(firstNotSerializedPosition<toPosition){seri alizeNextChunk.call(this);return;} 880 this._instanceCount+=items.length;if(firstNotSerializedPosition<toPosition){seri alizeNextChunk.call(this);return;}
795 if(afterPopulate) 881 if(this.expanded)
882 this._dataGrid.updateVisibleNodes(true);if(afterPopulate)
796 afterPopulate();this.dispatchEventToListeners(WebInspector.HeapSnapshotGridNode. Events.PopulateComplete);} 883 afterPopulate();this.dispatchEventToListeners(WebInspector.HeapSnapshotGridNode. Events.PopulateComplete);}
797 serializeNextChunk.call(this);},_saveChildren:function() 884 serializeNextChunk.call(this);},_saveChildren:function()
798 {this._savedChildren=null;for(var i=0,childrenCount=this.children.length;i<child renCount;++i){var child=this.children[i];if(!child.expanded) 885 {this._savedChildren=null;var children=this.allChildren();for(var i=0,l=children .length;i<l;++i){var child=children[i];if(!child.expanded)
799 continue;if(!this._savedChildren) 886 continue;if(!this._savedChildren)
800 this._savedChildren={};this._savedChildren[this._childHashForNode(child)]=child; }},sort:function() 887 this._savedChildren={};this._savedChildren[this._childHashForNode(child)]=child; }},sort:function()
801 {this._dataGrid.recursiveSortingEnter();function afterSort() 888 {this._dataGrid.recursiveSortingEnter();function afterSort()
802 {this._saveChildren();this.removeChildren();this._retrievedChildrenRanges=[];fun ction afterPopulate() 889 {this._saveChildren();this._dataGrid.removeAllChildren(this);this._retrievedChil drenRanges=[];function afterPopulate()
803 {for(var i=0,l=this.children.length;i<l;++i){var child=this.children[i];if(child .expanded) 890 {var children=this.allChildren();for(var i=0,l=children.length;i<l;++i){var chil d=children[i];if(child.expanded)
804 child.sort();} 891 child.sort();}
805 this._dataGrid.recursiveSortingLeave();} 892 this._dataGrid.recursiveSortingLeave();}
806 var instanceCount=this._instanceCount;this._instanceCount=0;this._populateChildr en(0,instanceCount,afterPopulate.bind(this));} 893 var instanceCount=this._instanceCount;this._instanceCount=0;this._populateChildr en(0,instanceCount,afterPopulate.bind(this));}
807 this._provider().sortAndRewind(this.comparator(),afterSort.bind(this));},__proto __:WebInspector.DataGridNode.prototype} 894 this._provider().sortAndRewind(this.comparator(),afterSort.bind(this));},__proto __:WebInspector.DataGridNode.prototype}
808 WebInspector.HeapSnapshotGenericObjectNode=function(tree,node) 895 WebInspector.HeapSnapshotGenericObjectNode=function(dataGrid,node)
809 {this.snapshotNodeIndex=0;WebInspector.HeapSnapshotGridNode.call(this,tree,false );if(!node) 896 {WebInspector.HeapSnapshotGridNode.call(this,dataGrid,false);if(!node)
810 return;this._name=node.name;this._type=node.type;this._distance=node.distance;th is._shallowSize=node.selfSize;this._retainedSize=node.retainedSize;this.snapshot NodeId=node.id;this.snapshotNodeIndex=node.nodeIndex;if(this._type==="string") 897 return;this._name=node.name;this._type=node.type;this._distance=node.distance;th is._shallowSize=node.selfSize;this._retainedSize=node.retainedSize;this.snapshot NodeId=node.id;this.snapshotNodeIndex=node.nodeIndex;if(this._type==="string")
811 this._reachableFromWindow=true;else if(this._type==="object"&&this._name.startsW ith("Window")){this._name=this.shortenWindowURL(this._name,false);this._reachabl eFromWindow=true;}else if(node.canBeQueried) 898 this._reachableFromWindow=true;else if(this._type==="object"&&this._name.startsW ith("Window")){this._name=this.shortenWindowURL(this._name,false);this._reachabl eFromWindow=true;}else if(node.canBeQueried)
812 this._reachableFromWindow=true;if(node.detachedDOMTreeNode) 899 this._reachableFromWindow=true;if(node.detachedDOMTreeNode)
813 this.detachedDOMTreeNode=true;};WebInspector.HeapSnapshotGenericObjectNode.proto type={createCell:function(columnIdentifier) 900 this.detachedDOMTreeNode=true;var snapshot=dataGrid.snapshot;var shallowSizePerc ent=this._shallowSize/snapshot.totalSize*100.0;var retainedSizePercent=this._ret ainedSize/snapshot.totalSize*100.0;this.data={"distance":this._distance,"shallow Size":Number.withThousandsSeparator(this._shallowSize),"retainedSize":Number.wit hThousandsSeparator(this._retainedSize),"shallowSize-percent":this._toPercentStr ing(shallowSizePercent),"retainedSize-percent":this._toPercentString(retainedSiz ePercent)};};WebInspector.HeapSnapshotGenericObjectNode.prototype={retainersData Source:function()
901 {return{snapshot:this._dataGrid.snapshot,snapshotNodeIndex:this.snapshotNodeInde x};},createCell:function(columnIdentifier)
814 {var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):th is._createObjectCell();if(this._searchMatched) 902 {var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):th is._createObjectCell();if(this._searchMatched)
815 cell.classList.add("highlight");return cell;},_createObjectCell:function() 903 cell.classList.add("highlight");return cell;},_createObjectCell:function()
816 {var cell=document.createElement("td");cell.className="object-column";var div=do cument.createElement("div");div.className="source-code event-properties";div.sty le.overflow="visible";var data=this.data["object"];if(this._prefixObjectCell) 904 {var value=this._name;var valueStyle="object";switch(this._type){case"concatenat ed string":case"string":value="\""+value+"\"";valueStyle="string";break;case"reg exp":value="/"+value+"/";valueStyle="string";break;case"closure":value="function "+(value?" ":"")+value+"()";valueStyle="function";break;case"number":valueStyle= "number";break;case"hidden":valueStyle="null";break;case"array":if(!value)
817 this._prefixObjectCell(div,data);var valueSpan=document.createElement("span");va lueSpan.className="value console-formatted-"+data.valueStyle;valueSpan.textConte nt=data.value;div.appendChild(valueSpan);var idSpan=document.createElement("span ");idSpan.className="console-formatted-id";idSpan.textContent=" @"+data["nodeId" ];div.appendChild(idSpan);if(this._postfixObjectCell)
818 this._postfixObjectCell(div,data);cell.appendChild(div);cell.classList.add("disc losure");if(this.depth)
819 cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px ");cell.heapSnapshotNode=this;return cell;},get data()
820 {var data=this._emptyData();var value=this._name;var valueStyle="object";switch( this._type){case"concatenated string":case"string":value="\""+value+"\"";valueSt yle="string";break;case"regexp":value="/"+value+"/";valueStyle="string";break;ca se"closure":value="function"+(value?" ":"")+value+"()";valueStyle="function";bre ak;case"number":valueStyle="number";break;case"hidden":valueStyle="null";break;c ase"array":if(!value)
821 value="[]";else 905 value="[]";else
822 value+="[]";break;};if(this._reachableFromWindow) 906 value+="[]";break;};if(this._reachableFromWindow)
823 valueStyle+=" highlight";if(value==="Object") 907 valueStyle+=" highlight";if(value==="Object")
824 value="";if(this.detachedDOMTreeNode) 908 value="";if(this.detachedDOMTreeNode)
825 valueStyle+=" detached-dom-tree-node";data["object"]={valueStyle:valueStyle,valu e:value,nodeId:this.snapshotNodeId};data["distance"]=this._distance;data["shallo wSize"]=Number.withThousandsSeparator(this._shallowSize);data["retainedSize"]=Nu mber.withThousandsSeparator(this._retainedSize);data["shallowSize-percent"]=this ._toPercentString(this._shallowSizePercent);data["retainedSize-percent"]=this._t oPercentString(this._retainedSizePercent);return this._enhanceData?this._enhance Data(data):data;},queryObjectContent:function(callback,objectGroupName) 909 valueStyle+=" detached-dom-tree-node";return this._createObjectCellWithValue(val ueStyle,value);},_createObjectCellWithValue:function(valueStyle,value)
910 {var cell=document.createElement("td");cell.className="object-column";var div=do cument.createElement("div");div.className="source-code event-properties";div.sty le.overflow="visible";this._prefixObjectCell(div);var valueSpan=document.createE lement("span");valueSpan.className="value console-formatted-"+valueStyle;valueSp an.textContent=value;div.appendChild(valueSpan);var idSpan=document.createElemen t("span");idSpan.className="console-formatted-id";idSpan.textContent=" @"+this.s napshotNodeId;div.appendChild(idSpan);cell.appendChild(div);cell.classList.add(" disclosure");if(this.depth)
911 cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px ");cell.heapSnapshotNode=this;return cell;},_prefixObjectCell:function(div)
912 {},queryObjectContent:function(callback,objectGroupName)
826 {function formatResult(error,object) 913 {function formatResult(error,object)
827 {if(!error&&object.type) 914 {if(!error&&object.type)
828 callback(WebInspector.RemoteObject.fromPayload(object),!!error);else 915 callback(WebInspector.RemoteObject.fromPayload(object),!!error);else
829 callback(WebInspector.RemoteObject.fromPrimitiveValue(WebInspector.UIString("Pre view is not available")));} 916 callback(WebInspector.RemoteObject.fromPrimitiveValue(WebInspector.UIString("Pre view is not available")));}
830 if(this._type==="string") 917 if(this._type==="string")
831 callback(WebInspector.RemoteObject.fromPrimitiveValue(this._name));else 918 callback(WebInspector.RemoteObject.fromPrimitiveValue(this._name));else
832 HeapProfilerAgent.getObjectByHeapObjectId(String(this.snapshotNodeId),objectGrou pName,formatResult);},get _retainedSizePercent() 919 HeapProfilerAgent.getObjectByHeapObjectId(String(this.snapshotNodeId),objectGrou pName,formatResult);},updateHasChildren:function()
833 {return this._retainedSize/this.dataGrid.snapshot.totalSize*100.0;},get _shallow SizePercent()
834 {return this._shallowSize/this.dataGrid.snapshot.totalSize*100.0;},updateHasChil dren:function()
835 {function isEmptyCallback(isEmpty) 920 {function isEmptyCallback(isEmpty)
836 {this.hasChildren=!isEmpty;} 921 {this.hasChildren=!isEmpty;}
837 this._provider().isEmpty(isEmptyCallback.bind(this));},shortenWindowURL:function (fullName,hasObjectId) 922 this._provider().isEmpty(isEmptyCallback.bind(this));},shortenWindowURL:function (fullName,hasObjectId)
838 {var startPos=fullName.indexOf("/");var endPos=hasObjectId?fullName.indexOf("@") :fullName.length;if(startPos!==-1&&endPos!==-1){var fullURL=fullName.substring(s tartPos+1,endPos).trimLeft();var url=fullURL.trimURL();if(url.length>40) 923 {var startPos=fullName.indexOf("/");var endPos=hasObjectId?fullName.indexOf("@") :fullName.length;if(startPos!==-1&&endPos!==-1){var fullURL=fullName.substring(s tartPos+1,endPos).trimLeft();var url=fullURL.trimURL();if(url.length>40)
839 url=url.trimMiddle(40);return fullName.substr(0,startPos+2)+url+fullName.substr( endPos);}else 924 url=url.trimMiddle(40);return fullName.substr(0,startPos+2)+url+fullName.substr( endPos);}else
840 return fullName;},__proto__:WebInspector.HeapSnapshotGridNode.prototype} 925 return fullName;},__proto__:WebInspector.HeapSnapshotGridNode.prototype}
841 WebInspector.HeapSnapshotObjectNode=function(tree,isFromBaseSnapshot,edge,parent GridNode) 926 WebInspector.HeapSnapshotObjectNode=function(dataGrid,snapshot,edge,parentGridNo de)
842 {WebInspector.HeapSnapshotGenericObjectNode.call(this,tree,edge.node);this._refe renceName=edge.name;this._referenceType=edge.type;this._distance=edge.distance;t his.showRetainingEdges=tree.showRetainingEdges;this._isFromBaseSnapshot=isFromBa seSnapshot;this._parentGridNode=parentGridNode;this._cycledWithAncestorGridNode= this._findAncestorWithSameSnapshotNodeId();if(!this._cycledWithAncestorGridNode) 927 {WebInspector.HeapSnapshotGenericObjectNode.call(this,dataGrid,edge.node);this._ referenceName=edge.name;this._referenceType=edge.type;this.showRetainingEdges=da taGrid.showRetainingEdges;this._snapshot=snapshot;this._parentGridNode=parentGri dNode;this._cycledWithAncestorGridNode=this._findAncestorWithSameSnapshotNodeId( );if(!this._cycledWithAncestorGridNode)
843 this.updateHasChildren();} 928 this.updateHasChildren();var data=this.data;data["count"]="";data["addedCount"]= "";data["removedCount"]="";data["countDelta"]="";data["addedSize"]="";data["remo vedSize"]="";data["sizeDelta"]="";}
844 WebInspector.HeapSnapshotObjectNode.prototype={createProvider:function() 929 WebInspector.HeapSnapshotObjectNode.prototype={retainersDataSource:function()
845 {var tree=this._dataGrid;var showHiddenData=WebInspector.settings.showAdvancedHe apSnapshotProperties.get();var snapshot=this._isFromBaseSnapshot?tree.baseSnapsh ot:tree.snapshot;if(this.showRetainingEdges) 930 {return{snapshot:this._snapshot,snapshotNodeIndex:this.snapshotNodeIndex};},crea teProvider:function()
846 return snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex,showHiddenDa ta);else 931 {var tree=this._dataGrid;if(this.showRetainingEdges)
847 return snapshot.createEdgesProvider(this.snapshotNodeIndex,showHiddenData);},_fi ndAncestorWithSameSnapshotNodeId:function() 932 return this._snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex);else
933 return this._snapshot.createEdgesProvider(this.snapshotNodeIndex);},_findAncesto rWithSameSnapshotNodeId:function()
848 {var ancestor=this._parentGridNode;while(ancestor){if(ancestor.snapshotNodeId=== this.snapshotNodeId) 934 {var ancestor=this._parentGridNode;while(ancestor){if(ancestor.snapshotNodeId=== this.snapshotNodeId)
849 return ancestor;ancestor=ancestor._parentGridNode;} 935 return ancestor;ancestor=ancestor._parentGridNode;}
850 return null;},_createChildNode:function(item) 936 return null;},_createChildNode:function(item)
851 {return new WebInspector.HeapSnapshotObjectNode(this._dataGrid,this._isFromBaseS napshot,item,this);},_childHashForEntity:function(edge) 937 {return new WebInspector.HeapSnapshotObjectNode(this._dataGrid,this._snapshot,it em,this);},_childHashForEntity:function(edge)
852 {var prefix=this.showRetainingEdges?edge.node.id+"#":"";return prefix+edge.type+ "#"+edge.name;},_childHashForNode:function(childNode) 938 {var prefix=this.showRetainingEdges?edge.node.id+"#":"";return prefix+edge.type+ "#"+edge.name;},_childHashForNode:function(childNode)
853 {var prefix=this.showRetainingEdges?childNode.snapshotNodeId+"#":"";return prefi x+childNode._referenceType+"#"+childNode._referenceName;},comparator:function() 939 {var prefix=this.showRetainingEdges?childNode.snapshotNodeId+"#":"";return prefi x+childNode._referenceType+"#"+childNode._referenceName;},comparator:function()
854 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["!edgeName",sort Ascending,"retainedSize",false],count:["!edgeName",true,"retainedSize",false],sh allowSize:["selfSize",sortAscending,"!edgeName",true],retainedSize:["retainedSiz e",sortAscending,"!edgeName",true],distance:["distance",sortAscending,"_name",tr ue]}[sortColumnIdentifier]||["!edgeName",true,"retainedSize",false];return WebIn spector.HeapSnapshotGridNode.createComparator(sortFields);},_emptyData:function( ) 940 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["!edgeName",sort Ascending,"retainedSize",false],count:["!edgeName",true,"retainedSize",false],sh allowSize:["selfSize",sortAscending,"!edgeName",true],retainedSize:["retainedSiz e",sortAscending,"!edgeName",true],distance:["distance",sortAscending,"_name",tr ue]}[sortColumnIdentifier]||["!edgeName",true,"retainedSize",false];return WebIn spector.HeapSnapshotGridNode.createComparator(sortFields);},_prefixObjectCell:fu nction(div)
855 {return{count:"",addedCount:"",removedCount:"",countDelta:"",addedSize:"",remove dSize:"",sizeDelta:""};},_enhanceData:function(data) 941 {var name=this._referenceName;if(name==="")name="(empty)";var nameClass="name";s witch(this._referenceType){case"context":nameClass="console-formatted-number";br eak;case"internal":case"hidden":case"weak":nameClass="console-formatted-null";br eak;case"element":name="["+name+"]";break;}
856 {var name=this._referenceName;if(name==="")name="(empty)";var nameClass="name";s witch(this._referenceType){case"context":nameClass="console-formatted-number";br eak;case"internal":case"hidden":nameClass="console-formatted-null";break;case"el ement":name="["+name+"]";break;} 942 if(this._cycledWithAncestorGridNode)
857 data["object"].nameClass=nameClass;data["object"].name=name;data["distance"]=thi s._distance;return data;},_prefixObjectCell:function(div,data) 943 div.className+=" cycled-ancessor-node";var nameSpan=document.createElement("span ");nameSpan.className=nameClass;nameSpan.textContent=name;div.appendChild(nameSp an);var separatorSpan=document.createElement("span");separatorSpan.className="gr ayed";separatorSpan.textContent=this.showRetainingEdges?" in ":" :: ";div.append Child(separatorSpan);},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prot otype}
858 {if(this._cycledWithAncestorGridNode) 944 WebInspector.HeapSnapshotInstanceNode=function(dataGrid,snapshot,node,isDeletedN ode)
859 div.className+=" cycled-ancessor-node";var nameSpan=document.createElement("span ");nameSpan.className=data.nameClass;nameSpan.textContent=data.name;div.appendCh ild(nameSpan);var separatorSpan=document.createElement("span");separatorSpan.cla ssName="grayed";separatorSpan.textContent=this.showRetainingEdges?" in ":" :: "; div.appendChild(separatorSpan);},__proto__:WebInspector.HeapSnapshotGenericObjec tNode.prototype} 945 {WebInspector.HeapSnapshotGenericObjectNode.call(this,dataGrid,node);this._baseS napshotOrSnapshot=snapshot;this._isDeletedNode=isDeletedNode;this.updateHasChild ren();var data=this.data;data["count"]="";data["countDelta"]="";data["sizeDelta" ]="";if(this._isDeletedNode){data["addedCount"]="";data["addedSize"]="";data["re movedCount"]="\u2022";data["removedSize"]=Number.withThousandsSeparator(this._sh allowSize);}else{data["addedCount"]="\u2022";data["addedSize"]=Number.withThousa ndsSeparator(this._shallowSize);data["removedCount"]="";data["removedSize"]="";} };WebInspector.HeapSnapshotInstanceNode.prototype={retainersDataSource:function( )
860 WebInspector.HeapSnapshotInstanceNode=function(tree,baseSnapshot,snapshot,node) 946 {return{snapshot:this._baseSnapshotOrSnapshot,snapshotNodeIndex:this.snapshotNod eIndex};},createProvider:function()
861 {WebInspector.HeapSnapshotGenericObjectNode.call(this,tree,node);this._baseSnaps hotOrSnapshot=baseSnapshot||snapshot;this._isDeletedNode=!!baseSnapshot;this.upd ateHasChildren();};WebInspector.HeapSnapshotInstanceNode.prototype={createProvid er:function() 947 {return this._baseSnapshotOrSnapshot.createEdgesProvider(this.snapshotNodeIndex) ;},_createChildNode:function(item)
862 {var showHiddenData=WebInspector.settings.showAdvancedHeapSnapshotProperties.get ();return this._baseSnapshotOrSnapshot.createEdgesProvider(this.snapshotNodeInde x,showHiddenData);},_createChildNode:function(item) 948 {return new WebInspector.HeapSnapshotObjectNode(this._dataGrid,this._baseSnapsho tOrSnapshot,item,null);},_childHashForEntity:function(edge)
863 {return new WebInspector.HeapSnapshotObjectNode(this._dataGrid,this._isDeletedNo de,item,null);},_childHashForEntity:function(edge)
864 {return edge.type+"#"+edge.name;},_childHashForNode:function(childNode) 949 {return edge.type+"#"+edge.name;},_childHashForNode:function(childNode)
865 {return childNode._referenceType+"#"+childNode._referenceName;},comparator:funct ion() 950 {return childNode._referenceType+"#"+childNode._referenceName;},comparator:funct ion()
866 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["!edgeName",sort Ascending,"retainedSize",false],distance:["distance",sortAscending,"retainedSize ",false],count:["!edgeName",true,"retainedSize",false],addedSize:["selfSize",sor tAscending,"!edgeName",true],removedSize:["selfSize",sortAscending,"!edgeName",t rue],shallowSize:["selfSize",sortAscending,"!edgeName",true],retainedSize:["reta inedSize",sortAscending,"!edgeName",true]}[sortColumnIdentifier]||["!edgeName",t rue,"retainedSize",false];return WebInspector.HeapSnapshotGridNode.createCompara tor(sortFields);},_emptyData:function() 951 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["!edgeName",sort Ascending,"retainedSize",false],distance:["distance",sortAscending,"retainedSize ",false],count:["!edgeName",true,"retainedSize",false],addedSize:["selfSize",sor tAscending,"!edgeName",true],removedSize:["selfSize",sortAscending,"!edgeName",t rue],shallowSize:["selfSize",sortAscending,"!edgeName",true],retainedSize:["reta inedSize",sortAscending,"!edgeName",true]}[sortColumnIdentifier]||["!edgeName",t rue,"retainedSize",false];return WebInspector.HeapSnapshotGridNode.createCompara tor(sortFields);},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype }
867 {return{count:"",countDelta:"",sizeDelta:""};},_enhanceData:function(data) 952 WebInspector.HeapSnapshotConstructorNode=function(dataGrid,className,aggregate,n odeFilter)
868 {if(this._isDeletedNode){data["addedCount"]="";data["addedSize"]="";data["remove dCount"]="\u2022";data["removedSize"]=Number.withThousandsSeparator(this._shallo wSize);}else{data["addedCount"]="\u2022";data["addedSize"]=Number.withThousandsS eparator(this._shallowSize);data["removedCount"]="";data["removedSize"]="";} 953 {WebInspector.HeapSnapshotGridNode.call(this,dataGrid,aggregate.count>0);this._n ame=className;this._nodeFilter=nodeFilter;this._distance=aggregate.distance;this ._count=aggregate.count;this._shallowSize=aggregate.self;this._retainedSize=aggr egate.maxRet;var snapshot=dataGrid.snapshot;var countPercent=this._count/snapsho t.nodeCount*100.0;var retainedSizePercent=this._retainedSize/snapshot.totalSize* 100.0;var shallowSizePercent=this._shallowSize/snapshot.totalSize*100.0;this.dat a={"object":className,"count":Number.withThousandsSeparator(this._count),"distan ce":this._distance,"shallowSize":Number.withThousandsSeparator(this._shallowSize ),"retainedSize":Number.withThousandsSeparator(this._retainedSize),"count-percen t":this._toPercentString(countPercent),"shallowSize-percent":this._toPercentStri ng(shallowSizePercent),"retainedSize-percent":this._toPercentString(retainedSize Percent)};}
869 return data;},get isDeletedNode()
870 {return this._isDeletedNode;},__proto__:WebInspector.HeapSnapshotGenericObjectNo de.prototype}
871 WebInspector.HeapSnapshotConstructorNode=function(tree,className,aggregate,aggre gatesKey)
872 {WebInspector.HeapSnapshotGridNode.call(this,tree,aggregate.count>0);this._name= className;this._aggregatesKey=aggregatesKey;this._distance=aggregate.distance;th is._count=aggregate.count;this._shallowSize=aggregate.self;this._retainedSize=ag gregate.maxRet;}
873 WebInspector.HeapSnapshotConstructorNode.prototype={createProvider:function() 954 WebInspector.HeapSnapshotConstructorNode.prototype={createProvider:function()
874 {return this._dataGrid.snapshot.createNodesProviderForClass(this._name,this._agg regatesKey)},revealNodeBySnapshotObjectId:function(snapshotObjectId,callback) 955 {return this._dataGrid.snapshot.createNodesProviderForClass(this._name,this._nod eFilter)},revealNodeBySnapshotObjectId:function(snapshotObjectId,callback)
875 {function didExpand() 956 {function didExpand()
876 {this._provider().nodePosition(snapshotObjectId,didGetNodePosition.bind(this));} 957 {this._provider().nodePosition(snapshotObjectId,didGetNodePosition.bind(this));}
877 function didGetNodePosition(nodePosition) 958 function didGetNodePosition(nodePosition)
878 {if(nodePosition===-1){this.collapse();callback(false);}else{this._populateChild ren(nodePosition,null,didPopulateChildren.bind(this,nodePosition));}} 959 {if(nodePosition===-1){this.collapse();callback(false);}else{this._populateChild ren(nodePosition,null,didPopulateChildren.bind(this,nodePosition));}}
879 function didPopulateChildren(nodePosition) 960 function didPopulateChildren(nodePosition)
880 {var indexOfFirsChildInRange=0;for(var i=0;i<this._retrievedChildrenRanges.lengt h;i++){var range=this._retrievedChildrenRanges[i];if(range.from<=nodePosition&&n odePosition<range.to){var childIndex=indexOfFirsChildInRange+nodePosition-range. from;var instanceNode=this.children[childIndex];this._dataGrid.highlightNode((in stanceNode));callback(true);return;} 961 {var child=this.childForPosition(nodePosition);if(child){this._dataGrid.revealTr eeNode([this,child]);this._dataGrid.highlightNode((child));}
881 indexOfFirsChildInRange+=range.to-range.from+1;} 962 callback(!!child);}
882 callback(false);} 963 this._dataGrid.resetNameFilter(this.expandWithoutPopulate.bind(this,didExpand.bi nd(this)));},filteredOut:function()
883 this.expandWithoutPopulate(didExpand.bind(this));},createCell:function(columnIde ntifier) 964 {return this._name.toLowerCase().indexOf(this._dataGrid._nameFilter)===-1;},crea teCell:function(columnIdentifier)
884 {var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):We bInspector.HeapSnapshotGridNode.prototype.createCell.call(this,columnIdentifier) ;if(this._searchMatched) 965 {var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):We bInspector.HeapSnapshotGridNode.prototype.createCell.call(this,columnIdentifier) ;if(this._searchMatched)
885 cell.classList.add("highlight");return cell;},_createChildNode:function(item) 966 cell.classList.add("highlight");return cell;},_createChildNode:function(item)
886 {return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,null,this._data Grid.snapshot,item);},comparator:function() 967 {return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,this._dataGrid. snapshot,item,false);},comparator:function()
887 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"retainedSize",false],distance:["distance",sortAscending,"retainedSize",false ],count:["id",true,"retainedSize",false],shallowSize:["selfSize",sortAscending," id",true],retainedSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdent ifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},_ childHashForEntity:function(node) 968 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"retainedSize",false],distance:["distance",sortAscending,"retainedSize",false ],count:["id",true,"retainedSize",false],shallowSize:["selfSize",sortAscending," id",true],retainedSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdent ifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},_ childHashForEntity:function(node)
888 {return node.id;},_childHashForNode:function(childNode) 969 {return node.id;},_childHashForNode:function(childNode)
889 {return childNode.snapshotNodeId;},get data() 970 {return childNode.snapshotNodeId;},__proto__:WebInspector.HeapSnapshotGridNode.p rototype}
890 {var data={object:this._name};data["count"]=Number.withThousandsSeparator(this._ count);data["distance"]=this._distance;data["shallowSize"]=Number.withThousandsS eparator(this._shallowSize);data["retainedSize"]=Number.withThousandsSeparator(t his._retainedSize);data["count-percent"]=this._toPercentString(this._countPercen t);data["shallowSize-percent"]=this._toPercentString(this._shallowSizePercent);d ata["retainedSize-percent"]=this._toPercentString(this._retainedSizePercent);ret urn data;},get _countPercent()
891 {return this._count/this.dataGrid.snapshot.nodeCount*100.0;},get _retainedSizePe rcent()
892 {return this._retainedSize/this.dataGrid.snapshot.totalSize*100.0;},get _shallow SizePercent()
893 {return this._shallowSize/this.dataGrid.snapshot.totalSize*100.0;},__proto__:Web Inspector.HeapSnapshotGridNode.prototype}
894 WebInspector.HeapSnapshotDiffNodesProvider=function(addedNodesProvider,deletedNo desProvider,addedCount,removedCount) 971 WebInspector.HeapSnapshotDiffNodesProvider=function(addedNodesProvider,deletedNo desProvider,addedCount,removedCount)
895 {this._addedNodesProvider=addedNodesProvider;this._deletedNodesProvider=deletedN odesProvider;this._addedCount=addedCount;this._removedCount=removedCount;} 972 {this._addedNodesProvider=addedNodesProvider;this._deletedNodesProvider=deletedN odesProvider;this._addedCount=addedCount;this._removedCount=removedCount;}
896 WebInspector.HeapSnapshotDiffNodesProvider.prototype={dispose:function() 973 WebInspector.HeapSnapshotDiffNodesProvider.prototype={dispose:function()
897 {this._addedNodesProvider.dispose();this._deletedNodesProvider.dispose();},isEmp ty:function(callback) 974 {this._addedNodesProvider.dispose();this._deletedNodesProvider.dispose();},nodeP osition:function(snapshotObjectId,callback)
975 {throw new Error("Unreachable");},isEmpty:function(callback)
898 {callback(false);},serializeItemsRange:function(beginPosition,endPosition,callba ck) 976 {callback(false);},serializeItemsRange:function(beginPosition,endPosition,callba ck)
899 {function didReceiveAllItems(items) 977 {function didReceiveAllItems(items)
900 {items.totalLength=this._addedCount+this._removedCount;callback(items);} 978 {items.totalLength=this._addedCount+this._removedCount;callback(items);}
901 function didReceiveDeletedItems(addedItems,items) 979 function didReceiveDeletedItems(addedItems,itemsRange)
902 {if(!addedItems.length) 980 {var items=itemsRange.items;if(!addedItems.items.length)
903 addedItems.startPosition=this._addedCount+items.startPosition;for(var i=0;i<item s.length;i++){items[i].isAddedNotRemoved=false;addedItems.push(items[i]);} 981 addedItems.startPosition=this._addedCount+itemsRange.startPosition;for(var i=0;i <items.length;i++){items[i].isAddedNotRemoved=false;addedItems.items.push(items[ i]);}
904 addedItems.endPosition=this._addedCount+items.endPosition;didReceiveAllItems.cal l(this,addedItems);} 982 addedItems.endPosition=this._addedCount+itemsRange.endPosition;didReceiveAllItem s.call(this,addedItems);}
905 function didReceiveAddedItems(items) 983 function didReceiveAddedItems(itemsRange)
906 {for(var i=0;i<items.length;i++) 984 {var items=itemsRange.items;for(var i=0;i<items.length;i++)
907 items[i].isAddedNotRemoved=true;if(items.endPosition<endPosition) 985 items[i].isAddedNotRemoved=true;if(itemsRange.endPosition<endPosition)
908 return this._deletedNodesProvider.serializeItemsRange(0,endPosition-items.endPos ition,didReceiveDeletedItems.bind(this,items));items.totalLength=this._addedCoun t+this._removedCount;didReceiveAllItems.call(this,items);} 986 return this._deletedNodesProvider.serializeItemsRange(0,endPosition-itemsRange.e ndPosition,didReceiveDeletedItems.bind(this,itemsRange));itemsRange.totalLength= this._addedCount+this._removedCount;didReceiveAllItems.call(this,itemsRange);}
909 if(beginPosition<this._addedCount) 987 if(beginPosition<this._addedCount){this._addedNodesProvider.serializeItemsRange( beginPosition,endPosition,didReceiveAddedItems.bind(this));}else{var emptyRange= new WebInspector.HeapSnapshotCommon.ItemsRange(0,0,0,[]);this._deletedNodesProvi der.serializeItemsRange(beginPosition-this._addedCount,endPosition-this._addedCo unt,didReceiveDeletedItems.bind(this,emptyRange));}},sortAndRewind:function(comp arator,callback)
910 this._addedNodesProvider.serializeItemsRange(beginPosition,endPosition,didReceiv eAddedItems.bind(this));else
911 this._deletedNodesProvider.serializeItemsRange(beginPosition-this._addedCount,en dPosition-this._addedCount,didReceiveDeletedItems.bind(this,[]));},sortAndRewind :function(comparator,callback)
912 {function afterSort() 988 {function afterSort()
913 {this._deletedNodesProvider.sortAndRewind(comparator,callback);} 989 {this._deletedNodesProvider.sortAndRewind(comparator,callback);}
914 this._addedNodesProvider.sortAndRewind(comparator,afterSort.bind(this));},__prot o__:WebInspector.HeapSnapshotProviderProxy.prototype};WebInspector.HeapSnapshotD iffNode=function(tree,className,diffForClass) 990 this._addedNodesProvider.sortAndRewind(comparator,afterSort.bind(this));}};WebIn spector.HeapSnapshotDiffNode=function(dataGrid,className,diffForClass)
915 {WebInspector.HeapSnapshotGridNode.call(this,tree,true);this._name=className;thi s._addedCount=diffForClass.addedCount;this._removedCount=diffForClass.removedCou nt;this._countDelta=diffForClass.countDelta;this._addedSize=diffForClass.addedSi ze;this._removedSize=diffForClass.removedSize;this._sizeDelta=diffForClass.sizeD elta;this._deletedIndexes=diffForClass.deletedIndexes;} 991 {WebInspector.HeapSnapshotGridNode.call(this,dataGrid,true);this._name=className ;this._addedCount=diffForClass.addedCount;this._removedCount=diffForClass.remove dCount;this._countDelta=diffForClass.countDelta;this._addedSize=diffForClass.add edSize;this._removedSize=diffForClass.removedSize;this._sizeDelta=diffForClass.s izeDelta;this._deletedIndexes=diffForClass.deletedIndexes;this.data={"object":cl assName,"addedCount":Number.withThousandsSeparator(this._addedCount),"removedCou nt":Number.withThousandsSeparator(this._removedCount),"countDelta":this._signFor Delta(this._countDelta)+Number.withThousandsSeparator(Math.abs(this._countDelta) ),"addedSize":Number.withThousandsSeparator(this._addedSize),"removedSize":Numbe r.withThousandsSeparator(this._removedSize),"sizeDelta":this._signForDelta(this. _sizeDelta)+Number.withThousandsSeparator(Math.abs(this._sizeDelta))};}
916 WebInspector.HeapSnapshotDiffNode.prototype={createProvider:function() 992 WebInspector.HeapSnapshotDiffNode.prototype={createProvider:function()
917 {var tree=this._dataGrid;return new WebInspector.HeapSnapshotDiffNodesProvider(t ree.snapshot.createAddedNodesProvider(tree.baseSnapshot.uid,this._name),tree.bas eSnapshot.createDeletedNodesProvider(this._deletedIndexes),this._addedCount,this ._removedCount);},_createChildNode:function(item) 993 {var tree=this._dataGrid;return new WebInspector.HeapSnapshotDiffNodesProvider(t ree.snapshot.createAddedNodesProvider(tree.baseSnapshot.uid,this._name),tree.bas eSnapshot.createDeletedNodesProvider(this._deletedIndexes),this._addedCount,this ._removedCount);},_createChildNode:function(item)
918 {if(item.isAddedNotRemoved) 994 {if(item.isAddedNotRemoved)
919 return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,null,this._dataG rid.snapshot,item);else 995 return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,this._dataGrid.s napshot,item,false);else
920 return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,this._dataGrid.b aseSnapshot,null,item);},_childHashForEntity:function(node) 996 return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,this._dataGrid.b aseSnapshot,item,true);},_childHashForEntity:function(node)
921 {return node.id;},_childHashForNode:function(childNode) 997 {return node.id;},_childHashForNode:function(childNode)
922 {return childNode.snapshotNodeId;},comparator:function() 998 {return childNode.snapshotNodeId;},comparator:function()
923 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"selfSize",false],addedCount:["selfSize",sortAscending,"id",true],removedCoun t:["selfSize",sortAscending,"id",true],countDelta:["selfSize",sortAscending,"id" ,true],addedSize:["selfSize",sortAscending,"id",true],removedSize:["selfSize",so rtAscending,"id",true],sizeDelta:["selfSize",sortAscending,"id",true]}[sortColum nIdentifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortField s);},_signForDelta:function(delta) 999 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"selfSize",false],addedCount:["selfSize",sortAscending,"id",true],removedCoun t:["selfSize",sortAscending,"id",true],countDelta:["selfSize",sortAscending,"id" ,true],addedSize:["selfSize",sortAscending,"id",true],removedSize:["selfSize",so rtAscending,"id",true],sizeDelta:["selfSize",sortAscending,"id",true]}[sortColum nIdentifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortField s);},filteredOut:function()
1000 {return this._name.toLowerCase().indexOf(this._dataGrid._nameFilter)===-1;},_sig nForDelta:function(delta)
924 {if(delta===0) 1001 {if(delta===0)
925 return"";if(delta>0) 1002 return"";if(delta>0)
926 return"+";else 1003 return"+";else
927 return"\u2212";},get data() 1004 return"\u2212";},__proto__:WebInspector.HeapSnapshotGridNode.prototype}
928 {var data={object:this._name};data["addedCount"]=Number.withThousandsSeparator(t his._addedCount);data["removedCount"]=Number.withThousandsSeparator(this._remove dCount);data["countDelta"]=this._signForDelta(this._countDelta)+Number.withThous andsSeparator(Math.abs(this._countDelta));data["addedSize"]=Number.withThousands Separator(this._addedSize);data["removedSize"]=Number.withThousandsSeparator(thi s._removedSize);data["sizeDelta"]=this._signForDelta(this._sizeDelta)+Number.wit hThousandsSeparator(Math.abs(this._sizeDelta));return data;},__proto__:WebInspec tor.HeapSnapshotGridNode.prototype} 1005 WebInspector.HeapSnapshotDominatorObjectNode=function(dataGrid,node)
929 WebInspector.HeapSnapshotDominatorObjectNode=function(tree,node) 1006 {WebInspector.HeapSnapshotGenericObjectNode.call(this,dataGrid,node);this.update HasChildren();};WebInspector.HeapSnapshotDominatorObjectNode.prototype={createPr ovider:function()
930 {WebInspector.HeapSnapshotGenericObjectNode.call(this,tree,node);this.updateHasC hildren();};WebInspector.HeapSnapshotDominatorObjectNode.prototype={createProvid er:function()
931 {return this._dataGrid.snapshot.createNodesProviderForDominator(this.snapshotNod eIndex);},retrieveChildBySnapshotObjectId:function(snapshotObjectId,callback) 1007 {return this._dataGrid.snapshot.createNodesProviderForDominator(this.snapshotNod eIndex);},retrieveChildBySnapshotObjectId:function(snapshotObjectId,callback)
932 {function didExpand() 1008 {function didExpand()
933 {this._provider().nodePosition(snapshotObjectId,didGetNodePosition.bind(this));} 1009 {this._provider().nodePosition(snapshotObjectId,didGetNodePosition.bind(this));}
934 function didGetNodePosition(nodePosition) 1010 function didGetNodePosition(nodePosition)
935 {if(nodePosition===-1){this.collapse();callback(null);}else 1011 {if(nodePosition===-1){this.collapse();callback(null);}else
936 this._populateChildren(nodePosition,null,didPopulateChildren.bind(this,nodePosit ion));} 1012 this._populateChildren(nodePosition,null,didPopulateChildren.bind(this,nodePosit ion));}
937 function didPopulateChildren(nodePosition) 1013 function didPopulateChildren(nodePosition)
938 {var child=this.childForPosition(nodePosition);callback(child);} 1014 {var child=this.childForPosition(nodePosition);callback(child);}
939 this.hasChildren=true;this.expandWithoutPopulate(didExpand.bind(this));},_create ChildNode:function(item) 1015 this.hasChildren=true;this.expandWithoutPopulate(didExpand.bind(this));},_create ChildNode:function(item)
940 {return new WebInspector.HeapSnapshotDominatorObjectNode(this._dataGrid,item);}, _childHashForEntity:function(node) 1016 {return new WebInspector.HeapSnapshotDominatorObjectNode(this._dataGrid,item);}, _childHashForEntity:function(node)
941 {return node.id;},_childHashForNode:function(childNode) 1017 {return node.id;},_childHashForNode:function(childNode)
942 {return childNode.snapshotNodeId;},comparator:function() 1018 {return childNode.snapshotNodeId;},comparator:function()
943 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"retainedSize",false],shallowSize:["selfSize",sortAscending,"id",true],retain edSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdentifier];return We bInspector.HeapSnapshotGridNode.createComparator(sortFields);},_emptyData:functi on() 1019 {var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifie r=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscendi ng,"retainedSize",false],shallowSize:["selfSize",sortAscending,"id",true],retain edSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdentifier];return We bInspector.HeapSnapshotGridNode.createComparator(sortFields);},__proto__:WebInsp ector.HeapSnapshotGenericObjectNode.prototype}
944 {return{};},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype};WebI nspector.HeapSnapshotView=function(parent,profile) 1020 WebInspector.AllocationGridNode=function(dataGrid,data)
945 {WebInspector.View.call(this);this.element.classList.add("heap-snapshot-view");t his.parent=parent;profile.profileType().addEventListener(WebInspector.ProfileTyp e.Events.AddProfileHeader,this._onProfileHeaderAdded,this);if(profile._profileTy pe.id===WebInspector.TrackingHeapSnapshotProfileType.TypeId){this._trackingOverv iewGrid=new WebInspector.HeapTrackingOverviewGrid(profile);this._trackingOvervie wGrid.addEventListener(WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged,thi s._onIdsRangeChanged.bind(this));this._trackingOverviewGrid.show(this.element);} 1021 {WebInspector.DataGridNode.call(this,data,data.hasChildren);this._dataGrid=dataG rid;this._populated=false;}
946 this.viewsContainer=document.createElement("div");this.viewsContainer.classList. add("views-container");this.element.appendChild(this.viewsContainer);this.contai nmentView=new WebInspector.View();this.containmentView.element.classList.add("vi ew");this.containmentDataGrid=new WebInspector.HeapSnapshotContainmentDataGrid() ;this.containmentDataGrid.element.addEventListener("mousedown",this._mouseDownIn ContentsGrid.bind(this),true);this.containmentDataGrid.show(this.containmentView .element);this.containmentDataGrid.addEventListener(WebInspector.DataGrid.Events .SelectedNode,this._selectionChanged,this);this.constructorsView=new WebInspecto r.View();this.constructorsView.element.classList.add("view");this.constructorsVi ew.element.appendChild(this._createToolbarWithClassNameFilter());this.constructo rsDataGrid=new WebInspector.HeapSnapshotConstructorsDataGrid();this.constructors DataGrid.element.classList.add("class-view-grid");this.constructorsDataGrid.elem ent.addEventListener("mousedown",this._mouseDownInContentsGrid.bind(this),true); this.constructorsDataGrid.show(this.constructorsView.element);this.constructorsD ataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selecti onChanged,this);this.dataGrid=(this.constructorsDataGrid);this.currentView=this. constructorsView;this.currentView.show(this.viewsContainer);this.diffView=new We bInspector.View();this.diffView.element.classList.add("view");this.diffView.elem ent.appendChild(this._createToolbarWithClassNameFilter());this.diffDataGrid=new WebInspector.HeapSnapshotDiffDataGrid();this.diffDataGrid.element.classList.add( "class-view-grid");this.diffDataGrid.show(this.diffView.element);this.diffDataGr id.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionCha nged,this);this.dominatorView=new WebInspector.View();this.dominatorView.element .classList.add("view");this.dominatorDataGrid=new WebInspector.HeapSnapshotDomin atorsDataGrid();this.dominatorDataGrid.element.addEventListener("mousedown",this ._mouseDownInContentsGrid.bind(this),true);this.dominatorDataGrid.show(this.domi natorView.element);this.dominatorDataGrid.addEventListener(WebInspector.DataGrid .Events.SelectedNode,this._selectionChanged,this);if(WebInspector.HeapSnapshotVi ew.enableAllocationProfiler){this.allocationView=new WebInspector.View();this.al locationView.element.classList.add("view");this.allocationDataGrid=new WebInspec tor.AllocationDataGrid();this.allocationDataGrid.element.addEventListener("mouse down",this._mouseDownInContentsGrid.bind(this),true);this.allocationDataGrid.sho w(this.allocationView.element);this.allocationDataGrid.addEventListener(WebInspe ctor.DataGrid.Events.SelectedNode,this._selectionChanged,this);} 1022 WebInspector.AllocationGridNode.prototype={populate:function()
947 this.retainmentViewHeader=document.createElement("div");this.retainmentViewHeade r.classList.add("retainers-view-header");WebInspector.installDragHandle(this.ret ainmentViewHeader,this._startRetainersHeaderDragging.bind(this),this._retainersH eaderDragging.bind(this),this._endRetainersHeaderDragging.bind(this),"ns-resize" );var retainingPathsTitleDiv=document.createElement("div");retainingPathsTitleDi v.className="title";var retainingPathsTitle=document.createElement("span");retai ningPathsTitle.textContent=WebInspector.UIString("Object's retaining tree");reta iningPathsTitleDiv.appendChild(retainingPathsTitle);this.retainmentViewHeader.ap pendChild(retainingPathsTitleDiv);this.element.appendChild(this.retainmentViewHe ader);this.retainmentView=new WebInspector.View();this.retainmentView.element.cl assList.add("view");this.retainmentView.element.classList.add("retaining-paths-v iew");this.retainmentDataGrid=new WebInspector.HeapSnapshotRetainmentDataGrid(); this.retainmentDataGrid.show(this.retainmentView.element);this.retainmentDataGri d.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._inspectedObje ctChanged,this);this.retainmentView.show(this.element);this.retainmentDataGrid.r eset();this.viewSelect=new WebInspector.StatusBarComboBox(this._onSelectedViewCh anged.bind(this));this.views=[{title:WebInspector.UIString("Summary"),view:this. constructorsView,grid:this.constructorsDataGrid},{title:WebInspector.UIString("C omparison"),view:this.diffView,grid:this.diffDataGrid},{title:WebInspector.UIStr ing("Containment"),view:this.containmentView,grid:this.containmentDataGrid}];if( WebInspector.settings.showAdvancedHeapSnapshotProperties.get()) 1023 {if(this._populated)
948 this.views.push({title:WebInspector.UIString("Dominators"),view:this.dominatorVi ew,grid:this.dominatorDataGrid});if(WebInspector.HeapSnapshotView.enableAllocati onProfiler) 1024 return;this._populated=true;this._dataGrid.snapshot.allocationNodeCallers(this.d ata.id,didReceiveCallers.bind(this));function didReceiveCallers(callers)
949 this.views.push({title:WebInspector.UIString("Allocation"),view:this.allocationV iew,grid:this.allocationDataGrid});this.views.current=0;for(var i=0;i<this.views .length;++i) 1025 {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)
950 this.viewSelect.createOption(WebInspector.UIString(this.views[i].title));this._p rofile=profile;this.baseSelect=new WebInspector.StatusBarComboBox(this._changeBa se.bind(this));this.baseSelect.element.classList.add("hidden");this._updateBaseO ptions();this.filterSelect=new WebInspector.StatusBarComboBox(this._changeFilter .bind(this));this._updateFilterOptions();this.selectedSizeText=new WebInspector. StatusBarText("");this._popoverHelper=new WebInspector.ObjectPopoverHelper(this. element,this._getHoverAnchor.bind(this),this._resolveObjectForPopover.bind(this) ,undefined,true);this._refreshView();} 1026 parentNode.expand();}
951 WebInspector.HeapSnapshotView.enableAllocationProfiler=false;WebInspector.HeapSn apshotView.prototype={_refreshView:function() 1027 var callersBranch=callers.branchingCallers;callersBranch.sort(this._dataGrid._cr eateComparator());for(var i=0;i<callersBranch.length;i++)
952 {this.profile.load(profileCallback.bind(this));function profileCallback(heapSnap shotProxy) 1028 parentNode.appendChild(new WebInspector.AllocationGridNode(this._dataGrid,caller sBranch[i]));}},expand:function()
953 {var list=this._profiles();var profileIndex=list.indexOf(this._profile);this.bas eSelect.setSelectedIndex(Math.max(0,profileIndex-1));this.dataGrid.setDataSource (heapSnapshotProxy);}},_onIdsRangeChanged:function(event) 1029 {WebInspector.DataGridNode.prototype.expand.call(this);if(this.children.length== =1)
954 {var minId=event.data.minId;var maxId=event.data.maxId;this.selectedSizeText.set Text(WebInspector.UIString("Selected size: %s",Number.bytesToString(event.data.s ize)));if(this.constructorsDataGrid.snapshot) 1030 this.children[0].expand();},createCell:function(columnIdentifier)
955 this.constructorsDataGrid.setSelectionRange(minId,maxId);},dispose:function() 1031 {var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentif ier);if(columnIdentifier!=="name")
956 {this.profile.profileType().removeEventListener(WebInspector.ProfileType.Events. AddProfileHeader,this._onProfileHeaderAdded,this);this.profile.dispose();if(this .baseProfile) 1032 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);}
957 this.baseProfile.dispose();this.containmentDataGrid.dispose();this.constructorsD ataGrid.dispose();this.diffDataGrid.dispose();this.dominatorDataGrid.dispose();t his.retainmentDataGrid.dispose();},get statusBarItems() 1033 return cell;},allocationNodeId:function()
958 {return[this.viewSelect.element,this.baseSelect.element,this.filterSelect.elemen t,this.selectedSizeText.element];},get profile() 1034 {return this.data.id;},__proto__:WebInspector.DataGridNode.prototype};WebInspect or.HeapSnapshotView=function(profile)
959 {return this._profile;},get baseProfile() 1035 {WebInspector.VBox.call(this);this.element.classList.add("heap-snapshot-view");p rofile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType.Snaps hotReceived,this._onReceiveSnapshot,this);profile.profileType().addEventListener (WebInspector.ProfileType.Events.RemoveProfileHeader,this._onProfileHeaderRemove d,this);if(profile._profileType.id===WebInspector.TrackingHeapSnapshotProfileTyp e.TypeId){this._trackingOverviewGrid=new WebInspector.HeapTrackingOverviewGrid(p rofile);this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOve rviewGrid.IdsRangeChanged,this._onIdsRangeChanged.bind(this));}
960 {return this._profile.profileType().getProfile(this._baseProfileUid);},wasShown: function() 1036 this._splitView=new WebInspector.SplitView(false,true,"heapSnapshotSplitViewStat e",200,200);this._splitView.show(this.element);this._containmentView=new WebInsp ector.VBox();this._containmentView.setMinimumSize(50,25);this._containmentDataGr id=new WebInspector.HeapSnapshotContainmentDataGrid();this._containmentDataGrid. show(this._containmentView.element);this._containmentDataGrid.addEventListener(W ebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);this._stat isticsView=new WebInspector.HeapSnapshotStatisticsView();this._constructorsView= new WebInspector.VBox();this._constructorsView.setMinimumSize(50,25);this._const ructorsDataGrid=new WebInspector.HeapSnapshotConstructorsDataGrid();this._constr uctorsDataGrid.show(this._constructorsView.element);this._constructorsDataGrid.a ddEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged ,this);this._diffView=new WebInspector.VBox();this._diffView.setMinimumSize(50,2 5);this._diffDataGrid=new WebInspector.HeapSnapshotDiffDataGrid();this._diffData Grid.show(this._diffView.element);this._diffDataGrid.addEventListener(WebInspect or.DataGrid.Events.SelectedNode,this._selectionChanged,this);this._dominatorView =new WebInspector.VBox();this._dominatorView.setMinimumSize(50,25);this._dominat orDataGrid=new WebInspector.HeapSnapshotDominatorsDataGrid();this._dominatorData Grid.show(this._dominatorView.element);this._dominatorDataGrid.addEventListener( WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);if(WebIns pector.experimentsSettings.allocationProfiler.isEnabled()&&profile.profileType() ===WebInspector.ProfileTypeRegistry.instance.trackingHeapSnapshotProfileType){th is._allocationView=new WebInspector.VBox();this._allocationView.setMinimumSize(5 0,25);this._allocationDataGrid=new WebInspector.AllocationDataGrid();this._alloc ationDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._o nSelectAllocationNode,this);this._allocationDataGrid.show(this._allocationView.e lement);}
961 {this.profile.load(profileCallback.bind(this));function profileCallback(){this.p rofile._wasShown();if(this.baseProfile) 1037 this._retainmentViewHeader=document.createElementWithClass("div","retainers-view -header");var retainingPathsTitleDiv=this._retainmentViewHeader.createChild("div ","title");var retainingPathsTitle=retainingPathsTitleDiv.createChild("span");re tainingPathsTitle.textContent=WebInspector.UIString("Object's retaining tree");t his._splitView.hideDefaultResizer();this._splitView.installResizer(this._retainm entViewHeader);this._retainmentView=new WebInspector.VBox();this._retainmentView .setMinimumSize(50,21);this._retainmentView.element.classList.add("retaining-pat hs-view");this._retainmentView.element.appendChild(this._retainmentViewHeader);t his._retainmentDataGrid=new WebInspector.HeapSnapshotRetainmentDataGrid();this._ retainmentDataGrid.show(this._retainmentView.element);this._retainmentDataGrid.a ddEventListener(WebInspector.DataGrid.Events.SelectedNode,this._inspectedObjectC hanged,this);this._retainmentDataGrid.reset();this._perspectives=[];this._perspe ctives.push(new WebInspector.HeapSnapshotView.SummaryPerspective());if(profile.p rofileType()!==WebInspector.ProfileTypeRegistry.instance.trackingHeapSnapshotPro fileType)
962 this.baseProfile.load(function(){});}},willHide:function() 1038 this._perspectives.push(new WebInspector.HeapSnapshotView.ComparisonPerspective( ));this._perspectives.push(new WebInspector.HeapSnapshotView.ContainmentPerspect ive());if(WebInspector.settings.showAdvancedHeapSnapshotProperties.get())
1039 this._perspectives.push(new WebInspector.HeapSnapshotView.DominatorPerspective() );if(this._allocationView)
1040 this._perspectives.push(new WebInspector.HeapSnapshotView.AllocationPerspective( ));if(WebInspector.experimentsSettings.heapSnapshotStatistics.isEnabled())
1041 this._perspectives.push(new WebInspector.HeapSnapshotView.StatisticsPerspective( ));this._perspectiveSelect=new WebInspector.StatusBarComboBox(this._onSelectedPe rspectiveChanged.bind(this));for(var i=0;i<this._perspectives.length;++i)
1042 this._perspectiveSelect.createOption(this._perspectives[i].title());this._profil e=profile;this._baseSelect=new WebInspector.StatusBarComboBox(this._changeBase.b ind(this));this._baseSelect.visible=false;this._updateBaseOptions();this._filter Select=new WebInspector.StatusBarComboBox(this._changeFilter.bind(this));this._f ilterSelect.visible=false;this._updateFilterOptions();this._classNameFilter=new WebInspector.StatusBarInput("Class filter");this._classNameFilter.visible=false; this._classNameFilter.setOnChangeHandler(this._onClassFilterChanged.bind(this)); this._selectedSizeText=new WebInspector.StatusBarText("");this._popoverHelper=ne w WebInspector.ObjectPopoverHelper(this.element,this._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this),undefined,true);this._currentPerspectiv eIndex=0;this._currentPerspective=this._perspectives[0];this._currentPerspective .activate(this);this._dataGrid=this._currentPerspective.masterGrid(this);this._d ataGrid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ResetF ilter,this._onResetClassNameFilter,this);this._refreshView();}
1043 WebInspector.HeapSnapshotView.Perspective=function(title)
1044 {this._title=title;}
1045 WebInspector.HeapSnapshotView.Perspective.prototype={activate:function(heapSnaps hotView){},deactivate:function(heapSnapshotView)
1046 {heapSnapshotView._baseSelect.visible=false;heapSnapshotView._filterSelect.visib le=false;heapSnapshotView._classNameFilter.visible=false;if(heapSnapshotView._tr ackingOverviewGrid)
1047 heapSnapshotView._trackingOverviewGrid.detach();if(heapSnapshotView._allocationV iew)
1048 heapSnapshotView._allocationView.detach();if(heapSnapshotView._statisticsView)
1049 heapSnapshotView._statisticsView.detach();heapSnapshotView._splitView.detach();h eapSnapshotView._splitView.detachChildViews();},masterGrid:function(heapSnapshot View)
1050 {return null;},title:function()
1051 {return this._title;},supportsSearch:function()
1052 {return false;}}
1053 WebInspector.HeapSnapshotView.SummaryPerspective=function()
1054 {WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Summ ary"));}
1055 WebInspector.HeapSnapshotView.SummaryPerspective.prototype={activate:function(he apSnapshotView)
1056 {heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.mainElement ());heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarEle ment());heapSnapshotView._splitView.show(heapSnapshotView.element);heapSnapshotV iew._filterSelect.visible=true;heapSnapshotView._classNameFilter.visible=true;if (heapSnapshotView._trackingOverviewGrid){heapSnapshotView._trackingOverviewGrid. show(heapSnapshotView.element,heapSnapshotView._splitView.element);heapSnapshotV iew._trackingOverviewGrid.update();heapSnapshotView._trackingOverviewGrid._updat eGrid();}},masterGrid:function(heapSnapshotView)
1057 {return heapSnapshotView._constructorsDataGrid;},supportsSearch:function()
1058 {return true;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
1059 WebInspector.HeapSnapshotView.ComparisonPerspective=function()
1060 {WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Comp arison"));}
1061 WebInspector.HeapSnapshotView.ComparisonPerspective.prototype={activate:function (heapSnapshotView)
1062 {heapSnapshotView._diffView.show(heapSnapshotView._splitView.mainElement());heap SnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElement()); heapSnapshotView._splitView.show(heapSnapshotView.element);heapSnapshotView._bas eSelect.visible=true;heapSnapshotView._classNameFilter.visible=true;},masterGrid :function(heapSnapshotView)
1063 {return heapSnapshotView._diffDataGrid;},supportsSearch:function()
1064 {return true;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
1065 WebInspector.HeapSnapshotView.ContainmentPerspective=function()
1066 {WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Cont ainment"));}
1067 WebInspector.HeapSnapshotView.ContainmentPerspective.prototype={activate:functio n(heapSnapshotView)
1068 {heapSnapshotView._containmentView.show(heapSnapshotView._splitView.mainElement( ));heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElem ent());heapSnapshotView._splitView.show(heapSnapshotView.element);},masterGrid:f unction(heapSnapshotView)
1069 {return heapSnapshotView._containmentDataGrid;},__proto__:WebInspector.HeapSnaps hotView.Perspective.prototype}
1070 WebInspector.HeapSnapshotView.DominatorPerspective=function()
1071 {WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Domi nators"));}
1072 WebInspector.HeapSnapshotView.DominatorPerspective.prototype={activate:function( heapSnapshotView)
1073 {heapSnapshotView._dominatorView.show(heapSnapshotView._splitView.mainElement()) ;heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElemen t());heapSnapshotView._splitView.show(heapSnapshotView.element);},masterGrid:fun ction(heapSnapshotView)
1074 {return heapSnapshotView._dominatorDataGrid;},__proto__:WebInspector.HeapSnapsho tView.Perspective.prototype}
1075 WebInspector.HeapSnapshotView.AllocationPerspective=function()
1076 {WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Allo cation"));this._allocationSplitView=new WebInspector.SplitView(false,true,"heapS napshotAllocationSplitViewState",200,200);}
1077 WebInspector.HeapSnapshotView.AllocationPerspective.prototype={activate:function (heapSnapshotView)
1078 {heapSnapshotView._allocationView.show(this._allocationSplitView.mainElement()); heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.mainElement( ));heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElem ent());heapSnapshotView._splitView.show(this._allocationSplitView.sidebarElement ());this._allocationSplitView.show(heapSnapshotView.element);heapSnapshotView._c onstructorsDataGrid.clear();var selectedNode=heapSnapshotView._allocationDataGri d.selectedNode;if(selectedNode)
1079 heapSnapshotView._constructorsDataGrid.setAllocationNodeId(selectedNode.allocati onNodeId());},deactivate:function(heapSnapshotView)
1080 {this._allocationSplitView.detach();WebInspector.HeapSnapshotView.Perspective.pr ototype.deactivate.call(this,heapSnapshotView);},masterGrid:function(heapSnapsho tView)
1081 {return heapSnapshotView._allocationDataGrid;},__proto__:WebInspector.HeapSnapsh otView.Perspective.prototype}
1082 WebInspector.HeapSnapshotView.StatisticsPerspective=function()
1083 {WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Stat istics"));}
1084 WebInspector.HeapSnapshotView.StatisticsPerspective.prototype={activate:function (heapSnapshotView)
1085 {heapSnapshotView._statisticsView.show(heapSnapshotView.element);},masterGrid:fu nction(heapSnapshotView)
1086 {return null;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
1087 WebInspector.HeapSnapshotView.prototype={_refreshView:function()
1088 {this._profile.load(profileCallback.bind(this));function profileCallback(heapSna pshotProxy)
1089 {heapSnapshotProxy.getStatistics(this._gotStatistics.bind(this));var list=this._ profiles();var profileIndex=list.indexOf(this._profile);this._baseSelect.setSele ctedIndex(Math.max(0,profileIndex-1));this._dataGrid.setDataSource(heapSnapshotP roxy);if(this._trackingOverviewGrid)
1090 this._trackingOverviewGrid._updateGrid();}},_gotStatistics:function(statistics){ this._statisticsView.setTotal(statistics.total);this._statisticsView.addRecord(s tatistics.code,WebInspector.UIString("Code"),"#f77");this._statisticsView.addRec ord(statistics.strings,WebInspector.UIString("Strings"),"#5e5");this._statistics View.addRecord(statistics.jsArrays,WebInspector.UIString("JS Arrays"),"#7af");th is._statisticsView.addRecord(statistics.native,WebInspector.UIString("Typed Arra ys"),"#fc5");this._statisticsView.addRecord(statistics.total,WebInspector.UIStri ng("Total"));},_onIdsRangeChanged:function(event)
1091 {var minId=event.data.minId;var maxId=event.data.maxId;this._selectedSizeText.se tText(WebInspector.UIString("Selected size: %s",Number.bytesToString(event.data. size)));if(this._constructorsDataGrid.snapshot)
1092 this._constructorsDataGrid.setSelectionRange(minId,maxId);},get statusBarItems()
1093 {var result=[this._perspectiveSelect.element,this._classNameFilter.element];if(t his._profile.profileType()!==WebInspector.ProfileTypeRegistry.instance.trackingH eapSnapshotProfileType)
1094 result.push(this._baseSelect.element,this._filterSelect.element);result.push(thi s._selectedSizeText.element);return result;},wasShown:function()
1095 {this._profile.load(profileCallback.bind(this));function profileCallback(){this. _profile._wasShown();if(this._baseProfile)
1096 this._baseProfile.load(function(){});}},willHide:function()
963 {this._currentSearchResultIndex=-1;this._popoverHelper.hidePopover();if(this.hel pPopover&&this.helpPopover.isShowing()) 1097 {this._currentSearchResultIndex=-1;this._popoverHelper.hidePopover();if(this.hel pPopover&&this.helpPopover.isShowing())
964 this.helpPopover.hide();},onResize:function() 1098 this.helpPopover.hide();},searchCanceled:function()
965 {var height=this.retainmentView.element.clientHeight;this._updateRetainmentViewH eight(height);},searchCanceled:function()
966 {if(this._searchResults){for(var i=0;i<this._searchResults.length;++i){var node= this._searchResults[i].node;delete node._searchMatched;node.refresh();}} 1099 {if(this._searchResults){for(var i=0;i<this._searchResults.length;++i){var node= this._searchResults[i].node;delete node._searchMatched;node.refresh();}}
967 delete this._searchFinishedCallback;this._currentSearchResultIndex=-1;this._sear chResults=[];},performSearch:function(query,finishedCallback) 1100 delete this._searchFinishedCallback;this._currentSearchResultIndex=-1;this._sear chResults=[];},performSearch:function(query,finishedCallback)
968 {this.searchCanceled();query=query.trim();if(!query) 1101 {this.searchCanceled();query=query.trim();if(!query)
969 return;if(this.currentView!==this.constructorsView&&this.currentView!==this.diff View) 1102 return;if(!this._currentPerspective.supportsSearch())
970 return;function didHighlight(found) 1103 return;function didHighlight(found)
971 {finishedCallback(this,found?1:0);} 1104 {finishedCallback(this,found?1:0);}
972 if(query.charAt(0)==="@"){var snapshotNodeId=parseInt(query.substring(1),10);if( !isNaN(snapshotNodeId)) 1105 if(query.charAt(0)==="@"){var snapshotNodeId=parseInt(query.substring(1),10);if( !isNaN(snapshotNodeId))
973 this.dataGrid.highlightObjectByHeapSnapshotId(String(snapshotNodeId),didHighligh t.bind(this));else 1106 this._dataGrid.highlightObjectByHeapSnapshotId(String(snapshotNodeId),didHighlig ht.bind(this));else
974 finishedCallback(this,0);return;} 1107 finishedCallback(this,0);return;}
975 this._searchFinishedCallback=finishedCallback;var nameRegExp=createPlainTextSear chRegex(query,"i");function matchesByName(gridNode){return("_name"in gridNode)&& nameRegExp.test(gridNode._name);} 1108 this._searchFinishedCallback=finishedCallback;var nameRegExp=createPlainTextSear chRegex(query,"i");function matchesByName(gridNode){return("_name"in gridNode)&& nameRegExp.test(gridNode._name);}
976 function matchesQuery(gridNode) 1109 function matchesQuery(gridNode)
977 {delete gridNode._searchMatched;if(matchesByName(gridNode)){gridNode._searchMatc hed=true;gridNode.refresh();return true;} 1110 {delete gridNode._searchMatched;if(matchesByName(gridNode)){gridNode._searchMatc hed=true;gridNode.refresh();return true;}
978 return false;} 1111 return false;}
979 var current=this.dataGrid.rootNode().children[0];var depth=0;var info={};const m axDepth=1;while(current){if(matchesQuery(current)) 1112 var current=this._dataGrid.rootNode().children[0];var depth=0;var info={};const maxDepth=1;while(current){if(matchesQuery(current))
980 this._searchResults.push({node:current});current=current.traverseNextNode(false, null,(depth>=maxDepth),info);depth+=info.depthChange;} 1113 this._searchResults.push({node:current});current=current.traverseNextNode(false, null,(depth>=maxDepth),info);depth+=info.depthChange;}
981 finishedCallback(this,this._searchResults.length);},jumpToFirstSearchResult:func tion() 1114 finishedCallback(this,this._searchResults.length);},jumpToFirstSearchResult:func tion()
982 {if(!this._searchResults||!this._searchResults.length) 1115 {if(!this._searchResults||!this._searchResults.length)
983 return;this._currentSearchResultIndex=0;this._jumpToSearchResult(this._currentSe archResultIndex);},jumpToLastSearchResult:function() 1116 return;this._currentSearchResultIndex=0;this._jumpToSearchResult(this._currentSe archResultIndex);},jumpToLastSearchResult:function()
984 {if(!this._searchResults||!this._searchResults.length) 1117 {if(!this._searchResults||!this._searchResults.length)
985 return;this._currentSearchResultIndex=(this._searchResults.length-1);this._jumpT oSearchResult(this._currentSearchResultIndex);},jumpToNextSearchResult:function( ) 1118 return;this._currentSearchResultIndex=(this._searchResults.length-1);this._jumpT oSearchResult(this._currentSearchResultIndex);},jumpToNextSearchResult:function( )
986 {if(!this._searchResults||!this._searchResults.length) 1119 {if(!this._searchResults||!this._searchResults.length)
987 return;if(++this._currentSearchResultIndex>=this._searchResults.length) 1120 return;if(++this._currentSearchResultIndex>=this._searchResults.length)
988 this._currentSearchResultIndex=0;this._jumpToSearchResult(this._currentSearchRes ultIndex);},jumpToPreviousSearchResult:function() 1121 this._currentSearchResultIndex=0;this._jumpToSearchResult(this._currentSearchRes ultIndex);},jumpToPreviousSearchResult:function()
989 {if(!this._searchResults||!this._searchResults.length) 1122 {if(!this._searchResults||!this._searchResults.length)
990 return;if(--this._currentSearchResultIndex<0) 1123 return;if(--this._currentSearchResultIndex<0)
991 this._currentSearchResultIndex=(this._searchResults.length-1);this._jumpToSearch Result(this._currentSearchResultIndex);},showingFirstSearchResult:function() 1124 this._currentSearchResultIndex=(this._searchResults.length-1);this._jumpToSearch Result(this._currentSearchResultIndex);},showingFirstSearchResult:function()
992 {return(this._currentSearchResultIndex===0);},showingLastSearchResult:function() 1125 {return(this._currentSearchResultIndex===0);},showingLastSearchResult:function()
993 {return(this._searchResults&&this._currentSearchResultIndex===(this._searchResul ts.length-1));},currentSearchResultIndex:function(){return this._currentSearchRe sultIndex;},_jumpToSearchResult:function(index) 1126 {return(this._searchResults&&this._currentSearchResultIndex===(this._searchResul ts.length-1));},currentSearchResultIndex:function(){return this._currentSearchRe sultIndex;},_jumpToSearchResult:function(index)
994 {var searchResult=this._searchResults[index];if(!searchResult) 1127 {var searchResult=this._searchResults[index];if(!searchResult)
995 return;var node=searchResult.node;node.revealAndSelect();},refreshVisibleData:fu nction() 1128 return;var node=searchResult.node;node.revealAndSelect();},refreshVisibleData:fu nction()
996 {var child=this.dataGrid.rootNode().children[0];while(child){child.refresh();chi ld=child.traverseNextNode(false,null,true);}},_changeBase:function() 1129 {if(!this._dataGrid)
997 {if(this._baseProfileUid===this._profiles()[this.baseSelect.selectedIndex()].uid ) 1130 return;var child=this._dataGrid.rootNode().children[0];while(child){child.refres h();child=child.traverseNextNode(false,null,true);}},_changeBase:function()
998 return;this._baseProfileUid=this._profiles()[this.baseSelect.selectedIndex()].ui d;var dataGrid=(this.dataGrid);if(dataGrid.snapshot) 1131 {if(this._baseProfile===this._profiles()[this._baseSelect.selectedIndex()])
999 this.baseProfile.load(dataGrid.setBaseDataSource.bind(dataGrid));if(!this.curren tQuery||!this._searchFinishedCallback||!this._searchResults) 1132 return;this._baseProfile=this._profiles()[this._baseSelect.selectedIndex()];var dataGrid=(this._dataGrid);if(dataGrid.snapshot)
1133 this._baseProfile.load(dataGrid.setBaseDataSource.bind(dataGrid));if(!this.curre ntQuery||!this._searchFinishedCallback||!this._searchResults)
1000 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_changeFilter:functio n() 1134 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_changeFilter:functio n()
1001 {var profileIndex=this.filterSelect.selectedIndex()-1;this.dataGrid.filterSelect IndexChanged(this._profiles(),profileIndex);WebInspector.notifications.dispatchE ventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMet rics.UserActionNames.HeapSnapshotFilterChanged,label:this.filterSelect.selectedO ption().label});if(!this.currentQuery||!this._searchFinishedCallback||!this._sea rchResults) 1135 {var profileIndex=this._filterSelect.selectedIndex()-1;this._dataGrid.filterSele ctIndexChanged(this._profiles(),profileIndex);WebInspector.notifications.dispatc hEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserM etrics.UserActionNames.HeapSnapshotFilterChanged,label:this._filterSelect.select edOption().label});if(!this.currentQuery||!this._searchFinishedCallback||!this._ searchResults)
1002 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_createToolbarWithCla ssNameFilter:function() 1136 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_onClassFilterChanged :function(value)
1003 {var toolbar=document.createElement("div");toolbar.classList.add("class-view-too lbar");var classNameFilter=document.createElement("input");classNameFilter.class List.add("class-name-filter");classNameFilter.setAttribute("placeholder",WebInsp ector.UIString("Class filter"));classNameFilter.addEventListener("keyup",this._c hangeNameFilter.bind(this,classNameFilter),false);toolbar.appendChild(classNameF ilter);return toolbar;},_changeNameFilter:function(classNameInputElement) 1137 {this._dataGrid.changeNameFilter(value);},_onResetClassNameFilter:function()
1004 {var filter=classNameInputElement.value;this.dataGrid.changeNameFilter(filter);} ,_profiles:function() 1138 {this._classNameFilter.setValue("");},_profiles:function()
1005 {return this._profile.profileType().getProfiles();},populateContextMenu:function (contextMenu,event) 1139 {return this._profile.profileType().getProfiles();},populateContextMenu:function (contextMenu,event)
1006 {this.dataGrid.populateContextMenu(this.parent,contextMenu,event);},_selectionCh anged:function(event) 1140 {if(this._dataGrid)
1007 {var selectedNode=event.target.selectedNode;this._setRetainmentDataGridSource(se lectedNode);this._inspectedObjectChanged(event);},_inspectedObjectChanged:functi on(event) 1141 this._dataGrid.populateContextMenu(contextMenu,event);},_selectionChanged:functi on(event)
1008 {var selectedNode=event.target.selectedNode;if(!this.profile.fromFile()&&selecte dNode instanceof WebInspector.HeapSnapshotGenericObjectNode) 1142 {var selectedNode=event.target.selectedNode;this._setRetainmentDataGridSource(se lectedNode);this._inspectedObjectChanged(event);},_onSelectAllocationNode:functi on(event)
1143 {var selectedNode=event.target.selectedNode;this._constructorsDataGrid.setAlloca tionNodeId(selectedNode.allocationNodeId());},_inspectedObjectChanged:function(e vent)
1144 {var selectedNode=event.target.selectedNode;if(!this._profile.fromFile()&&select edNode instanceof WebInspector.HeapSnapshotGenericObjectNode)
1009 ConsoleAgent.addInspectedHeapObject(selectedNode.snapshotNodeId);},_setRetainmen tDataGridSource:function(nodeItem) 1145 ConsoleAgent.addInspectedHeapObject(selectedNode.snapshotNodeId);},_setRetainmen tDataGridSource:function(nodeItem)
1010 {if(nodeItem&&nodeItem.snapshotNodeIndex) 1146 {var dataSource=nodeItem&&nodeItem.retainersDataSource();if(dataSource)
1011 this.retainmentDataGrid.setDataSource(nodeItem.isDeletedNode?nodeItem.dataGrid.b aseSnapshot:nodeItem.dataGrid.snapshot,nodeItem.snapshotNodeIndex);else 1147 this._retainmentDataGrid.setDataSource(dataSource.snapshot,dataSource.snapshotNo deIndex);else
1012 this.retainmentDataGrid.reset();},_mouseDownInContentsGrid:function(event) 1148 this._retainmentDataGrid.reset();},_changePerspectiveAndWait:function(perspectiv eTitle,callback)
1013 {if(event.detail<2) 1149 {var perspectiveIndex=null;for(var i=0;i<this._perspectives.length;++i){if(this. _perspectives[i].title()===perspectiveTitle){perspectiveIndex=i;break;}}
1014 return;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell||(!c ell.classList.contains("count-column")&&!cell.classList.contains("shallowSize-co lumn")&&!cell.classList.contains("retainedSize-column"))) 1150 if(this._currentPerspectiveIndex===perspectiveIndex||perspectiveIndex===null){se tTimeout(callback,0);return;}
1015 return;event.consume(true);},changeView:function(viewTitle,callback)
1016 {var viewIndex=null;for(var i=0;i<this.views.length;++i){if(this.views[i].title= ==viewTitle){viewIndex=i;break;}}
1017 if(this.views.current===viewIndex||viewIndex==null){setTimeout(callback,0);retur n;}
1018 function dataGridContentShown(event) 1151 function dataGridContentShown(event)
1019 {var dataGrid=event.data;dataGrid.removeEventListener(WebInspector.HeapSnapshotS ortableDataGrid.Events.ContentShown,dataGridContentShown,this);if(dataGrid===thi s.dataGrid) 1152 {var dataGrid=event.data;dataGrid.removeEventListener(WebInspector.HeapSnapshotS ortableDataGrid.Events.ContentShown,dataGridContentShown,this);if(dataGrid===thi s._dataGrid)
1020 callback();} 1153 callback();}
1021 this.views[viewIndex].grid.addEventListener(WebInspector.HeapSnapshotSortableDat aGrid.Events.ContentShown,dataGridContentShown,this);this.viewSelect.setSelected Index(viewIndex);this._changeView(viewIndex);},_updateDataSourceAndView:function () 1154 this._perspectives[perspectiveIndex].masterGrid(this).addEventListener(WebInspec tor.HeapSnapshotSortableDataGrid.Events.ContentShown,dataGridContentShown,this); this._perspectiveSelect.setSelectedIndex(perspectiveIndex);this._changePerspecti ve(perspectiveIndex);},_updateDataSourceAndView:function()
1022 {var dataGrid=this.dataGrid;if(dataGrid.snapshot) 1155 {var dataGrid=this._dataGrid;if(!dataGrid||dataGrid.snapshot)
1023 return;this.profile.load(didLoadSnapshot.bind(this));function didLoadSnapshot(sn apshotProxy) 1156 return;this._profile.load(didLoadSnapshot.bind(this));function didLoadSnapshot(s napshotProxy)
1024 {if(this.dataGrid!==dataGrid) 1157 {if(this._dataGrid!==dataGrid)
1025 return;if(dataGrid.snapshot!==snapshotProxy) 1158 return;if(dataGrid.snapshot!==snapshotProxy)
1026 dataGrid.setDataSource(snapshotProxy);if(dataGrid===this.diffDataGrid){if(!this. _baseProfileUid) 1159 dataGrid.setDataSource(snapshotProxy);if(dataGrid===this._diffDataGrid){if(!this ._baseProfile)
1027 this._baseProfileUid=this._profiles()[this.baseSelect.selectedIndex()].uid;this. baseProfile.load(didLoadBaseSnaphot.bind(this));}} 1160 this._baseProfile=this._profiles()[this._baseSelect.selectedIndex()];this._baseP rofile.load(didLoadBaseSnaphot.bind(this));}}
1028 function didLoadBaseSnaphot(baseSnapshotProxy) 1161 function didLoadBaseSnaphot(baseSnapshotProxy)
1029 {if(this.diffDataGrid.baseSnapshot!==baseSnapshotProxy) 1162 {if(this._diffDataGrid.baseSnapshot!==baseSnapshotProxy)
1030 this.diffDataGrid.setBaseDataSource(baseSnapshotProxy);}},_onSelectedViewChanged :function(event) 1163 this._diffDataGrid.setBaseDataSource(baseSnapshotProxy);}},_onSelectedPerspectiv eChanged:function(event)
1031 {this._changeView(event.target.selectedIndex);},_updateSelectorsVisibility:funct ion() 1164 {this._changePerspective(event.target.selectedIndex);this._onSelectedViewChanged (event);},_onSelectedViewChanged:function(event)
1032 {if(this.currentView===this.diffView) 1165 {},_changePerspective:function(selectedIndex)
1033 this.baseSelect.element.classList.remove("hidden");else 1166 {if(selectedIndex===this._currentPerspectiveIndex)
1034 this.baseSelect.element.classList.add("hidden");if(this.currentView===this.const ructorsView){if(this._trackingOverviewGrid){this._trackingOverviewGrid.element.c lassList.remove("hidden");this._trackingOverviewGrid.update();this.viewsContaine r.classList.add("reserve-80px-at-top");} 1167 return;if(this._dataGrid)
1035 this.filterSelect.element.classList.remove("hidden");}else{this.filterSelect.ele ment.classList.add("hidden");if(this._trackingOverviewGrid){this._trackingOvervi ewGrid.element.classList.add("hidden");this.viewsContainer.classList.remove("res erve-80px-at-top");}}},_changeView:function(selectedIndex) 1168 this._dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGrid.Eve nts.ResetFilter,this._onResetClassNameFilter,this);this._currentPerspectiveIndex =selectedIndex;this._currentPerspective.deactivate(this);var perspective=this._p erspectives[selectedIndex];this._currentPerspective=perspective;this._dataGrid=p erspective.masterGrid(this);perspective.activate(this);this.refreshVisibleData() ;if(this._dataGrid){this._dataGrid.addEventListener(WebInspector.HeapSnapshotSor tableDataGrid.Events.ResetFilter,this._onResetClassNameFilter,this);this._dataGr id.updateWidths();}
1036 {if(selectedIndex===this.views.current) 1169 this._updateDataSourceAndView();if(!this.currentQuery||!this._searchFinishedCall back||!this._searchResults)
1037 return;this.views.current=selectedIndex;this.currentView.detach();var view=this. views[this.views.current];this.currentView=view.view;this.dataGrid=view.grid;thi s.currentView.show(this.viewsContainer);this.refreshVisibleData();this.dataGrid. updateWidths();this._updateSelectorsVisibility();this._updateDataSourceAndView() ;if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults) 1170 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},highlightLiveObject:f unction(perspectiveName,snapshotObjectId)
1038 return;this._searchFinishedCallback(this,-this._searchResults.length);this.perfo rmSearch(this.currentQuery,this._searchFinishedCallback);},_getHoverAnchor:funct ion(target) 1171 {this._changePerspectiveAndWait(perspectiveName,didChangePerspective.bind(this)) ;function didChangePerspective()
1172 {this._dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId,didHighlightObj ect);}
1173 function didHighlightObject(found)
1174 {if(!found)
1175 WebInspector.console.log("Cannot find corresponding heap snapshot node",WebInspe ctor.ConsoleMessage.MessageLevel.Error,true);}},_getHoverAnchor:function(target)
1039 {var span=target.enclosingNodeOrSelfWithNodeName("span");if(!span) 1176 {var span=target.enclosingNodeOrSelfWithNodeName("span");if(!span)
1040 return;var row=target.enclosingNodeOrSelfWithNodeName("tr");if(!row) 1177 return;var row=target.enclosingNodeOrSelfWithNodeName("tr");if(!row)
1041 return;span.node=row._dataGridNode;return span;},_resolveObjectForPopover:functi on(element,showCallback,objectGroupName) 1178 return;span.node=row._dataGridNode;return span;},_resolveObjectForPopover:functi on(element,showCallback,objectGroupName)
1042 {if(this.profile.fromFile()) 1179 {if(this._profile.fromFile())
1043 return;element.node.queryObjectContent(showCallback,objectGroupName);},_startRet ainersHeaderDragging:function(event) 1180 return;element.node.queryObjectContent(showCallback,objectGroupName);},_updateBa seOptions:function()
1044 {if(!this.isShowing()) 1181 {var list=this._profiles();if(this._baseSelect.size()===list.length)
1045 return false;this._previousDragPosition=event.pageY;return true;},_retainersHead erDragging:function(event) 1182 return;for(var i=this._baseSelect.size(),n=list.length;i<n;++i){var title=list[i ].title;this._baseSelect.createOption(title);}},_updateFilterOptions:function()
1046 {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) 1183 {var list=this._profiles();if(this._filterSelect.size()-1===list.length)
1047 {delete this._previousDragPosition;event.consume();},_updateRetainmentViewHeight :function(height) 1184 return;if(!this._filterSelect.size())
1048 {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) 1185 this._filterSelect.createOption(WebInspector.UIString("All objects"));for(var i= this._filterSelect.size()-1,n=list.length;i<n;++i){var title=list[i].title;if(!i )
1049 this.viewsContainer.classList.add("reserve-80px-at-top");this.retainmentView.ele ment.style.height=height+"px";this.retainmentViewHeader.style.bottom=height+"px" ;this.currentView.doResize();},_updateBaseOptions:function()
1050 {var list=this._profiles();if(this.baseSelect.size()===list.length)
1051 return;for(var i=this.baseSelect.size(),n=list.length;i<n;++i){var title=list[i] .title;this.baseSelect.createOption(title);}},_updateFilterOptions:function()
1052 {var list=this._profiles();if(this.filterSelect.size()-1===list.length)
1053 return;if(!this.filterSelect.size())
1054 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)
1055 title=WebInspector.UIString("Objects allocated before %s",title);else 1186 title=WebInspector.UIString("Objects allocated before %s",title);else
1056 title=WebInspector.UIString("Objects allocated between %s and %s",list[i-1].titl e,title);this.filterSelect.createOption(title);}},_onProfileHeaderAdded:function (event) 1187 title=WebInspector.UIString("Objects allocated between %s and %s",list[i-1].titl e,title);this._filterSelect.createOption(title);}},_updateControls:function()
1057 {this._updateBaseOptions();this._updateFilterOptions();},__proto__:WebInspector. View.prototype} 1188 {this._updateBaseOptions();this._updateFilterOptions();},_onReceiveSnapshot:func tion(event)
1189 {this._updateControls();},_onProfileHeaderRemoved:function(event)
1190 {var profile=event.data;if(this._profile===profile){this.detach();this._profile. profileType().removeEventListener(WebInspector.HeapSnapshotProfileType.SnapshotR eceived,this._onReceiveSnapshot,this);this._profile.profileType().removeEventLis tener(WebInspector.ProfileType.Events.RemoveProfileHeader,this._onProfileHeaderR emoved,this);}else{this._updateControls();}},__proto__:WebInspector.VBox.prototy pe}
1058 WebInspector.HeapProfilerDispatcher=function() 1191 WebInspector.HeapProfilerDispatcher=function()
1059 {this._dispatchers=[];InspectorBackend.registerHeapProfilerDispatcher(this);} 1192 {this._dispatchers=[];InspectorBackend.registerHeapProfilerDispatcher(this);}
1060 WebInspector.HeapProfilerDispatcher.prototype={register:function(dispatcher) 1193 WebInspector.HeapProfilerDispatcher.prototype={register:function(dispatcher)
1061 {this._dispatchers.push(dispatcher);},_genericCaller:function(eventName) 1194 {this._dispatchers.push(dispatcher);},_genericCaller:function(eventName)
1062 {var args=Array.prototype.slice.call(arguments.callee.caller.arguments);for(var i=0;i<this._dispatchers.length;++i) 1195 {var args=Array.prototype.slice.call(arguments.callee.caller.arguments);for(var i=0;i<this._dispatchers.length;++i)
1063 this._dispatchers[i][eventName].apply(this._dispatchers[i],args);},heapStatsUpda te:function(samples) 1196 this._dispatchers[i][eventName].apply(this._dispatchers[i],args);},heapStatsUpda te:function(samples)
1064 {this._genericCaller("heapStatsUpdate");},lastSeenObjectId:function(lastSeenObje ctId,timestamp) 1197 {this._genericCaller("heapStatsUpdate");},lastSeenObjectId:function(lastSeenObje ctId,timestamp)
1065 {this._genericCaller("lastSeenObjectId");},addProfileHeader:function(profileHead er) 1198 {this._genericCaller("lastSeenObjectId");},addHeapSnapshotChunk:function(chunk)
1066 {this._genericCaller("addProfileHeader");},addHeapSnapshotChunk:function(uid,chu nk) 1199 {this._genericCaller("addHeapSnapshotChunk");},reportHeapSnapshotProgress:functi on(done,total,finished)
1067 {this._genericCaller("addHeapSnapshotChunk");},reportHeapSnapshotProgress:functi on(done,total)
1068 {this._genericCaller("reportHeapSnapshotProgress");},resetProfiles:function() 1200 {this._genericCaller("reportHeapSnapshotProgress");},resetProfiles:function()
1069 {this._genericCaller("resetProfiles");}} 1201 {this._genericCaller("resetProfiles");}}
1070 WebInspector.HeapProfilerDispatcher._dispatcher=new WebInspector.HeapProfilerDis patcher();WebInspector.HeapSnapshotProfileType=function() 1202 WebInspector.HeapProfilerDispatcher._dispatcher=new WebInspector.HeapProfilerDis patcher();WebInspector.HeapSnapshotProfileType=function(id,title)
1071 {WebInspector.ProfileType.call(this,WebInspector.HeapSnapshotProfileType.TypeId, WebInspector.UIString("Take Heap Snapshot"));WebInspector.HeapProfilerDispatcher ._dispatcher.register(this);} 1203 {WebInspector.ProfileType.call(this,id||WebInspector.HeapSnapshotProfileType.Typ eId,title||WebInspector.UIString("Take Heap Snapshot"));WebInspector.HeapProfile rDispatcher._dispatcher.register(this);}
1072 WebInspector.HeapSnapshotProfileType.TypeId="HEAP";WebInspector.HeapSnapshotProf ileType.SnapshotReceived="SnapshotReceived";WebInspector.HeapSnapshotProfileType .prototype={fileExtension:function() 1204 WebInspector.HeapSnapshotProfileType.TypeId="HEAP";WebInspector.HeapSnapshotProf ileType.SnapshotReceived="SnapshotReceived";WebInspector.HeapSnapshotProfileType .prototype={fileExtension:function()
1073 {return".heapsnapshot";},get buttonTooltip() 1205 {return".heapsnapshot";},get buttonTooltip()
1074 {return WebInspector.UIString("Take heap snapshot.");},isInstantProfile:function () 1206 {return WebInspector.UIString("Take heap snapshot.");},isInstantProfile:function ()
1075 {return true;},buttonClicked:function() 1207 {return true;},buttonClicked:function()
1076 {this._takeHeapSnapshot(function(){});WebInspector.userMetrics.ProfilesHeapProfi leTaken.record();return false;},heapStatsUpdate:function(samples) 1208 {this._takeHeapSnapshot(function(){});WebInspector.userMetrics.ProfilesHeapProfi leTaken.record();return false;},heapStatsUpdate:function(samples)
1077 {},lastSeenObjectId:function(lastSeenObjectId,timestamp) 1209 {},lastSeenObjectId:function(lastSeenObjectId,timestamp)
1078 {},get treeItemTitle() 1210 {},get treeItemTitle()
1079 {return WebInspector.UIString("HEAP SNAPSHOTS");},get description() 1211 {return WebInspector.UIString("HEAP SNAPSHOTS");},get description()
1080 {return WebInspector.UIString("Heap snapshot profiles show memory distribution a mong your page's JavaScript objects and related DOM nodes.");},createProfileLoad edFromFile:function(title) 1212 {return WebInspector.UIString("Heap snapshot profiles show memory distribution a mong your page's JavaScript objects and related DOM nodes.");},createProfileLoad edFromFile:function(title)
1081 {return new WebInspector.HeapProfileHeader(this,title);},_takeHeapSnapshot:funct ion(callback) 1213 {return new WebInspector.HeapProfileHeader(this,title);},_takeHeapSnapshot:funct ion(callback)
1082 {if(this.profileBeingRecorded()) 1214 {if(this.profileBeingRecorded())
1083 return;this._profileBeingRecorded=new WebInspector.HeapProfileHeader(this,WebIns pector.UIString("Snapshotting\u2026"));this.addProfile(this._profileBeingRecorde d);HeapProfilerAgent.takeHeapSnapshot(true,callback);},addProfileHeader:function (profileHeader) 1215 return;this._profileBeingRecorded=new WebInspector.HeapProfileHeader(this);this. addProfile(this._profileBeingRecorded);this._profileBeingRecorded.updateStatus(W ebInspector.UIString("Snapshotting\u2026"));function didTakeHeapSnapshot(error)
1216 {var profile=this._profileBeingRecorded;profile.title=WebInspector.UIString("Sna pshot %d",profile.uid);profile._finishLoad();this._profileBeingRecorded=null;Web Inspector.panels.profiles.showProfile(profile);callback();}
1217 HeapProfilerAgent.takeHeapSnapshot(true,didTakeHeapSnapshot.bind(this));},addHea pSnapshotChunk:function(chunk)
1218 {if(!this.profileBeingRecorded())
1219 return;this.profileBeingRecorded().transferChunk(chunk);},reportHeapSnapshotProg ress:function(done,total,finished)
1084 {var profile=this.profileBeingRecorded();if(!profile) 1220 {var profile=this.profileBeingRecorded();if(!profile)
1085 return;profile.title=profileHeader.title;profile.uid=profileHeader.uid;profile.m axJSObjectId=profileHeader.maxJSObjectId||0;profile.sidebarElement.mainTitle=pro file.title;profile.sidebarElement.subtitle="";profile.sidebarElement.wait=false; this._profileSamples=null;this._profileBeingRecorded=null;WebInspector.panels.pr ofiles._showProfile(profile);profile.existingView()._refreshView();},addHeapSnap shotChunk:function(uid,chunk) 1221 return;profile.updateStatus(WebInspector.UIString("%.0f%",(done/total)*100),true );if(finished)
1086 {var profile=this.getProfile(uid);if(profile) 1222 profile._prepareToLoad();},resetProfiles:function()
1087 profile.transferChunk(chunk);},reportHeapSnapshotProgress:function(done,total) 1223 {this._reset();},_snapshotReceived:function(profile)
1088 {var profile=this.profileBeingRecorded();if(!profile)
1089 return;profile.sidebarElement.subtitle=WebInspector.UIString("%.0f%",(done/total )*100);profile.sidebarElement.wait=true;},resetProfiles:function()
1090 {this._reset();},removeProfile:function(profile)
1091 {if(this._profileBeingRecorded!==profile&&!profile.fromFile())
1092 HeapProfilerAgent.removeProfile(profile.uid);WebInspector.ProfileType.prototype. removeProfile.call(this,profile);},_snapshotReceived:function(profile)
1093 {if(this._profileBeingRecorded===profile) 1224 {if(this._profileBeingRecorded===profile)
1094 this._profileBeingRecorded=null;this.dispatchEventToListeners(WebInspector.HeapS napshotProfileType.SnapshotReceived,profile);},__proto__:WebInspector.ProfileTyp e.prototype} 1225 this._profileBeingRecorded=null;this.dispatchEventToListeners(WebInspector.HeapS napshotProfileType.SnapshotReceived,profile);},__proto__:WebInspector.ProfileTyp e.prototype}
1095 WebInspector.TrackingHeapSnapshotProfileType=function(profilesPanel) 1226 WebInspector.TrackingHeapSnapshotProfileType=function()
1096 {WebInspector.ProfileType.call(this,WebInspector.TrackingHeapSnapshotProfileType .TypeId,WebInspector.UIString("Record Heap Allocations"));this._profilesPanel=pr ofilesPanel;WebInspector.HeapProfilerDispatcher._dispatcher.register(this);} 1227 {WebInspector.HeapSnapshotProfileType.call(this,WebInspector.TrackingHeapSnapsho tProfileType.TypeId,WebInspector.UIString("Record Heap Allocations"));}
1097 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) 1228 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)
1098 {if(!this._profileSamples) 1229 {if(!this._profileSamples)
1099 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]) 1230 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])
1100 this._profileSamples.max[index]=size;} 1231 this._profileSamples.max[index]=size;}},lastSeenObjectId:function(lastSeenObject Id,timestamp)
1101 this._lastUpdatedIndex=index;},lastSeenObjectId:function(lastSeenObjectId,timest amp)
1102 {var profileSamples=this._profileSamples;if(!profileSamples) 1232 {var profileSamples=this._profileSamples;if(!profileSamples)
1103 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;} 1233 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;}
1104 profileSamples.timestamps[currentIndex]=timestamp;if(profileSamples.totalTime<ti mestamp-profileSamples.timestamps[0]) 1234 profileSamples.timestamps[currentIndex]=timestamp;if(profileSamples.totalTime<ti mestamp-profileSamples.timestamps[0])
1105 profileSamples.totalTime*=2;this.dispatchEventToListeners(WebInspector.TrackingH eapSnapshotProfileType.HeapStatsUpdate,this._profileSamples);var profile=this._p rofileBeingRecorded;profile.sidebarElement.wait=true;if(profile.sidebarElement&& !profile.sidebarElement.wait) 1235 profileSamples.totalTime*=2;this.dispatchEventToListeners(WebInspector.TrackingH eapSnapshotProfileType.HeapStatsUpdate,this._profileSamples);this._profileBeingR ecorded.updateStatus(null,true);},hasTemporaryView:function()
1106 profile.sidebarElement.wait=true;},hasTemporaryView:function()
1107 {return true;},get buttonTooltip() 1236 {return true;},get buttonTooltip()
1108 {return this._recording?WebInspector.UIString("Stop recording heap profile."):We bInspector.UIString("Start recording heap profile.");},isInstantProfile:function () 1237 {return this._recording?WebInspector.UIString("Stop recording heap profile."):We bInspector.UIString("Start recording heap profile.");},isInstantProfile:function ()
1109 {return false;},buttonClicked:function() 1238 {return false;},buttonClicked:function()
1110 {return this._toggleRecording();},_startRecordingProfile:function() 1239 {return this._toggleRecording();},_startRecordingProfile:function()
1111 {if(this.profileBeingRecorded()) 1240 {if(this.profileBeingRecorded())
1112 return;this._profileBeingRecorded=new WebInspector.HeapProfileHeader(this,WebIns pector.UIString("Recording\u2026"));this._lastSeenIndex=-1;this._profileSamples= {'sizes':[],'ids':[],'timestamps':[],'max':[],'totalTime':30000};this._profileBe ingRecorded._profileSamples=this._profileSamples;this._recording=true;this.addPr ofile(this._profileBeingRecorded);HeapProfilerAgent.startTrackingHeapObjects();t his.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.Tracki ngStarted);},_stopRecordingProfile:function() 1241 return;this._addNewProfile();HeapProfilerAgent.startTrackingHeapObjects(WebInspe ctor.experimentsSettings.allocationProfiler.isEnabled());},_addNewProfile:functi on()
1113 {HeapProfilerAgent.stopTrackingHeapObjects(true);this._recording=false;this.disp atchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.TrackingStoppe d);},_toggleRecording:function() 1242 {this._profileBeingRecorded=new WebInspector.HeapProfileHeader(this);this._lastS eenIndex=-1;this._profileSamples={'sizes':[],'ids':[],'timestamps':[],'max':[],' totalTime':30000};this._profileBeingRecorded._profileSamples=this._profileSample s;this._recording=true;this.addProfile(this._profileBeingRecorded);this._profile BeingRecorded.updateStatus(WebInspector.UIString("Recording\u2026"));this.dispat chEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.TrackingStarted) ;},_stopRecordingProfile:function()
1243 {this._profileBeingRecorded.updateStatus(WebInspector.UIString("Snapshotting\u20 26"));function didTakeHeapSnapshot(error)
1244 {var profile=this._profileBeingRecorded;if(!profile)
1245 return;profile._finishLoad();this._profileSamples=null;this._profileBeingRecorde d=null;WebInspector.panels.profiles.showProfile(profile);}
1246 HeapProfilerAgent.stopTrackingHeapObjects(true,didTakeHeapSnapshot.bind(this));t his._recording=false;this.dispatchEventToListeners(WebInspector.TrackingHeapSnap shotProfileType.TrackingStopped);},_toggleRecording:function()
1114 {if(this._recording) 1247 {if(this._recording)
1115 this._stopRecordingProfile();else 1248 this._stopRecordingProfile();else
1116 this._startRecordingProfile();return this._recording;},get treeItemTitle() 1249 this._startRecordingProfile();return this._recording;},get treeItemTitle()
1117 {return WebInspector.UIString("HEAP TIMELINES");},get description() 1250 {return WebInspector.UIString("HEAP TIMELINES");},get description()
1118 {return WebInspector.UIString("Record JavaScript object allocations over time. U se this profile type to isolate memory leaks.");},_reset:function() 1251 {return WebInspector.UIString("Record JavaScript object allocations over time. U se this profile type to isolate memory leaks.");},resetProfiles:function()
1119 {WebInspector.HeapSnapshotProfileType.prototype._reset.call(this);if(this._recor ding) 1252 {var wasRecording=this._recording;this._profileBeingRecorded=null;WebInspector.H eapSnapshotProfileType.prototype.resetProfiles.call(this);this._profileSamples=n ull;this._lastSeenIndex=-1;if(wasRecording)
1120 this._stopRecordingProfile();this._profileSamples=null;this._lastSeenIndex=-1;}, removeProfile:function(profile) 1253 this._addNewProfile();},profileBeingRecordedRemoved:function()
1121 {if(this._profileBeingRecorded===profile){this._stopRecordingProfile();this._pro fileSamples=null;} 1254 {this._stopRecordingProfile();this._profileSamples=null;},__proto__:WebInspector .HeapSnapshotProfileType.prototype}
1122 WebInspector.HeapSnapshotProfileType.prototype.removeProfile.call(this,profile); },__proto__:WebInspector.HeapSnapshotProfileType.prototype} 1255 WebInspector.HeapProfileHeader=function(type,title)
1123 WebInspector.HeapProfileHeader=function(type,title,uid,maxJSObjectId) 1256 {WebInspector.ProfileHeader.call(this,type,title||WebInspector.UIString("Snapsho t %d",type._nextProfileUid));this.maxJSObjectId=-1;this._workerProxy=null;this._ receiver=null;this._snapshotProxy=null;this._loadCallbacks=[];this._totalNumberO fChunks=0;this._bufferedWriter=null;}
1124 {WebInspector.ProfileHeader.call(this,type,title,uid);this.maxJSObjectId=maxJSOb jectId;this._receiver=null;this._snapshotProxy=null;this._totalNumberOfChunks=0; this._transferHandler=null;this._bufferedWriter=null;}
1125 WebInspector.HeapProfileHeader.prototype={createSidebarTreeElement:function() 1257 WebInspector.HeapProfileHeader.prototype={createSidebarTreeElement:function()
1126 {return new WebInspector.ProfileSidebarTreeElement(this,"heap-snapshot-sidebar-t ree-item");},createView:function(profilesPanel) 1258 {return new WebInspector.ProfileSidebarTreeElement(this,"heap-snapshot-sidebar-t ree-item");},createView:function()
1127 {return new WebInspector.HeapSnapshotView(profilesPanel,this);},load:function(ca llback) 1259 {return new WebInspector.HeapSnapshotView(this);},load:function(callback)
1128 {if(this.uid===-1) 1260 {if(this.uid===-1)
1129 return;if(this._snapshotProxy){callback(this._snapshotProxy);return;} 1261 return;if(this._snapshotProxy){callback(this._snapshotProxy);return;}
1130 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();} 1262 this._loadCallbacks.push(callback);},_prepareToLoad:function()
1131 var loaderProxy=(this._receiver);console.assert(loaderProxy);loaderProxy.addCons umer(callback);},_transferSnapshot:function() 1263 {console.assert(!this._receiver,"Already loading");this._setupWorker();this.upda teStatus(WebInspector.UIString("Loading\u2026"),true);},_finishLoad:function()
1132 {function finishTransfer() 1264 {if(!this._wasDisposed)
1133 {if(this._transferHandler){this._transferHandler.finishTransfer();this._totalNum berOfChunks=this._transferHandler._totalNumberOfChunks;} 1265 this._receiver.close(function(){});if(this._bufferedWriter){this._bufferedWriter .close(this._didWriteToTempFile.bind(this));this._bufferedWriter=null;}},_didWri teToTempFile:function(tempFile)
1134 if(this._bufferedWriter){this._bufferedWriter.close(this._didWriteToTempFile.bin d(this));this._bufferedWriter=null;}} 1266 {if(this._wasDisposed){if(tempFile)
1135 HeapProfilerAgent.getHeapSnapshot(this.uid,finishTransfer.bind(this));},_didWrit eToTempFile:function(tempFile) 1267 tempFile.remove();return;}
1136 {this._tempFile=tempFile;if(!tempFile) 1268 this._tempFile=tempFile;if(!tempFile)
1137 this._failedToCreateTempFile=true;if(this._onTempFileReady){this._onTempFileRead y();this._onTempFileReady=null;}},snapshotConstructorName:function() 1269 this._failedToCreateTempFile=true;if(this._onTempFileReady){this._onTempFileRead y();this._onTempFileReady=null;}},_setupWorker:function()
1138 {return"JSHeapSnapshot";},snapshotProxyConstructor:function()
1139 {return WebInspector.HeapSnapshotProxy;},_setupWorker:function()
1140 {function setProfileWait(event) 1270 {function setProfileWait(event)
1141 {this.sidebarElement.wait=event.data;} 1271 {this.updateStatus(null,event.data);}
1142 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) 1272 console.assert(!this._workerProxy,"HeapSnapshotWorkerProxy already exists");this ._workerProxy=new WebInspector.HeapSnapshotWorkerProxy(this._handleWorkerEvent.b ind(this));this._workerProxy.addEventListener("wait",setProfileWait,this);this._ receiver=this._workerProxy.createLoader(this.uid,this._snapshotReceived.bind(thi s));},_handleWorkerEvent:function(eventName,data)
1143 {if(WebInspector.HeapSnapshotProgressEvent.Update!==eventName) 1273 {if(WebInspector.HeapSnapshotProgressEvent.Update!==eventName)
1144 return;this._updateSubtitle(data);},dispose:function() 1274 return;var subtitle=(data);this.updateStatus(subtitle);},dispose:function()
1145 {if(this._receiver) 1275 {if(this._workerProxy)
1146 this._receiver.close();else if(this._snapshotProxy) 1276 this._workerProxy.dispose();this.removeTempFile();this._wasDisposed=true;},_didC ompleteSnapshotTransfer:function()
1147 this._snapshotProxy.dispose();if(this._view){var view=this._view;this._view=null ;view.dispose();}
1148 this.removeTempFile();},_updateSubtitle:function(value)
1149 {this.sidebarElement.subtitle=value;},_didCompleteSnapshotTransfer:function()
1150 {if(!this._snapshotProxy) 1277 {if(!this._snapshotProxy)
1151 return;this.sidebarElement.subtitle=Number.bytesToString(this._snapshotProxy.tot alSize);this.sidebarElement.wait=false;},transferChunk:function(chunk) 1278 return;this.updateStatus(Number.bytesToString(this._snapshotProxy.totalSize),fal se);},transferChunk:function(chunk)
1152 {if(!this._bufferedWriter) 1279 {if(!this._bufferedWriter)
1153 this._bufferedWriter=new WebInspector.BufferedTempFileWriter("heap-profiler",thi s.uid);this._bufferedWriter.write(chunk);this._transferHandler.transferChunk(chu nk);},_snapshotReceived:function(snapshotProxy) 1280 this._bufferedWriter=new WebInspector.BufferedTempFileWriter("heap-profiler",thi s.uid);this._bufferedWriter.write(chunk);++this._totalNumberOfChunks;this._recei ver.write(chunk,function(){});},_snapshotReceived:function(snapshotProxy)
1154 {this._receiver=null;if(snapshotProxy) 1281 {if(this._wasDisposed)
1155 this._snapshotProxy=snapshotProxy;this._didCompleteSnapshotTransfer();var worker =(this._snapshotProxy.worker);worker.startCheckingForLongRunningCalls();this.not ifySnapshotReceived();function didGetMaxNodeId(id) 1282 return;this._receiver=null;this._snapshotProxy=snapshotProxy;this.maxJSObjectId= snapshotProxy.maxJSObjectId();this._didCompleteSnapshotTransfer();this._workerPr oxy.startCheckingForLongRunningCalls();this.notifySnapshotReceived();},notifySna pshotReceived:function()
1156 {this.maxJSObjectId=id;} 1283 {for(var i=0;i<this._loadCallbacks.length;i++)
1157 if(this.fromFile()) 1284 this._loadCallbacks[i](this._snapshotProxy);this._loadCallbacks=null;this._profi leType._snapshotReceived(this);if(this.canSaveToFile())
1158 snapshotProxy.maxJsNodeId(didGetMaxNodeId.bind(this));},notifySnapshotReceived:f unction() 1285 this.dispatchEventToListeners(WebInspector.ProfileHeader.Events.ProfileReceived) ;},_wasShown:function()
1159 {this._profileType._snapshotReceived(this);},_wasShown:function()
1160 {},canSaveToFile:function() 1286 {},canSaveToFile:function()
1161 {return!this.fromFile()&&!this._bufferedWriter&&!this._failedToCreateTempFile;}, saveToFile:function() 1287 {return!this.fromFile()&&this._snapshotProxy;},saveToFile:function()
1162 {var fileOutputStream=new WebInspector.FileOutputStream();function onOpen(accept ed) 1288 {var fileOutputStream=new WebInspector.FileOutputStream();function onOpen(accept ed)
1163 {if(!accepted) 1289 {if(!accepted)
1164 return;if(this._failedToCreateTempFile){WebInspector.log("Failed to open temp fi le with heap snapshot",WebInspector.ConsoleMessage.MessageLevel.Error);fileOutpu tStream.close();}else if(this._tempFile){var delegate=new WebInspector.SaveSnaps hotOutputStreamDelegate(this);this._tempFile.writeToOutputSteam(fileOutputStream ,delegate);}else{this._onTempFileReady=onOpen.bind(this,accepted);this._updateSa veProgress(0,1);}} 1290 return;if(this._failedToCreateTempFile){WebInspector.console.log("Failed to open temp file with heap snapshot",WebInspector.ConsoleMessage.MessageLevel.Error);f ileOutputStream.close();}else if(this._tempFile){var delegate=new WebInspector.S aveSnapshotOutputStreamDelegate(this);this._tempFile.writeToOutputSteam(fileOutp utStream,delegate);}else{this._onTempFileReady=onOpen.bind(this,accepted);this._ updateSaveProgress(0,1);}}
1165 this._fileName=this._fileName||"Heap-"+new Date().toISO8601Compact()+this._profi leType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));} ,_updateSaveProgress:function(value,total) 1291 this._fileName=this._fileName||"Heap-"+new Date().toISO8601Compact()+this._profi leType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));} ,_updateSaveProgress:function(value,total)
1166 {var percentValue=((total?(value/total):0)*100).toFixed(0);this._updateSubtitle( WebInspector.UIString("Saving\u2026 %d\%",percentValue));},loadFromFile:function (file) 1292 {var percentValue=((total?(value/total):0)*100).toFixed(0);this.updateStatus(Web Inspector.UIString("Saving\u2026 %d\%",percentValue));},loadFromFile:function(fi le)
1167 {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) 1293 {this.updateStatus(WebInspector.UIString("Loading\u2026"),true);this._setupWorke r();var delegate=new WebInspector.HeapSnapshotLoadFromFileDelegate(this);var fil eReader=this._createFileReader(file,delegate);fileReader.start(this._receiver);} ,_createFileReader:function(file,delegate)
1168 {return new WebInspector.ChunkedFileReader(file,10000000,delegate);},__proto__:W ebInspector.ProfileHeader.prototype} 1294 {return new WebInspector.ChunkedFileReader(file,10000000,delegate);},__proto__:W ebInspector.ProfileHeader.prototype}
1169 WebInspector.SnapshotTransferHandler=function(header,title)
1170 {this._numberOfChunks=0;this._savedChunks=0;this._header=header;this._totalNumbe rOfChunks=0;this._title=title;}
1171 WebInspector.SnapshotTransferHandler.prototype={transferChunk:function(chunk)
1172 {++this._numberOfChunks;this._header._receiver.write(chunk,this._didTransferChun k.bind(this));},finishTransfer:function()
1173 {},_didTransferChunk:function()
1174 {this._updateProgress(++this._savedChunks,this._totalNumberOfChunks);},_updatePr ogress:function(value,total)
1175 {}}
1176 WebInspector.BackendSnapshotLoader=function(header)
1177 {WebInspector.SnapshotTransferHandler.call(this,header,"Loading\u2026 %d\%");}
1178 WebInspector.BackendSnapshotLoader.prototype={finishTransfer:function()
1179 {this._header._receiver.close(this._didFinishTransfer.bind(this));this._header._ receiver=null;this._totalNumberOfChunks=this._numberOfChunks;},_didFinishTransfe r:function()
1180 {console.assert(this._totalNumberOfChunks===this._savedChunks,"Not all chunks we re transfered.");},__proto__:WebInspector.SnapshotTransferHandler.prototype}
1181 WebInspector.HeapSnapshotLoadFromFileDelegate=function(snapshotHeader) 1295 WebInspector.HeapSnapshotLoadFromFileDelegate=function(snapshotHeader)
1182 {this._snapshotHeader=snapshotHeader;} 1296 {this._snapshotHeader=snapshotHeader;}
1183 WebInspector.HeapSnapshotLoadFromFileDelegate.prototype={onTransferStarted:funct ion() 1297 WebInspector.HeapSnapshotLoadFromFileDelegate.prototype={onTransferStarted:funct ion()
1184 {},onChunkTransferred:function(reader) 1298 {},onChunkTransferred:function(reader)
1185 {},onTransferFinished:function() 1299 {},onTransferFinished:function()
1186 {},onError:function(reader,e) 1300 {},onError:function(reader,e)
1187 {switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:this._snapshotHea der._updateSubtitle(WebInspector.UIString("'%s' not found.",reader.fileName())); break;case e.target.error.NOT_READABLE_ERR:this._snapshotHeader._updateSubtitle( WebInspector.UIString("'%s' is not readable",reader.fileName()));break;case e.ta rget.error.ABORT_ERR:break;default:this._snapshotHeader._updateSubtitle(WebInspe ctor.UIString("'%s' error %d",reader.fileName(),e.target.error.code));}}} 1301 {var subtitle;switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:subt itle=WebInspector.UIString("'%s' not found.",reader.fileName());break;case e.tar get.error.NOT_READABLE_ERR:subtitle=WebInspector.UIString("'%s' is not readable" ,reader.fileName());break;case e.target.error.ABORT_ERR:return;default:subtitle= WebInspector.UIString("'%s' error %d",reader.fileName(),e.target.error.code);}
1302 this._snapshotHeader.updateStatus(subtitle);}}
1188 WebInspector.SaveSnapshotOutputStreamDelegate=function(profileHeader) 1303 WebInspector.SaveSnapshotOutputStreamDelegate=function(profileHeader)
1189 {this._profileHeader=profileHeader;} 1304 {this._profileHeader=profileHeader;}
1190 WebInspector.SaveSnapshotOutputStreamDelegate.prototype={onTransferStarted:funct ion() 1305 WebInspector.SaveSnapshotOutputStreamDelegate.prototype={onTransferStarted:funct ion()
1191 {this._profileHeader._updateSaveProgress(0,1);},onTransferFinished:function() 1306 {this._profileHeader._updateSaveProgress(0,1);},onTransferFinished:function()
1192 {this._profileHeader._didCompleteSnapshotTransfer();},onChunkTransferred:functio n(reader) 1307 {this._profileHeader._didCompleteSnapshotTransfer();},onChunkTransferred:functio n(reader)
1193 {this._profileHeader._updateSaveProgress(reader.loadedSize(),reader.fileSize()); },onError:function(reader,event) 1308 {this._profileHeader._updateSaveProgress(reader.loadedSize(),reader.fileSize()); },onError:function(reader,event)
1194 {WebInspector.log("Failed to read heap snapshot from temp file: "+event.message, WebInspector.ConsoleMessage.MessageLevel.Error);this.onTransferFinished();}} 1309 {WebInspector.console.log("Failed to read heap snapshot from temp file: "+event. message,WebInspector.ConsoleMessage.MessageLevel.Error);this.onTransferFinished( );}}
1195 WebInspector.HeapTrackingOverviewGrid=function(heapProfileHeader) 1310 WebInspector.HeapTrackingOverviewGrid=function(heapProfileHeader)
1196 {WebInspector.View.call(this);this.registerRequiredCSS("flameChart.css");this.el ement.id="heap-recording-view";this._overviewContainer=this.element.createChild( "div","overview-container");this._overviewGrid=new WebInspector.OverviewGrid("he ap-recording");this._overviewGrid.element.classList.add("fill");this._overviewCa nvas=this._overviewContainer.createChild("canvas","heap-recording-overview-canva s");this._overviewContainer.appendChild(this._overviewGrid.element);this._overvi ewCalculator=new WebInspector.HeapTrackingOverviewGrid.OverviewCalculator();this ._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,t his._onWindowChanged,this);this._profileSamples=heapProfileHeader._profileSample s;if(heapProfileHeader.profileType().profileBeingRecorded()===heapProfileHeader) {this._profileType=heapProfileHeader._profileType;this._profileType.addEventList ener(WebInspector.TrackingHeapSnapshotProfileType.HeapStatsUpdate,this._onHeapSt atsUpdate,this);this._profileType.addEventListener(WebInspector.TrackingHeapSnap shotProfileType.TrackingStopped,this._onStopTracking,this);} 1311 {WebInspector.VBox.call(this);this.registerRequiredCSS("flameChart.css");this.el ement.id="heap-recording-view";this.element.classList.add("heap-tracking-overvie w");this._overviewContainer=this.element.createChild("div","overview-container") ;this._overviewGrid=new WebInspector.OverviewGrid("heap-recording");this._overvi ewGrid.element.classList.add("fill");this._overviewCanvas=this._overviewContaine r.createChild("canvas","heap-recording-overview-canvas");this._overviewContainer .appendChild(this._overviewGrid.element);this._overviewCalculator=new WebInspect or.HeapTrackingOverviewGrid.OverviewCalculator();this._overviewGrid.addEventList ener(WebInspector.OverviewGrid.Events.WindowChanged,this._onWindowChanged,this); this._profileSamples=heapProfileHeader._profileSamples;if(heapProfileHeader.prof ileType().profileBeingRecorded()===heapProfileHeader){this._profileType=heapProf ileHeader._profileType;this._profileType.addEventListener(WebInspector.TrackingH eapSnapshotProfileType.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profi leType.addEventListener(WebInspector.TrackingHeapSnapshotProfileType.TrackingSto pped,this._onStopTracking,this);}
1197 var timestamps=this._profileSamples.timestamps;var totalTime=this._profileSample s.totalTime;this._windowLeft=0.0;this._windowRight=totalTime&&timestamps.length? (timestamps[timestamps.length-1]-timestamps[0])/totalTime:1.0;this._overviewGrid .setWindow(this._windowLeft,this._windowRight);this._yScale=new WebInspector.Hea pTrackingOverviewGrid.SmoothScale();this._xScale=new WebInspector.HeapTrackingOv erviewGrid.SmoothScale();} 1312 var timestamps=this._profileSamples.timestamps;var totalTime=this._profileSample s.totalTime;this._windowLeft=0.0;this._windowRight=totalTime&&timestamps.length? (timestamps[timestamps.length-1]-timestamps[0])/totalTime:1.0;this._overviewGrid .setWindow(this._windowLeft,this._windowRight);this._yScale=new WebInspector.Hea pTrackingOverviewGrid.SmoothScale();this._xScale=new WebInspector.HeapTrackingOv erviewGrid.SmoothScale();}
1198 WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged="IdsRangeChanged";WebInspe ctor.HeapTrackingOverviewGrid.prototype={_onStopTracking:function(event) 1313 WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged="IdsRangeChanged";WebInspe ctor.HeapTrackingOverviewGrid.prototype={_onStopTracking:function(event)
1199 {this._profileType.removeEventListener(WebInspector.TrackingHeapSnapshotProfileT ype.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.removeEventL istener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onSto pTracking,this);},_onHeapStatsUpdate:function(event) 1314 {this._profileType.removeEventListener(WebInspector.TrackingHeapSnapshotProfileT ype.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.removeEventL istener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onSto pTracking,this);},_onHeapStatsUpdate:function(event)
1200 {this._profileSamples=event.data;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height) 1315 {this._profileSamples=event.data;this._scheduleUpdate();},_drawOverviewCanvas:fu nction(width,height)
1201 {if(!this._profileSamples) 1316 {if(!this._profileSamples)
1202 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) 1317 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)
1203 {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) 1318 {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)
1204 callback(currentX,size);size=0;currentX=x;} 1319 callback(currentX,size);size=0;currentX=x;}
1205 size+=sizes[i];} 1320 size+=sizes[i];}
1206 callback(currentX,size);} 1321 callback(currentX,size);}
1207 function maxSizeCallback(x,size) 1322 function maxSizeCallback(x,size)
1208 {maxSize=Math.max(maxSize,size);} 1323 {maxSize=Math.max(maxSize,size);}
1209 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) 1324 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)
1210 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();} 1325 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();}
1211 function drawBarCallback(x,size) 1326 function drawBarCallback(x,size)
1212 {context.moveTo(x,height-1);context.lineTo(x,Math.round(height-size*yScaleFactor -1));} 1327 {context.moveTo(x,height-1);context.lineTo(x,Math.round(height-size*yScaleFactor -1));}
1213 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() 1328 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()
1214 {this._updateOverviewCanvas=true;this._scheduleUpdate();},_onWindowChanged:funct ion() 1329 {this._updateOverviewCanvas=true;this._scheduleUpdate();},_onWindowChanged:funct ion()
1215 {if(!this._updateGridTimerId) 1330 {if(!this._updateGridTimerId)
1216 this._updateGridTimerId=setTimeout(this._updateGrid.bind(this),10);},_scheduleUp date:function() 1331 this._updateGridTimerId=setTimeout(this._updateGrid.bind(this),10);},_scheduleUp date:function()
1217 {if(this._updateTimerId) 1332 {if(this._updateTimerId)
1218 return;this._updateTimerId=setTimeout(this.update.bind(this),10);},_updateBounda ries:function() 1333 return;this._updateTimerId=setTimeout(this.update.bind(this),10);},_updateBounda ries:function()
1219 {this._windowLeft=this._overviewGrid.windowLeft();this._windowRight=this._overvi ewGrid.windowRight();this._windowWidth=this._windowRight-this._windowLeft;},upda te:function() 1334 {this._windowLeft=this._overviewGrid.windowLeft();this._windowRight=this._overvi ewGrid.windowRight();this._windowWidth=this._windowRight-this._windowLeft;},upda te:function()
1220 {this._updateTimerId=null;if(!this.isShowing()) 1335 {this._updateTimerId=null;if(!this.isShowing())
1221 return;this._updateBoundaries();this._overviewCalculator._updateBoundaries(this) ;this._overviewGrid.updateDividers(this._overviewCalculator);this._drawOverviewC anvas(this._overviewContainer.clientWidth,this._overviewContainer.clientHeight-2 0);},_updateGrid:function() 1336 return;this._updateBoundaries();this._overviewCalculator._updateBoundaries(this) ;this._overviewGrid.updateDividers(this._overviewCalculator);this._drawOverviewC anvas(this._overviewContainer.clientWidth,this._overviewContainer.clientHeight-2 0);},_updateGrid:function()
1222 {this._updateGridTimerId=0;this._updateBoundaries();var ids=this._profileSamples .ids;var timestamps=this._profileSamples.timestamps;var sizes=this._profileSampl es.sizes;var startTime=timestamps[0];var totalTime=this._profileSamples.totalTim e;var timeLeft=startTime+totalTime*this._windowLeft;var timeRight=startTime+tota lTime*this._windowRight;var minId=0;var maxId=ids[ids.length-1]+1;var size=0;for (var i=0;i<timestamps.length;++i){if(!timestamps[i]) 1337 {this._updateGridTimerId=0;this._updateBoundaries();var ids=this._profileSamples .ids;var timestamps=this._profileSamples.timestamps;var sizes=this._profileSampl es.sizes;var startTime=timestamps[0];var totalTime=this._profileSamples.totalTim e;var timeLeft=startTime+totalTime*this._windowLeft;var timeRight=startTime+tota lTime*this._windowRight;var minId=0;var maxId=ids[ids.length-1]+1;var size=0;for (var i=0;i<timestamps.length;++i){if(!timestamps[i])
1223 continue;if(timestamps[i]>timeRight) 1338 continue;if(timestamps[i]>timeRight)
1224 break;maxId=ids[i];if(timestamps[i]<timeLeft){minId=ids[i];continue;} 1339 break;maxId=ids[i];if(timestamps[i]<timeLeft){minId=ids[i];continue;}
1225 size+=sizes[i];} 1340 size+=sizes[i];}
1226 this.dispatchEventToListeners(WebInspector.HeapTrackingOverviewGrid.IdsRangeChan ged,{minId:minId,maxId:maxId,size:size});},__proto__:WebInspector.View.prototype } 1341 this.dispatchEventToListeners(WebInspector.HeapTrackingOverviewGrid.IdsRangeChan ged,{minId:minId,maxId:maxId,size:size});},__proto__:WebInspector.VBox.prototype }
1227 WebInspector.HeapTrackingOverviewGrid.SmoothScale=function() 1342 WebInspector.HeapTrackingOverviewGrid.SmoothScale=function()
1228 {this._lastUpdate=0;this._currentScale=0.0;} 1343 {this._lastUpdate=0;this._currentScale=0.0;}
1229 WebInspector.HeapTrackingOverviewGrid.SmoothScale.prototype={nextScale:function( target){target=target||this._currentScale;if(this._currentScale){var now=Date.no w();var timeDeltaMs=now-this._lastUpdate;this._lastUpdate=now;var maxChangePerSe c=20;var maxChangePerDelta=Math.pow(maxChangePerSec,timeDeltaMs/1000);var scaleC hange=target/this._currentScale;this._currentScale*=Number.constrain(scaleChange ,1/maxChangePerDelta,maxChangePerDelta);}else 1344 WebInspector.HeapTrackingOverviewGrid.SmoothScale.prototype={nextScale:function( target){target=target||this._currentScale;if(this._currentScale){var now=Date.no w();var timeDeltaMs=now-this._lastUpdate;this._lastUpdate=now;var maxChangePerSe c=20;var maxChangePerDelta=Math.pow(maxChangePerSec,timeDeltaMs/1000);var scaleC hange=target/this._currentScale;this._currentScale*=Number.constrain(scaleChange ,1/maxChangePerDelta,maxChangePerDelta);}else
1230 this._currentScale=target;return this._currentScale;}} 1345 this._currentScale=target;return this._currentScale;}}
1231 WebInspector.HeapTrackingOverviewGrid.OverviewCalculator=function() 1346 WebInspector.HeapTrackingOverviewGrid.OverviewCalculator=function()
1232 {} 1347 {}
1233 WebInspector.HeapTrackingOverviewGrid.OverviewCalculator.prototype={_updateBound aries:function(chart) 1348 WebInspector.HeapTrackingOverviewGrid.OverviewCalculator.prototype={paddingLeft: function()
1349 {return 0;},_updateBoundaries:function(chart)
1234 {this._minimumBoundaries=0;this._maximumBoundaries=chart._profileSamples.totalTi me;this._xScaleFactor=chart._overviewContainer.clientWidth/this._maximumBoundari es;},computePosition:function(time) 1350 {this._minimumBoundaries=0;this._maximumBoundaries=chart._profileSamples.totalTi me;this._xScaleFactor=chart._overviewContainer.clientWidth/this._maximumBoundari es;},computePosition:function(time)
1235 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue,hires) 1351 {return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(v alue,precision)
1236 {return Number.secondsToString((value+this._minimumBoundaries)/1000,hires);},max imumBoundary:function() 1352 {return Number.secondsToString(value/1000,!!precision);},maximumBoundary:functio n()
1237 {return this._maximumBoundaries;},minimumBoundary:function() 1353 {return this._maximumBoundaries;},minimumBoundary:function()
1238 {return this._minimumBoundaries;},zeroTime:function() 1354 {return this._minimumBoundaries;},zeroTime:function()
1239 {return this._minimumBoundaries;},boundarySpan:function() 1355 {return this._minimumBoundaries;},boundarySpan:function()
1240 {return this._maximumBoundaries-this._minimumBoundaries;}};WebInspector.ProfileL auncherView=function(profilesPanel) 1356 {return this._maximumBoundaries-this._minimumBoundaries;}}
1241 {WebInspector.View.call(this);this._panel=profilesPanel;this.element.classList.a dd("profile-launcher-view");this.element.classList.add("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) ;} 1357 WebInspector.HeapSnapshotStatisticsView=function()
1358 {WebInspector.VBox.call(this);this.setMinimumSize(50,25);this._pieChart=new WebI nspector.PieChart();this._pieChart.setSize(150);this.element.appendChild(this._p ieChart.element);this._labels=this.element.createChild("div","heap-snapshot-stat s-legend");}
1359 WebInspector.HeapSnapshotStatisticsView.prototype={setTotal:function(value)
1360 {this._pieChart.setTotal(value);},addRecord:function(value,name,color)
1361 {if(color)
1362 this._pieChart.addSlice(value,color);var node=this._labels.createChild("div");va r swatchDiv=node.createChild("div","heap-snapshot-stats-swatch");var nameDiv=nod e.createChild("div","heap-snapshot-stats-name");var sizeDiv=node.createChild("di v","heap-snapshot-stats-size");if(color)
1363 swatchDiv.style.backgroundColor=color;else
1364 swatchDiv.classList.add("heap-snapshot-stats-empty-swatch");nameDiv.textContent= name;sizeDiv.textContent=WebInspector.UIString("%s KB",Number.withThousandsSepar ator(Math.round(value/1024)));},__proto__:WebInspector.VBox.prototype};WebInspec tor.ProfileLauncherView=function(profilesPanel)
1365 {WebInspector.VBox.call(this);this._panel=profilesPanel;this.element.classList.a dd("profile-launcher-view");this.element.classList.add("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) ;this._loadButton=this._contentElement.createChild("button","load-profile");this ._loadButton.textContent=WebInspector.UIString("Load");this._loadButton.addEvent Listener("click",this._loadButtonClicked.bind(this),false);}
1242 WebInspector.ProfileLauncherView.prototype={addProfileType:function(profileType) 1366 WebInspector.ProfileLauncherView.prototype={addProfileType:function(profileType)
1243 {var descriptionElement=this._innerContentElement.createChild("h1");descriptionE lement.textContent=profileType.description;var decorationElement=profileType.dec orationElement();if(decorationElement) 1367 {var descriptionElement=this._innerContentElement.createChild("h1");descriptionE lement.textContent=profileType.description;var decorationElement=profileType.dec orationElement();if(decorationElement)
1244 this._innerContentElement.appendChild(decorationElement);this._isInstantProfile= profileType.isInstantProfile();this._isEnabled=profileType.isEnabled();this._pro fileTypeId=profileType.id;},_controlButtonClicked:function() 1368 this._innerContentElement.appendChild(decorationElement);this._isInstantProfile= profileType.isInstantProfile();this._isEnabled=profileType.isEnabled();this._pro fileTypeId=profileType.id;},_controlButtonClicked:function()
1245 {this._panel.toggleRecordButton();},_updateControls:function() 1369 {this._panel.toggleRecordButton();},_loadButtonClicked:function()
1370 {this._panel.showLoadFromFileDialog();},_updateControls:function()
1246 {if(this._isEnabled) 1371 {if(this._isEnabled)
1247 this._controlButton.removeAttribute("disabled");else 1372 this._controlButton.removeAttribute("disabled");else
1248 this._controlButton.setAttribute("disabled","");if(this._isInstantProfile){this. _controlButton.classList.remove("running");this._controlButton.textContent=WebIn spector.UIString("Take Snapshot");}else if(this._isProfiling){this._controlButto n.classList.add("running");this._controlButton.textContent=WebInspector.UIString ("Stop");}else{this._controlButton.classList.remove("running");this._controlButt on.textContent=WebInspector.UIString("Start");}},profileStarted:function() 1373 this._controlButton.setAttribute("disabled","");if(this._isInstantProfile){this. _controlButton.classList.remove("running");this._controlButton.textContent=WebIn spector.UIString("Take Snapshot");}else if(this._isProfiling){this._controlButto n.classList.add("running");this._controlButton.textContent=WebInspector.UIString ("Stop");}else{this._controlButton.classList.remove("running");this._controlButt on.textContent=WebInspector.UIString("Start");}},profileStarted:function()
1249 {this._isProfiling=true;this._updateControls();},profileFinished:function() 1374 {this._isProfiling=true;this._updateControls();},profileFinished:function()
1250 {this._isProfiling=false;this._updateControls();},updateProfileType:function(pro fileType) 1375 {this._isProfiling=false;this._updateControls();},updateProfileType:function(pro fileType)
1251 {this._isInstantProfile=profileType.isInstantProfile();this._isEnabled=profileTy pe.isEnabled();this._profileTypeId=profileType.id;this._updateControls();},__pro to__:WebInspector.View.prototype} 1376 {this._isInstantProfile=profileType.isInstantProfile();this._isEnabled=profileTy pe.isEnabled();this._profileTypeId=profileType.id;this._updateControls();},__pro to__:WebInspector.VBox.prototype}
1252 WebInspector.MultiProfileLauncherView=function(profilesPanel) 1377 WebInspector.MultiProfileLauncherView=function(profilesPanel)
1253 {WebInspector.ProfileLauncherView.call(this,profilesPanel);WebInspector.settings .selectedProfileType=WebInspector.settings.createSetting("selectedProfileType"," CPU");var header=this._innerContentElement.createChild("h1");header.textContent= WebInspector.UIString("Select profiling type");this._profileTypeSelectorForm=thi s._innerContentElement.createChild("form");this._innerContentElement.createChild ("div","flexible-space");this._typeIdToOptionElement={};} 1378 {WebInspector.ProfileLauncherView.call(this,profilesPanel);WebInspector.settings .selectedProfileType=WebInspector.settings.createSetting("selectedProfileType"," CPU");var header=this._innerContentElement.createChild("h1");header.textContent= WebInspector.UIString("Select profiling type");this._profileTypeSelectorForm=thi s._innerContentElement.createChild("form");this._innerContentElement.createChild ("div","flexible-space");this._typeIdToOptionElement={};}
1254 WebInspector.MultiProfileLauncherView.EventTypes={ProfileTypeSelected:"profile-t ype-selected"} 1379 WebInspector.MultiProfileLauncherView.EventTypes={ProfileTypeSelected:"profile-t ype-selected"}
1255 WebInspector.MultiProfileLauncherView.prototype={addProfileType:function(profile Type) 1380 WebInspector.MultiProfileLauncherView.prototype={addProfileType:function(profile Type)
1256 {var labelElement=this._profileTypeSelectorForm.createChild("label");labelElemen t.textContent=profileType.name;var optionElement=document.createElement("input") ;labelElement.insertBefore(optionElement,labelElement.firstChild);this._typeIdTo OptionElement[profileType.id]=optionElement;optionElement.type="radio";optionEle ment.name="profile-type";optionElement.style.hidden=true;optionElement.addEventL istener("change",this._profileTypeChanged.bind(this,profileType),false);var desc riptionElement=labelElement.createChild("p");descriptionElement.textContent=prof ileType.description;var decorationElement=profileType.decorationElement();if(dec orationElement) 1381 {var labelElement=this._profileTypeSelectorForm.createChild("label");labelElemen t.textContent=profileType.name;var optionElement=document.createElement("input") ;labelElement.insertBefore(optionElement,labelElement.firstChild);this._typeIdTo OptionElement[profileType.id]=optionElement;optionElement._profileType=profileTy pe;optionElement.type="radio";optionElement.name="profile-type";optionElement.st yle.hidden=true;optionElement.addEventListener("change",this._profileTypeChanged .bind(this,profileType),false);var descriptionElement=labelElement.createChild(" p");descriptionElement.textContent=profileType.description;var decorationElement =profileType.decorationElement();if(decorationElement)
1257 labelElement.appendChild(decorationElement);},restoreSelectedProfileType:functio n() 1382 labelElement.appendChild(decorationElement);},restoreSelectedProfileType:functio n()
1258 {var typeName=WebInspector.settings.selectedProfileType.get();if(!(typeName in t his._typeIdToOptionElement)) 1383 {var typeId=WebInspector.settings.selectedProfileType.get();if(!(typeId in this. _typeIdToOptionElement))
1259 typeName=Object.keys(this._typeIdToOptionElement)[0];this._typeIdToOptionElement [typeName].checked=true;this.dispatchEventToListeners(WebInspector.MultiProfileL auncherView.EventTypes.ProfileTypeSelected,this._panel.getProfileType(typeName)) ;},_controlButtonClicked:function() 1384 typeId=Object.keys(this._typeIdToOptionElement)[0];this._typeIdToOptionElement[t ypeId].checked=true;var type=this._typeIdToOptionElement[typeId]._profileType;th is.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes.Pro fileTypeSelected,type);},_controlButtonClicked:function()
1260 {this._panel.toggleRecordButton();},_updateControls:function() 1385 {this._panel.toggleRecordButton();},_updateControls:function()
1261 {WebInspector.ProfileLauncherView.prototype._updateControls.call(this);var items =this._profileTypeSelectorForm.elements;for(var i=0;i<items.length;++i){if(items [i].type==="radio") 1386 {WebInspector.ProfileLauncherView.prototype._updateControls.call(this);var items =this._profileTypeSelectorForm.elements;for(var i=0;i<items.length;++i){if(items [i].type==="radio")
1262 items[i].disabled=this._isProfiling;}},_profileTypeChanged:function(profileType, event) 1387 items[i].disabled=this._isProfiling;}},_profileTypeChanged:function(profileType, event)
1263 {this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes. ProfileTypeSelected,profileType);this._isInstantProfile=profileType.isInstantPro file();this._isEnabled=profileType.isEnabled();this._profileTypeId=profileType.i d;this._updateControls();WebInspector.settings.selectedProfileType.set(profileTy pe.id);},profileStarted:function() 1388 {this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes. ProfileTypeSelected,profileType);this._isInstantProfile=profileType.isInstantPro file();this._isEnabled=profileType.isEnabled();this._profileTypeId=profileType.i d;this._updateControls();WebInspector.settings.selectedProfileType.set(profileTy pe.id);},profileStarted:function()
1264 {this._isProfiling=true;this._updateControls();},profileFinished:function() 1389 {this._isProfiling=true;this._updateControls();},profileFinished:function()
1265 {this._isProfiling=false;this._updateControls();},__proto__:WebInspector.Profile LauncherView.prototype};WebInspector.TopDownProfileDataGridNode=function(profile Node,owningTree) 1390 {this._isProfiling=false;this._updateControls();},__proto__:WebInspector.Profile LauncherView.prototype};WebInspector.TopDownProfileDataGridNode=function(profile Node,owningTree)
1266 {var hasChildren=!!(profileNode.children&&profileNode.children.length);WebInspec tor.ProfileDataGridNode.call(this,profileNode,owningTree,hasChildren);this._rema iningChildren=profileNode.children;} 1391 {var hasChildren=!!(profileNode.children&&profileNode.children.length);WebInspec tor.ProfileDataGridNode.call(this,profileNode,owningTree,hasChildren);this._rema iningChildren=profileNode.children;}
1267 WebInspector.TopDownProfileDataGridNode.prototype={_sharedPopulate:function() 1392 WebInspector.TopDownProfileDataGridNode.prototype={_sharedPopulate:function()
1268 {var children=this._remainingChildren;var childrenLength=children.length;for(var i=0;i<childrenLength;++i) 1393 {var children=this._remainingChildren;var childrenLength=children.length;for(var i=0;i<childrenLength;++i)
1269 this.appendChild(new WebInspector.TopDownProfileDataGridNode(children[i],this.tr ee));this._remainingChildren=null;},_exclude:function(aCallUID) 1394 this.appendChild(new WebInspector.TopDownProfileDataGridNode(children[i],this.tr ee));this._remainingChildren=null;},_exclude:function(aCallUID)
1270 {if(this._remainingChildren) 1395 {if(this._remainingChildren)
1271 this.populate();this._save();var children=this.children;var index=this.children. length;while(index--) 1396 this.populate();this._save();var children=this.children;var index=this.children. length;while(index--)
1272 children[index]._exclude(aCallUID);var child=this.childrenByCallUID[aCallUID];if (child) 1397 children[index]._exclude(aCallUID);var child=this.childrenByCallUID[aCallUID];if (child)
1273 this._merge(child,true);},__proto__:WebInspector.ProfileDataGridNode.prototype} 1398 this._merge(child,true);},__proto__:WebInspector.ProfileDataGridNode.prototype}
1274 WebInspector.TopDownProfileDataGridTree=function(profileView,rootProfileNode) 1399 WebInspector.TopDownProfileDataGridTree=function(profileView,rootProfileNode)
1275 {WebInspector.ProfileDataGridTree.call(this,profileView,rootProfileNode);this._r emainingChildren=rootProfileNode.children;var any=(this);var node=(any);WebInspe ctor.TopDownProfileDataGridNode.prototype.populate.call(node);} 1400 {WebInspector.ProfileDataGridTree.call(this,profileView,rootProfileNode);this._r emainingChildren=rootProfileNode.children;var any=(this);var node=(any);WebInspe ctor.TopDownProfileDataGridNode.prototype.populate.call(node);}
1276 WebInspector.TopDownProfileDataGridTree.prototype={focus:function(profileDataGri dNode) 1401 WebInspector.TopDownProfileDataGridTree.prototype={focus:function(profileDataGri dNode)
1277 {if(!profileDataGridNode) 1402 {if(!profileDataGridNode)
1278 return;this._save();profileDataGridNode.savePosition();this.children=[profileDat aGridNode];this.totalTime=profileDataGridNode.totalTime;},exclude:function(profi leDataGridNode) 1403 return;this._save();profileDataGridNode.savePosition();this.children=[profileDat aGridNode];this.totalTime=profileDataGridNode.totalTime;},exclude:function(profi leDataGridNode)
1279 {if(!profileDataGridNode) 1404 {if(!profileDataGridNode)
1280 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) 1405 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)
1281 this.sort(this.lastComparator,true);},restore:function() 1406 this.sort(this.lastComparator,true);},restore:function()
1282 {if(!this._savedChildren) 1407 {if(!this._savedChildren)
1283 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) 1408 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)
1284 {WebInspector.View.call(this);this.registerRequiredCSS("canvasProfiler.css");thi s.element.classList.add("canvas-profile-view");this._profile=profile;this._trace LogId=profile.traceLogId();this._traceLogPlayer=(profile.traceLogPlayer());this. _linkifier=new WebInspector.Linkifier();const defaultReplayLogWidthPercent=0.34; this._replayInfoSplitView=new WebInspector.SplitView(true,"canvasProfileViewRepl aySplitLocation",defaultReplayLogWidthPercent);this._replayInfoSplitView.setMain ElementConstraints(defaultReplayLogWidthPercent,defaultReplayLogWidthPercent);th is._replayInfoSplitView.show(this.element);this._imageSplitView=new WebInspector .SplitView(false,"canvasProfileViewSplitLocation",300);this._replayInfoSplitView .setFirstView(this._imageSplitView);var replayImageContainer=this._imageSplitVie w.firstElement().createChild("div");replayImageContainer.id="canvas-replay-image -container";this._replayImageElement=replayImageContainer.createChild("img","can vas-replay-image");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","stat us-bar");var logGridContainer=replayLogContainer.createChild("div","canvas-repla y-log");this._createControlButton(controlsContainer,"canvas-replay-first-step",W ebInspector.UIString("First call."),this._onReplayFirstStepClick.bind(this));thi s._createControlButton(controlsContainer,"canvas-replay-prev-step",WebInspector. UIString("Previous call."),this._onReplayStepClick.bind(this,false));this._creat eControlButton(controlsContainer,"canvas-replay-next-step",WebInspector.UIString ("Next call."),this._onReplayStepClick.bind(this,true));this._createControlButto n(controlsContainer,"canvas-replay-prev-draw",WebInspector.UIString("Previous dr awing call."),this._onReplayDrawingCallClick.bind(this,false));this._createContr olButton(controlsContainer,"canvas-replay-next-draw",WebInspector.UIString("Next drawing call."),this._onReplayDrawingCallClick.bind(this,true));this._createCon trolButton(controlsContainer,"canvas-replay-last-step",WebInspector.UIString("La st call."),this._onReplayLastStepClick.bind(this));this._replayContextSelector=n ew WebInspector.StatusBarComboBox(this._onReplayContextChanged.bind(this));this. _replayContextSelector.createOption(WebInspector.UIString("<screenshot auto>"),W ebInspector.UIString("Show screenshot of the last replayed resource."),"");contr olsContainer.appendChild(this._replayContextSelector.element);this._installRepla yInfoSidebarWidgets(controlsContainer);this._replayStateView=new WebInspector.Ca nvasReplayStateView(this._traceLogPlayer);this._replayInfoSplitView.setSecondVie w(this._replayStateView);this._replayContexts={};var columns=[{title:"#",sortabl e:false,width:"5%"},{title:WebInspector.UIString("Call"),sortable:false,width:"7 5%",disclosure:true},{title:WebInspector.UIString("Location"),sortable:false,wid th:"20%"}];this._logGrid=new WebInspector.DataGrid(columns);this._logGrid.elemen t.classList.add("fill");this._logGrid.show(logGridContainer);this._logGrid.addEv entListener(WebInspector.DataGrid.Events.SelectedNode,this._replayTraceLog,this) ;this.element.addEventListener("mousedown",this._onMouseClick.bind(this),true);t his._popoverHelper=new WebInspector.ObjectPopoverHelper(this.element,this._popov erAnchor.bind(this),this._resolveObjectForPopover.bind(this),this._onHidePopover .bind(this),true);this._popoverHelper.setRemoteObjectFormatter(this._hexNumbersF ormatter.bind(this));this._requestTraceLog(0);} 1409 {WebInspector.VBox.call(this);this.registerRequiredCSS("canvasProfiler.css");thi s.element.classList.add("canvas-profile-view");this._profile=profile;this._trace LogId=profile.traceLogId();this._traceLogPlayer=(profile.traceLogPlayer());this. _linkifier=new WebInspector.Linkifier();this._replayInfoSplitView=new WebInspect or.SplitView(true,true,"canvasProfileViewReplaySplitViewState",0.34);this._repla yInfoSplitView.show(this.element);this._imageSplitView=new WebInspector.SplitVie w(false,true,"canvasProfileViewSplitViewState",300);this._imageSplitView.show(th is._replayInfoSplitView.mainElement());var replayImageContainerView=new WebInspe ctor.VBox();replayImageContainerView.setMinimumSize(50,28);replayImageContainerV iew.show(this._imageSplitView.mainElement());var replayImageContainer=replayImag eContainerView.element.createChild("div");replayImageContainer.id="canvas-replay -image-container";this._replayImageElement=replayImageContainer.createChild("img ","canvas-replay-image");this._debugInfoElement=replayImageContainer.createChild ("div","canvas-debug-info hidden");this._spinnerIcon=replayImageContainer.create Child("div","spinner-icon small hidden");var replayLogContainerView=new WebInspe ctor.VBox();replayLogContainerView.setMinimumSize(22,22);replayLogContainerView. show(this._imageSplitView.sidebarElement());var replayLogContainer=replayLogCont ainerView.element;var controlsContainer=replayLogContainer.createChild("div","st atus-bar");var logGridContainer=replayLogContainer.createChild("div","canvas-rep lay-log");this._createControlButton(controlsContainer,"canvas-replay-first-step" ,WebInspector.UIString("First call."),this._onReplayFirstStepClick.bind(this));t his._createControlButton(controlsContainer,"canvas-replay-prev-step",WebInspecto r.UIString("Previous call."),this._onReplayStepClick.bind(this,false));this._cre ateControlButton(controlsContainer,"canvas-replay-next-step",WebInspector.UIStri ng("Next call."),this._onReplayStepClick.bind(this,true));this._createControlBut ton(controlsContainer,"canvas-replay-prev-draw",WebInspector.UIString("Previous drawing call."),this._onReplayDrawingCallClick.bind(this,false));this._createCon trolButton(controlsContainer,"canvas-replay-next-draw",WebInspector.UIString("Ne xt drawing call."),this._onReplayDrawingCallClick.bind(this,true));this._createC ontrolButton(controlsContainer,"canvas-replay-last-step",WebInspector.UIString(" Last call."),this._onReplayLastStepClick.bind(this));this._replayContextSelector =new WebInspector.StatusBarComboBox(this._onReplayContextChanged.bind(this));thi s._replayContextSelector.createOption(WebInspector.UIString("<screenshot auto>") ,WebInspector.UIString("Show screenshot of the last replayed resource."),"");con trolsContainer.appendChild(this._replayContextSelector.element);this._installRep layInfoSidebarWidgets(controlsContainer);this._replayStateView=new WebInspector. CanvasReplayStateView(this._traceLogPlayer);this._replayStateView.show(this._rep layInfoSplitView.sidebarElement());this._replayContexts={};var columns=[{title:" #",sortable:false,width:"5%"},{title:WebInspector.UIString("Call"),sortable:fals e,width:"75%",disclosure:true},{title:WebInspector.UIString("Location"),sortable :false,width:"20%"}];this._logGrid=new WebInspector.DataGrid(columns);this._logG rid.element.classList.add("fill");this._logGrid.show(logGridContainer);this._log Grid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._replayTrac eLog,this);this.element.addEventListener("mousedown",this._onMouseClick.bind(thi s),true);this._popoverHelper=new WebInspector.ObjectPopoverHelper(this.element,t his._popoverAnchor.bind(this),this._resolveObjectForPopover.bind(this),this._onH idePopover.bind(this),true);this._popoverHelper.setRemoteObjectFormatter(this._h exNumbersFormatter.bind(this));this._requestTraceLog(0);}
1285 WebInspector.CanvasProfileView.TraceLogPollingInterval=500;WebInspector.CanvasPr ofileView.prototype={dispose:function() 1410 WebInspector.CanvasProfileView.TraceLogPollingInterval=500;WebInspector.CanvasPr ofileView.prototype={dispose:function()
1286 {this._linkifier.reset();},get statusBarItems() 1411 {this._linkifier.reset();},get statusBarItems()
1287 {return[];},get profile() 1412 {return[];},get profile()
1288 {return this._profile;},elementsToRestoreScrollPositionsFor:function() 1413 {return this._profile;},elementsToRestoreScrollPositionsFor:function()
1289 {return[this._logGrid.scrollContainer];},_installReplayInfoSidebarWidgets:functi on(controlsContainer) 1414 {return[this._logGrid.scrollContainer];},_installReplayInfoSidebarWidgets:functi on(controlsContainer)
1290 {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() 1415 {this._replayInfoResizeWidgetElement=controlsContainer.createChild("div","resize r-widget");this._replayInfoSplitView.addEventListener(WebInspector.SplitView.Eve nts.ShowModeChanged,this._updateReplayInfoResizeWidget,this);this._updateReplayI nfoResizeWidget();this._replayInfoSplitView.installResizer(this._replayInfoResiz eWidgetElement);this._toggleReplayStateSidebarButton=this._replayInfoSplitView.c reateShowHideSidebarButton("sidebar","canvas-sidebar-show-hide-button");controls Container.appendChild(this._toggleReplayStateSidebarButton.element);this._replay InfoSplitView.hideSidebar();},_updateReplayInfoResizeWidget:function()
1291 {this._enableReplayInfoSidebar(this._toggleReplayStateSidebarButton.state==="lef t");}},_enableReplayInfoSidebar:function(show) 1416 {this._replayInfoResizeWidgetElement.classList.toggle("hidden",this._replayInfoS plitView.showMode()!==WebInspector.SplitView.ShowMode.Both);},_onMouseClick:func tion(event)
1292 {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();} 1417 {var resourceLinkElement=event.target.enclosingNodeOrSelfWithClass("canvas-forma tted-resource");if(resourceLinkElement){this._replayInfoSplitView.showBoth();thi s._replayStateView.selectResource(resourceLinkElement.__resourceId);event.consum e(true);return;}
1293 this._replayInfoResizeWidgetElement.enableStyleClass("hidden",!show);},_onMouseC lick:function(event)
1294 {var resourceLinkElement=event.target.enclosingNodeOrSelfWithClass("canvas-forma tted-resource");if(resourceLinkElement){this._enableReplayInfoSidebar(true);this ._replayStateView.selectResource(resourceLinkElement.__resourceId);event.consume (true);return;}
1295 if(event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link")) 1418 if(event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link"))
1296 event.consume(false);},_createControlButton:function(parent,className,title,clic kCallback) 1419 event.consume(false);},_createControlButton:function(parent,className,title,clic kCallback)
1297 {var button=new WebInspector.StatusBarButton(title,className+" canvas-replay-but ton");parent.appendChild(button.element);button.makeLongClickEnabled();button.ad dEventListener("click",clickCallback,this);button.addEventListener("longClickDow n",clickCallback,this);button.addEventListener("longClickPress",clickCallback,th is);},_onReplayContextChanged:function() 1420 {var button=new WebInspector.StatusBarButton(title,className+" canvas-replay-but ton");parent.appendChild(button.element);button.makeLongClickEnabled();button.ad dEventListener("click",clickCallback,this);button.addEventListener("longClickDow n",clickCallback,this);button.addEventListener("longClickPress",clickCallback,th is);},_onReplayContextChanged:function()
1298 {var selectedContextId=this._replayContextSelector.selectedOption().value;functi on didReceiveResourceState(resourceState) 1421 {var selectedContextId=this._replayContextSelector.selectedOption().value;functi on didReceiveResourceState(resourceState)
1299 {this._enableWaitIcon(false);if(selectedContextId!==this._replayContextSelector. selectedOption().value) 1422 {this._enableWaitIcon(false);if(selectedContextId!==this._replayContextSelector. selectedOption().value)
1300 return;var imageURL=(resourceState&&resourceState.imageURL)||"";this._replayImag eElement.src=imageURL;this._replayImageElement.style.visibility=imageURL?"":"hid den";} 1423 return;var imageURL=(resourceState&&resourceState.imageURL)||"";this._replayImag eElement.src=imageURL;this._replayImageElement.style.visibility=imageURL?"":"hid den";}
1301 this._enableWaitIcon(true);this._traceLogPlayer.getResourceState(selectedContext Id,didReceiveResourceState.bind(this));},_onReplayStepClick:function(forward) 1424 this._enableWaitIcon(true);this._traceLogPlayer.getResourceState(selectedContext Id,didReceiveResourceState.bind(this));},_onReplayStepClick:function(forward)
1302 {var selectedNode=this._logGrid.selectedNode;if(!selectedNode) 1425 {var selectedNode=this._logGrid.selectedNode;if(!selectedNode)
1303 return;var nextNode=selectedNode;do{nextNode=forward?nextNode.traverseNextNode(f alse):nextNode.traversePreviousNode(false);}while(nextNode&&typeof nextNode.inde x!=="number");(nextNode||selectedNode).revealAndSelect();},_onReplayDrawingCallC lick:function(forward) 1426 return;var nextNode=selectedNode;do{nextNode=forward?nextNode.traverseNextNode(f alse):nextNode.traversePreviousNode(false);}while(nextNode&&typeof nextNode.inde x!=="number");(nextNode||selectedNode).revealAndSelect();},_onReplayDrawingCallC lick:function(forward)
1304 {var selectedNode=this._logGrid.selectedNode;if(!selectedNode) 1427 {var selectedNode=this._logGrid.selectedNode;if(!selectedNode)
1305 return;var nextNode=selectedNode;while(nextNode){var sibling=forward?nextNode.ne xtSibling:nextNode.previousSibling;if(sibling){nextNode=sibling;if(nextNode.hasC hildren||nextNode.call.isDrawingCall) 1428 return;var nextNode=selectedNode;while(nextNode){var sibling=forward?nextNode.ne xtSibling:nextNode.previousSibling;if(sibling){nextNode=sibling;if(nextNode.hasC hildren||nextNode.call.isDrawingCall)
1306 break;}else{nextNode=nextNode.parent;if(!forward) 1429 break;}else{nextNode=nextNode.parent;if(!forward)
1307 break;}} 1430 break;}}
1308 if(!nextNode&&forward) 1431 if(!nextNode&&forward)
1309 this._onReplayLastStepClick();else 1432 this._onReplayLastStepClick();else
1310 (nextNode||selectedNode).revealAndSelect();},_onReplayFirstStepClick:function() 1433 (nextNode||selectedNode).revealAndSelect();},_onReplayFirstStepClick:function()
1311 {var firstNode=this._logGrid.rootNode().children[0];if(firstNode) 1434 {var firstNode=this._logGrid.rootNode().children[0];if(firstNode)
1312 firstNode.revealAndSelect();},_onReplayLastStepClick:function() 1435 firstNode.revealAndSelect();},_onReplayLastStepClick:function()
1313 {var lastNode=this._logGrid.rootNode().children.peekLast();if(!lastNode) 1436 {var lastNode=this._logGrid.rootNode().children.peekLast();if(!lastNode)
1314 return;while(lastNode.expanded){var lastChild=lastNode.children.peekLast();if(!l astChild) 1437 return;while(lastNode.expanded){var lastChild=lastNode.children.peekLast();if(!l astChild)
1315 break;lastNode=lastChild;} 1438 break;lastNode=lastChild;}
1316 lastNode.revealAndSelect();},_enableWaitIcon:function(enable) 1439 lastNode.revealAndSelect();},_enableWaitIcon:function(enable)
1317 {this._spinnerIcon.enableStyleClass("hidden",!enable);this._debugInfoElement.ena bleStyleClass("hidden",enable);},_replayTraceLog:function() 1440 {this._spinnerIcon.classList.toggle("hidden",!enable);this._debugInfoElement.cla ssList.toggle("hidden",enable);},_replayTraceLog:function()
1318 {if(this._pendingReplayTraceLogEvent) 1441 {if(this._pendingReplayTraceLogEvent)
1319 return;var index=this._selectedCallIndex();if(index===-1||index===this._lastRepl ayCallIndex) 1442 return;var index=this._selectedCallIndex();if(index===-1||index===this._lastRepl ayCallIndex)
1320 return;this._lastReplayCallIndex=index;this._pendingReplayTraceLogEvent=true;fun ction didReplayTraceLog(resourceState,replayTime) 1443 return;this._lastReplayCallIndex=index;this._pendingReplayTraceLogEvent=true;fun ction didReplayTraceLog(resourceState,replayTime)
1321 {delete this._pendingReplayTraceLogEvent;this._enableWaitIcon(false);this._debug InfoElement.textContent=WebInspector.UIString("Replay time: %s",Number.secondsTo String(replayTime/1000,true));this._onReplayContextChanged();if(index!==this._se lectedCallIndex()) 1444 {delete this._pendingReplayTraceLogEvent;this._enableWaitIcon(false);this._debug InfoElement.textContent=WebInspector.UIString("Replay time: %s",Number.secondsTo String(replayTime/1000,true));this._onReplayContextChanged();if(index!==this._se lectedCallIndex())
1322 this._replayTraceLog();} 1445 this._replayTraceLog();}
1323 this._enableWaitIcon(true);this._traceLogPlayer.replayTraceLog(index,didReplayTr aceLog.bind(this));},_requestTraceLog:function(offset) 1446 this._enableWaitIcon(true);this._traceLogPlayer.replayTraceLog(index,didReplayTr aceLog.bind(this));},_requestTraceLog:function(offset)
1324 {function didReceiveTraceLog(traceLog) 1447 {function didReceiveTraceLog(traceLog)
1325 {this._enableWaitIcon(false);if(!traceLog) 1448 {this._enableWaitIcon(false);if(!traceLog)
1326 return;var callNodes=[];var calls=traceLog.calls;var index=traceLog.startOffset; for(var i=0,n=calls.length;i<n;++i) 1449 return;var callNodes=[];var calls=traceLog.calls;var index=traceLog.startOffset; for(var i=0,n=calls.length;i<n;++i)
1327 callNodes.push(this._createCallNode(index++,calls[i]));var contexts=traceLog.con texts;for(var i=0,n=contexts.length;i<n;++i){var contextId=contexts[i].resourceI d||"";var description=contexts[i].description||"";if(this._replayContexts[contex tId]) 1450 callNodes.push(this._createCallNode(index++,calls[i]));var contexts=traceLog.con texts;for(var i=0,n=contexts.length;i<n;++i){var contextId=contexts[i].resourceI d||"";var description=contexts[i].description||"";if(this._replayContexts[contex tId])
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 var evalResult=argumentElement.__evalResult;if(evalResult) 1486 var evalResult=argumentElement.__evalResult;if(evalResult)
1364 showObjectPopover.call(this,null,evalResult);else{var dataGridNode=this._logGrid .dataGridNodeFromNode(argumentElement);if(!dataGridNode||typeof dataGridNode.ind ex!=="number"){this._popoverHelper.hidePopover();return;} 1487 showObjectPopover.call(this,null,evalResult);else{var dataGridNode=this._logGrid .dataGridNodeFromNode(argumentElement);if(!dataGridNode||typeof dataGridNode.ind ex!=="number"){this._popoverHelper.hidePopover();return;}
1365 var callIndex=dataGridNode.index;var argumentIndex=argumentElement.__argumentInd ex;if(typeof argumentIndex!=="number") 1488 var callIndex=dataGridNode.index;var argumentIndex=argumentElement.__argumentInd ex;if(typeof argumentIndex!=="number")
1366 argumentIndex=-1;CanvasAgent.evaluateTraceLogCallArgument(this._traceLogId,callI ndex,argumentIndex,objectGroupName,showObjectPopover.bind(this));}},_hexNumbersF ormatter:function(object) 1489 argumentIndex=-1;CanvasAgent.evaluateTraceLogCallArgument(this._traceLogId,callI ndex,argumentIndex,objectGroupName,showObjectPopover.bind(this));}},_hexNumbersF ormatter:function(object)
1367 {if(object.type==="number"){var str="0000"+Number(object.description).toString(1 6).toUpperCase();str=str.replace(/^0+(.{4,})$/,"$1");return"0x"+str;} 1490 {if(object.type==="number"){var str="0000"+Number(object.description).toString(1 6).toUpperCase();str=str.replace(/^0+(.{4,})$/,"$1");return"0x"+str;}
1368 return object.description||"";},_onHidePopover:function() 1491 return object.description||"";},_onHidePopover:function()
1369 {if(this._popoverAnchorElement){this._popoverAnchorElement.remove() 1492 {if(this._popoverAnchorElement){this._popoverAnchorElement.remove()
1370 delete this._popoverAnchorElement;}},_flattenSingleFrameNode:function() 1493 delete this._popoverAnchorElement;}},_flattenSingleFrameNode:function()
1371 {var rootNode=this._logGrid.rootNode();if(rootNode.children.length!==1) 1494 {var rootNode=this._logGrid.rootNode();if(rootNode.children.length!==1)
1372 return;var frameNode=rootNode.children[0];while(frameNode.children[0]) 1495 return;var frameNode=rootNode.children[0];while(frameNode.children[0])
1373 rootNode.appendChild(frameNode.children[0]);rootNode.removeChild(frameNode);},__ proto__:WebInspector.View.prototype} 1496 rootNode.appendChild(frameNode.children[0]);rootNode.removeChild(frameNode);},__ proto__:WebInspector.VBox.prototype}
1374 WebInspector.CanvasProfileType=function() 1497 WebInspector.CanvasProfileType=function()
1375 {WebInspector.ProfileType.call(this,WebInspector.CanvasProfileType.TypeId,WebIns pector.UIString("Capture Canvas Frame"));this._nextProfileUid=1;this._recording= false;this._lastProfileHeader=null;this._capturingModeSelector=new WebInspector. StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this));this._capturingMode Selector.element.title=WebInspector.UIString("Canvas capture mode.");this._captu ringModeSelector.createOption(WebInspector.UIString("Single Frame"),WebInspector .UIString("Capture a single canvas frame."),"");this._capturingModeSelector.crea teOption(WebInspector.UIString("Consecutive Frames"),WebInspector.UIString("Capt ure consecutive canvas frames."),"1");this._frameOptions={};this._framesWithCanv ases={};this._frameSelector=new WebInspector.StatusBarComboBox(this._dispatchVie wUpdatedEvent.bind(this));this._frameSelector.element.title=WebInspector.UIStrin g("Frame containing the canvases to capture.");this._frameSelector.element.class List.add("hidden");WebInspector.runtimeModel.contextLists().forEach(this._addFra me,this);WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Ev ents.FrameExecutionContextListAdded,this._frameAdded,this);WebInspector.runtimeM odel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextList Removed,this._frameRemoved,this);this._dispatcher=new WebInspector.CanvasDispatc her(this);this._canvasAgentEnabled=false;this._decorationElement=document.create Element("div");this._decorationElement.className="profile-canvas-decoration";thi s._updateDecorationElement();} 1498 {WebInspector.ProfileType.call(this,WebInspector.CanvasProfileType.TypeId,WebIns pector.UIString("Capture Canvas Frame"));this._recording=false;this._lastProfile Header=null;this._capturingModeSelector=new WebInspector.StatusBarComboBox(this. _dispatchViewUpdatedEvent.bind(this));this._capturingModeSelector.element.title= WebInspector.UIString("Canvas capture mode.");this._capturingModeSelector.create Option(WebInspector.UIString("Single Frame"),WebInspector.UIString("Capture a si ngle canvas frame."),"");this._capturingModeSelector.createOption(WebInspector.U IString("Consecutive Frames"),WebInspector.UIString("Capture consecutive canvas frames."),"1");this._frameOptions={};this._framesWithCanvases={};this._frameSele ctor=new WebInspector.StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this ));this._frameSelector.element.title=WebInspector.UIString("Frame containing the canvases to capture.");this._frameSelector.element.classList.add("hidden");WebI nspector.resourceTreeModel.frames().forEach(this._addFrame,this);WebInspector.re sourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Frame Added,this._frameAdded,this);WebInspector.resourceTreeModel.addEventListener(Web Inspector.ResourceTreeModel.EventTypes.FrameDetached,this._frameRemoved,this);th is._dispatcher=new WebInspector.CanvasDispatcher(this);this._canvasAgentEnabled= false;this._decorationElement=document.createElement("div");this._decorationElem ent.className="profile-canvas-decoration";this._updateDecorationElement();}
1376 WebInspector.CanvasProfileType.TypeId="CANVAS_PROFILE";WebInspector.CanvasProfil eType.prototype={get statusBarItems() 1499 WebInspector.CanvasProfileType.TypeId="CANVAS_PROFILE";WebInspector.CanvasProfil eType.prototype={get statusBarItems()
1377 {return[this._capturingModeSelector.element,this._frameSelector.element];},get b uttonTooltip() 1500 {return[this._capturingModeSelector.element,this._frameSelector.element];},get b uttonTooltip()
1378 {if(this._isSingleFrameMode()) 1501 {if(this._isSingleFrameMode())
1379 return WebInspector.UIString("Capture next canvas frame.");else 1502 return WebInspector.UIString("Capture next canvas frame.");else
1380 return this._recording?WebInspector.UIString("Stop capturing canvas frames."):We bInspector.UIString("Start capturing canvas frames.");},buttonClicked:function() 1503 return this._recording?WebInspector.UIString("Stop capturing canvas frames."):We bInspector.UIString("Start capturing canvas frames.");},buttonClicked:function()
1381 {if(!this._canvasAgentEnabled) 1504 {if(!this._canvasAgentEnabled)
1382 return false;if(this._recording){this._recording=false;this._stopFrameCapturing( );}else if(this._isSingleFrameMode()){this._recording=false;this._runSingleFrame Capturing();}else{this._recording=true;this._startFrameCapturing();} 1505 return false;if(this._recording){this._recording=false;this._stopFrameCapturing( );}else if(this._isSingleFrameMode()){this._recording=false;this._runSingleFrame Capturing();}else{this._recording=true;this._startFrameCapturing();}
1383 return this._recording;},_runSingleFrameCapturing:function() 1506 return this._recording;},_runSingleFrameCapturing:function()
1384 {var frameId=this._selectedFrameId();CanvasAgent.captureFrame(frameId,this._didS tartCapturingFrame.bind(this,frameId));},_startFrameCapturing:function() 1507 {var frameId=this._selectedFrameId();CanvasAgent.captureFrame(frameId,this._didS tartCapturingFrame.bind(this,frameId));},_startFrameCapturing:function()
1385 {var frameId=this._selectedFrameId();CanvasAgent.startCapturing(frameId,this._di dStartCapturingFrame.bind(this,frameId));},_stopFrameCapturing:function() 1508 {var frameId=this._selectedFrameId();CanvasAgent.startCapturing(frameId,this._di dStartCapturingFrame.bind(this,frameId));},_stopFrameCapturing:function()
1386 {if(!this._lastProfileHeader) 1509 {if(!this._lastProfileHeader)
1387 return;var profileHeader=this._lastProfileHeader;var traceLogId=profileHeader.tr aceLogId();this._lastProfileHeader=null;function didStopCapturing() 1510 return;var profileHeader=this._lastProfileHeader;var traceLogId=profileHeader.tr aceLogId();this._lastProfileHeader=null;function didStopCapturing()
1388 {profileHeader._updateCapturingStatus();} 1511 {profileHeader._updateCapturingStatus();}
1389 CanvasAgent.stopCapturing(traceLogId,didStopCapturing.bind(this));},_didStartCap turingFrame:function(frameId,error,traceLogId) 1512 CanvasAgent.stopCapturing(traceLogId,didStopCapturing);},_didStartCapturingFrame :function(frameId,error,traceLogId)
1390 {if(error||this._lastProfileHeader&&this._lastProfileHeader.traceLogId()===trace LogId) 1513 {if(error||this._lastProfileHeader&&this._lastProfileHeader.traceLogId()===trace LogId)
1391 return;var profileHeader=new WebInspector.CanvasProfileHeader(this,WebInspector. UIString("Trace Log %d",this._nextProfileUid),this._nextProfileUid,traceLogId,fr ameId);++this._nextProfileUid;this._lastProfileHeader=profileHeader;this.addProf ile(profileHeader);profileHeader._updateCapturingStatus();},get treeItemTitle() 1514 return;var profileHeader=new WebInspector.CanvasProfileHeader(this,traceLogId,fr ameId);this._lastProfileHeader=profileHeader;this.addProfile(profileHeader);prof ileHeader._updateCapturingStatus();},get treeItemTitle()
1392 {return WebInspector.UIString("CANVAS PROFILE");},get description() 1515 {return WebInspector.UIString("CANVAS PROFILE");},get description()
1393 {return WebInspector.UIString("Canvas calls instrumentation");},decorationElemen t:function() 1516 {return WebInspector.UIString("Canvas calls instrumentation");},decorationElemen t:function()
1394 {return this._decorationElement;},_reset:function() 1517 {return this._decorationElement;},removeProfile:function(profile)
1395 {WebInspector.ProfileType.prototype._reset.call(this);this._nextProfileUid=1;},r emoveProfile:function(profile)
1396 {WebInspector.ProfileType.prototype.removeProfile.call(this,profile);if(this._re cording&&profile===this._lastProfileHeader) 1518 {WebInspector.ProfileType.prototype.removeProfile.call(this,profile);if(this._re cording&&profile===this._lastProfileHeader)
1397 this._recording=false;},_updateDecorationElement:function(forcePageReload) 1519 this._recording=false;},_updateDecorationElement:function(forcePageReload)
1398 {this._decorationElement.removeChildren();this._decorationElement.createChild("d iv","warning-icon-small");this._decorationElement.appendChild(document.createTex tNode(this._canvasAgentEnabled?WebInspector.UIString("Canvas Profiler is enabled ."):WebInspector.UIString("Canvas Profiler is disabled.")));var button=this._dec orationElement.createChild("button");button.type="button";button.textContent=thi s._canvasAgentEnabled?WebInspector.UIString("Disable"):WebInspector.UIString("En able");button.addEventListener("click",this._onProfilerEnableButtonClick.bind(th is,!this._canvasAgentEnabled),false);function hasUninstrumentedCanvasesCallback( error,result) 1520 {this._decorationElement.removeChildren();this._decorationElement.createChild("d iv","warning-icon-small");this._decorationElement.appendChild(document.createTex tNode(this._canvasAgentEnabled?WebInspector.UIString("Canvas Profiler is enabled ."):WebInspector.UIString("Canvas Profiler is disabled.")));var button=this._dec orationElement.createChild("button");button.type="button";button.textContent=thi s._canvasAgentEnabled?WebInspector.UIString("Disable"):WebInspector.UIString("En able");button.addEventListener("click",this._onProfilerEnableButtonClick.bind(th is,!this._canvasAgentEnabled),false);function hasUninstrumentedCanvasesCallback( error,result)
1399 {if(error||result) 1521 {if(error||result)
1400 WebInspector.resourceTreeModel.reloadPage();} 1522 WebInspector.resourceTreeModel.reloadPage();}
1401 if(forcePageReload){if(this._canvasAgentEnabled){CanvasAgent.hasUninstrumentedCa nvases(hasUninstrumentedCanvasesCallback.bind(this));}else{for(var frameId in th is._framesWithCanvases){if(this._framesWithCanvases.hasOwnProperty(frameId)){Web Inspector.resourceTreeModel.reloadPage();break;}}}}},_onProfilerEnableButtonClic k:function(enable) 1523 if(forcePageReload){if(this._canvasAgentEnabled){CanvasAgent.hasUninstrumentedCa nvases(hasUninstrumentedCanvasesCallback);}else{for(var frameId in this._framesW ithCanvases){if(this._framesWithCanvases.hasOwnProperty(frameId)){WebInspector.r esourceTreeModel.reloadPage();break;}}}}},_onProfilerEnableButtonClick:function( enable)
1402 {if(this._canvasAgentEnabled===enable) 1524 {if(this._canvasAgentEnabled===enable)
1403 return;function callback(error) 1525 return;function callback(error)
1404 {if(error) 1526 {if(error)
1405 return;this._canvasAgentEnabled=enable;this._updateDecorationElement(true);this. _dispatchViewUpdatedEvent();} 1527 return;this._canvasAgentEnabled=enable;this._updateDecorationElement(true);this. _dispatchViewUpdatedEvent();}
1406 if(enable) 1528 if(enable)
1407 CanvasAgent.enable(callback.bind(this));else 1529 CanvasAgent.enable(callback.bind(this));else
1408 CanvasAgent.disable(callback.bind(this));},_isSingleFrameMode:function() 1530 CanvasAgent.disable(callback.bind(this));},_isSingleFrameMode:function()
1409 {return!this._capturingModeSelector.selectedOption().value;},_frameAdded:functio n(event) 1531 {return!this._capturingModeSelector.selectedOption().value;},_frameAdded:functio n(event)
1410 {var contextList=(event.data);this._addFrame(contextList);},_addFrame:function(c ontextList) 1532 {var frame=(event.data);this._addFrame(frame);},_addFrame:function(frame)
1411 {var frameId=contextList.frameId;var option=document.createElement("option");opt ion.text=contextList.displayName;option.title=contextList.url;option.value=frame Id;this._frameOptions[frameId]=option;if(this._framesWithCanvases[frameId]){this ._frameSelector.addOption(option);this._dispatchViewUpdatedEvent();}},_frameRemo ved:function(event) 1533 {var frameId=frame.id;var option=document.createElement("option");option.text=fr ame.displayName();option.title=frame.url;option.value=frameId;this._frameOptions [frameId]=option;if(this._framesWithCanvases[frameId]){this._frameSelector.addOp tion(option);this._dispatchViewUpdatedEvent();}},_frameRemoved:function(event)
1412 {var contextList=(event.data);var frameId=contextList.frameId;var option=this._f rameOptions[frameId];if(option&&this._framesWithCanvases[frameId]){this._frameSe lector.removeOption(option);this._dispatchViewUpdatedEvent();} 1534 {var frame=(event.data);var frameId=frame.id;var option=this._frameOptions[frame Id];if(option&&this._framesWithCanvases[frameId]){this._frameSelector.removeOpti on(option);this._dispatchViewUpdatedEvent();}
1413 delete this._frameOptions[frameId];delete this._framesWithCanvases[frameId];},_c ontextCreated:function(frameId) 1535 delete this._frameOptions[frameId];delete this._framesWithCanvases[frameId];},_c ontextCreated:function(frameId)
1414 {if(this._framesWithCanvases[frameId]) 1536 {if(this._framesWithCanvases[frameId])
1415 return;this._framesWithCanvases[frameId]=true;var option=this._frameOptions[fram eId];if(option){this._frameSelector.addOption(option);this._dispatchViewUpdatedE vent();}},_traceLogsRemoved:function(frameId,traceLogId) 1537 return;this._framesWithCanvases[frameId]=true;var option=this._frameOptions[fram eId];if(option){this._frameSelector.addOption(option);this._dispatchViewUpdatedE vent();}},_traceLogsRemoved:function(frameId,traceLogId)
1416 {var sidebarElementsToDelete=[];var sidebarElements=((this.treeElement&&this.tre eElement.children)||[]);for(var i=0,n=sidebarElements.length;i<n;++i){var header =(sidebarElements[i].profile);if(!header) 1538 {var sidebarElementsToDelete=[];var sidebarElements=((this.treeElement&&this.tre eElement.children)||[]);for(var i=0,n=sidebarElements.length;i<n;++i){var header =(sidebarElements[i].profile);if(!header)
1417 continue;if(frameId&&frameId!==header.frameId()) 1539 continue;if(frameId&&frameId!==header.frameId())
1418 continue;if(traceLogId&&traceLogId!==header.traceLogId()) 1540 continue;if(traceLogId&&traceLogId!==header.traceLogId())
1419 continue;sidebarElementsToDelete.push(sidebarElements[i]);} 1541 continue;sidebarElementsToDelete.push(sidebarElements[i]);}
1420 for(var i=0,n=sidebarElementsToDelete.length;i<n;++i) 1542 for(var i=0,n=sidebarElementsToDelete.length;i<n;++i)
1421 sidebarElementsToDelete[i].ondelete();},_selectedFrameId:function() 1543 sidebarElementsToDelete[i].ondelete();},_selectedFrameId:function()
1422 {var option=this._frameSelector.selectedOption();return option?option.value:unde fined;},_dispatchViewUpdatedEvent:function() 1544 {var option=this._frameSelector.selectedOption();return option?option.value:unde fined;},_dispatchViewUpdatedEvent:function()
1423 {this._frameSelector.element.enableStyleClass("hidden",this._frameSelector.size( )<=1);this.dispatchEventToListeners(WebInspector.ProfileType.Events.ViewUpdated) ;},isInstantProfile:function() 1545 {this._frameSelector.element.classList.toggle("hidden",this._frameSelector.size( )<=1);this.dispatchEventToListeners(WebInspector.ProfileType.Events.ViewUpdated) ;},isInstantProfile:function()
1424 {return this._isSingleFrameMode();},isEnabled:function() 1546 {return this._isSingleFrameMode();},isEnabled:function()
1425 {return this._canvasAgentEnabled;},__proto__:WebInspector.ProfileType.prototype} 1547 {return this._canvasAgentEnabled;},__proto__:WebInspector.ProfileType.prototype}
1426 WebInspector.CanvasDispatcher=function(profileType) 1548 WebInspector.CanvasDispatcher=function(profileType)
1427 {this._profileType=profileType;InspectorBackend.registerCanvasDispatcher(this);} 1549 {this._profileType=profileType;InspectorBackend.registerCanvasDispatcher(this);}
1428 WebInspector.CanvasDispatcher.prototype={contextCreated:function(frameId) 1550 WebInspector.CanvasDispatcher.prototype={contextCreated:function(frameId)
1429 {this._profileType._contextCreated(frameId);},traceLogsRemoved:function(frameId, traceLogId) 1551 {this._profileType._contextCreated(frameId);},traceLogsRemoved:function(frameId, traceLogId)
1430 {this._profileType._traceLogsRemoved(frameId,traceLogId);}} 1552 {this._profileType._traceLogsRemoved(frameId,traceLogId);}}
1431 WebInspector.CanvasProfileHeader=function(type,title,uid,traceLogId,frameId) 1553 WebInspector.CanvasProfileHeader=function(type,traceLogId,frameId)
1432 {WebInspector.ProfileHeader.call(this,type,title,uid);this._traceLogId=traceLogI d||"";this._frameId=frameId;this._alive=true;this._traceLogSize=0;this._traceLog Player=traceLogId?new WebInspector.CanvasTraceLogPlayerProxy(traceLogId):null;} 1554 {WebInspector.ProfileHeader.call(this,type,WebInspector.UIString("Trace Log %d", type._nextProfileUid));this._traceLogId=traceLogId||"";this._frameId=frameId;thi s._alive=true;this._traceLogSize=0;this._traceLogPlayer=traceLogId?new WebInspec tor.CanvasTraceLogPlayerProxy(traceLogId):null;}
1433 WebInspector.CanvasProfileHeader.prototype={traceLogId:function() 1555 WebInspector.CanvasProfileHeader.prototype={traceLogId:function()
1434 {return this._traceLogId;},traceLogPlayer:function() 1556 {return this._traceLogId;},traceLogPlayer:function()
1435 {return this._traceLogPlayer;},frameId:function() 1557 {return this._traceLogPlayer;},frameId:function()
1436 {return this._frameId;},createSidebarTreeElement:function() 1558 {return this._frameId;},createSidebarTreeElement:function()
1437 {return new WebInspector.ProfileSidebarTreeElement(this,"profile-sidebar-tree-it em");},createView:function(profilesPanel) 1559 {return new WebInspector.ProfileSidebarTreeElement(this,"profile-sidebar-tree-it em");},createView:function()
1438 {return new WebInspector.CanvasProfileView(this);},dispose:function() 1560 {return new WebInspector.CanvasProfileView(this);},dispose:function()
1439 {if(this._traceLogPlayer) 1561 {if(this._traceLogPlayer)
1440 this._traceLogPlayer.dispose();clearTimeout(this._requestStatusTimer);this._aliv e=false;},_updateCapturingStatus:function(traceLog) 1562 this._traceLogPlayer.dispose();clearTimeout(this._requestStatusTimer);this._aliv e=false;},_updateCapturingStatus:function(traceLog)
1441 {if(!this.sidebarElement||!this._traceLogId) 1563 {if(!this._traceLogId)
1442 return;if(traceLog){this._alive=traceLog.alive;this._traceLogSize=traceLog.total AvailableCalls;} 1564 return;if(traceLog){this._alive=traceLog.alive;this._traceLogSize=traceLog.total AvailableCalls;}
1443 this.sidebarElement.subtitle=this._alive?WebInspector.UIString("Capturing\u2026 %d calls",this._traceLogSize):WebInspector.UIString("Captured %d calls",this._tr aceLogSize);this.sidebarElement.wait=this._alive;if(this._alive){clearTimeout(th is._requestStatusTimer);this._requestStatusTimer=setTimeout(this._requestCapturi ngStatus.bind(this),WebInspector.CanvasProfileView.TraceLogPollingInterval);}},_ requestCapturingStatus:function() 1565 var subtitle=this._alive?WebInspector.UIString("Capturing\u2026 %d calls",this._ traceLogSize):WebInspector.UIString("Captured %d calls",this._traceLogSize);this .updateStatus(subtitle,this._alive);if(this._alive){clearTimeout(this._requestSt atusTimer);this._requestStatusTimer=setTimeout(this._requestCapturingStatus.bind (this),WebInspector.CanvasProfileView.TraceLogPollingInterval);}},_requestCaptur ingStatus:function()
1444 {function didReceiveTraceLog(traceLog) 1566 {function didReceiveTraceLog(traceLog)
1445 {if(!traceLog) 1567 {if(!traceLog)
1446 return;this._alive=traceLog.alive;this._traceLogSize=traceLog.totalAvailableCall s;this._updateCapturingStatus();} 1568 return;this._alive=traceLog.alive;this._traceLogSize=traceLog.totalAvailableCall s;this._updateCapturingStatus();}
1447 this._traceLogPlayer.getTraceLog(0,0,didReceiveTraceLog.bind(this));},__proto__: WebInspector.ProfileHeader.prototype} 1569 this._traceLogPlayer.getTraceLog(0,0,didReceiveTraceLog.bind(this));},__proto__: WebInspector.ProfileHeader.prototype}
1448 WebInspector.CanvasProfileDataGridHelper={createCallArgumentElement:function(cal lArgument) 1570 WebInspector.CanvasProfileDataGridHelper={createCallArgumentElement:function(cal lArgument)
1449 {if(callArgument.enumName) 1571 {if(callArgument.enumName)
1450 return WebInspector.CanvasProfileDataGridHelper.createEnumValueElement(callArgum ent.enumName,+callArgument.description);var element=document.createElement("span ");element.className="canvas-call-argument";var description=callArgument.descrip tion;if(callArgument.type==="string"){const maxStringLength=150;element.createTe xtChild("\"");element.createChild("span","canvas-formatted-string").textContent= description.trimMiddle(maxStringLength);element.createTextChild("\"");element.__ suppressPopover=(description.length<=maxStringLength&&!/[\r\n]/.test(description ));if(!element.__suppressPopover) 1572 return WebInspector.CanvasProfileDataGridHelper.createEnumValueElement(callArgum ent.enumName,+callArgument.description);var element=document.createElement("span ");element.className="canvas-call-argument";var description=callArgument.descrip tion;if(callArgument.type==="string"){const maxStringLength=150;element.createTe xtChild("\"");element.createChild("span","canvas-formatted-string").textContent= description.trimMiddle(maxStringLength);element.createTextChild("\"");element.__ suppressPopover=(description.length<=maxStringLength&&!/[\r\n]/.test(description ));if(!element.__suppressPopover)
1451 element.__evalResult=WebInspector.RemoteObject.fromPrimitiveValue(description);} else{var type=callArgument.subtype||callArgument.type;if(type){element.classList .add("canvas-formatted-"+type);if(["null","undefined","boolean","number"].indexO f(type)>=0) 1573 element.__evalResult=WebInspector.RemoteObject.fromPrimitiveValue(description);} else{var type=callArgument.subtype||callArgument.type;if(type){element.classList .add("canvas-formatted-"+type);if(["null","undefined","boolean","number"].indexO f(type)>=0)
1452 element.__suppressPopover=true;} 1574 element.__suppressPopover=true;}
1453 element.textContent=description;if(callArgument.remoteObject) 1575 element.textContent=description;if(callArgument.remoteObject)
(...skipping 15 matching lines...) Expand all
1469 function callback(error,resourceState) 1591 function callback(error,resourceState)
1470 {if(error||!resourceState){userCallback(null);return;} 1592 {if(error||!resourceState){userCallback(null);return;}
1471 this._currentResourceStates[effectiveResourceId]=resourceState;userCallback(reso urceState);this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy. Events.CanvasResourceStateReceived,resourceState);} 1593 this._currentResourceStates[effectiveResourceId]=resourceState;userCallback(reso urceState);this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy. Events.CanvasResourceStateReceived,resourceState);}
1472 CanvasAgent.getResourceState(this._traceLogId,effectiveResourceId,callback.bind( this));},replayTraceLog:function(index,userCallback) 1594 CanvasAgent.getResourceState(this._traceLogId,effectiveResourceId,callback.bind( this));},replayTraceLog:function(index,userCallback)
1473 {function callback(error,resourceState,replayTime) 1595 {function callback(error,resourceState,replayTime)
1474 {this._currentResourceStates={};if(error){userCallback(null,replayTime);}else{th is._defaultResourceId=resourceState.id;this._currentResourceStates[resourceState .id]=resourceState;userCallback(resourceState,replayTime);} 1596 {this._currentResourceStates={};if(error){userCallback(null,replayTime);}else{th is._defaultResourceId=resourceState.id;this._currentResourceStates[resourceState .id]=resourceState;userCallback(resourceState,replayTime);}
1475 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.Canv asReplayStateChanged);if(!error) 1597 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.Canv asReplayStateChanged);if(!error)
1476 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.Canv asResourceStateReceived,resourceState);} 1598 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.Canv asResourceStateReceived,resourceState);}
1477 CanvasAgent.replayTraceLog(this._traceLogId,index,callback.bind(this));},clearRe sourceStates:function() 1599 CanvasAgent.replayTraceLog(this._traceLogId,index,callback.bind(this));},clearRe sourceStates:function()
1478 {this._currentResourceStates={};this.dispatchEventToListeners(WebInspector.Canva sTraceLogPlayerProxy.Events.CanvasReplayStateChanged);},__proto__:WebInspector.O bject.prototype};WebInspector.CanvasReplayStateView=function(traceLogPlayer) 1600 {this._currentResourceStates={};this.dispatchEventToListeners(WebInspector.Canva sTraceLogPlayerProxy.Events.CanvasReplayStateChanged);},__proto__:WebInspector.O bject.prototype};WebInspector.CanvasReplayStateView=function(traceLogPlayer)
1479 {WebInspector.View.call(this);this.registerRequiredCSS("canvasProfiler.css");thi s.element.classList.add("canvas-replay-state-view");this._traceLogPlayer=traceLo gPlayer;var controlsContainer=this.element.createChild("div","status-bar");this. _prevButton=this._createControlButton(controlsContainer,"canvas-replay-state-pre v",WebInspector.UIString("Previous resource."),this._onResourceNavigationClick.b ind(this,false));this._nextButton=this._createControlButton(controlsContainer,"c anvas-replay-state-next",WebInspector.UIString("Next resource."),this._onResourc eNavigationClick.bind(this,true));this._createControlButton(controlsContainer,"c anvas-replay-state-refresh",WebInspector.UIString("Refresh."),this._onStateRefre shClick.bind(this));this._resourceSelector=new WebInspector.StatusBarComboBox(th is._onReplayResourceChanged.bind(this));this._currentOption=this._resourceSelect or.createOption(WebInspector.UIString("<auto>"),WebInspector.UIString("Show stat e of the last replayed resource."),"");controlsContainer.appendChild(this._resou rceSelector.element);this._resourceIdToDescription={};this._gridNodesExpandedSta te={};this._gridScrollPositions={};this._currentResourceId=null;this._prevOption sStack=[];this._nextOptionsStack=[];this._highlightedGridNodes=[];var columns=[{ title:WebInspector.UIString("Name"),sortable:false,width:"50%",disclosure:true}, {title:WebInspector.UIString("Value"),sortable:false,width:"50%"}];this._stateGr id=new WebInspector.DataGrid(columns);this._stateGrid.element.classList.add("fil l");this._stateGrid.show(this.element);this._traceLogPlayer.addEventListener(Web Inspector.CanvasTraceLogPlayerProxy.Events.CanvasReplayStateChanged,this._onRepl ayResourceChanged,this);this._traceLogPlayer.addEventListener(WebInspector.Canva sTraceLogPlayerProxy.Events.CanvasTraceLogReceived,this._onCanvasTraceLogReceive d,this);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerP roxy.Events.CanvasResourceStateReceived,this._onCanvasResourceStateReceived,this );this._updateButtonsEnabledState();} 1601 {WebInspector.VBox.call(this);this.registerRequiredCSS("canvasProfiler.css");thi s.element.classList.add("canvas-replay-state-view");this._traceLogPlayer=traceLo gPlayer;var controlsContainer=this.element.createChild("div","status-bar");this. _prevButton=this._createControlButton(controlsContainer,"canvas-replay-state-pre v",WebInspector.UIString("Previous resource."),this._onResourceNavigationClick.b ind(this,false));this._nextButton=this._createControlButton(controlsContainer,"c anvas-replay-state-next",WebInspector.UIString("Next resource."),this._onResourc eNavigationClick.bind(this,true));this._createControlButton(controlsContainer,"c anvas-replay-state-refresh",WebInspector.UIString("Refresh."),this._onStateRefre shClick.bind(this));this._resourceSelector=new WebInspector.StatusBarComboBox(th is._onReplayResourceChanged.bind(this));this._currentOption=this._resourceSelect or.createOption(WebInspector.UIString("<auto>"),WebInspector.UIString("Show stat e of the last replayed resource."),"");controlsContainer.appendChild(this._resou rceSelector.element);this._resourceIdToDescription={};this._gridNodesExpandedSta te={};this._gridScrollPositions={};this._currentResourceId=null;this._prevOption sStack=[];this._nextOptionsStack=[];this._highlightedGridNodes=[];var columns=[{ title:WebInspector.UIString("Name"),sortable:false,width:"50%",disclosure:true}, {title:WebInspector.UIString("Value"),sortable:false,width:"50%"}];this._stateGr id=new WebInspector.DataGrid(columns);this._stateGrid.element.classList.add("fil l");this._stateGrid.show(this.element);this._traceLogPlayer.addEventListener(Web Inspector.CanvasTraceLogPlayerProxy.Events.CanvasReplayStateChanged,this._onRepl ayResourceChanged,this);this._traceLogPlayer.addEventListener(WebInspector.Canva sTraceLogPlayerProxy.Events.CanvasTraceLogReceived,this._onCanvasTraceLogReceive d,this);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerP roxy.Events.CanvasResourceStateReceived,this._onCanvasResourceStateReceived,this );this._updateButtonsEnabledState();}
1480 WebInspector.CanvasReplayStateView.prototype={selectResource:function(resourceId ) 1602 WebInspector.CanvasReplayStateView.prototype={selectResource:function(resourceId )
1481 {if(resourceId===this._resourceSelector.selectedOption().value) 1603 {if(resourceId===this._resourceSelector.selectedOption().value)
1482 return;var option=this._resourceSelector.selectElement().firstChild;for(var inde x=0;option;++index,option=option.nextSibling){if(resourceId===option.value){this ._resourceSelector.setSelectedIndex(index);this._onReplayResourceChanged();break ;}}},_createControlButton:function(parent,className,title,clickCallback) 1604 return;var option=this._resourceSelector.selectElement().firstChild;for(var inde x=0;option;++index,option=option.nextSibling){if(resourceId===option.value){this ._resourceSelector.setSelectedIndex(index);this._onReplayResourceChanged();break ;}}},_createControlButton:function(parent,className,title,clickCallback)
1483 {var button=new WebInspector.StatusBarButton(title,className+" canvas-replay-but ton");parent.appendChild(button.element);button.makeLongClickEnabled();button.ad dEventListener("click",clickCallback,this);button.addEventListener("longClickDow n",clickCallback,this);button.addEventListener("longClickPress",clickCallback,th is);return button;},_onResourceNavigationClick:function(forward) 1605 {var button=new WebInspector.StatusBarButton(title,className+" canvas-replay-but ton");parent.appendChild(button.element);button.makeLongClickEnabled();button.ad dEventListener("click",clickCallback,this);button.addEventListener("longClickDow n",clickCallback,this);button.addEventListener("longClickPress",clickCallback,th is);return button;},_onResourceNavigationClick:function(forward)
1484 {var newOption=forward?this._nextOptionsStack.pop():this._prevOptionsStack.pop() ;if(!newOption) 1606 {var newOption=forward?this._nextOptionsStack.pop():this._prevOptionsStack.pop() ;if(!newOption)
1485 return;(forward?this._prevOptionsStack:this._nextOptionsStack).push(this._curren tOption);this._isNavigationButton=true;this.selectResource(newOption.value);dele te this._isNavigationButton;this._updateButtonsEnabledState();},_onStateRefreshC lick:function() 1607 return;(forward?this._prevOptionsStack:this._nextOptionsStack).push(this._curren tOption);this._isNavigationButton=true;this.selectResource(newOption.value);dele te this._isNavigationButton;this._updateButtonsEnabledState();},_onStateRefreshC lick:function()
1486 {this._traceLogPlayer.clearResourceStates();},_updateButtonsEnabledState:functio n() 1608 {this._traceLogPlayer.clearResourceStates();},_updateButtonsEnabledState:functio n()
1487 {this._prevButton.setEnabled(this._prevOptionsStack.length>0);this._nextButton.s etEnabled(this._nextOptionsStack.length>0);},_updateCurrentOption:function() 1609 {this._prevButton.setEnabled(this._prevOptionsStack.length>0);this._nextButton.s etEnabled(this._nextOptionsStack.length>0);},_updateCurrentOption:function()
1488 {const maxStackSize=256;var selectedOption=this._resourceSelector.selectedOption ();if(this._currentOption===selectedOption) 1610 {const maxStackSize=256;var selectedOption=this._resourceSelector.selectedOption ();if(this._currentOption===selectedOption)
1489 return;if(!this._isNavigationButton){this._prevOptionsStack.push(this._currentOp tion);this._nextOptionsStack=[];if(this._prevOptionsStack.length>maxStackSize) 1611 return;if(!this._isNavigationButton){this._prevOptionsStack.push(this._currentOp tion);this._nextOptionsStack=[];if(this._prevOptionsStack.length>maxStackSize)
(...skipping 25 matching lines...) Expand all
1515 var nodesToHighlight=[];var nameToOldGridNodes={};function populateNameToNodesMa p(map,node) 1637 var nodesToHighlight=[];var nameToOldGridNodes={};function populateNameToNodesMa p(map,node)
1516 {if(!node) 1638 {if(!node)
1517 return;for(var i=0,child;child=node.children[i];++i){var item={node:child,childr en:{}};map[child.name]=item;populateNameToNodesMap(item.children,child);}} 1639 return;for(var i=0,child;child=node.children[i];++i){var item={node:child,childr en:{}};map[child.name]=item;populateNameToNodesMap(item.children,child);}}
1518 populateNameToNodesMap(nameToOldGridNodes,rootNode);rootNode.removeChildren();fu nction comparator(d1,d2) 1640 populateNameToNodesMap(nameToOldGridNodes,rootNode);rootNode.removeChildren();fu nction comparator(d1,d2)
1519 {var hasChildren1=!!d1.values;var hasChildren2=!!d2.values;if(hasChildren1!==has Children2) 1641 {var hasChildren1=!!d1.values;var hasChildren2=!!d2.values;if(hasChildren1!==has Children2)
1520 return hasChildren1?1:-1;return String.naturalOrderComparator(d1.name,d2.name);} 1642 return hasChildren1?1:-1;return String.naturalOrderComparator(d1.name,d2.name);}
1521 function appendResourceStateDescriptors(descriptors,parent,nameToOldChildren) 1643 function appendResourceStateDescriptors(descriptors,parent,nameToOldChildren)
1522 {descriptors=descriptors||[];descriptors.sort(comparator);var oldChildren=nameTo OldChildren||{};for(var i=0,n=descriptors.length;i<n;++i){var descriptor=descrip tors[i];var childNode=this._createDataGridNode(descriptor);parent.appendChild(ch ildNode);var oldChildrenItem=oldChildren[childNode.name]||{};var oldChildNode=ol dChildrenItem.node;if(!oldChildNode||oldChildNode.element.textContent!==childNod e.element.textContent) 1644 {descriptors=descriptors||[];descriptors.sort(comparator);var oldChildren=nameTo OldChildren||{};for(var i=0,n=descriptors.length;i<n;++i){var descriptor=descrip tors[i];var childNode=this._createDataGridNode(descriptor);parent.appendChild(ch ildNode);var oldChildrenItem=oldChildren[childNode.name]||{};var oldChildNode=ol dChildrenItem.node;if(!oldChildNode||oldChildNode.element.textContent!==childNod e.element.textContent)
1523 nodesToHighlight.push(childNode);appendResourceStateDescriptors.call(this,descri ptor.values,childNode,oldChildrenItem.children);}} 1645 nodesToHighlight.push(childNode);appendResourceStateDescriptors.call(this,descri ptor.values,childNode,oldChildrenItem.children);}}
1524 appendResourceStateDescriptors.call(this,resourceState.descriptors,rootNode,name ToOldGridNodes);var shouldHighlightChanges=(this._resourceKindId(this._currentRe sourceId)===this._resourceKindId(resourceState.id));this._currentResourceId=reso urceState.id;this._restoreExpandedState();this._updateDataGridHighlights(shouldH ighlightChanges?nodesToHighlight:[]);this._restoreScrollState();},_updateDataGri dHighlights:function(nodes) 1646 appendResourceStateDescriptors.call(this,resourceState.descriptors,rootNode,name ToOldGridNodes);var shouldHighlightChanges=(this._resourceKindId(this._currentRe sourceId)===this._resourceKindId(resourceState.id));this._currentResourceId=reso urceState.id;this._restoreExpandedState();this._updateDataGridHighlights(shouldH ighlightChanges?nodesToHighlight:[]);this._restoreScrollState();},_updateDataGri dHighlights:function(nodes)
1525 {for(var i=0,n=this._highlightedGridNodes.length;i<n;++i){var node=this._highlig htedGridNodes[i];node.element.classList.remove("canvas-grid-node-highlighted");} 1647 {for(var i=0,n=this._highlightedGridNodes.length;i<n;++i)
1526 this._highlightedGridNodes=nodes;for(var i=0,n=this._highlightedGridNodes.length ;i<n;++i){var node=this._highlightedGridNodes[i];node.element.classList.add("can vas-grid-node-highlighted");node.reveal();}},_resourceKindId:function(resourceId ) 1648 this._highlightedGridNodes[i].element.classList.remove("canvas-grid-node-highlig hted");this._highlightedGridNodes=nodes;for(var i=0,n=this._highlightedGridNodes .length;i<n;++i){var node=this._highlightedGridNodes[i];WebInspector.runCSSAnima tionOnce(node.element,"canvas-grid-node-highlighted");node.reveal();}},_resource KindId:function(resourceId)
1527 {var description=(resourceId&&this._resourceIdToDescription[resourceId])||"";ret urn description.replace(/\d+/g,"");},_forEachGridNode:function(callback) 1649 {var description=(resourceId&&this._resourceIdToDescription[resourceId])||"";ret urn description.replace(/\d+/g,"");},_forEachGridNode:function(callback)
1528 {function processRecursively(node,key) 1650 {function processRecursively(node,key)
1529 {for(var i=0,child;child=node.children[i];++i){var childKey=key+"#"+child.name;c allback(child,childKey);processRecursively(child,childKey);}} 1651 {for(var i=0,child;child=node.children[i];++i){var childKey=key+"#"+child.name;c allback(child,childKey);processRecursively(child,childKey);}}
1530 processRecursively(this._stateGrid.rootNode(),"");},_saveExpandedState:function( ) 1652 processRecursively(this._stateGrid.rootNode(),"");},_saveExpandedState:function( )
1531 {if(!this._currentResourceId) 1653 {if(!this._currentResourceId)
1532 return;var expandedState={};var key=this._resourceKindId(this._currentResourceId );this._gridNodesExpandedState[key]=expandedState;function callback(node,key) 1654 return;var expandedState={};var key=this._resourceKindId(this._currentResourceId );this._gridNodesExpandedState[key]=expandedState;function callback(node,key)
1533 {if(node.expanded) 1655 {if(node.expanded)
1534 expandedState[key]=true;} 1656 expandedState[key]=true;}
1535 this._forEachGridNode(callback);},_restoreExpandedState:function() 1657 this._forEachGridNode(callback);},_restoreExpandedState:function()
1536 {if(!this._currentResourceId) 1658 {if(!this._currentResourceId)
1537 return;var key=this._resourceKindId(this._currentResourceId);var expandedState=t his._gridNodesExpandedState[key];if(!expandedState) 1659 return;var key=this._resourceKindId(this._currentResourceId);var expandedState=t his._gridNodesExpandedState[key];if(!expandedState)
1538 return;function callback(node,key) 1660 return;function callback(node,key)
1539 {if(expandedState[key]) 1661 {if(expandedState[key])
1540 node.expand();} 1662 node.expand();}
1541 this._forEachGridNode(callback);},_saveScrollState:function() 1663 this._forEachGridNode(callback);},_saveScrollState:function()
1542 {if(!this._currentResourceId) 1664 {if(!this._currentResourceId)
1543 return;var key=this._resourceKindId(this._currentResourceId);this._gridScrollPos itions[key]={scrollTop:this._stateGrid.scrollContainer.scrollTop,scrollLeft:this ._stateGrid.scrollContainer.scrollLeft};},_restoreScrollState:function() 1665 return;var key=this._resourceKindId(this._currentResourceId);this._gridScrollPos itions[key]={scrollTop:this._stateGrid.scrollContainer.scrollTop,scrollLeft:this ._stateGrid.scrollContainer.scrollLeft};},_restoreScrollState:function()
1544 {if(!this._currentResourceId) 1666 {if(!this._currentResourceId)
1545 return;var key=this._resourceKindId(this._currentResourceId);var scrollState=thi s._gridScrollPositions[key];if(!scrollState) 1667 return;var key=this._resourceKindId(this._currentResourceId);var scrollState=thi s._gridScrollPositions[key];if(!scrollState)
1546 return;this._stateGrid.scrollContainer.scrollTop=scrollState.scrollTop;this._sta teGrid.scrollContainer.scrollLeft=scrollState.scrollLeft;},_createDataGridNode:f unction(descriptor) 1668 return;this._stateGrid.scrollContainer.scrollTop=scrollState.scrollTop;this._sta teGrid.scrollContainer.scrollLeft=scrollState.scrollLeft;},_createDataGridNode:f unction(descriptor)
1547 {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") 1669 {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")
1548 nameElement=WebInspector.CanvasProfileDataGridHelper.createEnumValueElement(name ,+descriptor.enumValueForName);if(descriptor.isArray&&descriptor.values){if(type of nameElement==="string") 1670 nameElement=WebInspector.CanvasProfileDataGridHelper.createEnumValueElement(name ,+descriptor.enumValueForName);if(descriptor.isArray&&descriptor.values){if(type of nameElement==="string")
1549 nameElement+="["+descriptor.values.length+"]";else{var element=document.createEl ement("span");element.appendChild(nameElement);element.createTextChild("["+descr iptor.values.length+"]");nameElement=element;}} 1671 nameElement+="["+descriptor.values.length+"]";else{var element=document.createEl ement("span");element.appendChild(nameElement);element.createTextChild("["+descr iptor.values.length+"]");nameElement=element;}}
1550 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}; 1672 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.VBox.prototype};WebInspector.PieChart=function(totalValue,formatter)
1673 {const shadowOffset=0.04;this.element=document.createElementWithClass("div","pie -chart");var svg=this._createSVGChild(this.element,"svg");svg.setAttribute("widt h","100%");svg.setAttribute("height",(100*(1+shadowOffset))+"%");this._group=thi s._createSVGChild(svg,"g");var shadow=this._createSVGChild(this._group,"circle") ;shadow.setAttribute("r",1);shadow.setAttribute("cy",shadowOffset);shadow.setAtt ribute("fill","hsl(0,0%,70%)");var background=this._createSVGChild(this._group," circle");background.setAttribute("r",1);background.setAttribute("fill","hsl(0,0% ,92%)");if(totalValue){var totalString=formatter?formatter(totalValue):totalValu e;this._totalElement=this.element.createChild("div","pie-chart-foreground");this ._totalElement.textContent=totalString;this._totalValue=totalValue;}
1674 this._lastAngle=-Math.PI/2;this.setSize(100);}
1675 WebInspector.PieChart.prototype={setTotal:function(value)
1676 {this._totalValue=value;},setSize:function(value)
1677 {this._group.setAttribute("transform","scale("+(value/2)+") translate(1,1)");var size=value+"px";this.element.style.width=size;this.element.style.height=size;if (this._totalElement)
1678 this._totalElement.style.lineHeight=size;},addSlice:function(value,color)
1679 {var sliceAngle=value/this._totalValue*2*Math.PI;if(!isFinite(sliceAngle))
1680 return;sliceAngle=Math.min(sliceAngle,2*Math.PI*0.9999);var path=this._createSVG Child(this._group,"path");var x1=Math.cos(this._lastAngle);var y1=Math.sin(this. _lastAngle);this._lastAngle+=sliceAngle;var x2=Math.cos(this._lastAngle);var y2= Math.sin(this._lastAngle);var largeArc=sliceAngle>Math.PI?1:0;path.setAttribute( "d","M0,0 L"+x1+","+y1+" A1,1,0,"+largeArc+",1,"+x2+","+y2+" Z");path.setAttribu te("fill",color);},_createSVGChild:function(parent,childType)
1681 {var child=document.createElementNS("http://www.w3.org/2000/svg",childType);pare nt.appendChild(child);return child;}};WebInspector.ProfileTypeRegistry.instance= new WebInspector.ProfileTypeRegistry();
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