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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome_linux64/resources/inspector/ProfilesPanel.js
===================================================================
--- chrome_linux64/resources/inspector/ProfilesPanel.js (revision 273864)
+++ chrome_linux64/resources/inspector/ProfilesPanel.js (working copy)
@@ -1,5 +1,5 @@
WebInspector.ProfileType=function(id,name)
-{this._id=id;this._name=name;this._profiles=[];this.treeElement=null;this._profileBeingRecorded=null;window.addEventListener("unload",this._clearTempStorage.bind(this),false);}
+{WebInspector.Object.call(this);this._id=id;this._name=name;this._profiles=[];this._profileBeingRecorded=null;this._nextProfileUid=1;window.addEventListener("unload",this._clearTempStorage.bind(this),false);}
WebInspector.ProfileType.Events={AddProfileHeader:"add-profile-header",RemoveProfileHeader:"remove-profile-header",ViewUpdated:"view-updated"}
WebInspector.ProfileType.prototype={hasTemporaryView:function()
{return false;},fileExtension:function()
@@ -24,23 +24,24 @@
name=name.substr(0,name.length-this.fileExtension().length);var profile=this.createProfileLoadedFromFile(name);profile.setFromFile();this._profileBeingRecorded=profile;this.addProfile(profile);profile.loadFromFile(file);},createProfileLoadedFromFile:function(title)
{throw new Error("Needs implemented.");},addProfile:function(profile)
{this._profiles.push(profile);this.dispatchEventToListeners(WebInspector.ProfileType.Events.AddProfileHeader,profile);},removeProfile:function(profile)
-{if(this._profileBeingRecorded===profile)
-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;}}},_clearTempStorage:function()
+{var index=this._profiles.indexOf(profile);if(index===-1)
+return;this._profiles.splice(index,1);this._disposeProfile(profile);},_clearTempStorage:function()
{for(var i=0;i<this._profiles.length;++i)
this._profiles[i].removeTempFile();},profileBeingRecorded:function()
-{return this._profileBeingRecorded;},_reset:function()
-{var profiles=this._profiles.slice(0);for(var i=0;i<profiles.length;++i){var profile=profiles[i];var view=profile.existingView();if(view){view.detach();if("dispose"in view)
-view.dispose();}
-this.dispatchEventToListeners(WebInspector.ProfileType.Events.RemoveProfileHeader,profile);}
-this.treeElement.removeChildren();this._profiles=[];},__proto__:WebInspector.Object.prototype}
-WebInspector.ProfileHeader=function(profileType,title,uid)
-{this._profileType=profileType;this.title=title;this.uid=(uid===undefined)?-1:uid;this._fromFile=false;}
-WebInspector.ProfileHeader._nextProfileFromFileUid=1;WebInspector.ProfileHeader.prototype={profileType:function()
-{return this._profileType;},createSidebarTreeElement:function()
-{throw new Error("Needs implemented.");},existingView:function()
-{return this._view;},view:function(panel)
-{if(!this._view)
-this._view=this.createView(panel);return this._view;},createView:function(panel)
+{return this._profileBeingRecorded;},profileBeingRecordedRemoved:function()
+{},_reset:function()
+{var profiles=this._profiles.slice(0);for(var i=0;i<profiles.length;++i)
+this._disposeProfile(profiles[i]);this._profiles=[];this._nextProfileUid=1;},_disposeProfile:function(profile)
+{this.dispatchEventToListeners(WebInspector.ProfileType.Events.RemoveProfileHeader,profile);profile.dispose();if(this._profileBeingRecorded===profile){this.profileBeingRecordedRemoved();this._profileBeingRecorded=null;}},__proto__:WebInspector.Object.prototype}
+WebInspector.ProfileHeader=function(profileType,title)
+{this._profileType=profileType;this.title=title;this.uid=profileType._nextProfileUid++;this._fromFile=false;}
+WebInspector.ProfileHeader.StatusUpdate=function(subtitle,wait)
+{this.subtitle=subtitle;this.wait=wait;}
+WebInspector.ProfileHeader.Events={UpdateStatus:"UpdateStatus",ProfileReceived:"ProfileReceived"}
+WebInspector.ProfileHeader.prototype={profileType:function()
+{return this._profileType;},updateStatus:function(subtitle,wait)
+{this.dispatchEventToListeners(WebInspector.ProfileHeader.Events.UpdateStatus,new WebInspector.ProfileHeader.StatusUpdate(subtitle,wait));},createSidebarTreeElement:function()
+{throw new Error("Needs implemented.");},createView:function()
{throw new Error("Not implemented.");},removeTempFile:function()
{if(this._tempFile)
this._tempFile.remove();},dispose:function()
@@ -50,79 +51,73 @@
{throw new Error("Needs implemented");},loadFromFile:function(file)
{throw new Error("Needs implemented");},fromFile:function()
{return this._fromFile;},setFromFile:function()
-{this._fromFile=true;this.uid="From file #"+WebInspector.ProfileHeader._nextProfileFromFileUid++;}}
-WebInspector.ProfilesPanel=function(name,type)
-{var singleProfileMode=typeof name!=="undefined";name=name||"profiles";WebInspector.Panel.call(this,name);this.registerRequiredCSS("panelEnablerView.css");this.registerRequiredCSS("heapProfiler.css");this.registerRequiredCSS("profilesPanel.css");this.createSidebarViewWithTree();this.splitView.mainElement().classList.add("vbox");this.splitView.sidebarElement().classList.add("vbox");this._searchableView=new WebInspector.SearchableView(this);this.splitView.setMainView(this._searchableView);this.profilesItemTreeElement=new WebInspector.ProfilesSidebarTreeElement(this);this.sidebarTree.appendChild(this.profilesItemTreeElement);this._singleProfileMode=singleProfileMode;this._profileTypesByIdMap={};this.profileViews=document.createElement("div");this.profileViews.id="profile-views";this.profileViews.classList.add("vbox");this._searchableView.element.appendChild(this.profileViews);var statusBarContainer=this.splitView.mainElement().createChild("div","profiles-status-bar");this._statusBarElement=statusBarContainer.createChild("div","status-bar");var sidebarTreeBox=this.splitView.sidebarElement().createChild("div","profiles-sidebar-tree-box");sidebarTreeBox.appendChild(this.sidebarTreeElement);var statusBarContainerLeft=this.splitView.sidebarElement().createChild("div","profiles-status-bar");this._statusBarButtons=statusBarContainerLeft.createChild("div","status-bar");this.recordButton=new WebInspector.StatusBarButton("","record-profile-status-bar-item");this.recordButton.addEventListener("click",this.toggleRecordButton,this);this._statusBarButtons.appendChild(this.recordButton.element);this.clearResultsButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profiles."),"clear-status-bar-item");this.clearResultsButton.addEventListener("click",this._clearProfiles,this);this._statusBarButtons.appendChild(this.clearResultsButton.element);this._profileTypeStatusBarItemsContainer=this._statusBarElement.createChild("div");this._profileViewStatusBarItemsContainer=this._statusBarElement.createChild("div");if(singleProfileMode){this._launcherView=this._createLauncherView();this._registerProfileType((type));this._selectedProfileType=type;this._updateProfileTypeSpecificUI();}else{this._launcherView=new WebInspector.MultiProfileLauncherView(this);this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,this._onProfileTypeSelected,this);this._registerProfileType(new WebInspector.CPUProfileType());this._registerProfileType(new WebInspector.HeapSnapshotProfileType());this._registerProfileType(new WebInspector.TrackingHeapSnapshotProfileType(this));if(!WebInspector.WorkerManager.isWorkerFrontend()&&WebInspector.experimentsSettings.canvasInspection.isEnabled())
-this._registerProfileType(new WebInspector.CanvasProfileType());this._launcherView.restoreSelectedProfileType();}
-this._reset();this._createFileSelectorElement();this.element.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),true);this._registerShortcuts();this._configureCpuProfilerSamplingInterval();WebInspector.settings.highResolutionCpuProfiling.addChangeListener(this._configureCpuProfilerSamplingInterval,this);}
+{this._fromFile=true;},__proto__:WebInspector.Object.prototype}
+WebInspector.ProfilesPanel=function()
+{WebInspector.PanelWithSidebarTree.call(this,"profiles");this.registerRequiredCSS("panelEnablerView.css");this.registerRequiredCSS("heapProfiler.css");this.registerRequiredCSS("profilesPanel.css");this._searchableView=new WebInspector.SearchableView(this);var mainView=new WebInspector.VBox();this._searchableView.show(mainView.element);mainView.show(this.mainElement());this.profilesItemTreeElement=new WebInspector.ProfilesSidebarTreeElement(this);this.sidebarTree.appendChild(this.profilesItemTreeElement);this.profileViews=document.createElement("div");this.profileViews.id="profile-views";this.profileViews.classList.add("vbox");this._searchableView.element.appendChild(this.profileViews);var statusBarContainer=document.createElementWithClass("div","profiles-status-bar");mainView.element.insertBefore(statusBarContainer,mainView.element.firstChild);this._statusBarElement=statusBarContainer.createChild("div","status-bar");this.sidebarElement().classList.add("profiles-sidebar-tree-box");var statusBarContainerLeft=document.createElementWithClass("div","profiles-status-bar");this.sidebarElement().insertBefore(statusBarContainerLeft,this.sidebarElement().firstChild);this._statusBarButtons=statusBarContainerLeft.createChild("div","status-bar");this.recordButton=new WebInspector.StatusBarButton("","record-profile-status-bar-item");this.recordButton.addEventListener("click",this.toggleRecordButton,this);this._statusBarButtons.appendChild(this.recordButton.element);this.clearResultsButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profiles."),"clear-status-bar-item");this.clearResultsButton.addEventListener("click",this._reset,this);this._statusBarButtons.appendChild(this.clearResultsButton.element);this._profileTypeStatusBarItemsContainer=this._statusBarElement.createChild("div");this._profileViewStatusBarItemsContainer=this._statusBarElement.createChild("div");this._profileGroups={};this._launcherView=new WebInspector.MultiProfileLauncherView(this);this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,this._onProfileTypeSelected,this);this._profileToView=[];this._typeIdToSidebarSection={};var types=WebInspector.ProfileTypeRegistry.instance.profileTypes();for(var i=0;i<types.length;i++)
+this._registerProfileType(types[i]);this._launcherView.restoreSelectedProfileType();this.profilesItemTreeElement.select();this._showLauncherView();this._createFileSelectorElement();this.element.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),true);this._registerShortcuts();this._configureCpuProfilerSamplingInterval();WebInspector.settings.highResolutionCpuProfiling.addChangeListener(this._configureCpuProfilerSamplingInterval,this);}
+WebInspector.ProfileTypeRegistry=function(){this._profileTypes=[];this.cpuProfileType=new WebInspector.CPUProfileType();this._addProfileType(this.cpuProfileType);this.heapSnapshotProfileType=new WebInspector.HeapSnapshotProfileType();this._addProfileType(this.heapSnapshotProfileType);this.trackingHeapSnapshotProfileType=new WebInspector.TrackingHeapSnapshotProfileType();this._addProfileType(this.trackingHeapSnapshotProfileType);HeapProfilerAgent.enable();if(Capabilities.isMainFrontend&&WebInspector.experimentsSettings.canvasInspection.isEnabled()){this.canvasProfileType=new WebInspector.CanvasProfileType();this._addProfileType(this.canvasProfileType);}}
+WebInspector.ProfileTypeRegistry.prototype={_addProfileType:function(profileType)
+{this._profileTypes.push(profileType);},profileTypes:function()
+{return this._profileTypes;}}
WebInspector.ProfilesPanel.prototype={searchableView:function()
{return this._searchableView;},_createFileSelectorElement:function()
{if(this._fileSelectorElement)
-this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=WebInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element.appendChild(this._fileSelectorElement);},_createLauncherView:function()
-{return new WebInspector.ProfileLauncherView(this);},_findProfileTypeByExtension:function(fileName)
-{for(var id in this._profileTypesByIdMap){var type=this._profileTypesByIdMap[id];var extension=type.fileExtension();if(!extension)
+this.element.removeChild(this._fileSelectorElement);this._fileSelectorElement=WebInspector.createFileSelectorElement(this._loadFromFile.bind(this));this.element.appendChild(this._fileSelectorElement);},_findProfileTypeByExtension:function(fileName)
+{var types=WebInspector.ProfileTypeRegistry.instance.profileTypes();for(var i=0;i<types.length;i++){var type=types[i];var extension=type.fileExtension();if(!extension)
continue;if(fileName.endsWith(type.fileExtension()))
return type;}
return null;},_registerShortcuts:function()
{this.registerShortcuts(WebInspector.ShortcutsScreen.ProfilesPanelShortcuts.StartStopRecording,this.toggleRecordButton.bind(this));},_configureCpuProfilerSamplingInterval:function()
-{var intervalUs=WebInspector.settings.highResolutionCpuProfiling.get()?100:1000;ProfilerAgent.setSamplingInterval(intervalUs,didChangeInterval.bind(this));function didChangeInterval(error)
+{var intervalUs=WebInspector.settings.highResolutionCpuProfiling.get()?100:1000;ProfilerAgent.setSamplingInterval(intervalUs,didChangeInterval);function didChangeInterval(error)
{if(error)
-WebInspector.showErrorMessage(error)}},_loadFromFile:function(file)
-{this._createFileSelectorElement();var profileType=this._findProfileTypeByExtension(file.name);if(!profileType){var extensions=[];for(var id in this._profileTypesByIdMap){var extension=this._profileTypesByIdMap[id].fileExtension();if(!extension)
+WebInspector.console.showErrorMessage(error);}},_loadFromFile:function(file)
+{this._createFileSelectorElement();var profileType=this._findProfileTypeByExtension(file.name);if(!profileType){var extensions=[];var types=WebInspector.ProfileTypeRegistry.instance.profileTypes();for(var i=0;i<types.length;i++){var extension=types[i].fileExtension();if(!extension)
continue;extensions.push(extension);}
-WebInspector.log(WebInspector.UIString("Can't load file. Only files with extensions '%s' can be loaded.",extensions.join("', '")));return;}
-if(!!profileType.profileBeingRecorded()){WebInspector.log(WebInspector.UIString("Can't load profile when other profile is recording."));return;}
+WebInspector.console.log(WebInspector.UIString("Can't load file. Only files with extensions '%s' can be loaded.",extensions.join("', '")));return;}
+if(!!profileType.profileBeingRecorded()){WebInspector.console.log(WebInspector.UIString("Can't load profile when other profile is recording."));return;}
profileType.loadFromFile(file);},toggleRecordButton:function()
{var type=this._selectedProfileType;var isProfiling=type.buttonClicked();this.recordButton.toggled=isProfiling;this.recordButton.title=type.buttonTooltip;if(isProfiling){this._launcherView.profileStarted();if(type.hasTemporaryView())
-this._showProfile(type.profileBeingRecorded());}else{this._launcherView.profileFinished();}
+this.showProfile(type.profileBeingRecorded());}else{this._launcherView.profileFinished();}
return true;},_profileBeingRecordedRemoved:function()
{this.recordButton.toggled=false;this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherView.profileFinished();},_onProfileTypeSelected:function(event)
{this._selectedProfileType=(event.data);this._updateProfileTypeSpecificUI();},_updateProfileTypeSpecificUI:function()
{this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherView.updateProfileType(this._selectedProfileType);this._profileTypeStatusBarItemsContainer.removeChildren();var statusBarItems=this._selectedProfileType.statusBarItems;if(statusBarItems){for(var i=0;i<statusBarItems.length;++i)
this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]);}},_reset:function()
-{WebInspector.Panel.prototype.reset.call(this);for(var typeId in this._profileTypesByIdMap)
-this._profileTypesByIdMap[typeId]._reset();delete this.visibleView;delete this.currentQuery;this.searchCanceled();this._profileGroups={};this.recordButton.toggled=false;if(this._selectedProfileType)
-this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherView.profileFinished();this.sidebarTreeElement.classList.remove("some-expandable");this._launcherView.detach();this.profileViews.removeChildren();this._profileViewStatusBarItemsContainer.removeChildren();this.removeAllListeners();this.recordButton.visible=true;this._profileViewStatusBarItemsContainer.classList.remove("hidden");this.clearResultsButton.element.classList.remove("hidden");this.profilesItemTreeElement.select();this._showLauncherView();},_showLauncherView:function()
-{this.closeVisibleView();this._profileViewStatusBarItemsContainer.removeChildren();this._launcherView.show(this.profileViews);this.visibleView=this._launcherView;},_clearProfiles:function()
-{HeapProfilerAgent.clearProfiles();this._reset();},_garbageCollectButtonClicked:function()
+{WebInspector.Panel.prototype.reset.call(this);var types=WebInspector.ProfileTypeRegistry.instance.profileTypes();for(var i=0;i<types.length;i++)
+types[i]._reset();delete this.visibleView;delete this.currentQuery;this.searchCanceled();this._profileGroups={};this.recordButton.toggled=false;if(this._selectedProfileType)
+this.recordButton.title=this._selectedProfileType.buttonTooltip;this._launcherView.profileFinished();this.sidebarTree.element.classList.remove("some-expandable");this._launcherView.detach();this.profileViews.removeChildren();this._profileViewStatusBarItemsContainer.removeChildren();this.removeAllListeners();this.recordButton.visible=true;this._profileViewStatusBarItemsContainer.classList.remove("hidden");this.clearResultsButton.element.classList.remove("hidden");this.profilesItemTreeElement.select();this._showLauncherView();},_showLauncherView:function()
+{this.closeVisibleView();this._profileViewStatusBarItemsContainer.removeChildren();this._launcherView.show(this.profileViews);this.visibleView=this._launcherView;},_garbageCollectButtonClicked:function()
{HeapProfilerAgent.collectGarbage();},_registerProfileType:function(profileType)
-{this._profileTypesByIdMap[profileType.id]=profileType;this._launcherView.addProfileType(profileType);profileType.treeElement=new WebInspector.SidebarSectionTreeElement(profileType.treeItemTitle,null,true);profileType.treeElement.hidden=!this._singleProfileMode;this.sidebarTree.appendChild(profileType.treeElement);profileType.treeElement.childrenListElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),true);function onAddProfileHeader(event)
+{this._launcherView.addProfileType(profileType);var profileTypeSection=new WebInspector.ProfileTypeSidebarSection(profileType);this._typeIdToSidebarSection[profileType.id]=profileTypeSection
+this.sidebarTree.appendChild(profileTypeSection);profileTypeSection.childrenListElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),true);function onAddProfileHeader(event)
{this._addProfileHeader(event.data);}
function onRemoveProfileHeader(event)
{this._removeProfileHeader(event.data);}
-profileType.addEventListener(WebInspector.ProfileType.Events.ViewUpdated,this._updateProfileTypeSpecificUI,this);profileType.addEventListener(WebInspector.ProfileType.Events.AddProfileHeader,onAddProfileHeader,this);profileType.addEventListener(WebInspector.ProfileType.Events.RemoveProfileHeader,onRemoveProfileHeader,this);},_handleContextMenuEvent:function(event)
+profileType.addEventListener(WebInspector.ProfileType.Events.ViewUpdated,this._updateProfileTypeSpecificUI,this);profileType.addEventListener(WebInspector.ProfileType.Events.AddProfileHeader,onAddProfileHeader,this);profileType.addEventListener(WebInspector.ProfileType.Events.RemoveProfileHeader,onRemoveProfileHeader,this);var profiles=profileType.getProfiles();for(var i=0;i<profiles.length;i++)
+this._addProfileHeader(profiles[i]);},_handleContextMenuEvent:function(event)
{var element=event.srcElement;while(element&&!element.treeElement&&element!==this.element)
element=element.parentElement;if(!element)
return;if(element.treeElement&&element.treeElement.handleContextMenuEvent){element.treeElement.handleContextMenuEvent(event,this);return;}
var contextMenu=new WebInspector.ContextMenu(event);if(this.visibleView instanceof WebInspector.HeapSnapshotView){this.visibleView.populateContextMenu(contextMenu,event);}
-if(element!==this.element||event.srcElement===this.splitView.sidebarElement()){contextMenu.appendItem(WebInspector.UIString("Load\u2026"),this._fileSelectorElement.click.bind(this._fileSelectorElement));}
-contextMenu.show();},_makeTitleKey:function(text,profileTypeId)
-{return escape(text)+'/'+escape(profileTypeId);},_addProfileHeader:function(profile)
-{var profileType=profile.profileType();var typeId=profileType.id;var sidebarParent=profileType.treeElement;sidebarParent.hidden=false;var small=false;var alternateTitle;if(!profile.fromFile()&&profile.profileType().profileBeingRecorded()!==profile){var profileTitleKey=this._makeTitleKey(profile.title,typeId);if(!(profileTitleKey in this._profileGroups))
-this._profileGroups[profileTitleKey]=[];var group=this._profileGroups[profileTitleKey];group.push(profile);if(group.length===2){group._profilesTreeElement=new WebInspector.ProfileGroupSidebarTreeElement(this,profile.title);var index=sidebarParent.children.indexOf(group[0]._profilesTreeElement);sidebarParent.insertChild(group._profilesTreeElement,index);var selected=group[0]._profilesTreeElement.selected;sidebarParent.removeChild(group[0]._profilesTreeElement);group._profilesTreeElement.appendChild(group[0]._profilesTreeElement);if(selected)
-group[0]._profilesTreeElement.revealAndSelect();group[0]._profilesTreeElement.small=true;group[0]._profilesTreeElement.mainTitle=WebInspector.UIString("Run %d",1);this.sidebarTreeElement.classList.add("some-expandable");}
-if(group.length>=2){sidebarParent=group._profilesTreeElement;alternateTitle=WebInspector.UIString("Run %d",group.length);small=true;}}
-var profileTreeElement=profile.createSidebarTreeElement();profile.sidebarElement=profileTreeElement;profileTreeElement.small=small;if(alternateTitle)
-profileTreeElement.mainTitle=alternateTitle;profile._profilesTreeElement=profileTreeElement;sidebarParent.appendChild(profileTreeElement);if(!this.visibleView||this.visibleView===this._launcherView)
-this._showProfile(profile);},_removeProfileHeader:function(profile)
+if(element!==this.element||event.srcElement===this.sidebarElement()){contextMenu.appendItem(WebInspector.UIString("Load\u2026"),this._fileSelectorElement.click.bind(this._fileSelectorElement));}
+contextMenu.show();},showLoadFromFileDialog:function()
+{this._fileSelectorElement.click();},_addProfileHeader:function(profile)
+{var profileType=profile.profileType();var typeId=profileType.id;this._typeIdToSidebarSection[typeId].addProfileHeader(profile);;if(!this.visibleView||this.visibleView===this._launcherView)
+this.showProfile(profile);},_removeProfileHeader:function(profile)
{if(profile.profileType()._profileBeingRecorded===profile)
-this._profileBeingRecordedRemoved();profile.dispose();profile.profileType().removeProfile(profile);var sidebarParent=profile.profileType().treeElement;var profileTitleKey=this._makeTitleKey(profile.title,profile.profileType().id);var group=this._profileGroups[profileTitleKey];if(group){group.splice(group.indexOf(profile),1);if(group.length===1){var index=sidebarParent.children.indexOf(group._profilesTreeElement);sidebarParent.insertChild(group[0]._profilesTreeElement,index);group[0]._profilesTreeElement.small=false;group[0]._profilesTreeElement.mainTitle=group[0].title;sidebarParent.removeChild(group._profilesTreeElement);}
-if(group.length!==0)
-sidebarParent=group._profilesTreeElement;else
-delete this._profileGroups[profileTitleKey];}
-sidebarParent.removeChild(profile._profilesTreeElement);if(!sidebarParent.children.length){this.profilesItemTreeElement.select();this._showLauncherView();sidebarParent.hidden=!this._singleProfileMode;}},_showProfile:function(profile)
+this._profileBeingRecordedRemoved();var i=this._indexOfViewForProfile(profile);if(i!==-1)
+this._profileToView.splice(i,1);var profileType=profile.profileType();var typeId=profileType.id;var sectionIsEmpty=this._typeIdToSidebarSection[typeId].removeProfileHeader(profile);if(sectionIsEmpty){this.profilesItemTreeElement.select();this._showLauncherView();}},showProfile:function(profile)
{if(!profile||(profile.profileType().profileBeingRecorded()===profile)&&!profile.profileType().hasTemporaryView())
-return null;var view=profile.view(this);if(view===this.visibleView)
-return view;this.closeVisibleView();view.show(this.profileViews);profile._profilesTreeElement._suppressOnSelect=true;profile._profilesTreeElement.revealAndSelect();delete profile._profilesTreeElement._suppressOnSelect;this.visibleView=view;this._profileViewStatusBarItemsContainer.removeChildren();var statusBarItems=view.statusBarItems;if(statusBarItems)
+return null;var view=this._viewForProfile(profile);if(view===this.visibleView)
+return view;this.closeVisibleView();view.show(this.profileViews);this.visibleView=view;var profileTypeSection=this._typeIdToSidebarSection[profile.profileType().id];var sidebarElement=profileTypeSection.sidebarElementForProfile(profile);sidebarElement.revealAndSelect();this._profileViewStatusBarItemsContainer.removeChildren();var statusBarItems=view.statusBarItems;if(statusBarItems)
for(var i=0;i<statusBarItems.length;++i)
-this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);return view;},showObject:function(snapshotObjectId,viewName)
-{var heapProfiles=this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId).getProfiles();for(var i=0;i<heapProfiles.length;i++){var profile=heapProfiles[i];if(profile.maxJSObjectId>=snapshotObjectId){this._showProfile(profile);var view=profile.view(this);view.changeView(viewName,function(){function didHighlightObject(found){if(!found)
-WebInspector.log("Cannot find corresponding heap snapshot node",WebInspector.ConsoleMessage.MessageLevel.Error,true);}
-view.dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId,didHighlightObject.bind(this));});break;}}},getProfile:function(typeId,uid)
-{return this.getProfileType(typeId).getProfile(uid);},showView:function(view)
-{this._showProfile(view.profile);},getProfileType:function(typeId)
-{return this._profileTypesByIdMap[typeId];},showProfile:function(typeId,uid)
-{return this._showProfile(this.getProfile(typeId,Number(uid)));},closeVisibleView:function()
+this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);return view;},showObject:function(snapshotObjectId,perspectiveName)
+{var heapProfiles=WebInspector.ProfileTypeRegistry.instance.heapSnapshotProfileType.getProfiles();for(var i=0;i<heapProfiles.length;i++){var profile=heapProfiles[i];if(profile.maxJSObjectId>=snapshotObjectId){this.showProfile(profile);var view=this._viewForProfile(profile);view.highlightLiveObject(perspectiveName,snapshotObjectId);break;}}},_viewForProfile:function(profile)
+{var index=this._indexOfViewForProfile(profile);if(index!==-1)
+return this._profileToView[index].view;var view=profile.createView();view.element.classList.add("profile-view");this._profileToView.push({profile:profile,view:view});return view;},_indexOfViewForProfile:function(profile)
+{for(var i=0;i<this._profileToView.length;i++){if(this._profileToView[i].profile===profile)
+return i;}
+return-1;},closeVisibleView:function()
{if(this.visibleView)
this.visibleView.detach();delete this.visibleView;},performSearch:function(query,shouldJump)
{this.searchCanceled();var visibleView=this.visibleView;if(!visibleView)
@@ -135,65 +130,78 @@
return;this._searchResultsView.jumpToNextSearchResult();this._searchableView.updateCurrentMatchIndex(this._searchResultsView.currentSearchResultIndex());},jumpToPreviousSearchResult:function()
{if(!this._searchResultsView)
return;if(this._searchResultsView!==this.visibleView)
-return;this._searchResultsView.jumpToPreviousSearchResult();this._searchableView.updateCurrentMatchIndex(this._searchResultsView.currentSearchResultIndex());},_getAllProfiles:function()
-{var profiles=[];for(var typeId in this._profileTypesByIdMap)
-profiles=profiles.concat(this._profileTypesByIdMap[typeId].getProfiles());return profiles;},searchCanceled:function()
+return;this._searchResultsView.jumpToPreviousSearchResult();this._searchableView.updateCurrentMatchIndex(this._searchResultsView.currentSearchResultIndex());},searchCanceled:function()
{if(this._searchResultsView){if(this._searchResultsView.searchCanceled)
this._searchResultsView.searchCanceled();this._searchResultsView.currentQuery=null;this._searchResultsView=null;}
-this._searchableView.updateSearchMatchesCount(0);},_reportProfileProgress:function(profile,done,total)
-{profile.sidebarElement.subtitle=WebInspector.UIString("%.0f%",(done/total)*100);profile.sidebarElement.wait=true;},appendApplicableItems:function(event,contextMenu,target)
+this._searchableView.updateSearchMatchesCount(0);},appendApplicableItems:function(event,contextMenu,target)
{if(!(target instanceof WebInspector.RemoteObject))
return;if(WebInspector.inspectorView.currentPanel()!==this)
return;var object=(target);var objectId=object.objectId;if(!objectId)
-return;var heapProfiles=this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId).getProfiles();if(!heapProfiles.length)
+return;var heapProfiles=WebInspector.ProfileTypeRegistry.instance.heapSnapshotProfileType.getProfiles();if(!heapProfiles.length)
return;function revealInView(viewName)
{HeapProfilerAgent.getHeapObjectId(objectId,didReceiveHeapObjectId.bind(this,viewName));}
function didReceiveHeapObjectId(viewName,error,result)
{if(WebInspector.inspectorView.currentPanel()!==this)
return;if(!error)
this.showObject(result,viewName);}
-contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInView.bind(this,"Dominators"));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInView.bind(this,"Summary"));},__proto__:WebInspector.Panel.prototype}
+if(WebInspector.settings.showAdvancedHeapSnapshotProperties.get())
+contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInView.bind(this,"Dominators"));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInView.bind(this,"Summary"));},__proto__:WebInspector.PanelWithSidebarTree.prototype}
+WebInspector.ProfileTypeSidebarSection=function(profileType)
+{WebInspector.SidebarSectionTreeElement.call(this,profileType.treeItemTitle,null,true);this._profileTreeElements=[];this._profileGroups={};this.hidden=true;}
+WebInspector.ProfileTypeSidebarSection.ProfileGroup=function()
+{this.profileSidebarTreeElements=[];this.sidebarTreeElement=null;}
+WebInspector.ProfileTypeSidebarSection.prototype={addProfileHeader:function(profile)
+{this.hidden=false;var profileType=profile.profileType();var sidebarParent=this;var profileTreeElement=profile.createSidebarTreeElement();this._profileTreeElements.push(profileTreeElement);if(!profile.fromFile()&&profileType.profileBeingRecorded()!==profile){var profileTitle=profile.title;var group=this._profileGroups[profileTitle];if(!group){group=new WebInspector.ProfileTypeSidebarSection.ProfileGroup();this._profileGroups[profileTitle]=group;}
+group.profileSidebarTreeElements.push(profileTreeElement);var groupSize=group.profileSidebarTreeElements.length;if(groupSize===2){group.sidebarTreeElement=new WebInspector.ProfileGroupSidebarTreeElement(profile.title);var firstProfileTreeElement=group.profileSidebarTreeElements[0];var index=this.children.indexOf(firstProfileTreeElement);this.insertChild(group.sidebarTreeElement,index);var selected=firstProfileTreeElement.selected;this.removeChild(firstProfileTreeElement);group.sidebarTreeElement.appendChild(firstProfileTreeElement);if(selected)
+firstProfileTreeElement.revealAndSelect();firstProfileTreeElement.small=true;firstProfileTreeElement.mainTitle=WebInspector.UIString("Run %d",1);this.treeOutline.element.classList.add("some-expandable");}
+if(groupSize>=2){sidebarParent=group.sidebarTreeElement;profileTreeElement.small=true;profileTreeElement.mainTitle=WebInspector.UIString("Run %d",groupSize);}}
+sidebarParent.appendChild(profileTreeElement);},removeProfileHeader:function(profile)
+{var index=this._sidebarElementIndex(profile);if(index===-1)
+return false;var profileTreeElement=this._profileTreeElements[index];this._profileTreeElements.splice(index,1);var sidebarParent=this;var group=this._profileGroups[profile.title];if(group){var groupElements=group.profileSidebarTreeElements;groupElements.splice(groupElements.indexOf(profileTreeElement),1);if(groupElements.length===1){var pos=sidebarParent.children.indexOf(group.sidebarTreeElement);this.insertChild(groupElements[0],pos);groupElements[0].small=false;groupElements[0].mainTitle=group.sidebarTreeElement.title;this.removeChild(group.sidebarTreeElement);}
+if(groupElements.length!==0)
+sidebarParent=group.sidebarTreeElement;}
+sidebarParent.removeChild(profileTreeElement);profileTreeElement.dispose();if(this.children.length)
+return false;this.hidden=true;return true;},sidebarElementForProfile:function(profile)
+{var index=this._sidebarElementIndex(profile);return index===-1?null:this._profileTreeElements[index];},_sidebarElementIndex:function(profile)
+{var elements=this._profileTreeElements;for(var i=0;i<elements.length;i++){if(elements[i].profile===profile)
+return i;}
+return-1;},__proto__:WebInspector.SidebarSectionTreeElement.prototype}
WebInspector.ProfilesPanel.ContextMenuProvider=function()
{}
WebInspector.ProfilesPanel.ContextMenuProvider.prototype={appendApplicableItems:function(event,contextMenu,target)
-{WebInspector.panel("profiles").appendApplicableItems(event,contextMenu,target);}}
+{WebInspector.inspectorView.panel("profiles").appendApplicableItems(event,contextMenu,target);}}
WebInspector.ProfileSidebarTreeElement=function(profile,className)
-{this.profile=profile;WebInspector.SidebarTreeElement.call(this,className,"","",profile,false);this.refreshTitles();}
-WebInspector.ProfileSidebarTreeElement.prototype={onselect:function()
-{if(!this._suppressOnSelect)
-this.treeOutline.panel._showProfile(this.profile);},ondelete:function()
-{this.treeOutline.panel._removeProfileHeader(this.profile);return true;},get mainTitle()
-{if(this._mainTitle)
-return this._mainTitle;return this.profile.title;},set mainTitle(x)
-{this._mainTitle=x;this.refreshTitles();},handleContextMenuEvent:function(event,panel)
+{this.profile=profile;WebInspector.SidebarTreeElement.call(this,className,profile.title,"",profile,false);this.refreshTitles();profile.addEventListener(WebInspector.ProfileHeader.Events.UpdateStatus,this._updateStatus,this);if(profile.canSaveToFile())
+this._createSaveLink();else
+profile.addEventListener(WebInspector.ProfileHeader.Events.ProfileReceived,this._onProfileReceived,this);}
+WebInspector.ProfileSidebarTreeElement.prototype={_createSaveLink:function()
+{this._saveLinkElement=this.titleContainer.createChild("span","save-link");this._saveLinkElement.textContent=WebInspector.UIString("Save");this._saveLinkElement.addEventListener("click",this._saveProfile.bind(this),false);},_onProfileReceived:function(event)
+{this._createSaveLink();},_updateStatus:function(event)
+{var statusUpdate=event.data;if(statusUpdate.subtitle!==null)
+this.subtitle=statusUpdate.subtitle;if(typeof statusUpdate.wait==="boolean")
+this.wait=statusUpdate.wait;this.refreshTitles();},dispose:function()
+{this.profile.removeEventListener(WebInspector.ProfileHeader.Events.UpdateStatus,this._updateStatus,this);this.profile.removeEventListener(WebInspector.ProfileHeader.Events.ProfileReceived,this._onProfileReceived,this);},onselect:function()
+{WebInspector.panels.profiles.showProfile(this.profile);},ondelete:function()
+{this.profile.profileType().removeProfile(this.profile);return true;},handleContextMenuEvent:function(event,panel)
{var profile=this.profile;var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString("Load\u2026"),panel._fileSelectorElement.click.bind(panel._fileSelectorElement));if(profile.canSaveToFile())
-contextMenu.appendItem(WebInspector.UIString("Save\u2026"),profile.saveToFile.bind(profile));contextMenu.appendItem(WebInspector.UIString("Delete"),this.ondelete.bind(this));contextMenu.show();},__proto__:WebInspector.SidebarTreeElement.prototype}
-WebInspector.ProfileGroupSidebarTreeElement=function(panel,title,subtitle)
-{WebInspector.SidebarTreeElement.call(this,"profile-group-sidebar-tree-item",title,subtitle,null,true);this._panel=panel;}
+contextMenu.appendItem(WebInspector.UIString("Save\u2026"),profile.saveToFile.bind(profile));contextMenu.appendItem(WebInspector.UIString("Delete"),this.ondelete.bind(this));contextMenu.show();},_saveProfile:function(event)
+{this.profile.saveToFile();},__proto__:WebInspector.SidebarTreeElement.prototype}
+WebInspector.ProfileGroupSidebarTreeElement=function(title,subtitle)
+{WebInspector.SidebarTreeElement.call(this,"profile-group-sidebar-tree-item",title,subtitle,null,true);}
WebInspector.ProfileGroupSidebarTreeElement.prototype={onselect:function()
{if(this.children.length>0)
-this._panel._showProfile(this.children[this.children.length-1].profile);},__proto__:WebInspector.SidebarTreeElement.prototype}
+WebInspector.panels.profiles.showProfile(this.children[this.children.length-1].profile);},__proto__:WebInspector.SidebarTreeElement.prototype}
WebInspector.ProfilesSidebarTreeElement=function(panel)
{this._panel=panel;this.small=false;WebInspector.SidebarTreeElement.call(this,"profile-launcher-view-tree-item",WebInspector.UIString("Profiles"),"",null,false);}
WebInspector.ProfilesSidebarTreeElement.prototype={onselect:function()
{this._panel._showLauncherView();},get selectable()
{return true;},__proto__:WebInspector.SidebarTreeElement.prototype}
-WebInspector.CPUProfilerPanel=function()
-{WebInspector.ProfilesPanel.call(this,"cpu-profiler",new WebInspector.CPUProfileType());}
-WebInspector.CPUProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel.prototype}
-WebInspector.HeapProfilerPanel=function()
-{var heapSnapshotProfileType=new WebInspector.HeapSnapshotProfileType();WebInspector.ProfilesPanel.call(this,"heap-profiler",heapSnapshotProfileType);this._singleProfileMode=false;this._registerProfileType(new WebInspector.TrackingHeapSnapshotProfileType(this));this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,this._onProfileTypeSelected,this);this._launcherView._profileTypeChanged(heapSnapshotProfileType);}
-WebInspector.HeapProfilerPanel.prototype={_createLauncherView:function()
-{return new WebInspector.MultiProfileLauncherView(this);},__proto__:WebInspector.ProfilesPanel.prototype}
-WebInspector.CanvasProfilerPanel=function()
-{WebInspector.ProfilesPanel.call(this,"canvas-profiler",new WebInspector.CanvasProfileType());}
-WebInspector.CanvasProfilerPanel.prototype={__proto__:WebInspector.ProfilesPanel.prototype}
WebInspector.ProfileDataGridNode=function(profileNode,owningTree,hasChildren)
{this.profileNode=profileNode;WebInspector.DataGridNode.call(this,null,hasChildren);this.tree=owningTree;this.childrenByCallUID={};this.lastComparator=null;this.callUID=profileNode.callUID;this.selfTime=profileNode.selfTime;this.totalTime=profileNode.totalTime;this.functionName=profileNode.functionName;this._deoptReason=(!profileNode.deoptReason||profileNode.deoptReason==="no reason")?"":profileNode.deoptReason;this.url=profileNode.url;}
WebInspector.ProfileDataGridNode.prototype={get data()
{function formatMilliseconds(time)
{return WebInspector.UIString("%.1f\u2009ms",time);}
-var data={};if(this._deoptReason){var div=document.createElement("div");var marker=div.createChild("span");marker.className="profile-warn-marker";marker.title=WebInspector.UIString("Not optimized: %s",this._deoptReason);var functionName=div.createChild("span");functionName.textContent=this.functionName;data["function"]=div;}else
+var data={};if(this._deoptReason){var content=document.createDocumentFragment();var marker=content.createChild("span","profile-warn-marker");marker.title=WebInspector.UIString("Not optimized: %s",this._deoptReason);content.createTextChild(this.functionName);data["function"]=content;}else
data["function"]=this.functionName;if(this.tree.profileView.showSelfTimeAsPercent.get())
data["self"]=WebInspector.UIString("%.2f%",this.selfPercent);else
data["self"]=formatMilliseconds(this.selfTime);if(this.tree.profileView.showTotalTimeAsPercent.get())
@@ -290,16 +298,57 @@
return;this._save();var excludedCallUID=profileDataGridNode.callUID;var excludedTopLevelChild=this.childrenByCallUID[excludedCallUID];if(excludedTopLevelChild)
this.children.remove(excludedTopLevelChild);var children=this.children;var count=children.length;for(var index=0;index<count;++index)
children[index]._exclude(excludedCallUID);if(this.lastComparator)
-this.sort(this.lastComparator,true);},_sharedPopulate:WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate,__proto__:WebInspector.ProfileDataGridTree.prototype};WebInspector.CPUProfileView=function(profileHeader)
-{WebInspector.View.call(this);this.element.classList.add("profile-view");this.showSelfTimeAsPercent=WebInspector.settings.createSetting("cpuProfilerShowSelfTimeAsPercent",true);this.showTotalTimeAsPercent=WebInspector.settings.createSetting("cpuProfilerShowTotalTimeAsPercent",true);this.showAverageTimeAsPercent=WebInspector.settings.createSetting("cpuProfilerShowAverageTimeAsPercent",true);this._viewType=WebInspector.settings.createSetting("cpuProfilerView",WebInspector.CPUProfileView._TypeHeavy);var columns=[];columns.push({id:"self",title:WebInspector.UIString("Self"),width:"72px",sort:WebInspector.DataGrid.Order.Descending,sortable:true});columns.push({id:"total",title:WebInspector.UIString("Total"),width:"72px",sortable:true});columns.push({id:"function",title:WebInspector.UIString("Function"),disclosure:true,sortable:true});this.dataGrid=new WebInspector.DataGrid(columns);this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,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(this));var options={};options[WebInspector.CPUProfileView._TypeFlame]=this.viewSelectComboBox.createOption(WebInspector.UIString("Flame Chart"),"",WebInspector.CPUProfileView._TypeFlame);options[WebInspector.CPUProfileView._TypeHeavy]=this.viewSelectComboBox.createOption(WebInspector.UIString("Heavy (Bottom Up)"),"",WebInspector.CPUProfileView._TypeHeavy);options[WebInspector.CPUProfileView._TypeTree]=this.viewSelectComboBox.createOption(WebInspector.UIString("Tree (Top Down)"),"",WebInspector.CPUProfileView._TypeTree);var optionName=this._viewType.get()||WebInspector.CPUProfileView._TypeFlame;var option=options[optionName]||options[WebInspector.CPUProfileView._TypeFlame];this.viewSelectComboBox.select(option);this._statusBarButtonsElement=document.createElement("span");this.percentButton=new WebInspector.StatusBarButton("","percent-time-status-bar-item");this.percentButton.addEventListener("click",this._percentClicked,this);this._statusBarButtonsElement.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.addEventListener("click",this._focusClicked,this);this._statusBarButtonsElement.appendChild(this.focusButton.element);this.excludeButton=new WebInspector.StatusBarButton(WebInspector.UIString("Exclude selected function."),"exclude-profile-node-status-bar-item");this.excludeButton.setEnabled(false);this.excludeButton.addEventListener("click",this._excludeClicked,this);this._statusBarButtonsElement.appendChild(this.excludeButton.element);this.resetButton=new WebInspector.StatusBarButton(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.resetButton.element);this.profileHead=(null);this.profile=profileHeader;this._linkifier=new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));if(this.profile._profile)
+this.sort(this.lastComparator,true);},_sharedPopulate:WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate,__proto__:WebInspector.ProfileDataGridTree.prototype};WebInspector.CPUProfileFlameChart=function(dataProvider)
+{WebInspector.VBox.call(this);this.registerRequiredCSS("flameChart.css");this.element.id="cpu-flame-chart";this._overviewPane=new WebInspector.CPUProfileFlameChart.OverviewPane(dataProvider);this._overviewPane.show(this.element);this._mainPane=new WebInspector.FlameChart(dataProvider,this._overviewPane,true,false);this._mainPane.show(this.element);this._mainPane.addEventListener(WebInspector.FlameChart.Events.EntrySelected,this._onEntrySelected,this);this._overviewPane._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,this._onWindowChanged,this);}
+WebInspector.CPUProfileFlameChart.prototype={_onWindowChanged:function(event)
+{this._mainPane.changeWindow(this._overviewPane._overviewGrid.windowLeft(),this._overviewPane._overviewGrid.windowRight());},selectRange:function(timeLeft,timeRight)
+{this._overviewPane._selectRange(timeLeft,timeRight);},_onEntrySelected:function(event)
+{this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelected,event.data);},update:function()
+{this._overviewPane.update();this._mainPane.update();},__proto__:WebInspector.VBox.prototype};WebInspector.CPUProfileFlameChart.OverviewCalculator=function()
+{}
+WebInspector.CPUProfileFlameChart.OverviewCalculator.prototype={paddingLeft:function()
+{return 0;},_updateBoundaries:function(overviewPane)
+{this._minimumBoundaries=0;var totalTime=overviewPane._dataProvider.totalTime();this._maximumBoundaries=totalTime;this._xScaleFactor=overviewPane._overviewCanvas.width/totalTime;},computePosition:function(time)
+{return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(value,precision)
+{return Number.secondsToString((value+this._minimumBoundaries)/1000);},maximumBoundary:function()
+{return this._maximumBoundaries;},minimumBoundary:function()
+{return this._minimumBoundaries;},zeroTime:function()
+{return this._minimumBoundaries;},boundarySpan:function()
+{return this._maximumBoundaries-this._minimumBoundaries;}}
+WebInspector.CPUProfileFlameChart.ColorGenerator=function()
+{this._colors={};this._currentColorIndex=0;}
+WebInspector.CPUProfileFlameChart.ColorGenerator.prototype={setColorForID:function(id,color)
+{this._colors[id]=color;},colorForID:function(id,sat)
+{if(typeof sat!=="number")
+sat=100;var color=this._colors[id];if(!color){color=this._createColor(this._currentColorIndex++,sat);this._colors[id]=color;}
+return color;},_createColor:function(index,sat)
+{var hue=(index*7+12*(index%2))%360;return"hsla("+hue+", "+sat+"%, 66%, 0.7)";}}
+WebInspector.CPUProfileFlameChart.OverviewPane=function(dataProvider)
+{WebInspector.VBox.call(this);this.element.classList.add("flame-chart-overview-pane");this._overviewContainer=this.element.createChild("div","overview-container");this._overviewGrid=new WebInspector.OverviewGrid("flame-chart");this._overviewGrid.element.classList.add("fill");this._overviewCanvas=this._overviewContainer.createChild("canvas","flame-chart-overview-canvas");this._overviewContainer.appendChild(this._overviewGrid.element);this._overviewCalculator=new WebInspector.CPUProfileFlameChart.OverviewCalculator();this._dataProvider=dataProvider;}
+WebInspector.CPUProfileFlameChart.OverviewPane.prototype={requestWindowTimes:function(windowStartTime,windowEndTime)
+{this._overviewGrid.setWindow(windowStartTime/this._dataProvider.totalTime(),windowEndTime/this._dataProvider.totalTime());},_selectRange:function(timeLeft,timeRight)
+{this._overviewGrid.setWindow(timeLeft/this._dataProvider.totalTime(),timeRight/this._dataProvider.totalTime());},_timelineData:function()
+{return this._dataProvider.timelineData();},onResize:function()
+{this._scheduleUpdate();},_scheduleUpdate:function()
+{if(this._updateTimerId)
+return;this._updateTimerId=requestAnimationFrame(this.update.bind(this));},update:function()
+{this._updateTimerId=0;var timelineData=this._timelineData();if(!timelineData)
+return;this._resetCanvas(this._overviewContainer.clientWidth,this._overviewContainer.clientHeight-WebInspector.FlameChart.DividersBarHeight);this._overviewCalculator._updateBoundaries(this);this._overviewGrid.updateDividers(this._overviewCalculator);WebInspector.CPUProfileFlameChart.OverviewPane.drawOverviewCanvas(this._dataProvider,timelineData,this._overviewCanvas.getContext("2d"),this._overviewContainer.clientWidth,this._overviewContainer.clientHeight-WebInspector.FlameChart.DividersBarHeight);},_resetCanvas:function(width,height)
+{var ratio=window.devicePixelRatio;this._overviewCanvas.width=width*ratio;this._overviewCanvas.height=height*ratio;},__proto__:WebInspector.VBox.prototype}
+WebInspector.CPUProfileFlameChart.OverviewPane.calculateDrawData=function(dataProvider,timelineData,width)
+{var entryOffsets=timelineData.entryOffsets;var entryTotalTimes=timelineData.entryTotalTimes;var entryLevels=timelineData.entryLevels;var length=entryOffsets.length;var drawData=new Uint8Array(width);var scaleFactor=width/dataProvider.totalTime();for(var entryIndex=0;entryIndex<length;++entryIndex){var start=Math.floor(entryOffsets[entryIndex]*scaleFactor);var finish=Math.floor((entryOffsets[entryIndex]+entryTotalTimes[entryIndex])*scaleFactor);for(var x=start;x<=finish;++x)
+drawData[x]=Math.max(drawData[x],entryLevels[entryIndex]+1);}
+return drawData;}
+WebInspector.CPUProfileFlameChart.OverviewPane.drawOverviewCanvas=function(dataProvider,timelineData,context,width,height)
+{var ratio=window.devicePixelRatio;var canvasWidth=width*ratio;var canvasHeight=height*ratio;var drawData=WebInspector.CPUProfileFlameChart.OverviewPane.calculateDrawData(dataProvider,timelineData,canvasWidth);if(!drawData)
+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)";context.fillStyle="rgba(214,225,254,0.8)";context.moveTo(-1,canvasHeight-1);context.lineTo(-1,Math.round(canvasHeight-drawData[0]*yScaleFactor-1));var value;for(var x=0;x<canvasWidth;++x){value=Math.round(canvasHeight-drawData[x]*yScaleFactor-1);context.lineTo(x,value);}
+context.lineTo(canvasWidth+1,value);context.lineTo(canvasWidth+1,canvasHeight-1);context.fill();context.stroke();context.closePath();};WebInspector.CPUProfileView=function(profileHeader)
+{WebInspector.VBox.call(this);this.element.classList.add("cpu-profile-view");this.showSelfTimeAsPercent=WebInspector.settings.createSetting("cpuProfilerShowSelfTimeAsPercent",true);this.showTotalTimeAsPercent=WebInspector.settings.createSetting("cpuProfilerShowTotalTimeAsPercent",true);this.showAverageTimeAsPercent=WebInspector.settings.createSetting("cpuProfilerShowAverageTimeAsPercent",true);this._viewType=WebInspector.settings.createSetting("cpuProfilerView",WebInspector.CPUProfileView._TypeHeavy);var columns=[];columns.push({id:"self",title:WebInspector.UIString("Self"),width:"72px",sort:WebInspector.DataGrid.Order.Descending,sortable:true});columns.push({id:"total",title:WebInspector.UIString("Total"),width:"72px",sortable:true});columns.push({id:"function",title:WebInspector.UIString("Function"),disclosure:true,sortable:true});this.dataGrid=new WebInspector.DataGrid(columns);this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,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(this));var options={};options[WebInspector.CPUProfileView._TypeFlame]=this.viewSelectComboBox.createOption(WebInspector.UIString("Chart"),"",WebInspector.CPUProfileView._TypeFlame);options[WebInspector.CPUProfileView._TypeHeavy]=this.viewSelectComboBox.createOption(WebInspector.UIString("Heavy (Bottom Up)"),"",WebInspector.CPUProfileView._TypeHeavy);options[WebInspector.CPUProfileView._TypeTree]=this.viewSelectComboBox.createOption(WebInspector.UIString("Tree (Top Down)"),"",WebInspector.CPUProfileView._TypeTree);var optionName=this._viewType.get()||WebInspector.CPUProfileView._TypeFlame;var option=options[optionName]||options[WebInspector.CPUProfileView._TypeFlame];this.viewSelectComboBox.select(option);this._statusBarButtonsElement=document.createElement("span");this.percentButton=new WebInspector.StatusBarButton("","percent-time-status-bar-item");this.percentButton.addEventListener("click",this._percentClicked,this);this._statusBarButtonsElement.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.addEventListener("click",this._focusClicked,this);this._statusBarButtonsElement.appendChild(this.focusButton.element);this.excludeButton=new WebInspector.StatusBarButton(WebInspector.UIString("Exclude selected function."),"exclude-profile-node-status-bar-item");this.excludeButton.setEnabled(false);this.excludeButton.addEventListener("click",this._excludeClicked,this);this._statusBarButtonsElement.appendChild(this.excludeButton.element);this.resetButton=new WebInspector.StatusBarButton(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.resetButton.element);this.profileHead=(null);this.profile=profileHeader;this._linkifier=new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));if(this.profile._profile)
this._processProfileData(this.profile._profile);else
this._processProfileData(this.profile.protocolProfile());}
WebInspector.CPUProfileView._TypeFlame="Flame";WebInspector.CPUProfileView._TypeTree="Tree";WebInspector.CPUProfileView._TypeHeavy="Heavy";WebInspector.CPUProfileView.prototype={selectRange:function(timeLeft,timeRight)
{if(!this._flameChart)
-return;this._flameChart.selectRange(timeLeft,timeRight);},_revealProfilerNode:function(event)
-{var current=this.profileDataGridTree.children[0];while(current&&current.profileNode!==event.data)
-current=current.traverseNextNode(false,null,false);if(current)
-current.revealAndSelect();},_processProfileData:function(profile)
+return;this._flameChart.selectRange(timeLeft,timeRight);},_processProfileData:function(profile)
{this.profileHead=profile.head;this.samples=profile.samples;this._calculateTimes(profile);this._assignParentsInProfile();if(this.samples)
this._buildIdToNodeMap();this._changeView();this._updatePercentButton();if(this._flameChart)
this._flameChart.update();},get statusBarItems()
@@ -359,15 +408,14 @@
{var searchResult=this._searchResults[index];if(!searchResult)
return;var profileNode=searchResult.profileNode;profileNode.revealAndSelect();},_ensureFlameChartCreated:function()
{if(this._flameChart)
-return;var dataProvider=new WebInspector.CPUFlameChartDataProvider(this);this._flameChart=new WebInspector.FlameChart(dataProvider);this._flameChart.addEventListener(WebInspector.FlameChart.Events.EntrySelected,this._onEntrySelected.bind(this));},_onEntrySelected:function(event)
-{var node=event.data;if(!node||!node.scriptId)
+return;this._dataProvider=new WebInspector.CPUFlameChartDataProvider(this);this._flameChart=new WebInspector.CPUProfileFlameChart(this._dataProvider);this._flameChart.addEventListener(WebInspector.FlameChart.Events.EntrySelected,this._onEntrySelected.bind(this));},_onEntrySelected:function(event)
+{var entryIndex=event.data;var node=this._dataProvider._entryNodes[entryIndex];if(!node||!node.scriptId)
return;var script=WebInspector.debuggerModel.scriptForId(node.scriptId)
if(!script)
-return;var uiLocation=script.rawLocationToUILocation(node.lineNumber);if(!uiLocation)
-return;WebInspector.panel("sources").showUILocation(uiLocation);},_changeView:function()
+return;WebInspector.Revealer.reveal(script.rawLocationToUILocation(node.lineNumber));},_changeView:function()
{if(!this.profile)
-return;switch(this.viewSelectComboBox.selectedOption().value){case WebInspector.CPUProfileView._TypeFlame:this._ensureFlameChartCreated();this.dataGrid.detach();this._flameChart.show(this.element);this._viewType.set(WebInspector.CPUProfileView._TypeFlame);this._statusBarButtonsElement.enableStyleClass("hidden",true);return;case WebInspector.CPUProfileView._TypeTree:this.profileDataGridTree=this._getTopDownProfileDataGridTree();this._sortProfile();this._viewType.set(WebInspector.CPUProfileView._TypeTree);break;case WebInspector.CPUProfileView._TypeHeavy:this.profileDataGridTree=this._getBottomUpProfileDataGridTree();this._sortProfile();this._viewType.set(WebInspector.CPUProfileView._TypeHeavy);break;}
-this._statusBarButtonsElement.enableStyleClass("hidden",false);if(this._flameChart)
+return;switch(this.viewSelectComboBox.selectedOption().value){case WebInspector.CPUProfileView._TypeFlame:this._ensureFlameChartCreated();this.dataGrid.detach();this._flameChart.show(this.element);this._viewType.set(WebInspector.CPUProfileView._TypeFlame);this._statusBarButtonsElement.classList.toggle("hidden",true);return;case WebInspector.CPUProfileView._TypeTree:this.profileDataGridTree=this._getTopDownProfileDataGridTree();this._sortProfile();this._viewType.set(WebInspector.CPUProfileView._TypeTree);break;case WebInspector.CPUProfileView._TypeHeavy:this.profileDataGridTree=this._getBottomUpProfileDataGridTree();this._sortProfile();this._viewType.set(WebInspector.CPUProfileView._TypeHeavy);break;}
+this._statusBarButtonsElement.classList.toggle("hidden",false);if(this._flameChart)
this._flameChart.detach();this.dataGrid.show(this.element);if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults)
return;this._searchFinishedCallback(this,-this._searchResults.length);this.performSearch(this.currentQuery,this._searchFinishedCallback);},_percentClicked:function(event)
{var currentState=this.showSelfTimeAsPercent.get()&&this.showTotalTimeAsPercent.get()&&this.showAverageTimeAsPercent.get();this.showSelfTimeAsPercent.set(!currentState);this.showTotalTimeAsPercent.set(!currentState);this.showAverageTimeAsPercent.set(!currentState);this.refreshShowAsPercents();},_updatePercentButton:function()
@@ -392,13 +440,13 @@
profile.totalHitCount=totalHitCount(profile.head);var durationMs=1000*(profile.endTime-profile.startTime);var samplingInterval=durationMs/profile.totalHitCount;this.samplingIntervalMs=samplingInterval;function calculateTimesForNode(node){node.selfTime=node.hitCount*samplingInterval;var totalHitCount=node.hitCount;for(var i=0;i<node.children.length;i++)
totalHitCount+=calculateTimesForNode(node.children[i]);node.totalTime=totalHitCount*samplingInterval;return totalHitCount;}
calculateTimesForNode(profile.head);},_assignParentsInProfile:function()
-{var head=this.profileHead;head.parent=null;head.head=null;var nodesToTraverse=[{parent:head,children:head.children}];while(nodesToTraverse.length>0){var pair=nodesToTraverse.pop();var parent=pair.parent;var children=pair.children;var length=children.length;for(var i=0;i<length;++i){children[i].head=head;children[i].parent=parent;if(children[i].children.length>0)
-nodesToTraverse.push({parent:children[i],children:children[i].children});}}},_buildIdToNodeMap:function()
+{var head=this.profileHead;head.parent=null;head.head=null;var nodesToTraverse=[head];while(nodesToTraverse.length){var parent=nodesToTraverse.pop();var children=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)
+nodesToTraverse.push(child);}}},_buildIdToNodeMap:function()
{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++)
stack.push(node.children[i]);}
-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}
+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}
WebInspector.CPUProfileType=function()
-{WebInspector.ProfileType.call(this,WebInspector.CPUProfileType.TypeId,WebInspector.UIString("Collect JavaScript CPU Profile"));this._recording=false;this._nextProfileId=1;this._nextAnonymousConsoleProfileNumber=1;this._anonymousConsoleProfileIdToTitle={};WebInspector.CPUProfileType.instance=this;WebInspector.cpuProfilerModel.setDelegate(this);}
+{WebInspector.ProfileType.call(this,WebInspector.CPUProfileType.TypeId,WebInspector.UIString("Collect JavaScript CPU Profile"));this._recording=false;this._nextAnonymousConsoleProfileNumber=1;this._anonymousConsoleProfileIdToTitle={};WebInspector.CPUProfileType.instance=this;WebInspector.cpuProfilerModel.setDelegate(this);}
WebInspector.CPUProfileType.TypeId="CPU";WebInspector.CPUProfileType.prototype={fileExtension:function()
{return".cpuprofile";},get buttonTooltip()
{return this._recording?WebInspector.UIString("Stop CPU profiling."):WebInspector.UIString("Start CPU profiling.");},buttonClicked:function()
@@ -406,98 +454,131 @@
{return WebInspector.UIString("CPU PROFILES");},get description()
{return WebInspector.UIString("CPU profiles show where the execution time is spent in your page's JavaScript functions.");},consoleProfileStarted:function(id,scriptLocation,title)
{var resolvedTitle=title;if(!resolvedTitle){resolvedTitle=WebInspector.UIString("Profile %s",this._nextAnonymousConsoleProfileNumber++);this._anonymousConsoleProfileIdToTitle[id]=resolvedTitle;}
-this._addMessageToConsole(WebInspector.ConsoleMessage.MessageType.Profile,scriptLocation,resolvedTitle);},consoleProfileFinished:function(protocolId,scriptLocation,cpuProfile,title)
+this._addMessageToConsole(WebInspector.ConsoleMessage.MessageType.Profile,scriptLocation,WebInspector.UIString("Profile '%s' started.",resolvedTitle));},consoleProfileFinished:function(protocolId,scriptLocation,cpuProfile,title)
{var resolvedTitle=title;if(typeof title==="undefined"){resolvedTitle=this._anonymousConsoleProfileIdToTitle[protocolId];delete this._anonymousConsoleProfileIdToTitle[protocolId];}
-var id=this._nextProfileId++;var profile=new WebInspector.CPUProfileHeader(this,resolvedTitle,id);profile.setProtocolProfile(cpuProfile);this.addProfile(profile);resolvedTitle+="#"+id;this._addMessageToConsole(WebInspector.ConsoleMessage.MessageType.ProfileEnd,scriptLocation,resolvedTitle);},_addMessageToConsole:function(type,scriptLocation,title)
-{var rawLocation=new WebInspector.DebuggerModel.Location(scriptLocation.scriptId,scriptLocation.lineNumber,scriptLocation.columnNumber||0);var uiLocation=WebInspector.debuggerModel.rawLocationToUILocation(rawLocation);var url;if(uiLocation)
-url=uiLocation.url();var message=WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.ConsoleAPI,WebInspector.ConsoleMessage.MessageLevel.Debug,title,type,url||undefined,scriptLocation.lineNumber,scriptLocation.columnNumber);WebInspector.console.addMessage(message);},isRecordingProfile:function()
+var profile=new WebInspector.CPUProfileHeader(this,resolvedTitle);profile.setProtocolProfile(cpuProfile);this.addProfile(profile);this._addMessageToConsole(WebInspector.ConsoleMessage.MessageType.ProfileEnd,scriptLocation,WebInspector.UIString("Profile '%s' finished.",resolvedTitle));},_addMessageToConsole:function(type,scriptLocation,messageText)
+{var script=WebInspector.debuggerModel.scriptForId(scriptLocation.scriptId);var message=new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.ConsoleAPI,WebInspector.ConsoleMessage.MessageLevel.Debug,messageText,type,undefined,undefined,undefined,undefined,undefined,[{functionName:"",scriptId:scriptLocation.scriptId,url:script?script.contentURL():"",lineNumber:scriptLocation.lineNumber,columnNumber:scriptLocation.columnNumber||0}]);WebInspector.console.addMessage(message);},isRecordingProfile:function()
{return this._recording;},startRecordingProfile:function()
{if(this._profileBeingRecorded)
-return;var id=this._nextProfileId++;this._profileBeingRecorded=new WebInspector.CPUProfileHeader(this,WebInspector.UIString("Recording\u2026"),id);this.addProfile(this._profileBeingRecorded);this._recording=true;WebInspector.cpuProfilerModel.setRecording(true);WebInspector.userMetrics.ProfilesCPUProfileTaken.record();ProfilerAgent.start();},stopRecordingProfile:function()
+return;this._profileBeingRecorded=new WebInspector.CPUProfileHeader(this);this.addProfile(this._profileBeingRecorded);this._profileBeingRecorded.updateStatus(WebInspector.UIString("Recording\u2026"));this._recording=true;WebInspector.cpuProfilerModel.setRecording(true);WebInspector.userMetrics.ProfilesCPUProfileTaken.record();ProfilerAgent.start();},stopRecordingProfile:function()
{this._recording=false;WebInspector.cpuProfilerModel.setRecording(false);function didStopProfiling(error,profile)
{if(!this._profileBeingRecorded)
-return;this._profileBeingRecorded.setProtocolProfile(profile);var title=WebInspector.UIString("Profile %d",this._profileBeingRecorded.uid);this._profileBeingRecorded.title=title;this._profileBeingRecorded.sidebarElement.mainTitle=title;var recordedProfile=this._profileBeingRecorded;this._profileBeingRecorded=null;WebInspector.panels.profiles._showProfile(recordedProfile);}
+return;this._profileBeingRecorded.setProtocolProfile(profile);this._profileBeingRecorded.updateStatus("");var recordedProfile=this._profileBeingRecorded;this._profileBeingRecorded=null;WebInspector.panels.profiles.showProfile(recordedProfile);}
ProfilerAgent.stop(didStopProfiling.bind(this));},createProfileLoadedFromFile:function(title)
-{return new WebInspector.CPUProfileHeader(this,title);},removeProfile:function(profile)
-{if(this._profileBeingRecorded===profile)
-this.stopRecordingProfile();WebInspector.ProfileType.prototype.removeProfile.call(this,profile);},__proto__:WebInspector.ProfileType.prototype}
-WebInspector.CPUProfileHeader=function(type,title,uid)
-{WebInspector.ProfileHeader.call(this,type,title,uid);this._tempFile=null;}
+{return new WebInspector.CPUProfileHeader(this,title);},profileBeingRecordedRemoved:function()
+{this.stopRecordingProfile();},__proto__:WebInspector.ProfileType.prototype}
+WebInspector.CPUProfileHeader=function(type,title)
+{WebInspector.ProfileHeader.call(this,type,title||WebInspector.UIString("Profile %d",type._nextProfileUid));this._tempFile=null;}
WebInspector.CPUProfileHeader.prototype={onTransferStarted:function()
-{this._jsonifiedProfile="";this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026 %s",Number.bytesToString(this._jsonifiedProfile.length));},onChunkTransferred:function(reader)
-{this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026 %d\%",Number.bytesToString(this._jsonifiedProfile.length));},onTransferFinished:function()
-{this.sidebarElement.subtitle=WebInspector.UIString("Parsing\u2026");this._profile=JSON.parse(this._jsonifiedProfile);this._jsonifiedProfile=null;this.sidebarElement.subtitle=WebInspector.UIString("Loaded");if(this._profileType._profileBeingRecorded===this)
+{this._jsonifiedProfile="";this.updateStatus(WebInspector.UIString("Loading\u2026 %s",Number.bytesToString(this._jsonifiedProfile.length)),true);},onChunkTransferred:function(reader)
+{this.updateStatus(WebInspector.UIString("Loading\u2026 %d\%",Number.bytesToString(this._jsonifiedProfile.length)));},onTransferFinished:function()
+{this.updateStatus(WebInspector.UIString("Parsing\u2026"),true);this._profile=JSON.parse(this._jsonifiedProfile);this._jsonifiedProfile=null;this.updateStatus(WebInspector.UIString("Loaded"),false);if(this._profileType._profileBeingRecorded===this)
this._profileType._profileBeingRecorded=null;},onError:function(reader,e)
-{switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:this.sidebarElement.subtitle=WebInspector.UIString("'%s' not found.",reader.fileName());break;case e.target.error.NOT_READABLE_ERR:this.sidebarElement.subtitle=WebInspector.UIString("'%s' is not readable",reader.fileName());break;case e.target.error.ABORT_ERR:break;default:this.sidebarElement.subtitle=WebInspector.UIString("'%s' error %d",reader.fileName(),e.target.error.code);}},write:function(text)
+{var subtitle;switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:subtitle=WebInspector.UIString("'%s' not found.",reader.fileName());break;case e.target.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);}
+this.updateStatus(subtitle);},write:function(text)
{this._jsonifiedProfile+=text;},close:function(){},dispose:function()
{this.removeTempFile();},createSidebarTreeElement:function()
-{return new WebInspector.ProfileSidebarTreeElement(this,"profile-sidebar-tree-item");},createView:function(profilesPanel)
+{return new WebInspector.ProfileSidebarTreeElement(this,"profile-sidebar-tree-item");},createView:function()
{return new WebInspector.CPUProfileView(this);},canSaveToFile:function()
-{return!!this._tempFile;},saveToFile:function()
+{return!this.fromFile()&&this._protocolProfile;},saveToFile:function()
{var fileOutputStream=new WebInspector.FileOutputStream();function onOpenForSave(accepted)
{if(!accepted)
return;function didRead(data)
{if(data)
fileOutputStream.write(data,fileOutputStream.close.bind(fileOutputStream));else
fileOutputStream.close();}
-this._tempFile.read(didRead.bind(this));}
+if(this._failedToCreateTempFile){WebInspector.console.log("Failed to open temp file with heap snapshot",WebInspector.ConsoleMessage.MessageLevel.Error);fileOutputStream.close();}else if(this._tempFile){this._tempFile.read(didRead);}else{this._onTempFileReady=onOpenForSave.bind(this,accepted);}}
this._fileName=this._fileName||"CPU-"+new Date().toISO8601Compact()+this._profileType.fileExtension();fileOutputStream.open(this._fileName,onOpenForSave.bind(this));},loadFromFile:function(file)
-{this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026");this.sidebarElement.wait=true;var fileReader=new WebInspector.ChunkedFileReader(file,10000000,this);fileReader.start(this);},protocolProfile:function()
+{this.updateStatus(WebInspector.UIString("Loading\u2026"),true);var fileReader=new WebInspector.ChunkedFileReader(file,10000000,this);fileReader.start(this);},protocolProfile:function()
{return this._protocolProfile;},setProtocolProfile:function(cpuProfile)
-{this._protocolProfile=cpuProfile;this._saveProfileDataToTempFile(cpuProfile);},_saveProfileDataToTempFile:function(data)
+{this._protocolProfile=cpuProfile;this._saveProfileDataToTempFile(cpuProfile);if(this.canSaveToFile())
+this.dispatchEventToListeners(WebInspector.ProfileHeader.Events.ProfileReceived);},_saveProfileDataToTempFile:function(data)
{var serializedData=JSON.stringify(data);function didCreateTempFile(tempFile)
{this._writeToTempFile(tempFile,serializedData);}
new WebInspector.TempFile("cpu-profiler",this.uid,didCreateTempFile.bind(this));},_writeToTempFile:function(tempFile,serializedData)
-{this._tempFile=tempFile;if(tempFile)
-tempFile.write(serializedData,tempFile.finishWriting.bind(tempFile));},__proto__:WebInspector.ProfileHeader.prototype}
+{this._tempFile=tempFile;if(!tempFile){this._failedToCreateTempFile=true;this._notifyTempFileReady();return;}
+function didWriteToTempFile(success)
+{if(!success)
+this._failedToCreateTempFile=true;tempFile.finishWriting();this._notifyTempFileReady();}
+tempFile.write(serializedData,didWriteToTempFile.bind(this));},_notifyTempFileReady:function()
+{if(this._onTempFileReady){this._onTempFileReady();this._onTempFileReady=null;}},__proto__:WebInspector.ProfileHeader.prototype}
+WebInspector.CPUProfileView.colorGenerator=function()
+{if(!WebInspector.CPUProfileView._colorGenerator){var colorGenerator=new WebInspector.CPUProfileFlameChart.ColorGenerator();colorGenerator.colorForID("(idle)::0",50);colorGenerator.colorForID("(program)::0",50);colorGenerator.colorForID("(garbage collector)::0",50);WebInspector.CPUProfileView._colorGenerator=colorGenerator;}
+return WebInspector.CPUProfileView._colorGenerator;}
WebInspector.CPUFlameChartDataProvider=function(cpuProfileView)
-{WebInspector.FlameChartDataProvider.call(this);this._cpuProfileView=cpuProfileView;}
-WebInspector.CPUFlameChartDataProvider.prototype={timelineData:function(colorGenerator)
-{return this._timelineData||this._calculateTimelineData(colorGenerator);},_calculateTimelineData:function(colorGenerator)
+{WebInspector.FlameChartDataProvider.call(this);this._cpuProfileView=cpuProfileView;this._colorGenerator=WebInspector.CPUProfileView.colorGenerator();}
+WebInspector.CPUFlameChartDataProvider.prototype={barHeight:function()
+{return 15;},textBaseline:function()
+{return 4;},textPadding:function()
+{return 2;},dividerOffsets:function(startTime,endTime)
+{return null;},zeroTime:function()
+{return 0;},totalTime:function()
+{return this._cpuProfileView.profileHead.totalTime;},maxStackDepth:function()
+{return this._maxStackDepth;},timelineData:function()
+{return this._timelineData||this._calculateTimelineData();},_calculateTimelineData:function()
{if(!this._cpuProfileView.profileHead)
-return null;var samples=this._cpuProfileView.samples;var idToNode=this._cpuProfileView._idToNode;var gcNode=this._cpuProfileView._gcNode;var samplesCount=samples.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)
-{this.colorPair=colorPair;this.depth=depth;this.duration=duration;this.startTime=startTime;this.node=node;this.selfTime=0;}
+return null;var samples=this._cpuProfileView.samples;var idToNode=this._cpuProfileView._idToNode;var gcNode=this._cpuProfileView._gcNode;var samplesCount=samples.length;var samplingInterval=this._cpuProfileView.samplingIntervalMs;var index=0;var openIntervals=[];var stackTrace=[];var maxDepth=5;var depth=0;function ChartEntry(depth,duration,startTime,node)
+{this.depth=depth;this.duration=duration;this.startTime=startTime;this.node=node;this.selfTime=0;}
var entries=([]);for(var sampleIndex=0;sampleIndex<samplesCount;sampleIndex++){var node=idToNode[samples[sampleIndex]];stackTrace.length=0;while(node){stackTrace.push(node);node=node.parent;}
stackTrace.pop();maxDepth=Math.max(maxDepth,depth);depth=0;node=stackTrace.pop();var intervalIndex;if(node===gcNode){while(depth<openIntervals.length){intervalIndex=openIntervals[depth].index;entries[intervalIndex].duration+=samplingInterval;++depth;}
if(openIntervals.length>0&&openIntervals.peekLast().node===node){entries[intervalIndex].selfTime+=samplingInterval;continue;}}
while(node&&depth<openIntervals.length&&node===openIntervals[depth].node){intervalIndex=openIntervals[depth].index;entries[intervalIndex].duration+=samplingInterval;node=stackTrace.pop();++depth;}
if(depth<openIntervals.length)
openIntervals.length=depth;if(!node){entries[intervalIndex].selfTime+=samplingInterval;continue;}
-while(node){var colorPair=colorGenerator._colorPairForID(node.functionName+":"+node.url+":"+node.lineNumber);var indexesForColor=colorEntryIndexes[colorPair.index];if(!indexesForColor)
-indexesForColor=colorEntryIndexes[colorPair.index]=[];var entry=new ChartEntry(colorPair,depth,samplingInterval,sampleIndex*samplingInterval,node);indexesForColor.push(entries.length);entries.push(entry);openIntervals.push({node:node,index:index});++index;node=stackTrace.pop();++depth;}
+var colorGenerator=this._colorGenerator;var color="";while(node){entries.push(new ChartEntry(depth,samplingInterval,sampleIndex*samplingInterval,node));openIntervals.push({node:node,index:index});++index;node=stackTrace.pop();++depth;}
entries[entries.length-1].selfTime+=samplingInterval;}
-var entryNodes=new Array(entries.length);var entryColorIndexes=new Uint16Array(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.length);var entryTitles=new Array(entries.length);var entryDeoptFlags=new Uint8Array(entries.length);for(var i=0;i<entries.length;++i){var entry=entries[i];entryNodes[i]=entry.node;entryColorIndexes[i]=colorPair.index;entryLevels[i]=entry.depth;entryTotalTimes[i]=entry.duration;entrySelfTimes[i]=entry.selfTime;entryOffsets[i]=entry.startTime;entryTitles[i]=entry.node.functionName;var reason=entry.node.deoptReason;entryDeoptFlags[i]=(reason&&reason!=="no reason");}
-this._timelineData={maxStackDepth:Math.max(maxDepth,depth),totalTime:this._cpuProfileView.profileHead.totalTime,entryNodes:entryNodes,entryColorIndexes:entryColorIndexes,entryLevels:entryLevels,entryTotalTimes:entryTotalTimes,entrySelfTimes:entrySelfTimes,entryOffsets:entryOffsets,colorEntryIndexes:colorEntryIndexes,entryTitles:entryTitles,entryDeoptFlags:entryDeoptFlags};return this._timelineData;},_millisecondsToString:function(ms)
+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.length);for(var i=0;i<entries.length;++i){var entry=entries[i];entryNodes[i]=entry.node;entryLevels[i]=entry.depth;entryTotalTimes[i]=entry.duration;entryOffsets[i]=entry.startTime;entrySelfTimes[i]=entry.selfTime;}
+this._maxStackDepth=Math.max(maxDepth,depth);this._timelineData={entryLevels:entryLevels,entryTotalTimes:entryTotalTimes,entryOffsets:entryOffsets,};this._entryNodes=entryNodes;this._entrySelfTimes=entrySelfTimes;return(this._timelineData);},_millisecondsToString:function(ms)
{if(ms===0)
return"0";if(ms<1000)
return WebInspector.UIString("%.1f\u2009ms",ms);return Number.secondsToString(ms/1000,true);},prepareHighlightedEntryInfo:function(entryIndex)
-{var timelineData=this._timelineData;var node=timelineData.entryNodes[entryIndex];if(!node)
+{var timelineData=this._timelineData;var node=this._entryNodes[entryIndex];if(!node)
return null;var entryInfo=[];function pushEntryInfoRow(title,text)
{var row={};row.title=title;row.text=text;entryInfo.push(row);}
-pushEntryInfoRow(WebInspector.UIString("Name"),timelineData.entryTitles[entryIndex]);var selfTime=this._millisecondsToString(timelineData.entrySelfTimes[entryIndex]);var totalTime=this._millisecondsToString(timelineData.entryTotalTimes[entryIndex]);pushEntryInfoRow(WebInspector.UIString("Self time"),selfTime);pushEntryInfoRow(WebInspector.UIString("Total time"),totalTime);if(node.url)
-pushEntryInfoRow(WebInspector.UIString("URL"),node.url+":"+node.lineNumber);pushEntryInfoRow(WebInspector.UIString("Aggregated self time"),Number.secondsToString(node.selfTime/1000,true));pushEntryInfoRow(WebInspector.UIString("Aggregated total time"),Number.secondsToString(node.totalTime/1000,true));if(node.deoptReason&&node.deoptReason!=="no reason")
+pushEntryInfoRow(WebInspector.UIString("Name"),node.functionName);var selfTime=this._millisecondsToString(this._entrySelfTimes[entryIndex]);var totalTime=this._millisecondsToString(timelineData.entryTotalTimes[entryIndex]);pushEntryInfoRow(WebInspector.UIString("Self time"),selfTime);pushEntryInfoRow(WebInspector.UIString("Total time"),totalTime);var text=WebInspector.Linkifier.liveLocationText(node.scriptId,node.lineNumber,node.columnNumber);pushEntryInfoRow(WebInspector.UIString("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,true));if(node.deoptReason&&node.deoptReason!=="no reason")
pushEntryInfoRow(WebInspector.UIString("Not optimized"),node.deoptReason);return entryInfo;},canJumpToEntry:function(entryIndex)
-{return this._timelineData.entryNodes[entryIndex].scriptId!=="0";},entryData:function(entryIndex)
-{return this._timelineData.entryNodes[entryIndex];}};WebInspector.HeapSnapshotProgressEvent={Update:"ProgressUpdate"};WebInspector.HeapSnapshotCommon={}
-WebInspector.HeapSnapshotCommon.AllocationNodeCallers=function()
-{this.nodesWithSingleCaller;this.branchingCallers;}
+{return this._entryNodes[entryIndex].scriptId!=="0";},entryTitle:function(entryIndex)
+{var node=this._entryNodes[entryIndex];return node.functionName;},entryFont:function(entryIndex)
+{if(!this._font){this._font=(this.barHeight()-4)+"px "+WebInspector.fontFamily();this._boldFont="bold "+this._font;}
+var node=this._entryNodes[entryIndex];var reason=node.deoptReason;return(reason&&reason!=="no reason")?this._boldFont:this._font;},entryColor:function(entryIndex)
+{var node=this._entryNodes[entryIndex];return this._colorGenerator.colorForID(node.functionName+":"+node.url+":"+node.lineNumber);},decorateEntry:function(entryIndex,context,text,barX,barY,barWidth,barHeight,offsetToPosition)
+{return false;},forceDecoration:function(entryIndex)
+{return false;},highlightTimeRange:function(entryIndex)
+{var startTimeOffset=this._timelineData.entryOffsets[entryIndex];return{startTimeOffset:startTimeOffset,endTimeOffset:startTimeOffset+this._timelineData.entryTotalTimes[entryIndex]};},paddingLeft:function()
+{return 15;},textColor:function(entryIndex)
+{return"#333";}};WebInspector.HeapSnapshotProgressEvent={Update:"ProgressUpdate"};WebInspector.HeapSnapshotCommon={}
+WebInspector.HeapSnapshotCommon.AllocationNodeCallers=function(nodesWithSingleCaller,branchingCallers)
+{this.nodesWithSingleCaller=nodesWithSingleCaller;this.branchingCallers=branchingCallers;}
+WebInspector.HeapSnapshotCommon.SerializedAllocationNode=function(nodeId,functionName,scriptName,line,column,count,size,liveCount,liveSize,hasChildren)
+{this.id=nodeId;this.name=functionName;this.scriptName=scriptName;this.line=line;this.column=column;this.count=count;this.size=size;this.liveCount=liveCount;this.liveSize=liveSize;this.hasChildren=hasChildren;}
WebInspector.HeapSnapshotCommon.Aggregate=function()
{this.count;this.distance;this.self;this.maxRet;this.type;this.name;this.idxs;}
+WebInspector.HeapSnapshotCommon.AggregateForDiff=function(){this.indexes=[];this.ids=[];this.selfSizes=[];}
+WebInspector.HeapSnapshotCommon.Diff=function()
+{this.addedCount=0;this.removedCount=0;this.addedSize=0;this.removedSize=0;this.deletedIndexes=[];this.addedIndexes=[];}
WebInspector.HeapSnapshotCommon.DiffForClass=function()
{this.addedCount;this.removedCount;this.addedSize;this.removedSize;this.deletedIndexes;this.addedIndexes;this.countDelta;this.sizeDelta;}
WebInspector.HeapSnapshotCommon.ComparatorConfig=function()
{this.fieldName1;this.ascending1;this.fieldName2;this.ascending2;}
WebInspector.HeapSnapshotCommon.WorkerCommand=function()
-{this.callId;this.disposition;this.objectId;this.newObjectId;this.methodName;this.methodArguments;this.source;};WebInspector.HeapSnapshotWorkerProxy=function(eventHandler)
-{this._eventHandler=eventHandler;this._nextObjectId=1;this._nextCallId=1;this._callbacks=[];this._previousCallbacks=[];this._worker=new Worker("HeapSnapshotWorker.js");this._worker.onmessage=this._messageReceived.bind(this);if(WebInspector.HeapSnapshotView.allocationProfilerEnabled)
-this._postMessage({disposition:"enableAllocationProfiler"});}
-WebInspector.HeapSnapshotWorkerProxy.prototype={createLoader:function(snapshotConstructorName,proxyConstructor)
-{var objectId=this._nextObjectId++;var proxy=new WebInspector.HeapSnapshotLoaderProxy(this,objectId,snapshotConstructorName,proxyConstructor);this._postMessage({callId:this._nextCallId++,disposition:"create",objectId:objectId,methodName:"WebInspector.HeapSnapshotLoader"});return proxy;},dispose:function()
+{this.callId;this.disposition;this.objectId;this.newObjectId;this.methodName;this.methodArguments;this.source;}
+WebInspector.HeapSnapshotCommon.ItemsRange=function(startPosition,endPosition,totalLength,items)
+{this.startPosition=startPosition;this.endPosition=endPosition;this.totalLength=totalLength;this.items=items;}
+WebInspector.HeapSnapshotCommon.StaticData=function(nodeCount,rootNodeIndex,totalSize,maxJSObjectId)
+{this.nodeCount=nodeCount;this.rootNodeIndex=rootNodeIndex;this.totalSize=totalSize;this.maxJSObjectId=maxJSObjectId;}
+WebInspector.HeapSnapshotCommon.Statistics=function()
+{this.total;this.v8heap;this.native;this.code;this.jsArrays;this.strings;}
+WebInspector.HeapSnapshotCommon.NodeFilter=function(minNodeId,maxNodeId)
+{this.minNodeId=minNodeId;this.maxNodeId=maxNodeId;this.allocationNodeId;}
+WebInspector.HeapSnapshotCommon.NodeFilter.prototype={equals:function(o)
+{return this.minNodeId===o.minNodeId&&this.maxNodeId===o.maxNodeId&&this.allocationNodeId===o.allocationNodeId;}};WebInspector.HeapSnapshotWorkerProxy=function(eventHandler)
+{this._eventHandler=eventHandler;this._nextObjectId=1;this._nextCallId=1;this._callbacks=[];this._previousCallbacks=[];this._worker=new Worker("HeapSnapshotWorker.js");this._worker.onmessage=this._messageReceived.bind(this);}
+WebInspector.HeapSnapshotWorkerProxy.prototype={createLoader:function(profileUid,snapshotReceivedCallback)
+{var objectId=this._nextObjectId++;var proxy=new WebInspector.HeapSnapshotLoaderProxy(this,objectId,profileUid,snapshotReceivedCallback);this._postMessage({callId:this._nextCallId++,disposition:"create",objectId:objectId,methodName:"WebInspector.HeapSnapshotLoader"});return proxy;},dispose:function()
{this._worker.terminate();if(this._interval)
clearInterval(this._interval);},disposeObject:function(objectId)
{this._postMessage({callId:this._nextCallId++,disposition:"dispose",objectId:objectId});},evaluateForTest:function(script,callback)
-{var callId=this._nextCallId++;this._callbacks[callId]=callback;this._postMessage({callId:callId,disposition:"evaluateForTest",source:script});},callGetter:function(callback,objectId,getterName)
-{var callId=this._nextCallId++;this._callbacks[callId]=callback;this._postMessage({callId:callId,disposition:"getter",objectId:objectId,methodName:getterName});},callFactoryMethod:function(callback,objectId,methodName,proxyConstructor)
+{var callId=this._nextCallId++;this._callbacks[callId]=callback;this._postMessage({callId:callId,disposition:"evaluateForTest",source:script});},callFactoryMethod:function(callback,objectId,methodName,proxyConstructor)
{var callId=this._nextCallId++;var methodArguments=Array.prototype.slice.call(arguments,4);var newObjectId=this._nextObjectId++;function wrapCallback(remoteResult)
{callback(remoteResult?new proxyConstructor(this,newObjectId):null);}
if(callback){this._callbacks[callId]=wrapCallback.bind(this);this._postMessage({callId:callId,disposition:"factory",objectId:objectId,methodName:methodName,methodArguments:methodArguments,newObjectId:newObjectId});return null;}else{this._postMessage({callId:callId,disposition:"factory",objectId:objectId,methodName:methodName,methodArguments:methodArguments,newObjectId:newObjectId});return new proxyConstructor(this,newObjectId);}},callMethod:function(callback,objectId,methodName)
@@ -509,13 +590,11 @@
if(!(callId in this._callbacks))
delete this._previousCallbacks[callId];var hasLongRunningCalls=false;for(callId in this._previousCallbacks){hasLongRunningCalls=true;break;}
this.dispatchEventToListeners("wait",hasLongRunningCalls);for(callId in this._callbacks)
-this._previousCallbacks[callId]=true;},_findFunction:function(name)
-{var path=name.split(".");var result=window;for(var i=0;i<path.length;++i)
-result=result[path[i]];return result;},_messageReceived:function(event)
+this._previousCallbacks[callId]=true;},_messageReceived:function(event)
{var data=event.data;if(data.eventName){if(this._eventHandler)
this._eventHandler(data.eventName,data.data);return;}
if(data.error){if(data.errorMethodName)
-WebInspector.log(WebInspector.UIString("An error happened when a call for method '%s' was requested",data.errorMethodName));WebInspector.log(data["errorCallStack"]);delete this._callbacks[data.callId];return;}
+WebInspector.console.log(WebInspector.UIString("An error happened when a call for method '%s' was requested",data.errorMethodName));WebInspector.console.log(data["errorCallStack"]);delete this._callbacks[data.callId];return;}
if(!this._callbacks[data.callId])
return;var callback=this._callbacks[data.callId];delete this._callbacks[data.callId];callback(data.result);},_postMessage:function(message)
{this._worker.postMessage(message);},__proto__:WebInspector.Object.prototype}
@@ -525,48 +604,45 @@
{args.splice(1,0,this._objectId);return this._worker[workerMethodName].apply(this._worker,args);},dispose:function()
{this._worker.disposeObject(this._objectId);},disposeWorker:function()
{this._worker.dispose();},callFactoryMethod:function(callback,methodName,proxyConstructor,var_args)
-{return this._callWorker("callFactoryMethod",Array.prototype.slice.call(arguments,0));},callGetter:function(callback,getterName)
-{return this._callWorker("callGetter",Array.prototype.slice.call(arguments,0));},callMethod:function(callback,methodName,var_args)
-{return this._callWorker("callMethod",Array.prototype.slice.call(arguments,0));},get worker(){return this._worker;}};WebInspector.HeapSnapshotLoaderProxy=function(worker,objectId,snapshotConstructorName,proxyConstructor)
-{WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);this._snapshotConstructorName=snapshotConstructorName;this._proxyConstructor=proxyConstructor;this._pendingSnapshotConsumers=[];}
-WebInspector.HeapSnapshotLoaderProxy.prototype={addConsumer:function(callback)
-{this._pendingSnapshotConsumers.push(callback);},write:function(chunk,callback)
+{return this._callWorker("callFactoryMethod",Array.prototype.slice.call(arguments,0));},callMethod:function(callback,methodName,var_args)
+{return this._callWorker("callMethod",Array.prototype.slice.call(arguments,0));}};WebInspector.HeapSnapshotLoaderProxy=function(worker,objectId,profileUid,snapshotReceivedCallback)
+{WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);this._profileUid=profileUid;this._snapshotReceivedCallback=snapshotReceivedCallback;}
+WebInspector.HeapSnapshotLoaderProxy.prototype={write:function(chunk,callback)
{this.callMethod(callback,"write",chunk);},close:function(callback)
{function buildSnapshot()
{if(callback)
-callback();this.callFactoryMethod(updateStaticData.bind(this),"buildSnapshot",this._proxyConstructor,this._snapshotConstructorName);}
+callback();var showHiddenData=WebInspector.settings.showAdvancedHeapSnapshotProperties.get();this.callFactoryMethod(updateStaticData.bind(this),"buildSnapshot",WebInspector.HeapSnapshotProxy,showHiddenData);}
function updateStaticData(snapshotProxy)
-{this.dispose();snapshotProxy.updateStaticData(notifyPendingConsumers.bind(this));}
-function notifyPendingConsumers(snapshotProxy)
-{for(var i=0;i<this._pendingSnapshotConsumers.length;++i)
-this._pendingSnapshotConsumers[i](snapshotProxy);this._pendingSnapshotConsumers=[];}
+{this.dispose();snapshotProxy.setProfileUid(this._profileUid);snapshotProxy.updateStaticData(this._snapshotReceivedCallback.bind(this));}
this.callMethod(buildSnapshot.bind(this),"close");},__proto__:WebInspector.HeapSnapshotProxyObject.prototype}
WebInspector.HeapSnapshotProxy=function(worker,objectId)
-{WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);}
-WebInspector.HeapSnapshotProxy.prototype={aggregates:function(sortedIndexes,key,filter,callback)
-{this.callMethod(callback,"aggregates",sortedIndexes,key,filter);},aggregatesForDiff:function(callback)
+{WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);this._staticData=null;}
+WebInspector.HeapSnapshotProxy.prototype={aggregatesWithFilter:function(filter,callback)
+{this.callMethod(callback,"aggregatesWithFilter",filter);},aggregatesForDiff:function(callback)
{this.callMethod(callback,"aggregatesForDiff");},calculateSnapshotDiff:function(baseSnapshotId,baseSnapshotAggregates,callback)
{this.callMethod(callback,"calculateSnapshotDiff",baseSnapshotId,baseSnapshotAggregates);},nodeClassName:function(snapshotObjectId,callback)
{this.callMethod(callback,"nodeClassName",snapshotObjectId);},dominatorIdsForNode:function(nodeIndex,callback)
-{this.callMethod(callback,"dominatorIdsForNode",nodeIndex);},createEdgesProvider:function(nodeIndex,showHiddenData)
-{return this.callFactoryMethod(null,"createEdgesProvider",WebInspector.HeapSnapshotProviderProxy,nodeIndex,showHiddenData);},createRetainingEdgesProvider:function(nodeIndex,showHiddenData)
-{return this.callFactoryMethod(null,"createRetainingEdgesProvider",WebInspector.HeapSnapshotProviderProxy,nodeIndex,showHiddenData);},createAddedNodesProvider:function(baseSnapshotId,className)
+{this.callMethod(callback,"dominatorIdsForNode",nodeIndex);},createEdgesProvider:function(nodeIndex)
+{return this.callFactoryMethod(null,"createEdgesProvider",WebInspector.HeapSnapshotProviderProxy,nodeIndex);},createRetainingEdgesProvider:function(nodeIndex)
+{return this.callFactoryMethod(null,"createRetainingEdgesProvider",WebInspector.HeapSnapshotProviderProxy,nodeIndex);},createAddedNodesProvider:function(baseSnapshotId,className)
{return this.callFactoryMethod(null,"createAddedNodesProvider",WebInspector.HeapSnapshotProviderProxy,baseSnapshotId,className);},createDeletedNodesProvider:function(nodeIndexes)
{return this.callFactoryMethod(null,"createDeletedNodesProvider",WebInspector.HeapSnapshotProviderProxy,nodeIndexes);},createNodesProvider:function(filter)
-{return this.callFactoryMethod(null,"createNodesProvider",WebInspector.HeapSnapshotProviderProxy,filter);},createNodesProviderForClass:function(className,aggregatesKey)
-{return this.callFactoryMethod(null,"createNodesProviderForClass",WebInspector.HeapSnapshotProviderProxy,className,aggregatesKey);},createNodesProviderForDominator:function(nodeIndex)
-{return this.callFactoryMethod(null,"createNodesProviderForDominator",WebInspector.HeapSnapshotProviderProxy,nodeIndex);},maxJsNodeId:function(callback)
-{this.callMethod(callback,"maxJsNodeId");},allocationTracesTops:function(callback)
+{return this.callFactoryMethod(null,"createNodesProvider",WebInspector.HeapSnapshotProviderProxy,filter);},createNodesProviderForClass:function(className,nodeFilter)
+{return this.callFactoryMethod(null,"createNodesProviderForClass",WebInspector.HeapSnapshotProviderProxy,className,nodeFilter);},createNodesProviderForDominator:function(nodeIndex)
+{return this.callFactoryMethod(null,"createNodesProviderForDominator",WebInspector.HeapSnapshotProviderProxy,nodeIndex);},allocationTracesTops:function(callback)
{this.callMethod(callback,"allocationTracesTops");},allocationNodeCallers:function(nodeId,callback)
{this.callMethod(callback,"allocationNodeCallers",nodeId);},dispose:function()
-{this.disposeWorker();},get nodeCount()
+{throw new Error("Should never be called");},get nodeCount()
{return this._staticData.nodeCount;},get rootNodeIndex()
{return this._staticData.rootNodeIndex;},updateStaticData:function(callback)
{function dataReceived(staticData)
{this._staticData=staticData;callback(this);}
-this.callMethod(dataReceived.bind(this),"updateStaticData");},get totalSize()
+this.callMethod(dataReceived.bind(this),"updateStaticData");},getStatistics:function(callback)
+{this.callMethod(callback,"getStatistics");},get totalSize()
{return this._staticData.totalSize;},get uid()
-{return this._staticData.uid;},__proto__:WebInspector.HeapSnapshotProxyObject.prototype}
+{return this._profileUid;},setProfileUid:function(profileUid)
+{this._profileUid=profileUid;},maxJSObjectId:function()
+{return this._staticData.maxJSObjectId;},__proto__:WebInspector.HeapSnapshotProxyObject.prototype}
WebInspector.HeapSnapshotProviderProxy=function(worker,objectId)
{WebInspector.HeapSnapshotProxyObject.call(this,worker,objectId);}
WebInspector.HeapSnapshotProviderProxy.prototype={nodePosition:function(snapshotObjectId,callback)
@@ -574,35 +650,34 @@
{this.callMethod(callback,"isEmpty");},serializeItemsRange:function(startPosition,endPosition,callback)
{this.callMethod(callback,"serializeItemsRange",startPosition,endPosition);},sortAndRewind:function(comparator,callback)
{this.callMethod(callback,"sortAndRewind",comparator);},__proto__:WebInspector.HeapSnapshotProxyObject.prototype};WebInspector.HeapSnapshotSortableDataGrid=function(columns)
-{WebInspector.DataGrid.call(this,columns);this._recursiveSortingDepth=0;this._highlightedNode=null;this._populatedAndSorted=false;this.addEventListener("sorting complete",this._sortingComplete,this);this.addEventListener(WebInspector.DataGrid.Events.SortingChanged,this.sortingChanged,this);}
-WebInspector.HeapSnapshotSortableDataGrid.Events={ContentShown:"ContentShown"}
+{WebInspector.DataGrid.call(this,columns);this._recursiveSortingDepth=0;this._highlightedNode=null;this._populatedAndSorted=false;this._nameFilter="";this.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.SortingComplete,this._sortingComplete,this);this.addEventListener(WebInspector.DataGrid.Events.SortingChanged,this.sortingChanged,this);}
+WebInspector.HeapSnapshotSortableDataGrid.Events={ContentShown:"ContentShown",ResetFilter:"ResetFilter",SortingComplete:"SortingComplete"}
WebInspector.HeapSnapshotSortableDataGrid.prototype={defaultPopulateCount:function()
-{return 100;},dispose:function()
+{return 100;},_disposeAllNodes:function()
{var children=this.topLevelNodes();for(var i=0,l=children.length;i<l;++i)
children[i].dispose();},wasShown:function()
{if(this._populatedAndSorted)
this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown,this);},_sortingComplete:function()
-{this.removeEventListener("sorting complete",this._sortingComplete,this);this._populatedAndSorted=true;this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown,this);},willHide:function()
-{this._clearCurrentHighlight();},populateContextMenu:function(profilesPanel,contextMenu,event)
+{this.removeEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.SortingComplete,this._sortingComplete,this);this._populatedAndSorted=true;this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown,this);},willHide:function()
+{this._clearCurrentHighlight();},populateContextMenu:function(contextMenu,event)
{var td=event.target.enclosingNodeOrSelfWithNodeName("td");if(!td)
return;var node=td.heapSnapshotNode;function revealInDominatorsView()
-{profilesPanel.showObject(node.snapshotNodeId,"Dominators");}
+{WebInspector.panels.profiles.showObject(node.snapshotNodeId,"Dominators");}
function revealInSummaryView()
-{profilesPanel.showObject(node.snapshotNodeId,"Summary");}
-if(node&&node.showRetainingEdges){contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInDominatorsView.bind(this));}
-else if(node instanceof WebInspector.HeapSnapshotInstanceNode||node instanceof WebInspector.HeapSnapshotObjectNode){contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInDominatorsView.bind(this));}else if(node instanceof WebInspector.HeapSnapshotDominatorObjectNode){contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView.bind(this));}},resetSortingCache:function()
+{WebInspector.panels.profiles.showObject(node.snapshotNodeId,"Summary");}
+if(node&&node.showRetainingEdges){contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInDominatorsView);}
+else if(node instanceof WebInspector.HeapSnapshotInstanceNode||node instanceof WebInspector.HeapSnapshotObjectNode){contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Dominators view":"Reveal in Dominators View"),revealInDominatorsView);}else if(node instanceof WebInspector.HeapSnapshotDominatorObjectNode){contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in Summary view":"Reveal in Summary View"),revealInSummaryView);}},resetSortingCache:function()
{delete this._lastSortColumnIdentifier;delete this._lastSortAscending;},topLevelNodes:function()
{return this.rootNode().children;},highlightObjectByHeapSnapshotId:function(heapSnapshotObjectId,callback)
{},highlightNode:function(node)
-{var prevNode=this._highlightedNode;this._clearCurrentHighlight();this._highlightedNode=node;this._highlightedNode.element.classList.add("highlighted-row");if(node===prevNode){var element=node.element;var parent=element.parentElement;var nextSibling=element.nextSibling;parent.removeChild(element);parent.insertBefore(element,nextSibling);}},nodeWasDetached:function(node)
+{var prevNode=this._highlightedNode;this._clearCurrentHighlight();this._highlightedNode=node;WebInspector.runCSSAnimationOnce(this._highlightedNode.element,"highlighted-row");},nodeWasDetached:function(node)
{if(this._highlightedNode===node)
this._clearCurrentHighlight();},_clearCurrentHighlight:function()
{if(!this._highlightedNode)
return
-this._highlightedNode.element.classList.remove("highlighted-row");this._highlightedNode=null;},changeNameFilter:function(filter)
-{filter=filter.toLowerCase();var children=this.topLevelNodes();for(var i=0,l=children.length;i<l;++i){var node=children[i];if(node.depth===0)
-node.revealed=node._name.toLowerCase().indexOf(filter)!==-1;}
-this.updateVisibleNodes();},sortingChanged:function()
+this._highlightedNode.element.classList.remove("highlighted-row");this._highlightedNode=null;},resetNameFilter:function(callback)
+{this._callbackAfterFilterChange=callback;this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.ResetFilter);},changeNameFilter:function(filter)
+{this._nameFilter=filter.toLowerCase();this.updateVisibleNodes(true);if(this._callbackAfterFilterChange){this._callbackAfterFilterChange();this._callbackAfterFilterChange=null;}},sortingChanged:function()
{var sortAscending=this.isSortOrderAscending();var sortColumnIdentifier=this.sortColumnIdentifier();if(this._lastSortColumnIdentifier===sortColumnIdentifier&&this._lastSortAscending===sortAscending)
return;this._lastSortColumnIdentifier=sortColumnIdentifier;this._lastSortAscending=sortAscending;var sortFields=this._sortFields(sortColumnIdentifier,sortAscending);function SortByTwoFields(nodeA,nodeB)
{var field1=nodeA[sortFields[0]];var field2=nodeB[sortFields[0]];var result=field1<field2?-1:(field1>field2?1:0);if(!sortFields[1])
@@ -610,44 +685,56 @@
return result;field1=nodeA[sortFields[2]];field2=nodeB[sortFields[2]];result=field1<field2?-1:(field1>field2?1:0);if(!sortFields[3])
result=-result;return result;}
this._performSorting(SortByTwoFields);},_performSorting:function(sortFunction)
-{this.recursiveSortingEnter();var children=this._topLevelNodes;this.rootNode().removeChildren();children.sort(sortFunction);for(var i=0,l=children.length;i<l;++i){var child=children[i];this.appendChildAfterSorting(child);if(child.expanded)
+{this.recursiveSortingEnter();var children=this.allChildren(this.rootNode());this.rootNode().removeChildren();children.sort(sortFunction);for(var i=0,l=children.length;i<l;++i){var child=children[i];this.appendChildAfterSorting(child);if(child.expanded)
child.sort();}
-this.updateVisibleNodes();this.recursiveSortingLeave();},appendChildAfterSorting:function(child)
-{var revealed=child.revealed;this.rootNode().appendChild(child);child.revealed=revealed;},updateVisibleNodes:function()
-{},recursiveSortingEnter:function()
+this.recursiveSortingLeave();},appendChildAfterSorting:function(child)
+{var revealed=child.revealed;this.rootNode().appendChild(child);child.revealed=revealed;},recursiveSortingEnter:function()
{++this._recursiveSortingDepth;},recursiveSortingLeave:function()
{if(!this._recursiveSortingDepth)
-return;if(!--this._recursiveSortingDepth)
-this.dispatchEventToListeners("sorting complete");},__proto__:WebInspector.DataGrid.prototype}
+return;if(--this._recursiveSortingDepth)
+return;this.updateVisibleNodes(true);this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.SortingComplete);},updateVisibleNodes:function(force)
+{},allChildren:function(parent)
+{return parent.children;},insertChild:function(parent,node,index)
+{parent.insertChild(node,index);},removeChildByIndex:function(parent,index)
+{parent.removeChild(parent.children[index]);},removeAllChildren:function(parent)
+{parent.removeChildren();},__proto__:WebInspector.DataGrid.prototype}
WebInspector.HeapSnapshotViewportDataGrid=function(columns)
-{WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);this.scrollContainer.addEventListener("scroll",this._onScroll.bind(this),true);this._topLevelNodes=[];this._topPadding=new WebInspector.HeapSnapshotPaddingNode();this._bottomPadding=new WebInspector.HeapSnapshotPaddingNode();this._nodeToHighlightAfterScroll=null;}
+{WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);this.scrollContainer.addEventListener("scroll",this._onScroll.bind(this),true);this._nodeToHighlightAfterScroll=null;this._topPadding=new WebInspector.HeapSnapshotPaddingNode();this._topPaddingHeight=0;this.dataTableBody.insertBefore(this._topPadding.element,this.dataTableBody.firstChild);this._bottomPadding=new WebInspector.HeapSnapshotPaddingNode();this._bottomPaddingHeight=0;this.dataTableBody.insertBefore(this._bottomPadding.element,this.dataTableBody.lastChild);}
WebInspector.HeapSnapshotViewportDataGrid.prototype={topLevelNodes:function()
-{return this._topLevelNodes;},appendChildAfterSorting:function(child)
-{},updateVisibleNodes:function()
-{var scrollTop=this.scrollContainer.scrollTop;var children=this._topLevelNodes;var i=0;var topPadding=0;while(i<children.length){if(children[i].revealed){var newTop=topPadding+children[i].nodeHeight();if(newTop>scrollTop)
+{return this.allChildren(this.rootNode());},appendChildAfterSorting:function(child)
+{},updateVisibleNodes:function(force,pathToReveal)
+{var guardZoneHeight=40;var scrollHeight=this.scrollContainer.scrollHeight;var scrollTop=this.scrollContainer.scrollTop;var scrollBottom=scrollHeight-scrollTop-this.scrollContainer.offsetHeight;scrollTop=Math.max(0,scrollTop-guardZoneHeight);scrollBottom=Math.max(0,scrollBottom-guardZoneHeight);var viewPortHeight=scrollHeight-scrollTop-scrollBottom;if(!pathToReveal){if(!force&&scrollTop>=this._topPaddingHeight&&scrollBottom>=this._bottomPaddingHeight)
+return;var hysteresisHeight=500;scrollTop-=hysteresisHeight;viewPortHeight+=2*hysteresisHeight;}
+var selectedNode=this.selectedNode;this.rootNode().removeChildren();this._topPaddingHeight=0;this._bottomPaddingHeight=0;this._addVisibleNodes(this.rootNode(),scrollTop,scrollTop+viewPortHeight,pathToReveal||null);this._topPadding.setHeight(this._topPaddingHeight);this._bottomPadding.setHeight(this._bottomPaddingHeight);if(selectedNode){if(selectedNode.parent)
+selectedNode.select(true);else
+this.selectedNode=selectedNode;}},_addVisibleNodes:function(parentNode,topBound,bottomBound,pathToReveal)
+{if(!parentNode.expanded)
+return 0;var nodeToReveal=pathToReveal?pathToReveal[0]:null;var restPathToReveal=pathToReveal&&pathToReveal.length>1?pathToReveal.slice(1):null;var children=this.allChildren(parentNode);var topPadding=0;for(var i=0;i<children.length;++i){var child=children[i];if(child.filteredOut&&child.filteredOut())
+continue;var newTop=topPadding+this._nodeHeight(child);if(nodeToReveal===child||(!nodeToReveal&&newTop>topBound))
break;topPadding=newTop;}
-++i;}
-this._addVisibleNodes(i,scrollTop-topPadding,topPadding);},_addVisibleNodes:function(firstVisibleNodeIndex,firstNodeHiddenHeight,topPadding)
-{var viewPortHeight=this.scrollContainer.offsetHeight;this._removePaddingRows();var children=this._topLevelNodes;var selectedNode=this.selectedNode;this.rootNode().removeChildren();var heightToFill=viewPortHeight+firstNodeHiddenHeight;var filledHeight=0;var i=firstVisibleNodeIndex;while(i<children.length&&filledHeight<heightToFill){if(children[i].revealed){this.rootNode().appendChild(children[i]);filledHeight+=children[i].nodeHeight();}
-++i;}
-var bottomPadding=0;while(i<children.length){bottomPadding+=children[i].nodeHeight();++i;}
-this._addPaddingRows(topPadding,bottomPadding);if(selectedNode){if(selectedNode.parent){selectedNode.select(true);}else{this.selectedNode=selectedNode;}}},_revealTopLevelNode:function(nodeToReveal)
-{var children=this._topLevelNodes;var i=0;var topPadding=0;while(i<children.length){if(children[i]===nodeToReveal)
-break;if(children[i].revealed){var newTop=topPadding+children[i].nodeHeight();topPadding=newTop;}
-++i;}
-this._addVisibleNodes(i,0,topPadding);},appendTopLevelNode:function(node)
-{this._topLevelNodes.push(node);},removeTopLevelNodes:function()
-{this.rootNode().removeChildren();this._topLevelNodes=[];},highlightNode:function(node)
-{if(this._isScrolledIntoView(node.element))
-WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this,node);else{node.element.scrollIntoViewIfNeeded(true);this._nodeToHighlightAfterScroll=node;}},_isScrolledIntoView:function(element)
+var position=topPadding;for(;i<children.length&&(nodeToReveal||position<bottomBound);++i){var child=children[i];if(child.filteredOut&&child.filteredOut())
+continue;var hasChildren=child.hasChildren;child.removeChildren();child.hasChildren=hasChildren;child.revealed=true;parentNode.appendChild(child);position+=child.nodeSelfHeight();position+=this._addVisibleNodes(child,topBound-position,bottomBound-position,restPathToReveal);if(nodeToReveal===child)
+break;}
+var bottomPadding=0;for(;i<children.length;++i){var child=children[i];if(child.filteredOut&&child.filteredOut())
+continue;bottomPadding+=this._nodeHeight(child);}
+this._topPaddingHeight+=topPadding;this._bottomPaddingHeight+=bottomPadding;return position+bottomPadding;},_nodeHeight:function(node)
+{if(!node.revealed)
+return 0;var result=node.nodeSelfHeight();if(!node.expanded)
+return result;var children=this.allChildren(node);for(var i=0;i<children.length;i++)
+result+=this._nodeHeight(children[i]);return result;},defaultAttachLocation:function()
+{return this._bottomPadding.element;},revealTreeNode:function(pathToReveal)
+{this.updateVisibleNodes(true,pathToReveal);},allChildren:function(parent)
+{return parent._allChildren||(parent._allChildren=[]);},appendNode:function(parent,node)
+{this.allChildren(parent).push(node);},insertChild:function(parent,node,index)
+{this.allChildren(parent).splice(index,0,node);},removeChildByIndex:function(parent,index)
+{this.allChildren(parent).splice(index,1);},removeAllChildren:function(parent)
+{parent._allChildren=[];},removeTopLevelNodes:function()
+{this._disposeAllNodes();this.rootNode().removeChildren();this.rootNode()._allChildren=[];},highlightNode:function(node)
+{if(this._isScrolledIntoView(node.element)){this.updateVisibleNodes(true);WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this,node);}else{node.element.scrollIntoViewIfNeeded(true);this._nodeToHighlightAfterScroll=node;}},_isScrolledIntoView:function(element)
{var viewportTop=this.scrollContainer.scrollTop;var viewportBottom=viewportTop+this.scrollContainer.clientHeight;var elemTop=element.offsetTop
-var elemBottom=elemTop+element.offsetHeight;return elemBottom<=viewportBottom&&elemTop>=viewportTop;},_addPaddingRows:function(top,bottom)
-{if(this._topPadding.element.parentNode!==this.dataTableBody)
-this.dataTableBody.insertBefore(this._topPadding.element,this.dataTableBody.firstChild);if(this._bottomPadding.element.parentNode!==this.dataTableBody)
-this.dataTableBody.insertBefore(this._bottomPadding.element,this.dataTableBody.lastChild);this._topPadding.setHeight(top);this._bottomPadding.setHeight(bottom);},_removePaddingRows:function()
-{this._bottomPadding.removeFromTable();this._topPadding.removeFromTable();},onResize:function()
-{WebInspector.HeapSnapshotSortableDataGrid.prototype.onResize.call(this);this.updateVisibleNodes();},_onScroll:function(event)
-{this.updateVisibleNodes();if(this._nodeToHighlightAfterScroll){WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this,this._nodeToHighlightAfterScroll);this._nodeToHighlightAfterScroll=null;}},__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
+var elemBottom=elemTop+element.offsetHeight;return elemBottom<=viewportBottom&&elemTop>=viewportTop;},onResize:function()
+{WebInspector.HeapSnapshotSortableDataGrid.prototype.onResize.call(this);this.updateVisibleNodes(false);},_onScroll:function(event)
+{this.updateVisibleNodes(false);if(this._nodeToHighlightAfterScroll){WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this,this._nodeToHighlightAfterScroll);this._nodeToHighlightAfterScroll=null;}},__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
WebInspector.HeapSnapshotPaddingNode=function()
{this.element=document.createElement("tr");this.element.classList.add("revealed");}
WebInspector.HeapSnapshotPaddingNode.prototype={setHeight:function(height)
@@ -657,8 +744,9 @@
WebInspector.HeapSnapshotContainmentDataGrid=function(columns)
{columns=columns||[{id:"object",title:WebInspector.UIString("Object"),disclosure:true,sortable:true},{id:"distance",title:WebInspector.UIString("Distance"),width:"80px",sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shallow Size"),width:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UIString("Retained Size"),width:"120px",sortable:true,sort:WebInspector.DataGrid.Order.Descending}];WebInspector.HeapSnapshotSortableDataGrid.call(this,columns);}
WebInspector.HeapSnapshotContainmentDataGrid.prototype={setDataSource:function(snapshot,nodeIndex)
-{this.snapshot=snapshot;var node={nodeIndex:nodeIndex||snapshot.rootNodeIndex};var fakeEdge={node:node};this.setRootNode(new WebInspector.HeapSnapshotObjectNode(this,false,fakeEdge,null));this.rootNode().sort();},sortingChanged:function()
-{this.rootNode().sort();},__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
+{this.snapshot=snapshot;var node={nodeIndex:nodeIndex||snapshot.rootNodeIndex};var fakeEdge={node:node};this.setRootNode(new WebInspector.HeapSnapshotObjectNode(this,snapshot,fakeEdge,null));this.rootNode().sort();},sortingChanged:function()
+{var rootNode=this.rootNode();if(rootNode.hasChildren)
+rootNode.sort();},__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
WebInspector.HeapSnapshotRetainmentDataGrid=function()
{this.showRetainingEdges=true;var columns=[{id:"object",title:WebInspector.UIString("Object"),disclosure:true,sortable:true},{id:"distance",title:WebInspector.UIString("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 Size"),width:"120px",sortable:true}];WebInspector.HeapSnapshotContainmentDataGrid.call(this,columns);}
WebInspector.HeapSnapshotRetainmentDataGrid.Events={ExpandRetainersComplete:"ExpandRetainersComplete"}
@@ -670,39 +758,38 @@
dataGrid.dispatchEventToListeners(WebInspector.HeapSnapshotRetainmentDataGrid.Events.ExpandRetainersComplete);}
this.rootNode().addEventListener(WebInspector.HeapSnapshotGridNode.Events.PopulateComplete,populateComplete,this.rootNode());},__proto__:WebInspector.HeapSnapshotContainmentDataGrid.prototype}
WebInspector.HeapSnapshotConstructorsDataGrid=function()
-{var columns=[{id:"object",title:WebInspector.UIString("Constructor"),disclosure:true,sortable:true},{id:"distance",title:WebInspector.UIString("Distance"),width:"90px",sortable:true},{id:"count",title:WebInspector.UIString("Objects Count"),width:"90px",sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shallow Size"),width:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UIString("Retained Size"),width:"120px",sort:WebInspector.DataGrid.Order.Descending,sortable:true}];WebInspector.HeapSnapshotViewportDataGrid.call(this,columns);this._profileIndex=-1;this._topLevelNodes=[];this._objectIdToSelect=null;}
-WebInspector.HeapSnapshotConstructorsDataGrid.Request=function(minNodeId,maxNodeId)
-{if(typeof minNodeId==="number"){this.key=minNodeId+".."+maxNodeId;this.filter="function(node) { var id = node.id(); return id > "+minNodeId+" && id <= "+maxNodeId+"; }";}else{this.key="allObjects";this.filter=null;}}
+{var columns=[{id:"object",title:WebInspector.UIString("Constructor"),disclosure:true,sortable:true},{id:"distance",title:WebInspector.UIString("Distance"),width:"90px",sortable:true},{id:"count",title:WebInspector.UIString("Objects Count"),width:"90px",sortable:true},{id:"shallowSize",title:WebInspector.UIString("Shallow Size"),width:"120px",sortable:true},{id:"retainedSize",title:WebInspector.UIString("Retained Size"),width:"120px",sort:WebInspector.DataGrid.Order.Descending,sortable:true}];WebInspector.HeapSnapshotViewportDataGrid.call(this,columns);this._profileIndex=-1;this._objectIdToSelect=null;}
WebInspector.HeapSnapshotConstructorsDataGrid.prototype={_sortFields:function(sortColumn,sortAscending)
{return{object:["_name",sortAscending,"_count",false],distance:["_distance",sortAscending,"_retainedSize",true],count:["_count",sortAscending,"_name",true],shallowSize:["_shallowSize",sortAscending,"_name",true],retainedSize:["_retainedSize",sortAscending,"_name",true]}[sortColumn];},highlightObjectByHeapSnapshotId:function(id,callback)
{if(!this.snapshot){this._objectIdToSelect=id;return;}
function didGetClassName(className)
{if(!className){callback(false);return;}
-var constructorNodes=this.topLevelNodes();for(var i=0;i<constructorNodes.length;i++){var parent=constructorNodes[i];if(parent._name===className){if(!parent.dataGrid){this._revealTopLevelNode(parent);}
-parent.revealNodeBySnapshotObjectId(parseInt(id,10),callback);return;}}}
-this.snapshot.nodeClassName(parseInt(id,10),didGetClassName.bind(this));},setDataSource:function(snapshot)
+var constructorNodes=this.topLevelNodes();for(var i=0;i<constructorNodes.length;i++){var parent=constructorNodes[i];if(parent._name===className){parent.revealNodeBySnapshotObjectId(parseInt(id,10),callback);return;}}}
+this.snapshot.nodeClassName(parseInt(id,10),didGetClassName.bind(this));},clear:function()
+{this._nextRequestedFilter=null;this._lastFilter=null;this.removeTopLevelNodes();},setDataSource:function(snapshot)
{this.snapshot=snapshot;if(this._profileIndex===-1)
this._populateChildren();if(this._objectIdToSelect){this.highlightObjectByHeapSnapshotId(this._objectIdToSelect,function(found){});this._objectIdToSelect=null;}},setSelectionRange:function(minNodeId,maxNodeId)
-{this._populateChildren(new WebInspector.HeapSnapshotConstructorsDataGrid.Request(minNodeId,maxNodeId));},_aggregatesReceived:function(key,aggregates)
-{this._requestInProgress=null;if(this._nextRequest){this.snapshot.aggregates(false,this._nextRequest.key,this._nextRequest.filter,this._aggregatesReceived.bind(this,this._nextRequest.key));this._requestInProgress=this._nextRequest;this._nextRequest=null;}
-this.dispose();this.removeTopLevelNodes();this.resetSortingCache();for(var constructor in aggregates)
-this.appendTopLevelNode(new WebInspector.HeapSnapshotConstructorNode(this,constructor,aggregates[constructor],key));this.sortingChanged();this._lastKey=key;},_populateChildren:function(request)
-{request=request||new WebInspector.HeapSnapshotConstructorsDataGrid.Request();if(this._requestInProgress){this._nextRequest=this._requestInProgress.key===request.key?null:request;return;}
-if(this._lastKey===request.key)
-return;this._requestInProgress=request;this.snapshot.aggregates(false,request.key,request.filter,this._aggregatesReceived.bind(this,request.key));},filterSelectIndexChanged:function(profiles,profileIndex)
-{this._profileIndex=profileIndex;var request=null;if(profileIndex!==-1){var minNodeId=profileIndex>0?profiles[profileIndex-1].maxJSObjectId:0;var maxNodeId=profiles[profileIndex].maxJSObjectId;request=new WebInspector.HeapSnapshotConstructorsDataGrid.Request(minNodeId,maxNodeId)}
-this._populateChildren(request);},__proto__:WebInspector.HeapSnapshotViewportDataGrid.prototype}
+{this._populateChildren(new WebInspector.HeapSnapshotCommon.NodeFilter(minNodeId,maxNodeId));},setAllocationNodeId:function(allocationNodeId)
+{var filter=new WebInspector.HeapSnapshotCommon.NodeFilter();filter.allocationNodeId=allocationNodeId;this._populateChildren(filter);},_aggregatesReceived:function(nodeFilter,aggregates)
+{this._filterInProgress=null;if(this._nextRequestedFilter){this.snapshot.aggregatesWithFilter(this._nextRequestedFilter,this._aggregatesReceived.bind(this,this._nextRequestedFilter));this._filterInProgress=this._nextRequestedFilter;this._nextRequestedFilter=null;}
+this.removeTopLevelNodes();this.resetSortingCache();for(var constructor in aggregates)
+this.appendNode(this.rootNode(),new WebInspector.HeapSnapshotConstructorNode(this,constructor,aggregates[constructor],nodeFilter));this.sortingChanged();this._lastFilter=nodeFilter;},_populateChildren:function(nodeFilter)
+{nodeFilter=nodeFilter||new WebInspector.HeapSnapshotCommon.NodeFilter();if(this._filterInProgress){this._nextRequestedFilter=this._filterInProgress.equals(nodeFilter)?null:nodeFilter;return;}
+if(this._lastFilter&&this._lastFilter.equals(nodeFilter))
+return;this._filterInProgress=nodeFilter;this.snapshot.aggregatesWithFilter(nodeFilter,this._aggregatesReceived.bind(this,nodeFilter));},filterSelectIndexChanged:function(profiles,profileIndex)
+{this._profileIndex=profileIndex;var nodeFilter;if(profileIndex!==-1){var minNodeId=profileIndex>0?profiles[profileIndex-1].maxJSObjectId:0;var maxNodeId=profiles[profileIndex].maxJSObjectId;nodeFilter=new WebInspector.HeapSnapshotCommon.NodeFilter(minNodeId,maxNodeId)}
+this._populateChildren(nodeFilter);},__proto__:WebInspector.HeapSnapshotViewportDataGrid.prototype}
WebInspector.HeapSnapshotDiffDataGrid=function()
{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("# Delta"),width:"64px",sortable:true},{id:"addedSize",title:WebInspector.UIString("Alloc. Size"),width:"72px",sortable:true,sort:WebInspector.DataGrid.Order.Descending},{id:"removedSize",title:WebInspector.UIString("Freed Size"),width:"72px",sortable:true},{id:"sizeDelta",title:WebInspector.UIString("Size Delta"),width:"72px",sortable:true}];WebInspector.HeapSnapshotViewportDataGrid.call(this,columns);}
WebInspector.HeapSnapshotDiffDataGrid.prototype={defaultPopulateCount:function()
{return 50;},_sortFields:function(sortColumn,sortAscending)
{return{object:["_name",sortAscending,"_count",false],addedCount:["_addedCount",sortAscending,"_name",true],removedCount:["_removedCount",sortAscending,"_name",true],countDelta:["_countDelta",sortAscending,"_name",true],addedSize:["_addedSize",sortAscending,"_name",true],removedSize:["_removedSize",sortAscending,"_name",true],sizeDelta:["_sizeDelta",sortAscending,"_name",true]}[sortColumn];},setDataSource:function(snapshot)
{this.snapshot=snapshot;},setBaseDataSource:function(baseSnapshot)
-{this.baseSnapshot=baseSnapshot;this.dispose();this.removeTopLevelNodes();this.resetSortingCache();if(this.baseSnapshot===this.snapshot){this.dispatchEventToListeners("sorting complete");return;}
+{this.baseSnapshot=baseSnapshot;this.removeTopLevelNodes();this.resetSortingCache();if(this.baseSnapshot===this.snapshot){this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.SortingComplete);return;}
this._populateChildren();},_populateChildren:function()
{function aggregatesForDiffReceived(aggregatesForDiff)
{this.snapshot.calculateSnapshotDiff(this.baseSnapshot.uid,aggregatesForDiff,didCalculateSnapshotDiff.bind(this));function didCalculateSnapshotDiff(diffByClassName)
-{for(var className in diffByClassName){var diff=diffByClassName[className];this.appendTopLevelNode(new WebInspector.HeapSnapshotDiffNode(this,className,diff));}
+{for(var className in diffByClassName){var diff=diffByClassName[className];this.appendNode(this.rootNode(),new WebInspector.HeapSnapshotDiffNode(this,className,diff));}
this.sortingChanged();}}
this.baseSnapshot.aggregatesForDiff(aggregatesForDiffReceived.bind(this));},__proto__:WebInspector.HeapSnapshotViewportDataGrid.prototype}
WebInspector.HeapSnapshotDominatorsDataGrid=function()
@@ -713,7 +800,7 @@
{this.rootNode().sort();},highlightObjectByHeapSnapshotId:function(id,callback)
{if(!this.snapshot){this._objectIdToSelect=id;callback(false);return;}
function didGetDominators(dominatorIds)
-{if(!dominatorIds){WebInspector.log(WebInspector.UIString("Cannot find corresponding heap snapshot node"));callback(false);return;}
+{if(!dominatorIds){WebInspector.console.log(WebInspector.UIString("Cannot find corresponding heap snapshot node"));callback(false);return;}
var dominatorNode=this.rootNode();expandNextDominator.call(this,dominatorIds,dominatorNode);}
function expandNextDominator(dominatorIds,dominatorNode)
{if(!dominatorNode){console.error("Cannot find dominator node");callback(false);return;}
@@ -721,45 +808,44 @@
var snapshotObjectId=dominatorIds.pop();dominatorNode.retrieveChildBySnapshotObjectId(snapshotObjectId,expandNextDominator.bind(this,dominatorIds));}
this.snapshot.dominatorIdsForNode(parseInt(id,10),didGetDominators.bind(this));},__proto__:WebInspector.HeapSnapshotSortableDataGrid.prototype}
WebInspector.AllocationDataGrid=function()
-{var columns=[{id:"count",title:WebInspector.UIString("Count"),width:"72px",sortable: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();}
+{var columns=[{id:"liveCount",title:WebInspector.UIString("Live Count"),width:"72px",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:WebInspector.UIString("Function"),disclosure:true,sortable:true},];WebInspector.DataGrid.call(this,columns);this._linkifier=new WebInspector.Linkifier();this.addEventListener(WebInspector.DataGrid.Events.SortingChanged,this._sortingChanged,this);}
WebInspector.AllocationDataGrid.prototype={setDataSource:function(snapshot)
-{this._snapshot=snapshot;this._snapshot.allocationTracesTops(didReceiveAllocationTracesTops.bind(this));function didReceiveAllocationTracesTops(tops)
-{var root=this.rootNode();for(var i=0;i<tops.length;i++)
-root.appendChild(new WebInspector.AllocationGridNode(this,tops[i]));}},__proto__:WebInspector.DataGrid.prototype}
-WebInspector.AllocationGridNode=function(dataGrid,data)
-{WebInspector.DataGridNode.call(this,data,data.hasChildren);this._dataGrid=dataGrid;this._populated=false;}
-WebInspector.AllocationGridNode.prototype={populate:function()
-{if(this._populated)
-return;this._populated=true;this._dataGrid._snapshot.allocationNodeCallers(this.data.id,didReceiveCallers.bind(this));function didReceiveCallers(callers)
-{var callersChain=callers.nodesWithSingleCaller;var parentNode=this;for(var i=0;i<callersChain.length;i++){var child=new WebInspector.AllocationGridNode(this._dataGrid,callersChain[i]);parentNode.appendChild(child);parentNode=child;parentNode._populated=true;if(this.expanded)
-parentNode.expand();}
-var callersBranch=callers.branchingCallers;for(var i=0;i<callersBranch.length;i++)
-parentNode.appendChild(new WebInspector.AllocationGridNode(this._dataGrid,callersBranch[i]));}},expand:function()
-{WebInspector.DataGridNode.prototype.expand.call(this);if(this.children.length===1)
-this.children[0].expand();},createCell:function(columnIdentifier)
-{var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentifier);if(columnIdentifier!=="name")
-return cell;var functionInfo=this.data;if(functionInfo.scriptName){var urlElement=this._dataGrid._linkifier.linkifyLocation(functionInfo.scriptName,functionInfo.line-1,functionInfo.column-1,"profile-node-file");urlElement.style.maxWidth="75%";cell.insertBefore(urlElement,cell.firstChild);}
-return cell;},__proto__:WebInspector.DataGridNode.prototype};WebInspector.HeapSnapshotGridNode=function(tree,hasChildren)
-{WebInspector.DataGridNode.call(this,null,hasChildren);this._dataGrid=tree;this._instanceCount=0;this._savedChildren=null;this._retrievedChildrenRanges=[];}
+{this.snapshot=snapshot;this.snapshot.allocationTracesTops(didReceiveAllocationTracesTops.bind(this));function didReceiveAllocationTracesTops(tops)
+{this._topNodes=tops;this._populateChildren();}},_populateChildren:function()
+{var root=this.rootNode();var tops=this._topNodes;for(var i=0;i<tops.length;i++)
+root.appendChild(new WebInspector.AllocationGridNode(this,tops[i]));},_sortingChanged:function()
+{this._topNodes.sort(this._createComparator());this.rootNode().removeChildren();this._populateChildren();},_createComparator:function()
+{var fieldName=this.sortColumnIdentifier();var compareResult=(this.sortOrder()===WebInspector.DataGrid.Order.Ascending)?+1:-1;function compare(a,b)
+{if(a[fieldName]>b[fieldName])
+return compareResult;if(a[fieldName]<b[fieldName])
+return-compareResult;return 0;}
+return compare;},__proto__:WebInspector.DataGrid.prototype};WebInspector.HeapSnapshotGridNode=function(tree,hasChildren)
+{WebInspector.DataGridNode.call(this,null,hasChildren);this._dataGrid=tree;this._instanceCount=0;this._savedChildren=null;this._retrievedChildrenRanges=[];this._providerObject=null;}
WebInspector.HeapSnapshotGridNode.Events={PopulateComplete:"PopulateComplete"}
WebInspector.HeapSnapshotGridNode.createComparator=function(fieldNames)
-{return{fieldName1:fieldNames[0],ascending1:fieldNames[1],fieldName2:fieldNames[2],ascending2:fieldNames[3]};}
+{return({fieldName1:fieldNames[0],ascending1:fieldNames[1],fieldName2:fieldNames[2],ascending2:fieldNames[3]});}
+WebInspector.HeapSnapshotGridNode.ChildrenProvider=function(){}
+WebInspector.HeapSnapshotGridNode.ChildrenProvider.prototype={dispose:function(){},nodePosition:function(snapshotObjectId,callback){},isEmpty:function(callback){},serializeItemsRange:function(startPosition,endPosition,callback){},sortAndRewind:function(comparator,callback){}}
WebInspector.HeapSnapshotGridNode.prototype={createProvider:function()
-{throw new Error("Needs implemented.");},_provider:function()
+{throw new Error("Not implemented.");},retainersDataSource:function()
+{return null;},_provider:function()
{if(!this._providerObject)
this._providerObject=this.createProvider();return this._providerObject;},createCell:function(columnIdentifier)
{var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentifier);if(this._searchMatched)
cell.classList.add("highlight");return cell;},collapse:function()
-{WebInspector.DataGridNode.prototype.collapse.call(this);this._dataGrid.updateVisibleNodes();},dispose:function()
-{if(this._provider())
-this._provider().dispose();for(var node=this.children[0];node;node=node.traverseNextNode(true,this,true))
+{WebInspector.DataGridNode.prototype.collapse.call(this);this._dataGrid.updateVisibleNodes(true);},expand:function()
+{WebInspector.DataGridNode.prototype.expand.call(this);this._dataGrid.updateVisibleNodes(true);},dispose:function()
+{if(this._providerObject)
+this._providerObject.dispose();for(var node=this.children[0];node;node=node.traverseNextNode(true,this,true))
if(node.dispose)
node.dispose();},_reachableFromWindow:false,queryObjectContent:function(callback)
{},wasDetached:function()
{this._dataGrid.nodeWasDetached(this);},_toPercentString:function(num)
-{return num.toFixed(0)+"\u2009%";},childForPosition:function(nodePosition)
-{var indexOfFirsChildInRange=0;for(var i=0;i<this._retrievedChildrenRanges.length;i++){var range=this._retrievedChildrenRanges[i];if(range.from<=nodePosition&&nodePosition<range.to){var childIndex=indexOfFirsChildInRange+nodePosition-range.from;return this.children[childIndex];}
-indexOfFirsChildInRange+=range.to-range.from+1;}
+{return num.toFixed(0)+"\u2009%";},allChildren:function()
+{return this._dataGrid.allChildren(this);},removeChildByIndex:function(index)
+{this._dataGrid.removeChildByIndex(this,index);},childForPosition:function(nodePosition)
+{var indexOfFirstChildInRange=0;for(var i=0;i<this._retrievedChildrenRanges.length;i++){var range=this._retrievedChildrenRanges[i];if(range.from<=nodePosition&&nodePosition<range.to){var childIndex=indexOfFirstChildInRange+nodePosition-range.from;return this.allChildren()[childIndex];}
+indexOfFirstChildInRange+=range.to-range.from+1;}
return null;},_createValueCell:function(columnIdentifier)
{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[columnIdentifier];div.appendChild(valueSpan);var percentColumn=columnIdentifier+"-percent";if(percentColumn in this.data){var percentSpan=document.createElement("span");percentSpan.className="percent-column";percentSpan.textContent=this.data[percentColumn];div.appendChild(percentSpan);div.classList.add("heap-snapshot-multiple-values");}
cell.appendChild(div);}
@@ -773,161 +859,151 @@
{if(firstNotSerializedPosition>=toPosition)
return;var end=Math.min(firstNotSerializedPosition+this._dataGrid.defaultPopulateCount(),toPosition);this._provider().serializeItemsRange(firstNotSerializedPosition,end,childrenRetrieved.bind(this));firstNotSerializedPosition=end;}
function insertRetrievedChild(item,insertionIndex)
-{if(this._savedChildren){var hash=this._childHashForEntity(item);if(hash in this._savedChildren){this.insertChild(this._savedChildren[hash],insertionIndex);return;}}
-this.insertChild(this._createChildNode(item),insertionIndex);}
+{if(this._savedChildren){var hash=this._childHashForEntity(item);if(hash in this._savedChildren){this._dataGrid.insertChild(this,this._savedChildren[hash],insertionIndex);return;}}
+this._dataGrid.insertChild(this,this._createChildNode(item),insertionIndex);}
function insertShowMoreButton(from,to,insertionIndex)
-{var button=new WebInspector.ShowMoreDataGridNode(this._populateChildren.bind(this),from,to,this._dataGrid.defaultPopulateCount());this.insertChild(button,insertionIndex);}
-function childrenRetrieved(items)
-{var itemIndex=0;var itemPosition=items.startPosition;var insertionIndex=0;if(!this._retrievedChildrenRanges.length){if(items.startPosition>0){this._retrievedChildrenRanges.push({from:0,to:0});insertShowMoreButton.call(this,0,items.startPosition,insertionIndex++);}
-this._retrievedChildrenRanges.push({from:items.startPosition,to:items.endPosition});for(var i=0,l=items.length;i<l;++i)
-insertRetrievedChild.call(this,items[i],insertionIndex++);if(items.endPosition<items.totalLength)
-insertShowMoreButton.call(this,items.endPosition,items.totalLength,insertionIndex++);}else{var rangeIndex=0;var found=false;var range;while(rangeIndex<this._retrievedChildrenRanges.length){range=this._retrievedChildrenRanges[rangeIndex];if(range.to>=itemPosition){found=true;break;}
-insertionIndex+=range.to-range.from;if(range.to<items.totalLength)
+{var button=new WebInspector.ShowMoreDataGridNode(this._populateChildren.bind(this),from,to,this._dataGrid.defaultPopulateCount());this._dataGrid.insertChild(this,button,insertionIndex);}
+function childrenRetrieved(itemsRange)
+{var itemIndex=0;var itemPosition=itemsRange.startPosition;var items=itemsRange.items;var insertionIndex=0;if(!this._retrievedChildrenRanges.length){if(itemsRange.startPosition>0){this._retrievedChildrenRanges.push({from:0,to:0});insertShowMoreButton.call(this,0,itemsRange.startPosition,insertionIndex++);}
+this._retrievedChildrenRanges.push({from:itemsRange.startPosition,to:itemsRange.endPosition});for(var i=0,l=items.length;i<l;++i)
+insertRetrievedChild.call(this,items[i],insertionIndex++);if(itemsRange.endPosition<itemsRange.totalLength)
+insertShowMoreButton.call(this,itemsRange.endPosition,itemsRange.totalLength,insertionIndex++);}else{var rangeIndex=0;var found=false;var range;while(rangeIndex<this._retrievedChildrenRanges.length){range=this._retrievedChildrenRanges[rangeIndex];if(range.to>=itemPosition){found=true;break;}
+insertionIndex+=range.to-range.from;if(range.to<itemsRange.totalLength)
insertionIndex+=1;++rangeIndex;}
-if(!found||items.startPosition<range.from){this.children[insertionIndex-1].setEndPosition(items.startPosition);insertShowMoreButton.call(this,items.startPosition,found?range.from:items.totalLength,insertionIndex);range={from:items.startPosition,to:items.startPosition};if(!found)
+if(!found||itemsRange.startPosition<range.from){this.allChildren()[insertionIndex-1].setEndPosition(itemsRange.startPosition);insertShowMoreButton.call(this,itemsRange.startPosition,found?range.from:itemsRange.totalLength,insertionIndex);range={from:itemsRange.startPosition,to:itemsRange.startPosition};if(!found)
rangeIndex=this._retrievedChildrenRanges.length;this._retrievedChildrenRanges.splice(rangeIndex,0,range);}else{insertionIndex+=itemPosition-range.from;}
-while(range.to<items.endPosition){var skipCount=range.to-itemPosition;insertionIndex+=skipCount;itemIndex+=skipCount;itemPosition=range.to;var nextRange=this._retrievedChildrenRanges[rangeIndex+1];var newEndOfRange=nextRange?nextRange.from:items.totalLength;if(newEndOfRange>items.endPosition)
-newEndOfRange=items.endPosition;while(itemPosition<newEndOfRange){insertRetrievedChild.call(this,items[itemIndex++],insertionIndex++);++itemPosition;}
-if(nextRange&&newEndOfRange===nextRange.from){range.to=nextRange.to;this.removeChild(this.children[insertionIndex]);this._retrievedChildrenRanges.splice(rangeIndex+1,1);}else{range.to=newEndOfRange;if(newEndOfRange===items.totalLength)
-this.removeChild(this.children[insertionIndex]);else
-this.children[insertionIndex].setStartPosition(items.endPosition);}}}
+while(range.to<itemsRange.endPosition){var skipCount=range.to-itemPosition;insertionIndex+=skipCount;itemIndex+=skipCount;itemPosition=range.to;var nextRange=this._retrievedChildrenRanges[rangeIndex+1];var newEndOfRange=nextRange?nextRange.from:itemsRange.totalLength;if(newEndOfRange>itemsRange.endPosition)
+newEndOfRange=itemsRange.endPosition;while(itemPosition<newEndOfRange){insertRetrievedChild.call(this,items[itemIndex++],insertionIndex++);++itemPosition;}
+if(nextRange&&newEndOfRange===nextRange.from){range.to=nextRange.to;this.removeChildByIndex(insertionIndex);this._retrievedChildrenRanges.splice(rangeIndex+1,1);}else{range.to=newEndOfRange;if(newEndOfRange===itemsRange.totalLength)
+this.removeChildByIndex(insertionIndex);else
+this.allChildren()[insertionIndex].setStartPosition(itemsRange.endPosition);}}}
this._instanceCount+=items.length;if(firstNotSerializedPosition<toPosition){serializeNextChunk.call(this);return;}
-if(afterPopulate)
+if(this.expanded)
+this._dataGrid.updateVisibleNodes(true);if(afterPopulate)
afterPopulate();this.dispatchEventToListeners(WebInspector.HeapSnapshotGridNode.Events.PopulateComplete);}
serializeNextChunk.call(this);},_saveChildren:function()
-{this._savedChildren=null;for(var i=0,childrenCount=this.children.length;i<childrenCount;++i){var child=this.children[i];if(!child.expanded)
+{this._savedChildren=null;var children=this.allChildren();for(var i=0,l=children.length;i<l;++i){var child=children[i];if(!child.expanded)
continue;if(!this._savedChildren)
this._savedChildren={};this._savedChildren[this._childHashForNode(child)]=child;}},sort:function()
{this._dataGrid.recursiveSortingEnter();function afterSort()
-{this._saveChildren();this.removeChildren();this._retrievedChildrenRanges=[];function afterPopulate()
-{for(var i=0,l=this.children.length;i<l;++i){var child=this.children[i];if(child.expanded)
+{this._saveChildren();this._dataGrid.removeAllChildren(this);this._retrievedChildrenRanges=[];function afterPopulate()
+{var children=this.allChildren();for(var i=0,l=children.length;i<l;++i){var child=children[i];if(child.expanded)
child.sort();}
this._dataGrid.recursiveSortingLeave();}
var instanceCount=this._instanceCount;this._instanceCount=0;this._populateChildren(0,instanceCount,afterPopulate.bind(this));}
this._provider().sortAndRewind(this.comparator(),afterSort.bind(this));},__proto__:WebInspector.DataGridNode.prototype}
-WebInspector.HeapSnapshotGenericObjectNode=function(tree,node)
-{this.snapshotNodeIndex=0;WebInspector.HeapSnapshotGridNode.call(this,tree,false);if(!node)
+WebInspector.HeapSnapshotGenericObjectNode=function(dataGrid,node)
+{WebInspector.HeapSnapshotGridNode.call(this,dataGrid,false);if(!node)
return;this._name=node.name;this._type=node.type;this._distance=node.distance;this._shallowSize=node.selfSize;this._retainedSize=node.retainedSize;this.snapshotNodeId=node.id;this.snapshotNodeIndex=node.nodeIndex;if(this._type==="string")
this._reachableFromWindow=true;else if(this._type==="object"&&this._name.startsWith("Window")){this._name=this.shortenWindowURL(this._name,false);this._reachableFromWindow=true;}else if(node.canBeQueried)
this._reachableFromWindow=true;if(node.detachedDOMTreeNode)
-this.detachedDOMTreeNode=true;};WebInspector.HeapSnapshotGenericObjectNode.prototype={createCell:function(columnIdentifier)
+this.detachedDOMTreeNode=true;var snapshot=dataGrid.snapshot;var shallowSizePercent=this._shallowSize/snapshot.totalSize*100.0;var retainedSizePercent=this._retainedSize/snapshot.totalSize*100.0;this.data={"distance":this._distance,"shallowSize":Number.withThousandsSeparator(this._shallowSize),"retainedSize":Number.withThousandsSeparator(this._retainedSize),"shallowSize-percent":this._toPercentString(shallowSizePercent),"retainedSize-percent":this._toPercentString(retainedSizePercent)};};WebInspector.HeapSnapshotGenericObjectNode.prototype={retainersDataSource:function()
+{return{snapshot:this._dataGrid.snapshot,snapshotNodeIndex:this.snapshotNodeIndex};},createCell:function(columnIdentifier)
{var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):this._createObjectCell();if(this._searchMatched)
cell.classList.add("highlight");return cell;},_createObjectCell:function()
-{var cell=document.createElement("td");cell.className="object-column";var div=document.createElement("div");div.className="source-code event-properties";div.style.overflow="visible";var data=this.data["object"];if(this._prefixObjectCell)
-this._prefixObjectCell(div,data);var valueSpan=document.createElement("span");valueSpan.className="value console-formatted-"+data.valueStyle;valueSpan.textContent=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)
-this._postfixObjectCell(div,data);cell.appendChild(div);cell.classList.add("disclosure");if(this.depth)
-cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px");cell.heapSnapshotNode=this;return cell;},get data()
-{var data=this._emptyData();var value=this._name;var valueStyle="object";switch(this._type){case"concatenated string":case"string":value="\""+value+"\"";valueStyle="string";break;case"regexp":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)
+{var value=this._name;var valueStyle="object";switch(this._type){case"concatenated string":case"string":value="\""+value+"\"";valueStyle="string";break;case"regexp":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)
value="[]";else
value+="[]";break;};if(this._reachableFromWindow)
valueStyle+=" highlight";if(value==="Object")
value="";if(this.detachedDOMTreeNode)
-valueStyle+=" detached-dom-tree-node";data["object"]={valueStyle:valueStyle,value:value,nodeId:this.snapshotNodeId};data["distance"]=this._distance;data["shallowSize"]=Number.withThousandsSeparator(this._shallowSize);data["retainedSize"]=Number.withThousandsSeparator(this._retainedSize);data["shallowSize-percent"]=this._toPercentString(this._shallowSizePercent);data["retainedSize-percent"]=this._toPercentString(this._retainedSizePercent);return this._enhanceData?this._enhanceData(data):data;},queryObjectContent:function(callback,objectGroupName)
+valueStyle+=" detached-dom-tree-node";return this._createObjectCellWithValue(valueStyle,value);},_createObjectCellWithValue:function(valueStyle,value)
+{var cell=document.createElement("td");cell.className="object-column";var div=document.createElement("div");div.className="source-code event-properties";div.style.overflow="visible";this._prefixObjectCell(div);var valueSpan=document.createElement("span");valueSpan.className="value console-formatted-"+valueStyle;valueSpan.textContent=value;div.appendChild(valueSpan);var idSpan=document.createElement("span");idSpan.className="console-formatted-id";idSpan.textContent=" @"+this.snapshotNodeId;div.appendChild(idSpan);cell.appendChild(div);cell.classList.add("disclosure");if(this.depth)
+cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px");cell.heapSnapshotNode=this;return cell;},_prefixObjectCell:function(div)
+{},queryObjectContent:function(callback,objectGroupName)
{function formatResult(error,object)
{if(!error&&object.type)
callback(WebInspector.RemoteObject.fromPayload(object),!!error);else
callback(WebInspector.RemoteObject.fromPrimitiveValue(WebInspector.UIString("Preview is not available")));}
if(this._type==="string")
callback(WebInspector.RemoteObject.fromPrimitiveValue(this._name));else
-HeapProfilerAgent.getObjectByHeapObjectId(String(this.snapshotNodeId),objectGroupName,formatResult);},get _retainedSizePercent()
-{return this._retainedSize/this.dataGrid.snapshot.totalSize*100.0;},get _shallowSizePercent()
-{return this._shallowSize/this.dataGrid.snapshot.totalSize*100.0;},updateHasChildren:function()
+HeapProfilerAgent.getObjectByHeapObjectId(String(this.snapshotNodeId),objectGroupName,formatResult);},updateHasChildren:function()
{function isEmptyCallback(isEmpty)
{this.hasChildren=!isEmpty;}
this._provider().isEmpty(isEmptyCallback.bind(this));},shortenWindowURL:function(fullName,hasObjectId)
{var startPos=fullName.indexOf("/");var endPos=hasObjectId?fullName.indexOf("@"):fullName.length;if(startPos!==-1&&endPos!==-1){var fullURL=fullName.substring(startPos+1,endPos).trimLeft();var url=fullURL.trimURL();if(url.length>40)
url=url.trimMiddle(40);return fullName.substr(0,startPos+2)+url+fullName.substr(endPos);}else
return fullName;},__proto__:WebInspector.HeapSnapshotGridNode.prototype}
-WebInspector.HeapSnapshotObjectNode=function(tree,isFromBaseSnapshot,edge,parentGridNode)
-{WebInspector.HeapSnapshotGenericObjectNode.call(this,tree,edge.node);this._referenceName=edge.name;this._referenceType=edge.type;this._distance=edge.distance;this.showRetainingEdges=tree.showRetainingEdges;this._isFromBaseSnapshot=isFromBaseSnapshot;this._parentGridNode=parentGridNode;this._cycledWithAncestorGridNode=this._findAncestorWithSameSnapshotNodeId();if(!this._cycledWithAncestorGridNode)
-this.updateHasChildren();}
-WebInspector.HeapSnapshotObjectNode.prototype={createProvider:function()
-{var tree=this._dataGrid;var showHiddenData=WebInspector.settings.showAdvancedHeapSnapshotProperties.get();var snapshot=this._isFromBaseSnapshot?tree.baseSnapshot:tree.snapshot;if(this.showRetainingEdges)
-return snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex,showHiddenData);else
-return snapshot.createEdgesProvider(this.snapshotNodeIndex,showHiddenData);},_findAncestorWithSameSnapshotNodeId:function()
+WebInspector.HeapSnapshotObjectNode=function(dataGrid,snapshot,edge,parentGridNode)
+{WebInspector.HeapSnapshotGenericObjectNode.call(this,dataGrid,edge.node);this._referenceName=edge.name;this._referenceType=edge.type;this.showRetainingEdges=dataGrid.showRetainingEdges;this._snapshot=snapshot;this._parentGridNode=parentGridNode;this._cycledWithAncestorGridNode=this._findAncestorWithSameSnapshotNodeId();if(!this._cycledWithAncestorGridNode)
+this.updateHasChildren();var data=this.data;data["count"]="";data["addedCount"]="";data["removedCount"]="";data["countDelta"]="";data["addedSize"]="";data["removedSize"]="";data["sizeDelta"]="";}
+WebInspector.HeapSnapshotObjectNode.prototype={retainersDataSource:function()
+{return{snapshot:this._snapshot,snapshotNodeIndex:this.snapshotNodeIndex};},createProvider:function()
+{var tree=this._dataGrid;if(this.showRetainingEdges)
+return this._snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex);else
+return this._snapshot.createEdgesProvider(this.snapshotNodeIndex);},_findAncestorWithSameSnapshotNodeId:function()
{var ancestor=this._parentGridNode;while(ancestor){if(ancestor.snapshotNodeId===this.snapshotNodeId)
return ancestor;ancestor=ancestor._parentGridNode;}
return null;},_createChildNode:function(item)
-{return new WebInspector.HeapSnapshotObjectNode(this._dataGrid,this._isFromBaseSnapshot,item,this);},_childHashForEntity:function(edge)
+{return new WebInspector.HeapSnapshotObjectNode(this._dataGrid,this._snapshot,item,this);},_childHashForEntity:function(edge)
{var prefix=this.showRetainingEdges?edge.node.id+"#":"";return prefix+edge.type+"#"+edge.name;},_childHashForNode:function(childNode)
{var prefix=this.showRetainingEdges?childNode.snapshotNodeId+"#":"";return prefix+childNode._referenceType+"#"+childNode._referenceName;},comparator:function()
-{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["!edgeName",sortAscending,"retainedSize",false],count:["!edgeName",true,"retainedSize",false],shallowSize:["selfSize",sortAscending,"!edgeName",true],retainedSize:["retainedSize",sortAscending,"!edgeName",true],distance:["distance",sortAscending,"_name",true]}[sortColumnIdentifier]||["!edgeName",true,"retainedSize",false];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},_emptyData:function()
-{return{count:"",addedCount:"",removedCount:"",countDelta:"",addedSize:"",removedSize:"",sizeDelta:""};},_enhanceData:function(data)
-{var name=this._referenceName;if(name==="")name="(empty)";var nameClass="name";switch(this._referenceType){case"context":nameClass="console-formatted-number";break;case"internal":case"hidden":nameClass="console-formatted-null";break;case"element":name="["+name+"]";break;}
-data["object"].nameClass=nameClass;data["object"].name=name;data["distance"]=this._distance;return data;},_prefixObjectCell:function(div,data)
-{if(this._cycledWithAncestorGridNode)
-div.className+=" cycled-ancessor-node";var nameSpan=document.createElement("span");nameSpan.className=data.nameClass;nameSpan.textContent=data.name;div.appendChild(nameSpan);var separatorSpan=document.createElement("span");separatorSpan.className="grayed";separatorSpan.textContent=this.showRetainingEdges?" in ":" :: ";div.appendChild(separatorSpan);},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype}
-WebInspector.HeapSnapshotInstanceNode=function(tree,baseSnapshot,snapshot,node)
-{WebInspector.HeapSnapshotGenericObjectNode.call(this,tree,node);this._baseSnapshotOrSnapshot=baseSnapshot||snapshot;this._isDeletedNode=!!baseSnapshot;this.updateHasChildren();};WebInspector.HeapSnapshotInstanceNode.prototype={createProvider:function()
-{var showHiddenData=WebInspector.settings.showAdvancedHeapSnapshotProperties.get();return this._baseSnapshotOrSnapshot.createEdgesProvider(this.snapshotNodeIndex,showHiddenData);},_createChildNode:function(item)
-{return new WebInspector.HeapSnapshotObjectNode(this._dataGrid,this._isDeletedNode,item,null);},_childHashForEntity:function(edge)
+{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["!edgeName",sortAscending,"retainedSize",false],count:["!edgeName",true,"retainedSize",false],shallowSize:["selfSize",sortAscending,"!edgeName",true],retainedSize:["retainedSize",sortAscending,"!edgeName",true],distance:["distance",sortAscending,"_name",true]}[sortColumnIdentifier]||["!edgeName",true,"retainedSize",false];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},_prefixObjectCell:function(div)
+{var name=this._referenceName;if(name==="")name="(empty)";var nameClass="name";switch(this._referenceType){case"context":nameClass="console-formatted-number";break;case"internal":case"hidden":case"weak":nameClass="console-formatted-null";break;case"element":name="["+name+"]";break;}
+if(this._cycledWithAncestorGridNode)
+div.className+=" cycled-ancessor-node";var nameSpan=document.createElement("span");nameSpan.className=nameClass;nameSpan.textContent=name;div.appendChild(nameSpan);var separatorSpan=document.createElement("span");separatorSpan.className="grayed";separatorSpan.textContent=this.showRetainingEdges?" in ":" :: ";div.appendChild(separatorSpan);},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype}
+WebInspector.HeapSnapshotInstanceNode=function(dataGrid,snapshot,node,isDeletedNode)
+{WebInspector.HeapSnapshotGenericObjectNode.call(this,dataGrid,node);this._baseSnapshotOrSnapshot=snapshot;this._isDeletedNode=isDeletedNode;this.updateHasChildren();var data=this.data;data["count"]="";data["countDelta"]="";data["sizeDelta"]="";if(this._isDeletedNode){data["addedCount"]="";data["addedSize"]="";data["removedCount"]="\u2022";data["removedSize"]=Number.withThousandsSeparator(this._shallowSize);}else{data["addedCount"]="\u2022";data["addedSize"]=Number.withThousandsSeparator(this._shallowSize);data["removedCount"]="";data["removedSize"]="";}};WebInspector.HeapSnapshotInstanceNode.prototype={retainersDataSource:function()
+{return{snapshot:this._baseSnapshotOrSnapshot,snapshotNodeIndex:this.snapshotNodeIndex};},createProvider:function()
+{return this._baseSnapshotOrSnapshot.createEdgesProvider(this.snapshotNodeIndex);},_createChildNode:function(item)
+{return new WebInspector.HeapSnapshotObjectNode(this._dataGrid,this._baseSnapshotOrSnapshot,item,null);},_childHashForEntity:function(edge)
{return edge.type+"#"+edge.name;},_childHashForNode:function(childNode)
{return childNode._referenceType+"#"+childNode._referenceName;},comparator:function()
-{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["!edgeName",sortAscending,"retainedSize",false],distance:["distance",sortAscending,"retainedSize",false],count:["!edgeName",true,"retainedSize",false],addedSize:["selfSize",sortAscending,"!edgeName",true],removedSize:["selfSize",sortAscending,"!edgeName",true],shallowSize:["selfSize",sortAscending,"!edgeName",true],retainedSize:["retainedSize",sortAscending,"!edgeName",true]}[sortColumnIdentifier]||["!edgeName",true,"retainedSize",false];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},_emptyData:function()
-{return{count:"",countDelta:"",sizeDelta:""};},_enhanceData:function(data)
-{if(this._isDeletedNode){data["addedCount"]="";data["addedSize"]="";data["removedCount"]="\u2022";data["removedSize"]=Number.withThousandsSeparator(this._shallowSize);}else{data["addedCount"]="\u2022";data["addedSize"]=Number.withThousandsSeparator(this._shallowSize);data["removedCount"]="";data["removedSize"]="";}
-return data;},get isDeletedNode()
-{return this._isDeletedNode;},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype}
-WebInspector.HeapSnapshotConstructorNode=function(tree,className,aggregate,aggregatesKey)
-{WebInspector.HeapSnapshotGridNode.call(this,tree,aggregate.count>0);this._name=className;this._aggregatesKey=aggregatesKey;this._distance=aggregate.distance;this._count=aggregate.count;this._shallowSize=aggregate.self;this._retainedSize=aggregate.maxRet;}
+{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["!edgeName",sortAscending,"retainedSize",false],distance:["distance",sortAscending,"retainedSize",false],count:["!edgeName",true,"retainedSize",false],addedSize:["selfSize",sortAscending,"!edgeName",true],removedSize:["selfSize",sortAscending,"!edgeName",true],shallowSize:["selfSize",sortAscending,"!edgeName",true],retainedSize:["retainedSize",sortAscending,"!edgeName",true]}[sortColumnIdentifier]||["!edgeName",true,"retainedSize",false];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype}
+WebInspector.HeapSnapshotConstructorNode=function(dataGrid,className,aggregate,nodeFilter)
+{WebInspector.HeapSnapshotGridNode.call(this,dataGrid,aggregate.count>0);this._name=className;this._nodeFilter=nodeFilter;this._distance=aggregate.distance;this._count=aggregate.count;this._shallowSize=aggregate.self;this._retainedSize=aggregate.maxRet;var snapshot=dataGrid.snapshot;var countPercent=this._count/snapshot.nodeCount*100.0;var retainedSizePercent=this._retainedSize/snapshot.totalSize*100.0;var shallowSizePercent=this._shallowSize/snapshot.totalSize*100.0;this.data={"object":className,"count":Number.withThousandsSeparator(this._count),"distance":this._distance,"shallowSize":Number.withThousandsSeparator(this._shallowSize),"retainedSize":Number.withThousandsSeparator(this._retainedSize),"count-percent":this._toPercentString(countPercent),"shallowSize-percent":this._toPercentString(shallowSizePercent),"retainedSize-percent":this._toPercentString(retainedSizePercent)};}
WebInspector.HeapSnapshotConstructorNode.prototype={createProvider:function()
-{return this._dataGrid.snapshot.createNodesProviderForClass(this._name,this._aggregatesKey)},revealNodeBySnapshotObjectId:function(snapshotObjectId,callback)
+{return this._dataGrid.snapshot.createNodesProviderForClass(this._name,this._nodeFilter)},revealNodeBySnapshotObjectId:function(snapshotObjectId,callback)
{function didExpand()
{this._provider().nodePosition(snapshotObjectId,didGetNodePosition.bind(this));}
function didGetNodePosition(nodePosition)
{if(nodePosition===-1){this.collapse();callback(false);}else{this._populateChildren(nodePosition,null,didPopulateChildren.bind(this,nodePosition));}}
function didPopulateChildren(nodePosition)
-{var indexOfFirsChildInRange=0;for(var i=0;i<this._retrievedChildrenRanges.length;i++){var range=this._retrievedChildrenRanges[i];if(range.from<=nodePosition&&nodePosition<range.to){var childIndex=indexOfFirsChildInRange+nodePosition-range.from;var instanceNode=this.children[childIndex];this._dataGrid.highlightNode((instanceNode));callback(true);return;}
-indexOfFirsChildInRange+=range.to-range.from+1;}
-callback(false);}
-this.expandWithoutPopulate(didExpand.bind(this));},createCell:function(columnIdentifier)
+{var child=this.childForPosition(nodePosition);if(child){this._dataGrid.revealTreeNode([this,child]);this._dataGrid.highlightNode((child));}
+callback(!!child);}
+this._dataGrid.resetNameFilter(this.expandWithoutPopulate.bind(this,didExpand.bind(this)));},filteredOut:function()
+{return this._name.toLowerCase().indexOf(this._dataGrid._nameFilter)===-1;},createCell:function(columnIdentifier)
{var cell=columnIdentifier!=="object"?this._createValueCell(columnIdentifier):WebInspector.HeapSnapshotGridNode.prototype.createCell.call(this,columnIdentifier);if(this._searchMatched)
cell.classList.add("highlight");return cell;},_createChildNode:function(item)
-{return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,null,this._dataGrid.snapshot,item);},comparator:function()
+{return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,this._dataGrid.snapshot,item,false);},comparator:function()
{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscending,"retainedSize",false],distance:["distance",sortAscending,"retainedSize",false],count:["id",true,"retainedSize",false],shallowSize:["selfSize",sortAscending,"id",true],retainedSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdentifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},_childHashForEntity:function(node)
{return node.id;},_childHashForNode:function(childNode)
-{return childNode.snapshotNodeId;},get data()
-{var data={object:this._name};data["count"]=Number.withThousandsSeparator(this._count);data["distance"]=this._distance;data["shallowSize"]=Number.withThousandsSeparator(this._shallowSize);data["retainedSize"]=Number.withThousandsSeparator(this._retainedSize);data["count-percent"]=this._toPercentString(this._countPercent);data["shallowSize-percent"]=this._toPercentString(this._shallowSizePercent);data["retainedSize-percent"]=this._toPercentString(this._retainedSizePercent);return data;},get _countPercent()
-{return this._count/this.dataGrid.snapshot.nodeCount*100.0;},get _retainedSizePercent()
-{return this._retainedSize/this.dataGrid.snapshot.totalSize*100.0;},get _shallowSizePercent()
-{return this._shallowSize/this.dataGrid.snapshot.totalSize*100.0;},__proto__:WebInspector.HeapSnapshotGridNode.prototype}
+{return childNode.snapshotNodeId;},__proto__:WebInspector.HeapSnapshotGridNode.prototype}
WebInspector.HeapSnapshotDiffNodesProvider=function(addedNodesProvider,deletedNodesProvider,addedCount,removedCount)
{this._addedNodesProvider=addedNodesProvider;this._deletedNodesProvider=deletedNodesProvider;this._addedCount=addedCount;this._removedCount=removedCount;}
WebInspector.HeapSnapshotDiffNodesProvider.prototype={dispose:function()
-{this._addedNodesProvider.dispose();this._deletedNodesProvider.dispose();},isEmpty:function(callback)
+{this._addedNodesProvider.dispose();this._deletedNodesProvider.dispose();},nodePosition:function(snapshotObjectId,callback)
+{throw new Error("Unreachable");},isEmpty:function(callback)
{callback(false);},serializeItemsRange:function(beginPosition,endPosition,callback)
{function didReceiveAllItems(items)
{items.totalLength=this._addedCount+this._removedCount;callback(items);}
-function didReceiveDeletedItems(addedItems,items)
-{if(!addedItems.length)
-addedItems.startPosition=this._addedCount+items.startPosition;for(var i=0;i<items.length;i++){items[i].isAddedNotRemoved=false;addedItems.push(items[i]);}
-addedItems.endPosition=this._addedCount+items.endPosition;didReceiveAllItems.call(this,addedItems);}
-function didReceiveAddedItems(items)
-{for(var i=0;i<items.length;i++)
-items[i].isAddedNotRemoved=true;if(items.endPosition<endPosition)
-return this._deletedNodesProvider.serializeItemsRange(0,endPosition-items.endPosition,didReceiveDeletedItems.bind(this,items));items.totalLength=this._addedCount+this._removedCount;didReceiveAllItems.call(this,items);}
-if(beginPosition<this._addedCount)
-this._addedNodesProvider.serializeItemsRange(beginPosition,endPosition,didReceiveAddedItems.bind(this));else
-this._deletedNodesProvider.serializeItemsRange(beginPosition-this._addedCount,endPosition-this._addedCount,didReceiveDeletedItems.bind(this,[]));},sortAndRewind:function(comparator,callback)
+function didReceiveDeletedItems(addedItems,itemsRange)
+{var items=itemsRange.items;if(!addedItems.items.length)
+addedItems.startPosition=this._addedCount+itemsRange.startPosition;for(var i=0;i<items.length;i++){items[i].isAddedNotRemoved=false;addedItems.items.push(items[i]);}
+addedItems.endPosition=this._addedCount+itemsRange.endPosition;didReceiveAllItems.call(this,addedItems);}
+function didReceiveAddedItems(itemsRange)
+{var items=itemsRange.items;for(var i=0;i<items.length;i++)
+items[i].isAddedNotRemoved=true;if(itemsRange.endPosition<endPosition)
+return this._deletedNodesProvider.serializeItemsRange(0,endPosition-itemsRange.endPosition,didReceiveDeletedItems.bind(this,itemsRange));itemsRange.totalLength=this._addedCount+this._removedCount;didReceiveAllItems.call(this,itemsRange);}
+if(beginPosition<this._addedCount){this._addedNodesProvider.serializeItemsRange(beginPosition,endPosition,didReceiveAddedItems.bind(this));}else{var emptyRange=new WebInspector.HeapSnapshotCommon.ItemsRange(0,0,0,[]);this._deletedNodesProvider.serializeItemsRange(beginPosition-this._addedCount,endPosition-this._addedCount,didReceiveDeletedItems.bind(this,emptyRange));}},sortAndRewind:function(comparator,callback)
{function afterSort()
{this._deletedNodesProvider.sortAndRewind(comparator,callback);}
-this._addedNodesProvider.sortAndRewind(comparator,afterSort.bind(this));},__proto__:WebInspector.HeapSnapshotProviderProxy.prototype};WebInspector.HeapSnapshotDiffNode=function(tree,className,diffForClass)
-{WebInspector.HeapSnapshotGridNode.call(this,tree,true);this._name=className;this._addedCount=diffForClass.addedCount;this._removedCount=diffForClass.removedCount;this._countDelta=diffForClass.countDelta;this._addedSize=diffForClass.addedSize;this._removedSize=diffForClass.removedSize;this._sizeDelta=diffForClass.sizeDelta;this._deletedIndexes=diffForClass.deletedIndexes;}
+this._addedNodesProvider.sortAndRewind(comparator,afterSort.bind(this));}};WebInspector.HeapSnapshotDiffNode=function(dataGrid,className,diffForClass)
+{WebInspector.HeapSnapshotGridNode.call(this,dataGrid,true);this._name=className;this._addedCount=diffForClass.addedCount;this._removedCount=diffForClass.removedCount;this._countDelta=diffForClass.countDelta;this._addedSize=diffForClass.addedSize;this._removedSize=diffForClass.removedSize;this._sizeDelta=diffForClass.sizeDelta;this._deletedIndexes=diffForClass.deletedIndexes;this.data={"object":className,"addedCount":Number.withThousandsSeparator(this._addedCount),"removedCount":Number.withThousandsSeparator(this._removedCount),"countDelta":this._signForDelta(this._countDelta)+Number.withThousandsSeparator(Math.abs(this._countDelta)),"addedSize":Number.withThousandsSeparator(this._addedSize),"removedSize":Number.withThousandsSeparator(this._removedSize),"sizeDelta":this._signForDelta(this._sizeDelta)+Number.withThousandsSeparator(Math.abs(this._sizeDelta))};}
WebInspector.HeapSnapshotDiffNode.prototype={createProvider:function()
{var tree=this._dataGrid;return new WebInspector.HeapSnapshotDiffNodesProvider(tree.snapshot.createAddedNodesProvider(tree.baseSnapshot.uid,this._name),tree.baseSnapshot.createDeletedNodesProvider(this._deletedIndexes),this._addedCount,this._removedCount);},_createChildNode:function(item)
{if(item.isAddedNotRemoved)
-return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,null,this._dataGrid.snapshot,item);else
-return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,this._dataGrid.baseSnapshot,null,item);},_childHashForEntity:function(node)
+return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,this._dataGrid.snapshot,item,false);else
+return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid,this._dataGrid.baseSnapshot,item,true);},_childHashForEntity:function(node)
{return node.id;},_childHashForNode:function(childNode)
{return childNode.snapshotNodeId;},comparator:function()
-{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscending,"selfSize",false],addedCount:["selfSize",sortAscending,"id",true],removedCount:["selfSize",sortAscending,"id",true],countDelta:["selfSize",sortAscending,"id",true],addedSize:["selfSize",sortAscending,"id",true],removedSize:["selfSize",sortAscending,"id",true],sizeDelta:["selfSize",sortAscending,"id",true]}[sortColumnIdentifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},_signForDelta:function(delta)
+{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscending,"selfSize",false],addedCount:["selfSize",sortAscending,"id",true],removedCount:["selfSize",sortAscending,"id",true],countDelta:["selfSize",sortAscending,"id",true],addedSize:["selfSize",sortAscending,"id",true],removedSize:["selfSize",sortAscending,"id",true],sizeDelta:["selfSize",sortAscending,"id",true]}[sortColumnIdentifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},filteredOut:function()
+{return this._name.toLowerCase().indexOf(this._dataGrid._nameFilter)===-1;},_signForDelta:function(delta)
{if(delta===0)
return"";if(delta>0)
return"+";else
-return"\u2212";},get data()
-{var data={object:this._name};data["addedCount"]=Number.withThousandsSeparator(this._addedCount);data["removedCount"]=Number.withThousandsSeparator(this._removedCount);data["countDelta"]=this._signForDelta(this._countDelta)+Number.withThousandsSeparator(Math.abs(this._countDelta));data["addedSize"]=Number.withThousandsSeparator(this._addedSize);data["removedSize"]=Number.withThousandsSeparator(this._removedSize);data["sizeDelta"]=this._signForDelta(this._sizeDelta)+Number.withThousandsSeparator(Math.abs(this._sizeDelta));return data;},__proto__:WebInspector.HeapSnapshotGridNode.prototype}
-WebInspector.HeapSnapshotDominatorObjectNode=function(tree,node)
-{WebInspector.HeapSnapshotGenericObjectNode.call(this,tree,node);this.updateHasChildren();};WebInspector.HeapSnapshotDominatorObjectNode.prototype={createProvider:function()
+return"\u2212";},__proto__:WebInspector.HeapSnapshotGridNode.prototype}
+WebInspector.HeapSnapshotDominatorObjectNode=function(dataGrid,node)
+{WebInspector.HeapSnapshotGenericObjectNode.call(this,dataGrid,node);this.updateHasChildren();};WebInspector.HeapSnapshotDominatorObjectNode.prototype={createProvider:function()
{return this._dataGrid.snapshot.createNodesProviderForDominator(this.snapshotNodeIndex);},retrieveChildBySnapshotObjectId:function(snapshotObjectId,callback)
{function didExpand()
{this._provider().nodePosition(snapshotObjectId,didGetNodePosition.bind(this));}
@@ -940,43 +1016,100 @@
{return new WebInspector.HeapSnapshotDominatorObjectNode(this._dataGrid,item);},_childHashForEntity:function(node)
{return node.id;},_childHashForNode:function(childNode)
{return childNode.snapshotNodeId;},comparator:function()
-{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscending,"retainedSize",false],shallowSize:["selfSize",sortAscending,"id",true],retainedSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdentifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},_emptyData:function()
-{return{};},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype};WebInspector.HeapSnapshotView=function(parent,profile)
-{WebInspector.View.call(this);this.element.classList.add("heap-snapshot-view");this.parent=parent;profile.profileType().addEventListener(WebInspector.ProfileType.Events.AddProfileHeader,this._onProfileHeaderAdded,this);if(profile._profileType.id===WebInspector.TrackingHeapSnapshotProfileType.TypeId){this._trackingOverviewGrid=new WebInspector.HeapTrackingOverviewGrid(profile);this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged,this._onIdsRangeChanged.bind(this));this._trackingOverviewGrid.show(this.element);}
-this.viewsContainer=document.createElement("div");this.viewsContainer.classList.add("views-container");this.element.appendChild(this.viewsContainer);this.containmentView=new WebInspector.View();this.containmentView.element.classList.add("view");this.containmentDataGrid=new WebInspector.HeapSnapshotContainmentDataGrid();this.containmentDataGrid.element.addEventListener("mousedown",this._mouseDownInContentsGrid.bind(this),true);this.containmentDataGrid.show(this.containmentView.element);this.containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);this.constructorsView=new WebInspector.View();this.constructorsView.element.classList.add("view");this.constructorsView.element.appendChild(this._createToolbarWithClassNameFilter());this.constructorsDataGrid=new WebInspector.HeapSnapshotConstructorsDataGrid();this.constructorsDataGrid.element.classList.add("class-view-grid");this.constructorsDataGrid.element.addEventListener("mousedown",this._mouseDownInContentsGrid.bind(this),true);this.constructorsDataGrid.show(this.constructorsView.element);this.constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);this.dataGrid=(this.constructorsDataGrid);this.currentView=this.constructorsView;this.currentView.show(this.viewsContainer);this.diffView=new WebInspector.View();this.diffView.element.classList.add("view");this.diffView.element.appendChild(this._createToolbarWithClassNameFilter());this.diffDataGrid=new WebInspector.HeapSnapshotDiffDataGrid();this.diffDataGrid.element.classList.add("class-view-grid");this.diffDataGrid.show(this.diffView.element);this.diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);this.dominatorView=new WebInspector.View();this.dominatorView.element.classList.add("view");this.dominatorDataGrid=new WebInspector.HeapSnapshotDominatorsDataGrid();this.dominatorDataGrid.element.addEventListener("mousedown",this._mouseDownInContentsGrid.bind(this),true);this.dominatorDataGrid.show(this.dominatorView.element);this.dominatorDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);if(WebInspector.HeapSnapshotView.enableAllocationProfiler){this.allocationView=new WebInspector.View();this.allocationView.element.classList.add("view");this.allocationDataGrid=new WebInspector.AllocationDataGrid();this.allocationDataGrid.element.addEventListener("mousedown",this._mouseDownInContentsGrid.bind(this),true);this.allocationDataGrid.show(this.allocationView.element);this.allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);}
-this.retainmentViewHeader=document.createElement("div");this.retainmentViewHeader.classList.add("retainers-view-header");WebInspector.installDragHandle(this.retainmentViewHeader,this._startRetainersHeaderDragging.bind(this),this._retainersHeaderDragging.bind(this),this._endRetainersHeaderDragging.bind(this),"ns-resize");var retainingPathsTitleDiv=document.createElement("div");retainingPathsTitleDiv.className="title";var retainingPathsTitle=document.createElement("span");retainingPathsTitle.textContent=WebInspector.UIString("Object's retaining tree");retainingPathsTitleDiv.appendChild(retainingPathsTitle);this.retainmentViewHeader.appendChild(retainingPathsTitleDiv);this.element.appendChild(this.retainmentViewHeader);this.retainmentView=new WebInspector.View();this.retainmentView.element.classList.add("view");this.retainmentView.element.classList.add("retaining-paths-view");this.retainmentDataGrid=new WebInspector.HeapSnapshotRetainmentDataGrid();this.retainmentDataGrid.show(this.retainmentView.element);this.retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._inspectedObjectChanged,this);this.retainmentView.show(this.element);this.retainmentDataGrid.reset();this.viewSelect=new WebInspector.StatusBarComboBox(this._onSelectedViewChanged.bind(this));this.views=[{title:WebInspector.UIString("Summary"),view:this.constructorsView,grid:this.constructorsDataGrid},{title:WebInspector.UIString("Comparison"),view:this.diffView,grid:this.diffDataGrid},{title:WebInspector.UIString("Containment"),view:this.containmentView,grid:this.containmentDataGrid}];if(WebInspector.settings.showAdvancedHeapSnapshotProperties.get())
-this.views.push({title:WebInspector.UIString("Dominators"),view:this.dominatorView,grid:this.dominatorDataGrid});if(WebInspector.HeapSnapshotView.enableAllocationProfiler)
-this.views.push({title:WebInspector.UIString("Allocation"),view:this.allocationView,grid:this.allocationDataGrid});this.views.current=0;for(var i=0;i<this.views.length;++i)
-this.viewSelect.createOption(WebInspector.UIString(this.views[i].title));this._profile=profile;this.baseSelect=new WebInspector.StatusBarComboBox(this._changeBase.bind(this));this.baseSelect.element.classList.add("hidden");this._updateBaseOptions();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();}
-WebInspector.HeapSnapshotView.enableAllocationProfiler=false;WebInspector.HeapSnapshotView.prototype={_refreshView:function()
-{this.profile.load(profileCallback.bind(this));function profileCallback(heapSnapshotProxy)
-{var list=this._profiles();var profileIndex=list.indexOf(this._profile);this.baseSelect.setSelectedIndex(Math.max(0,profileIndex-1));this.dataGrid.setDataSource(heapSnapshotProxy);}},_onIdsRangeChanged:function(event)
-{var minId=event.data.minId;var maxId=event.data.maxId;this.selectedSizeText.setText(WebInspector.UIString("Selected size: %s",Number.bytesToString(event.data.size)));if(this.constructorsDataGrid.snapshot)
-this.constructorsDataGrid.setSelectionRange(minId,maxId);},dispose:function()
-{this.profile.profileType().removeEventListener(WebInspector.ProfileType.Events.AddProfileHeader,this._onProfileHeaderAdded,this);this.profile.dispose();if(this.baseProfile)
-this.baseProfile.dispose();this.containmentDataGrid.dispose();this.constructorsDataGrid.dispose();this.diffDataGrid.dispose();this.dominatorDataGrid.dispose();this.retainmentDataGrid.dispose();},get statusBarItems()
-{return[this.viewSelect.element,this.baseSelect.element,this.filterSelect.element,this.selectedSizeText.element];},get profile()
-{return this._profile;},get baseProfile()
-{return this._profile.profileType().getProfile(this._baseProfileUid);},wasShown:function()
-{this.profile.load(profileCallback.bind(this));function profileCallback(){this.profile._wasShown();if(this.baseProfile)
-this.baseProfile.load(function(){});}},willHide:function()
+{var sortAscending=this._dataGrid.isSortOrderAscending();var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier();var sortFields={object:["id",sortAscending,"retainedSize",false],shallowSize:["selfSize",sortAscending,"id",true],retainedSize:["retainedSize",sortAscending,"id",true]}[sortColumnIdentifier];return WebInspector.HeapSnapshotGridNode.createComparator(sortFields);},__proto__:WebInspector.HeapSnapshotGenericObjectNode.prototype}
+WebInspector.AllocationGridNode=function(dataGrid,data)
+{WebInspector.DataGridNode.call(this,data,data.hasChildren);this._dataGrid=dataGrid;this._populated=false;}
+WebInspector.AllocationGridNode.prototype={populate:function()
+{if(this._populated)
+return;this._populated=true;this._dataGrid.snapshot.allocationNodeCallers(this.data.id,didReceiveCallers.bind(this));function didReceiveCallers(callers)
+{var callersChain=callers.nodesWithSingleCaller;var parentNode=this;for(var i=0;i<callersChain.length;i++){var child=new WebInspector.AllocationGridNode(this._dataGrid,callersChain[i]);parentNode.appendChild(child);parentNode=child;parentNode._populated=true;if(this.expanded)
+parentNode.expand();}
+var callersBranch=callers.branchingCallers;callersBranch.sort(this._dataGrid._createComparator());for(var i=0;i<callersBranch.length;i++)
+parentNode.appendChild(new WebInspector.AllocationGridNode(this._dataGrid,callersBranch[i]));}},expand:function()
+{WebInspector.DataGridNode.prototype.expand.call(this);if(this.children.length===1)
+this.children[0].expand();},createCell:function(columnIdentifier)
+{var cell=WebInspector.DataGridNode.prototype.createCell.call(this,columnIdentifier);if(columnIdentifier!=="name")
+return cell;var functionInfo=this.data;if(functionInfo.scriptName){var urlElement=this._dataGrid._linkifier.linkifyLocation(functionInfo.scriptName,functionInfo.line-1,functionInfo.column-1,"profile-node-file");urlElement.style.maxWidth="75%";cell.insertBefore(urlElement,cell.firstChild);}
+return cell;},allocationNodeId:function()
+{return this.data.id;},__proto__:WebInspector.DataGridNode.prototype};WebInspector.HeapSnapshotView=function(profile)
+{WebInspector.VBox.call(this);this.element.classList.add("heap-snapshot-view");profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType.SnapshotReceived,this._onReceiveSnapshot,this);profile.profileType().addEventListener(WebInspector.ProfileType.Events.RemoveProfileHeader,this._onProfileHeaderRemoved,this);if(profile._profileType.id===WebInspector.TrackingHeapSnapshotProfileType.TypeId){this._trackingOverviewGrid=new WebInspector.HeapTrackingOverviewGrid(profile);this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged,this._onIdsRangeChanged.bind(this));}
+this._splitView=new WebInspector.SplitView(false,true,"heapSnapshotSplitViewState",200,200);this._splitView.show(this.element);this._containmentView=new WebInspector.VBox();this._containmentView.setMinimumSize(50,25);this._containmentDataGrid=new WebInspector.HeapSnapshotContainmentDataGrid();this._containmentDataGrid.show(this._containmentView.element);this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);this._statisticsView=new WebInspector.HeapSnapshotStatisticsView();this._constructorsView=new WebInspector.VBox();this._constructorsView.setMinimumSize(50,25);this._constructorsDataGrid=new WebInspector.HeapSnapshotConstructorsDataGrid();this._constructorsDataGrid.show(this._constructorsView.element);this._constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);this._diffView=new WebInspector.VBox();this._diffView.setMinimumSize(50,25);this._diffDataGrid=new WebInspector.HeapSnapshotDiffDataGrid();this._diffDataGrid.show(this._diffView.element);this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);this._dominatorView=new WebInspector.VBox();this._dominatorView.setMinimumSize(50,25);this._dominatorDataGrid=new WebInspector.HeapSnapshotDominatorsDataGrid();this._dominatorDataGrid.show(this._dominatorView.element);this._dominatorDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._selectionChanged,this);if(WebInspector.experimentsSettings.allocationProfiler.isEnabled()&&profile.profileType()===WebInspector.ProfileTypeRegistry.instance.trackingHeapSnapshotProfileType){this._allocationView=new WebInspector.VBox();this._allocationView.setMinimumSize(50,25);this._allocationDataGrid=new WebInspector.AllocationDataGrid();this._allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._onSelectAllocationNode,this);this._allocationDataGrid.show(this._allocationView.element);}
+this._retainmentViewHeader=document.createElementWithClass("div","retainers-view-header");var retainingPathsTitleDiv=this._retainmentViewHeader.createChild("div","title");var retainingPathsTitle=retainingPathsTitleDiv.createChild("span");retainingPathsTitle.textContent=WebInspector.UIString("Object's retaining tree");this._splitView.hideDefaultResizer();this._splitView.installResizer(this._retainmentViewHeader);this._retainmentView=new WebInspector.VBox();this._retainmentView.setMinimumSize(50,21);this._retainmentView.element.classList.add("retaining-paths-view");this._retainmentView.element.appendChild(this._retainmentViewHeader);this._retainmentDataGrid=new WebInspector.HeapSnapshotRetainmentDataGrid();this._retainmentDataGrid.show(this._retainmentView.element);this._retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._inspectedObjectChanged,this);this._retainmentDataGrid.reset();this._perspectives=[];this._perspectives.push(new WebInspector.HeapSnapshotView.SummaryPerspective());if(profile.profileType()!==WebInspector.ProfileTypeRegistry.instance.trackingHeapSnapshotProfileType)
+this._perspectives.push(new WebInspector.HeapSnapshotView.ComparisonPerspective());this._perspectives.push(new WebInspector.HeapSnapshotView.ContainmentPerspective());if(WebInspector.settings.showAdvancedHeapSnapshotProperties.get())
+this._perspectives.push(new WebInspector.HeapSnapshotView.DominatorPerspective());if(this._allocationView)
+this._perspectives.push(new WebInspector.HeapSnapshotView.AllocationPerspective());if(WebInspector.experimentsSettings.heapSnapshotStatistics.isEnabled())
+this._perspectives.push(new WebInspector.HeapSnapshotView.StatisticsPerspective());this._perspectiveSelect=new WebInspector.StatusBarComboBox(this._onSelectedPerspectiveChanged.bind(this));for(var i=0;i<this._perspectives.length;++i)
+this._perspectiveSelect.createOption(this._perspectives[i].title());this._profile=profile;this._baseSelect=new WebInspector.StatusBarComboBox(this._changeBase.bind(this));this._baseSelect.visible=false;this._updateBaseOptions();this._filterSelect=new WebInspector.StatusBarComboBox(this._changeFilter.bind(this));this._filterSelect.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=new WebInspector.ObjectPopoverHelper(this.element,this._getHoverAnchor.bind(this),this._resolveObjectForPopover.bind(this),undefined,true);this._currentPerspectiveIndex=0;this._currentPerspective=this._perspectives[0];this._currentPerspective.activate(this);this._dataGrid=this._currentPerspective.masterGrid(this);this._dataGrid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ResetFilter,this._onResetClassNameFilter,this);this._refreshView();}
+WebInspector.HeapSnapshotView.Perspective=function(title)
+{this._title=title;}
+WebInspector.HeapSnapshotView.Perspective.prototype={activate:function(heapSnapshotView){},deactivate:function(heapSnapshotView)
+{heapSnapshotView._baseSelect.visible=false;heapSnapshotView._filterSelect.visible=false;heapSnapshotView._classNameFilter.visible=false;if(heapSnapshotView._trackingOverviewGrid)
+heapSnapshotView._trackingOverviewGrid.detach();if(heapSnapshotView._allocationView)
+heapSnapshotView._allocationView.detach();if(heapSnapshotView._statisticsView)
+heapSnapshotView._statisticsView.detach();heapSnapshotView._splitView.detach();heapSnapshotView._splitView.detachChildViews();},masterGrid:function(heapSnapshotView)
+{return null;},title:function()
+{return this._title;},supportsSearch:function()
+{return false;}}
+WebInspector.HeapSnapshotView.SummaryPerspective=function()
+{WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Summary"));}
+WebInspector.HeapSnapshotView.SummaryPerspective.prototype={activate:function(heapSnapshotView)
+{heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.mainElement());heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElement());heapSnapshotView._splitView.show(heapSnapshotView.element);heapSnapshotView._filterSelect.visible=true;heapSnapshotView._classNameFilter.visible=true;if(heapSnapshotView._trackingOverviewGrid){heapSnapshotView._trackingOverviewGrid.show(heapSnapshotView.element,heapSnapshotView._splitView.element);heapSnapshotView._trackingOverviewGrid.update();heapSnapshotView._trackingOverviewGrid._updateGrid();}},masterGrid:function(heapSnapshotView)
+{return heapSnapshotView._constructorsDataGrid;},supportsSearch:function()
+{return true;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
+WebInspector.HeapSnapshotView.ComparisonPerspective=function()
+{WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Comparison"));}
+WebInspector.HeapSnapshotView.ComparisonPerspective.prototype={activate:function(heapSnapshotView)
+{heapSnapshotView._diffView.show(heapSnapshotView._splitView.mainElement());heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElement());heapSnapshotView._splitView.show(heapSnapshotView.element);heapSnapshotView._baseSelect.visible=true;heapSnapshotView._classNameFilter.visible=true;},masterGrid:function(heapSnapshotView)
+{return heapSnapshotView._diffDataGrid;},supportsSearch:function()
+{return true;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
+WebInspector.HeapSnapshotView.ContainmentPerspective=function()
+{WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Containment"));}
+WebInspector.HeapSnapshotView.ContainmentPerspective.prototype={activate:function(heapSnapshotView)
+{heapSnapshotView._containmentView.show(heapSnapshotView._splitView.mainElement());heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElement());heapSnapshotView._splitView.show(heapSnapshotView.element);},masterGrid:function(heapSnapshotView)
+{return heapSnapshotView._containmentDataGrid;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
+WebInspector.HeapSnapshotView.DominatorPerspective=function()
+{WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Dominators"));}
+WebInspector.HeapSnapshotView.DominatorPerspective.prototype={activate:function(heapSnapshotView)
+{heapSnapshotView._dominatorView.show(heapSnapshotView._splitView.mainElement());heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElement());heapSnapshotView._splitView.show(heapSnapshotView.element);},masterGrid:function(heapSnapshotView)
+{return heapSnapshotView._dominatorDataGrid;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
+WebInspector.HeapSnapshotView.AllocationPerspective=function()
+{WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Allocation"));this._allocationSplitView=new WebInspector.SplitView(false,true,"heapSnapshotAllocationSplitViewState",200,200);}
+WebInspector.HeapSnapshotView.AllocationPerspective.prototype={activate:function(heapSnapshotView)
+{heapSnapshotView._allocationView.show(this._allocationSplitView.mainElement());heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.mainElement());heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sidebarElement());heapSnapshotView._splitView.show(this._allocationSplitView.sidebarElement());this._allocationSplitView.show(heapSnapshotView.element);heapSnapshotView._constructorsDataGrid.clear();var selectedNode=heapSnapshotView._allocationDataGrid.selectedNode;if(selectedNode)
+heapSnapshotView._constructorsDataGrid.setAllocationNodeId(selectedNode.allocationNodeId());},deactivate:function(heapSnapshotView)
+{this._allocationSplitView.detach();WebInspector.HeapSnapshotView.Perspective.prototype.deactivate.call(this,heapSnapshotView);},masterGrid:function(heapSnapshotView)
+{return heapSnapshotView._allocationDataGrid;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
+WebInspector.HeapSnapshotView.StatisticsPerspective=function()
+{WebInspector.HeapSnapshotView.Perspective.call(this,WebInspector.UIString("Statistics"));}
+WebInspector.HeapSnapshotView.StatisticsPerspective.prototype={activate:function(heapSnapshotView)
+{heapSnapshotView._statisticsView.show(heapSnapshotView.element);},masterGrid:function(heapSnapshotView)
+{return null;},__proto__:WebInspector.HeapSnapshotView.Perspective.prototype}
+WebInspector.HeapSnapshotView.prototype={_refreshView:function()
+{this._profile.load(profileCallback.bind(this));function profileCallback(heapSnapshotProxy)
+{heapSnapshotProxy.getStatistics(this._gotStatistics.bind(this));var list=this._profiles();var profileIndex=list.indexOf(this._profile);this._baseSelect.setSelectedIndex(Math.max(0,profileIndex-1));this._dataGrid.setDataSource(heapSnapshotProxy);if(this._trackingOverviewGrid)
+this._trackingOverviewGrid._updateGrid();}},_gotStatistics:function(statistics){this._statisticsView.setTotal(statistics.total);this._statisticsView.addRecord(statistics.code,WebInspector.UIString("Code"),"#f77");this._statisticsView.addRecord(statistics.strings,WebInspector.UIString("Strings"),"#5e5");this._statisticsView.addRecord(statistics.jsArrays,WebInspector.UIString("JS Arrays"),"#7af");this._statisticsView.addRecord(statistics.native,WebInspector.UIString("Typed Arrays"),"#fc5");this._statisticsView.addRecord(statistics.total,WebInspector.UIString("Total"));},_onIdsRangeChanged:function(event)
+{var minId=event.data.minId;var maxId=event.data.maxId;this._selectedSizeText.setText(WebInspector.UIString("Selected size: %s",Number.bytesToString(event.data.size)));if(this._constructorsDataGrid.snapshot)
+this._constructorsDataGrid.setSelectionRange(minId,maxId);},get statusBarItems()
+{var result=[this._perspectiveSelect.element,this._classNameFilter.element];if(this._profile.profileType()!==WebInspector.ProfileTypeRegistry.instance.trackingHeapSnapshotProfileType)
+result.push(this._baseSelect.element,this._filterSelect.element);result.push(this._selectedSizeText.element);return result;},wasShown:function()
+{this._profile.load(profileCallback.bind(this));function profileCallback(){this._profile._wasShown();if(this._baseProfile)
+this._baseProfile.load(function(){});}},willHide:function()
{this._currentSearchResultIndex=-1;this._popoverHelper.hidePopover();if(this.helpPopover&&this.helpPopover.isShowing())
-this.helpPopover.hide();},onResize:function()
-{var height=this.retainmentView.element.clientHeight;this._updateRetainmentViewHeight(height);},searchCanceled:function()
+this.helpPopover.hide();},searchCanceled:function()
{if(this._searchResults){for(var i=0;i<this._searchResults.length;++i){var node=this._searchResults[i].node;delete node._searchMatched;node.refresh();}}
delete this._searchFinishedCallback;this._currentSearchResultIndex=-1;this._searchResults=[];},performSearch:function(query,finishedCallback)
{this.searchCanceled();query=query.trim();if(!query)
-return;if(this.currentView!==this.constructorsView&&this.currentView!==this.diffView)
+return;if(!this._currentPerspective.supportsSearch())
return;function didHighlight(found)
{finishedCallback(this,found?1:0);}
if(query.charAt(0)==="@"){var snapshotNodeId=parseInt(query.substring(1),10);if(!isNaN(snapshotNodeId))
-this.dataGrid.highlightObjectByHeapSnapshotId(String(snapshotNodeId),didHighlight.bind(this));else
+this._dataGrid.highlightObjectByHeapSnapshotId(String(snapshotNodeId),didHighlight.bind(this));else
finishedCallback(this,0);return;}
this._searchFinishedCallback=finishedCallback;var nameRegExp=createPlainTextSearchRegex(query,"i");function matchesByName(gridNode){return("_name"in gridNode)&&nameRegExp.test(gridNode._name);}
function matchesQuery(gridNode)
{delete gridNode._searchMatched;if(matchesByName(gridNode)){gridNode._searchMatched=true;gridNode.refresh();return true;}
return false;}
-var current=this.dataGrid.rootNode().children[0];var depth=0;var info={};const maxDepth=1;while(current){if(matchesQuery(current))
+var current=this._dataGrid.rootNode().children[0];var depth=0;var info={};const maxDepth=1;while(current){if(matchesQuery(current))
this._searchResults.push({node:current});current=current.traverseNextNode(false,null,(depth>=maxDepth),info);depth+=info.depthChange;}
finishedCallback(this,this._searchResults.length);},jumpToFirstSearchResult:function()
{if(!this._searchResults||!this._searchResults.length)
@@ -993,68 +1126,68 @@
{return(this._searchResults&&this._currentSearchResultIndex===(this._searchResults.length-1));},currentSearchResultIndex:function(){return this._currentSearchResultIndex;},_jumpToSearchResult:function(index)
{var searchResult=this._searchResults[index];if(!searchResult)
return;var node=searchResult.node;node.revealAndSelect();},refreshVisibleData:function()
-{var child=this.dataGrid.rootNode().children[0];while(child){child.refresh();child=child.traverseNextNode(false,null,true);}},_changeBase:function()
-{if(this._baseProfileUid===this._profiles()[this.baseSelect.selectedIndex()].uid)
-return;this._baseProfileUid=this._profiles()[this.baseSelect.selectedIndex()].uid;var dataGrid=(this.dataGrid);if(dataGrid.snapshot)
-this.baseProfile.load(dataGrid.setBaseDataSource.bind(dataGrid));if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults)
+{if(!this._dataGrid)
+return;var child=this._dataGrid.rootNode().children[0];while(child){child.refresh();child=child.traverseNextNode(false,null,true);}},_changeBase:function()
+{if(this._baseProfile===this._profiles()[this._baseSelect.selectedIndex()])
+return;this._baseProfile=this._profiles()[this._baseSelect.selectedIndex()];var dataGrid=(this._dataGrid);if(dataGrid.snapshot)
+this._baseProfile.load(dataGrid.setBaseDataSource.bind(dataGrid));if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults)
return;this._searchFinishedCallback(this,-this._searchResults.length);this.performSearch(this.currentQuery,this._searchFinishedCallback);},_changeFilter:function()
-{var profileIndex=this.filterSelect.selectedIndex()-1;this.dataGrid.filterSelectIndexChanged(this._profiles(),profileIndex);WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.HeapSnapshotFilterChanged,label:this.filterSelect.selectedOption().label});if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults)
-return;this._searchFinishedCallback(this,-this._searchResults.length);this.performSearch(this.currentQuery,this._searchFinishedCallback);},_createToolbarWithClassNameFilter:function()
-{var toolbar=document.createElement("div");toolbar.classList.add("class-view-toolbar");var classNameFilter=document.createElement("input");classNameFilter.classList.add("class-name-filter");classNameFilter.setAttribute("placeholder",WebInspector.UIString("Class filter"));classNameFilter.addEventListener("keyup",this._changeNameFilter.bind(this,classNameFilter),false);toolbar.appendChild(classNameFilter);return toolbar;},_changeNameFilter:function(classNameInputElement)
-{var filter=classNameInputElement.value;this.dataGrid.changeNameFilter(filter);},_profiles:function()
+{var profileIndex=this._filterSelect.selectedIndex()-1;this._dataGrid.filterSelectIndexChanged(this._profiles(),profileIndex);WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.HeapSnapshotFilterChanged,label:this._filterSelect.selectedOption().label});if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults)
+return;this._searchFinishedCallback(this,-this._searchResults.length);this.performSearch(this.currentQuery,this._searchFinishedCallback);},_onClassFilterChanged:function(value)
+{this._dataGrid.changeNameFilter(value);},_onResetClassNameFilter:function()
+{this._classNameFilter.setValue("");},_profiles:function()
{return this._profile.profileType().getProfiles();},populateContextMenu:function(contextMenu,event)
-{this.dataGrid.populateContextMenu(this.parent,contextMenu,event);},_selectionChanged:function(event)
-{var selectedNode=event.target.selectedNode;this._setRetainmentDataGridSource(selectedNode);this._inspectedObjectChanged(event);},_inspectedObjectChanged:function(event)
-{var selectedNode=event.target.selectedNode;if(!this.profile.fromFile()&&selectedNode instanceof WebInspector.HeapSnapshotGenericObjectNode)
+{if(this._dataGrid)
+this._dataGrid.populateContextMenu(contextMenu,event);},_selectionChanged:function(event)
+{var selectedNode=event.target.selectedNode;this._setRetainmentDataGridSource(selectedNode);this._inspectedObjectChanged(event);},_onSelectAllocationNode:function(event)
+{var selectedNode=event.target.selectedNode;this._constructorsDataGrid.setAllocationNodeId(selectedNode.allocationNodeId());},_inspectedObjectChanged:function(event)
+{var selectedNode=event.target.selectedNode;if(!this._profile.fromFile()&&selectedNode instanceof WebInspector.HeapSnapshotGenericObjectNode)
ConsoleAgent.addInspectedHeapObject(selectedNode.snapshotNodeId);},_setRetainmentDataGridSource:function(nodeItem)
-{if(nodeItem&&nodeItem.snapshotNodeIndex)
-this.retainmentDataGrid.setDataSource(nodeItem.isDeletedNode?nodeItem.dataGrid.baseSnapshot:nodeItem.dataGrid.snapshot,nodeItem.snapshotNodeIndex);else
-this.retainmentDataGrid.reset();},_mouseDownInContentsGrid:function(event)
-{if(event.detail<2)
-return;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell||(!cell.classList.contains("count-column")&&!cell.classList.contains("shallowSize-column")&&!cell.classList.contains("retainedSize-column")))
-return;event.consume(true);},changeView:function(viewTitle,callback)
-{var viewIndex=null;for(var i=0;i<this.views.length;++i){if(this.views[i].title===viewTitle){viewIndex=i;break;}}
-if(this.views.current===viewIndex||viewIndex==null){setTimeout(callback,0);return;}
+{var dataSource=nodeItem&&nodeItem.retainersDataSource();if(dataSource)
+this._retainmentDataGrid.setDataSource(dataSource.snapshot,dataSource.snapshotNodeIndex);else
+this._retainmentDataGrid.reset();},_changePerspectiveAndWait:function(perspectiveTitle,callback)
+{var perspectiveIndex=null;for(var i=0;i<this._perspectives.length;++i){if(this._perspectives[i].title()===perspectiveTitle){perspectiveIndex=i;break;}}
+if(this._currentPerspectiveIndex===perspectiveIndex||perspectiveIndex===null){setTimeout(callback,0);return;}
function dataGridContentShown(event)
-{var dataGrid=event.data;dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown,dataGridContentShown,this);if(dataGrid===this.dataGrid)
+{var dataGrid=event.data;dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown,dataGridContentShown,this);if(dataGrid===this._dataGrid)
callback();}
-this.views[viewIndex].grid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown,dataGridContentShown,this);this.viewSelect.setSelectedIndex(viewIndex);this._changeView(viewIndex);},_updateDataSourceAndView:function()
-{var dataGrid=this.dataGrid;if(dataGrid.snapshot)
-return;this.profile.load(didLoadSnapshot.bind(this));function didLoadSnapshot(snapshotProxy)
-{if(this.dataGrid!==dataGrid)
+this._perspectives[perspectiveIndex].masterGrid(this).addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown,dataGridContentShown,this);this._perspectiveSelect.setSelectedIndex(perspectiveIndex);this._changePerspective(perspectiveIndex);},_updateDataSourceAndView:function()
+{var dataGrid=this._dataGrid;if(!dataGrid||dataGrid.snapshot)
+return;this._profile.load(didLoadSnapshot.bind(this));function didLoadSnapshot(snapshotProxy)
+{if(this._dataGrid!==dataGrid)
return;if(dataGrid.snapshot!==snapshotProxy)
-dataGrid.setDataSource(snapshotProxy);if(dataGrid===this.diffDataGrid){if(!this._baseProfileUid)
-this._baseProfileUid=this._profiles()[this.baseSelect.selectedIndex()].uid;this.baseProfile.load(didLoadBaseSnaphot.bind(this));}}
+dataGrid.setDataSource(snapshotProxy);if(dataGrid===this._diffDataGrid){if(!this._baseProfile)
+this._baseProfile=this._profiles()[this._baseSelect.selectedIndex()];this._baseProfile.load(didLoadBaseSnaphot.bind(this));}}
function didLoadBaseSnaphot(baseSnapshotProxy)
-{if(this.diffDataGrid.baseSnapshot!==baseSnapshotProxy)
-this.diffDataGrid.setBaseDataSource(baseSnapshotProxy);}},_onSelectedViewChanged:function(event)
-{this._changeView(event.target.selectedIndex);},_updateSelectorsVisibility:function()
-{if(this.currentView===this.diffView)
-this.baseSelect.element.classList.remove("hidden");else
-this.baseSelect.element.classList.add("hidden");if(this.currentView===this.constructorsView){if(this._trackingOverviewGrid){this._trackingOverviewGrid.element.classList.remove("hidden");this._trackingOverviewGrid.update();this.viewsContainer.classList.add("reserve-80px-at-top");}
-this.filterSelect.element.classList.remove("hidden");}else{this.filterSelect.element.classList.add("hidden");if(this._trackingOverviewGrid){this._trackingOverviewGrid.element.classList.add("hidden");this.viewsContainer.classList.remove("reserve-80px-at-top");}}},_changeView:function(selectedIndex)
-{if(selectedIndex===this.views.current)
-return;this.views.current=selectedIndex;this.currentView.detach();var view=this.views[this.views.current];this.currentView=view.view;this.dataGrid=view.grid;this.currentView.show(this.viewsContainer);this.refreshVisibleData();this.dataGrid.updateWidths();this._updateSelectorsVisibility();this._updateDataSourceAndView();if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults)
-return;this._searchFinishedCallback(this,-this._searchResults.length);this.performSearch(this.currentQuery,this._searchFinishedCallback);},_getHoverAnchor:function(target)
+{if(this._diffDataGrid.baseSnapshot!==baseSnapshotProxy)
+this._diffDataGrid.setBaseDataSource(baseSnapshotProxy);}},_onSelectedPerspectiveChanged:function(event)
+{this._changePerspective(event.target.selectedIndex);this._onSelectedViewChanged(event);},_onSelectedViewChanged:function(event)
+{},_changePerspective:function(selectedIndex)
+{if(selectedIndex===this._currentPerspectiveIndex)
+return;if(this._dataGrid)
+this._dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ResetFilter,this._onResetClassNameFilter,this);this._currentPerspectiveIndex=selectedIndex;this._currentPerspective.deactivate(this);var perspective=this._perspectives[selectedIndex];this._currentPerspective=perspective;this._dataGrid=perspective.masterGrid(this);perspective.activate(this);this.refreshVisibleData();if(this._dataGrid){this._dataGrid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ResetFilter,this._onResetClassNameFilter,this);this._dataGrid.updateWidths();}
+this._updateDataSourceAndView();if(!this.currentQuery||!this._searchFinishedCallback||!this._searchResults)
+return;this._searchFinishedCallback(this,-this._searchResults.length);this.performSearch(this.currentQuery,this._searchFinishedCallback);},highlightLiveObject:function(perspectiveName,snapshotObjectId)
+{this._changePerspectiveAndWait(perspectiveName,didChangePerspective.bind(this));function didChangePerspective()
+{this._dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId,didHighlightObject);}
+function didHighlightObject(found)
+{if(!found)
+WebInspector.console.log("Cannot find corresponding heap snapshot node",WebInspector.ConsoleMessage.MessageLevel.Error,true);}},_getHoverAnchor:function(target)
{var span=target.enclosingNodeOrSelfWithNodeName("span");if(!span)
return;var row=target.enclosingNodeOrSelfWithNodeName("tr");if(!row)
return;span.node=row._dataGridNode;return span;},_resolveObjectForPopover:function(element,showCallback,objectGroupName)
-{if(this.profile.fromFile())
-return;element.node.queryObjectContent(showCallback,objectGroupName);},_startRetainersHeaderDragging:function(event)
-{if(!this.isShowing())
-return false;this._previousDragPosition=event.pageY;return true;},_retainersHeaderDragging:function(event)
-{var height=this.retainmentView.element.clientHeight;height+=this._previousDragPosition-event.pageY;this._previousDragPosition=event.pageY;this._updateRetainmentViewHeight(height);event.consume(true);},_endRetainersHeaderDragging:function(event)
-{delete this._previousDragPosition;event.consume();},_updateRetainmentViewHeight:function(height)
-{height=Number.constrain(height,Preferences.minConsoleHeight,this.element.clientHeight-Preferences.minConsoleHeight);this.viewsContainer.style.bottom=(height+this.retainmentViewHeader.clientHeight)+"px";if(this._trackingOverviewGrid&&this.currentView===this.constructorsView)
-this.viewsContainer.classList.add("reserve-80px-at-top");this.retainmentView.element.style.height=height+"px";this.retainmentViewHeader.style.bottom=height+"px";this.currentView.doResize();},_updateBaseOptions:function()
-{var list=this._profiles();if(this.baseSelect.size()===list.length)
-return;for(var i=this.baseSelect.size(),n=list.length;i<n;++i){var title=list[i].title;this.baseSelect.createOption(title);}},_updateFilterOptions:function()
-{var list=this._profiles();if(this.filterSelect.size()-1===list.length)
-return;if(!this.filterSelect.size())
-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)
+{if(this._profile.fromFile())
+return;element.node.queryObjectContent(showCallback,objectGroupName);},_updateBaseOptions:function()
+{var list=this._profiles();if(this._baseSelect.size()===list.length)
+return;for(var i=this._baseSelect.size(),n=list.length;i<n;++i){var title=list[i].title;this._baseSelect.createOption(title);}},_updateFilterOptions:function()
+{var list=this._profiles();if(this._filterSelect.size()-1===list.length)
+return;if(!this._filterSelect.size())
+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)
title=WebInspector.UIString("Objects allocated before %s",title);else
-title=WebInspector.UIString("Objects allocated between %s and %s",list[i-1].title,title);this.filterSelect.createOption(title);}},_onProfileHeaderAdded:function(event)
-{this._updateBaseOptions();this._updateFilterOptions();},__proto__:WebInspector.View.prototype}
+title=WebInspector.UIString("Objects allocated between %s and %s",list[i-1].title,title);this._filterSelect.createOption(title);}},_updateControls:function()
+{this._updateBaseOptions();this._updateFilterOptions();},_onReceiveSnapshot:function(event)
+{this._updateControls();},_onProfileHeaderRemoved:function(event)
+{var profile=event.data;if(this._profile===profile){this.detach();this._profile.profileType().removeEventListener(WebInspector.HeapSnapshotProfileType.SnapshotReceived,this._onReceiveSnapshot,this);this._profile.profileType().removeEventListener(WebInspector.ProfileType.Events.RemoveProfileHeader,this._onProfileHeaderRemoved,this);}else{this._updateControls();}},__proto__:WebInspector.VBox.prototype}
WebInspector.HeapProfilerDispatcher=function()
{this._dispatchers=[];InspectorBackend.registerHeapProfilerDispatcher(this);}
WebInspector.HeapProfilerDispatcher.prototype={register:function(dispatcher)
@@ -1062,13 +1195,12 @@
{var args=Array.prototype.slice.call(arguments.callee.caller.arguments);for(var i=0;i<this._dispatchers.length;++i)
this._dispatchers[i][eventName].apply(this._dispatchers[i],args);},heapStatsUpdate:function(samples)
{this._genericCaller("heapStatsUpdate");},lastSeenObjectId:function(lastSeenObjectId,timestamp)
-{this._genericCaller("lastSeenObjectId");},addProfileHeader:function(profileHeader)
-{this._genericCaller("addProfileHeader");},addHeapSnapshotChunk:function(uid,chunk)
-{this._genericCaller("addHeapSnapshotChunk");},reportHeapSnapshotProgress:function(done,total)
+{this._genericCaller("lastSeenObjectId");},addHeapSnapshotChunk:function(chunk)
+{this._genericCaller("addHeapSnapshotChunk");},reportHeapSnapshotProgress:function(done,total,finished)
{this._genericCaller("reportHeapSnapshotProgress");},resetProfiles:function()
{this._genericCaller("resetProfiles");}}
-WebInspector.HeapProfilerDispatcher._dispatcher=new WebInspector.HeapProfilerDispatcher();WebInspector.HeapSnapshotProfileType=function()
-{WebInspector.ProfileType.call(this,WebInspector.HeapSnapshotProfileType.TypeId,WebInspector.UIString("Take Heap Snapshot"));WebInspector.HeapProfilerDispatcher._dispatcher.register(this);}
+WebInspector.HeapProfilerDispatcher._dispatcher=new WebInspector.HeapProfilerDispatcher();WebInspector.HeapSnapshotProfileType=function(id,title)
+{WebInspector.ProfileType.call(this,id||WebInspector.HeapSnapshotProfileType.TypeId,title||WebInspector.UIString("Take Heap Snapshot"));WebInspector.HeapProfilerDispatcher._dispatcher.register(this);}
WebInspector.HeapSnapshotProfileType.TypeId="HEAP";WebInspector.HeapSnapshotProfileType.SnapshotReceived="SnapshotReceived";WebInspector.HeapSnapshotProfileType.prototype={fileExtension:function()
{return".heapsnapshot";},get buttonTooltip()
{return WebInspector.UIString("Take heap snapshot.");},isInstantProfile:function()
@@ -1080,120 +1212,103 @@
{return WebInspector.UIString("Heap snapshot profiles show memory distribution among your page's JavaScript objects and related DOM nodes.");},createProfileLoadedFromFile:function(title)
{return new WebInspector.HeapProfileHeader(this,title);},_takeHeapSnapshot:function(callback)
{if(this.profileBeingRecorded())
-return;this._profileBeingRecorded=new WebInspector.HeapProfileHeader(this,WebInspector.UIString("Snapshotting\u2026"));this.addProfile(this._profileBeingRecorded);HeapProfilerAgent.takeHeapSnapshot(true,callback);},addProfileHeader:function(profileHeader)
+return;this._profileBeingRecorded=new WebInspector.HeapProfileHeader(this);this.addProfile(this._profileBeingRecorded);this._profileBeingRecorded.updateStatus(WebInspector.UIString("Snapshotting\u2026"));function didTakeHeapSnapshot(error)
+{var profile=this._profileBeingRecorded;profile.title=WebInspector.UIString("Snapshot %d",profile.uid);profile._finishLoad();this._profileBeingRecorded=null;WebInspector.panels.profiles.showProfile(profile);callback();}
+HeapProfilerAgent.takeHeapSnapshot(true,didTakeHeapSnapshot.bind(this));},addHeapSnapshotChunk:function(chunk)
+{if(!this.profileBeingRecorded())
+return;this.profileBeingRecorded().transferChunk(chunk);},reportHeapSnapshotProgress:function(done,total,finished)
{var profile=this.profileBeingRecorded();if(!profile)
-return;profile.title=profileHeader.title;profile.uid=profileHeader.uid;profile.maxJSObjectId=profileHeader.maxJSObjectId||0;profile.sidebarElement.mainTitle=profile.title;profile.sidebarElement.subtitle="";profile.sidebarElement.wait=false;this._profileSamples=null;this._profileBeingRecorded=null;WebInspector.panels.profiles._showProfile(profile);profile.existingView()._refreshView();},addHeapSnapshotChunk:function(uid,chunk)
-{var profile=this.getProfile(uid);if(profile)
-profile.transferChunk(chunk);},reportHeapSnapshotProgress:function(done,total)
-{var profile=this.profileBeingRecorded();if(!profile)
-return;profile.sidebarElement.subtitle=WebInspector.UIString("%.0f%",(done/total)*100);profile.sidebarElement.wait=true;},resetProfiles:function()
-{this._reset();},removeProfile:function(profile)
-{if(this._profileBeingRecorded!==profile&&!profile.fromFile())
-HeapProfilerAgent.removeProfile(profile.uid);WebInspector.ProfileType.prototype.removeProfile.call(this,profile);},_snapshotReceived:function(profile)
+return;profile.updateStatus(WebInspector.UIString("%.0f%",(done/total)*100),true);if(finished)
+profile._prepareToLoad();},resetProfiles:function()
+{this._reset();},_snapshotReceived:function(profile)
{if(this._profileBeingRecorded===profile)
this._profileBeingRecorded=null;this.dispatchEventToListeners(WebInspector.HeapSnapshotProfileType.SnapshotReceived,profile);},__proto__:WebInspector.ProfileType.prototype}
-WebInspector.TrackingHeapSnapshotProfileType=function(profilesPanel)
-{WebInspector.ProfileType.call(this,WebInspector.TrackingHeapSnapshotProfileType.TypeId,WebInspector.UIString("Record Heap Allocations"));this._profilesPanel=profilesPanel;WebInspector.HeapProfilerDispatcher._dispatcher.register(this);}
+WebInspector.TrackingHeapSnapshotProfileType=function()
+{WebInspector.HeapSnapshotProfileType.call(this,WebInspector.TrackingHeapSnapshotProfileType.TypeId,WebInspector.UIString("Record Heap Allocations"));}
WebInspector.TrackingHeapSnapshotProfileType.TypeId="HEAP-RECORD";WebInspector.TrackingHeapSnapshotProfileType.HeapStatsUpdate="HeapStatsUpdate";WebInspector.TrackingHeapSnapshotProfileType.TrackingStarted="TrackingStarted";WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped="TrackingStopped";WebInspector.TrackingHeapSnapshotProfileType.prototype={heapStatsUpdate:function(samples)
{if(!this._profileSamples)
-return;var index;for(var i=0;i<samples.length;i+=3){index=samples[i];var count=samples[i+1];var size=samples[i+2];this._profileSamples.sizes[index]=size;if(!this._profileSamples.max[index]||size>this._profileSamples.max[index])
-this._profileSamples.max[index]=size;}
-this._lastUpdatedIndex=index;},lastSeenObjectId:function(lastSeenObjectId,timestamp)
+return;var index;for(var i=0;i<samples.length;i+=3){index=samples[i];var count=samples[i+1];var size=samples[i+2];this._profileSamples.sizes[index]=size;if(!this._profileSamples.max[index])
+this._profileSamples.max[index]=size;}},lastSeenObjectId:function(lastSeenObjectId,timestamp)
{var profileSamples=this._profileSamples;if(!profileSamples)
return;var currentIndex=Math.max(profileSamples.ids.length,profileSamples.max.length-1);profileSamples.ids[currentIndex]=lastSeenObjectId;if(!profileSamples.max[currentIndex]){profileSamples.max[currentIndex]=0;profileSamples.sizes[currentIndex]=0;}
profileSamples.timestamps[currentIndex]=timestamp;if(profileSamples.totalTime<timestamp-profileSamples.timestamps[0])
-profileSamples.totalTime*=2;this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.HeapStatsUpdate,this._profileSamples);var profile=this._profileBeingRecorded;profile.sidebarElement.wait=true;if(profile.sidebarElement&&!profile.sidebarElement.wait)
-profile.sidebarElement.wait=true;},hasTemporaryView:function()
+profileSamples.totalTime*=2;this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.HeapStatsUpdate,this._profileSamples);this._profileBeingRecorded.updateStatus(null,true);},hasTemporaryView:function()
{return true;},get buttonTooltip()
{return this._recording?WebInspector.UIString("Stop recording heap profile."):WebInspector.UIString("Start recording heap profile.");},isInstantProfile:function()
{return false;},buttonClicked:function()
{return this._toggleRecording();},_startRecordingProfile:function()
{if(this.profileBeingRecorded())
-return;this._profileBeingRecorded=new WebInspector.HeapProfileHeader(this,WebInspector.UIString("Recording\u2026"));this._lastSeenIndex=-1;this._profileSamples={'sizes':[],'ids':[],'timestamps':[],'max':[],'totalTime':30000};this._profileBeingRecorded._profileSamples=this._profileSamples;this._recording=true;this.addProfile(this._profileBeingRecorded);HeapProfilerAgent.startTrackingHeapObjects();this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.TrackingStarted);},_stopRecordingProfile:function()
-{HeapProfilerAgent.stopTrackingHeapObjects(true);this._recording=false;this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped);},_toggleRecording:function()
+return;this._addNewProfile();HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsSettings.allocationProfiler.isEnabled());},_addNewProfile:function()
+{this._profileBeingRecorded=new WebInspector.HeapProfileHeader(this);this._lastSeenIndex=-1;this._profileSamples={'sizes':[],'ids':[],'timestamps':[],'max':[],'totalTime':30000};this._profileBeingRecorded._profileSamples=this._profileSamples;this._recording=true;this.addProfile(this._profileBeingRecorded);this._profileBeingRecorded.updateStatus(WebInspector.UIString("Recording\u2026"));this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.TrackingStarted);},_stopRecordingProfile:function()
+{this._profileBeingRecorded.updateStatus(WebInspector.UIString("Snapshotting\u2026"));function didTakeHeapSnapshot(error)
+{var profile=this._profileBeingRecorded;if(!profile)
+return;profile._finishLoad();this._profileSamples=null;this._profileBeingRecorded=null;WebInspector.panels.profiles.showProfile(profile);}
+HeapProfilerAgent.stopTrackingHeapObjects(true,didTakeHeapSnapshot.bind(this));this._recording=false;this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped);},_toggleRecording:function()
{if(this._recording)
this._stopRecordingProfile();else
this._startRecordingProfile();return this._recording;},get treeItemTitle()
{return WebInspector.UIString("HEAP TIMELINES");},get description()
-{return WebInspector.UIString("Record JavaScript object allocations over time. Use this profile type to isolate memory leaks.");},_reset:function()
-{WebInspector.HeapSnapshotProfileType.prototype._reset.call(this);if(this._recording)
-this._stopRecordingProfile();this._profileSamples=null;this._lastSeenIndex=-1;},removeProfile:function(profile)
-{if(this._profileBeingRecorded===profile){this._stopRecordingProfile();this._profileSamples=null;}
-WebInspector.HeapSnapshotProfileType.prototype.removeProfile.call(this,profile);},__proto__:WebInspector.HeapSnapshotProfileType.prototype}
-WebInspector.HeapProfileHeader=function(type,title,uid,maxJSObjectId)
-{WebInspector.ProfileHeader.call(this,type,title,uid);this.maxJSObjectId=maxJSObjectId;this._receiver=null;this._snapshotProxy=null;this._totalNumberOfChunks=0;this._transferHandler=null;this._bufferedWriter=null;}
+{return WebInspector.UIString("Record JavaScript object allocations over time. Use this profile type to isolate memory leaks.");},resetProfiles:function()
+{var wasRecording=this._recording;this._profileBeingRecorded=null;WebInspector.HeapSnapshotProfileType.prototype.resetProfiles.call(this);this._profileSamples=null;this._lastSeenIndex=-1;if(wasRecording)
+this._addNewProfile();},profileBeingRecordedRemoved:function()
+{this._stopRecordingProfile();this._profileSamples=null;},__proto__:WebInspector.HeapSnapshotProfileType.prototype}
+WebInspector.HeapProfileHeader=function(type,title)
+{WebInspector.ProfileHeader.call(this,type,title||WebInspector.UIString("Snapshot %d",type._nextProfileUid));this.maxJSObjectId=-1;this._workerProxy=null;this._receiver=null;this._snapshotProxy=null;this._loadCallbacks=[];this._totalNumberOfChunks=0;this._bufferedWriter=null;}
WebInspector.HeapProfileHeader.prototype={createSidebarTreeElement:function()
-{return new WebInspector.ProfileSidebarTreeElement(this,"heap-snapshot-sidebar-tree-item");},createView:function(profilesPanel)
-{return new WebInspector.HeapSnapshotView(profilesPanel,this);},load:function(callback)
+{return new WebInspector.ProfileSidebarTreeElement(this,"heap-snapshot-sidebar-tree-item");},createView:function()
+{return new WebInspector.HeapSnapshotView(this);},load:function(callback)
{if(this.uid===-1)
return;if(this._snapshotProxy){callback(this._snapshotProxy);return;}
-this._numberOfChunks=0;if(!this._receiver){this._setupWorker();this._transferHandler=new WebInspector.BackendSnapshotLoader(this);this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026");this.sidebarElement.wait=true;this._transferSnapshot();}
-var loaderProxy=(this._receiver);console.assert(loaderProxy);loaderProxy.addConsumer(callback);},_transferSnapshot:function()
-{function finishTransfer()
-{if(this._transferHandler){this._transferHandler.finishTransfer();this._totalNumberOfChunks=this._transferHandler._totalNumberOfChunks;}
-if(this._bufferedWriter){this._bufferedWriter.close(this._didWriteToTempFile.bind(this));this._bufferedWriter=null;}}
-HeapProfilerAgent.getHeapSnapshot(this.uid,finishTransfer.bind(this));},_didWriteToTempFile:function(tempFile)
-{this._tempFile=tempFile;if(!tempFile)
-this._failedToCreateTempFile=true;if(this._onTempFileReady){this._onTempFileReady();this._onTempFileReady=null;}},snapshotConstructorName:function()
-{return"JSHeapSnapshot";},snapshotProxyConstructor:function()
-{return WebInspector.HeapSnapshotProxy;},_setupWorker:function()
+this._loadCallbacks.push(callback);},_prepareToLoad:function()
+{console.assert(!this._receiver,"Already loading");this._setupWorker();this.updateStatus(WebInspector.UIString("Loading\u2026"),true);},_finishLoad:function()
+{if(!this._wasDisposed)
+this._receiver.close(function(){});if(this._bufferedWriter){this._bufferedWriter.close(this._didWriteToTempFile.bind(this));this._bufferedWriter=null;}},_didWriteToTempFile:function(tempFile)
+{if(this._wasDisposed){if(tempFile)
+tempFile.remove();return;}
+this._tempFile=tempFile;if(!tempFile)
+this._failedToCreateTempFile=true;if(this._onTempFileReady){this._onTempFileReady();this._onTempFileReady=null;}},_setupWorker:function()
{function setProfileWait(event)
-{this.sidebarElement.wait=event.data;}
-var worker=new WebInspector.HeapSnapshotWorkerProxy(this._handleWorkerEvent.bind(this));worker.addEventListener("wait",setProfileWait,this);var loaderProxy=worker.createLoader(this.snapshotConstructorName(),this.snapshotProxyConstructor());loaderProxy.addConsumer(this._snapshotReceived.bind(this));this._receiver=loaderProxy;},_handleWorkerEvent:function(eventName,data)
+{this.updateStatus(null,event.data);}
+console.assert(!this._workerProxy,"HeapSnapshotWorkerProxy already exists");this._workerProxy=new WebInspector.HeapSnapshotWorkerProxy(this._handleWorkerEvent.bind(this));this._workerProxy.addEventListener("wait",setProfileWait,this);this._receiver=this._workerProxy.createLoader(this.uid,this._snapshotReceived.bind(this));},_handleWorkerEvent:function(eventName,data)
{if(WebInspector.HeapSnapshotProgressEvent.Update!==eventName)
-return;this._updateSubtitle(data);},dispose:function()
-{if(this._receiver)
-this._receiver.close();else if(this._snapshotProxy)
-this._snapshotProxy.dispose();if(this._view){var view=this._view;this._view=null;view.dispose();}
-this.removeTempFile();},_updateSubtitle:function(value)
-{this.sidebarElement.subtitle=value;},_didCompleteSnapshotTransfer:function()
+return;var subtitle=(data);this.updateStatus(subtitle);},dispose:function()
+{if(this._workerProxy)
+this._workerProxy.dispose();this.removeTempFile();this._wasDisposed=true;},_didCompleteSnapshotTransfer:function()
{if(!this._snapshotProxy)
-return;this.sidebarElement.subtitle=Number.bytesToString(this._snapshotProxy.totalSize);this.sidebarElement.wait=false;},transferChunk:function(chunk)
+return;this.updateStatus(Number.bytesToString(this._snapshotProxy.totalSize),false);},transferChunk:function(chunk)
{if(!this._bufferedWriter)
-this._bufferedWriter=new WebInspector.BufferedTempFileWriter("heap-profiler",this.uid);this._bufferedWriter.write(chunk);this._transferHandler.transferChunk(chunk);},_snapshotReceived:function(snapshotProxy)
-{this._receiver=null;if(snapshotProxy)
-this._snapshotProxy=snapshotProxy;this._didCompleteSnapshotTransfer();var worker=(this._snapshotProxy.worker);worker.startCheckingForLongRunningCalls();this.notifySnapshotReceived();function didGetMaxNodeId(id)
-{this.maxJSObjectId=id;}
-if(this.fromFile())
-snapshotProxy.maxJsNodeId(didGetMaxNodeId.bind(this));},notifySnapshotReceived:function()
-{this._profileType._snapshotReceived(this);},_wasShown:function()
+this._bufferedWriter=new WebInspector.BufferedTempFileWriter("heap-profiler",this.uid);this._bufferedWriter.write(chunk);++this._totalNumberOfChunks;this._receiver.write(chunk,function(){});},_snapshotReceived:function(snapshotProxy)
+{if(this._wasDisposed)
+return;this._receiver=null;this._snapshotProxy=snapshotProxy;this.maxJSObjectId=snapshotProxy.maxJSObjectId();this._didCompleteSnapshotTransfer();this._workerProxy.startCheckingForLongRunningCalls();this.notifySnapshotReceived();},notifySnapshotReceived:function()
+{for(var i=0;i<this._loadCallbacks.length;i++)
+this._loadCallbacks[i](this._snapshotProxy);this._loadCallbacks=null;this._profileType._snapshotReceived(this);if(this.canSaveToFile())
+this.dispatchEventToListeners(WebInspector.ProfileHeader.Events.ProfileReceived);},_wasShown:function()
{},canSaveToFile:function()
-{return!this.fromFile()&&!this._bufferedWriter&&!this._failedToCreateTempFile;},saveToFile:function()
+{return!this.fromFile()&&this._snapshotProxy;},saveToFile:function()
{var fileOutputStream=new WebInspector.FileOutputStream();function onOpen(accepted)
{if(!accepted)
-return;if(this._failedToCreateTempFile){WebInspector.log("Failed to open temp file with heap snapshot",WebInspector.ConsoleMessage.MessageLevel.Error);fileOutputStream.close();}else if(this._tempFile){var delegate=new WebInspector.SaveSnapshotOutputStreamDelegate(this);this._tempFile.writeToOutputSteam(fileOutputStream,delegate);}else{this._onTempFileReady=onOpen.bind(this,accepted);this._updateSaveProgress(0,1);}}
+return;if(this._failedToCreateTempFile){WebInspector.console.log("Failed to open temp file with heap snapshot",WebInspector.ConsoleMessage.MessageLevel.Error);fileOutputStream.close();}else if(this._tempFile){var delegate=new WebInspector.SaveSnapshotOutputStreamDelegate(this);this._tempFile.writeToOutputSteam(fileOutputStream,delegate);}else{this._onTempFileReady=onOpen.bind(this,accepted);this._updateSaveProgress(0,1);}}
this._fileName=this._fileName||"Heap-"+new Date().toISO8601Compact()+this._profileType.fileExtension();fileOutputStream.open(this._fileName,onOpen.bind(this));},_updateSaveProgress:function(value,total)
-{var percentValue=((total?(value/total):0)*100).toFixed(0);this._updateSubtitle(WebInspector.UIString("Saving\u2026 %d\%",percentValue));},loadFromFile:function(file)
-{this.sidebarElement.subtitle=WebInspector.UIString("Loading\u2026");this.sidebarElement.wait=true;this._setupWorker();var delegate=new WebInspector.HeapSnapshotLoadFromFileDelegate(this);var fileReader=this._createFileReader(file,delegate);fileReader.start(this._receiver);},_createFileReader:function(file,delegate)
+{var percentValue=((total?(value/total):0)*100).toFixed(0);this.updateStatus(WebInspector.UIString("Saving\u2026 %d\%",percentValue));},loadFromFile:function(file)
+{this.updateStatus(WebInspector.UIString("Loading\u2026"),true);this._setupWorker();var delegate=new WebInspector.HeapSnapshotLoadFromFileDelegate(this);var fileReader=this._createFileReader(file,delegate);fileReader.start(this._receiver);},_createFileReader:function(file,delegate)
{return new WebInspector.ChunkedFileReader(file,10000000,delegate);},__proto__:WebInspector.ProfileHeader.prototype}
-WebInspector.SnapshotTransferHandler=function(header,title)
-{this._numberOfChunks=0;this._savedChunks=0;this._header=header;this._totalNumberOfChunks=0;this._title=title;}
-WebInspector.SnapshotTransferHandler.prototype={transferChunk:function(chunk)
-{++this._numberOfChunks;this._header._receiver.write(chunk,this._didTransferChunk.bind(this));},finishTransfer:function()
-{},_didTransferChunk:function()
-{this._updateProgress(++this._savedChunks,this._totalNumberOfChunks);},_updateProgress:function(value,total)
-{}}
-WebInspector.BackendSnapshotLoader=function(header)
-{WebInspector.SnapshotTransferHandler.call(this,header,"Loading\u2026 %d\%");}
-WebInspector.BackendSnapshotLoader.prototype={finishTransfer:function()
-{this._header._receiver.close(this._didFinishTransfer.bind(this));this._header._receiver=null;this._totalNumberOfChunks=this._numberOfChunks;},_didFinishTransfer:function()
-{console.assert(this._totalNumberOfChunks===this._savedChunks,"Not all chunks were transfered.");},__proto__:WebInspector.SnapshotTransferHandler.prototype}
WebInspector.HeapSnapshotLoadFromFileDelegate=function(snapshotHeader)
{this._snapshotHeader=snapshotHeader;}
WebInspector.HeapSnapshotLoadFromFileDelegate.prototype={onTransferStarted:function()
{},onChunkTransferred:function(reader)
{},onTransferFinished:function()
{},onError:function(reader,e)
-{switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:this._snapshotHeader._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.target.error.ABORT_ERR:break;default:this._snapshotHeader._updateSubtitle(WebInspector.UIString("'%s' error %d",reader.fileName(),e.target.error.code));}}}
+{var subtitle;switch(e.target.error.code){case e.target.error.NOT_FOUND_ERR:subtitle=WebInspector.UIString("'%s' not found.",reader.fileName());break;case e.target.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);}
+this._snapshotHeader.updateStatus(subtitle);}}
WebInspector.SaveSnapshotOutputStreamDelegate=function(profileHeader)
{this._profileHeader=profileHeader;}
WebInspector.SaveSnapshotOutputStreamDelegate.prototype={onTransferStarted:function()
{this._profileHeader._updateSaveProgress(0,1);},onTransferFinished:function()
{this._profileHeader._didCompleteSnapshotTransfer();},onChunkTransferred:function(reader)
{this._profileHeader._updateSaveProgress(reader.loadedSize(),reader.fileSize());},onError:function(reader,event)
-{WebInspector.log("Failed to read heap snapshot from temp file: "+event.message,WebInspector.ConsoleMessage.MessageLevel.Error);this.onTransferFinished();}}
+{WebInspector.console.log("Failed to read heap snapshot from temp file: "+event.message,WebInspector.ConsoleMessage.MessageLevel.Error);this.onTransferFinished();}}
WebInspector.HeapTrackingOverviewGrid=function(heapProfileHeader)
-{WebInspector.View.call(this);this.registerRequiredCSS("flameChart.css");this.element.id="heap-recording-view";this._overviewContainer=this.element.createChild("div","overview-container");this._overviewGrid=new WebInspector.OverviewGrid("heap-recording");this._overviewGrid.element.classList.add("fill");this._overviewCanvas=this._overviewContainer.createChild("canvas","heap-recording-overview-canvas");this._overviewContainer.appendChild(this._overviewGrid.element);this._overviewCalculator=new WebInspector.HeapTrackingOverviewGrid.OverviewCalculator();this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,this._onWindowChanged,this);this._profileSamples=heapProfileHeader._profileSamples;if(heapProfileHeader.profileType().profileBeingRecorded()===heapProfileHeader){this._profileType=heapProfileHeader._profileType;this._profileType.addEventListener(WebInspector.TrackingHeapSnapshotProfileType.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.addEventListener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onStopTracking,this);}
+{WebInspector.VBox.call(this);this.registerRequiredCSS("flameChart.css");this.element.id="heap-recording-view";this.element.classList.add("heap-tracking-overview");this._overviewContainer=this.element.createChild("div","overview-container");this._overviewGrid=new WebInspector.OverviewGrid("heap-recording");this._overviewGrid.element.classList.add("fill");this._overviewCanvas=this._overviewContainer.createChild("canvas","heap-recording-overview-canvas");this._overviewContainer.appendChild(this._overviewGrid.element);this._overviewCalculator=new WebInspector.HeapTrackingOverviewGrid.OverviewCalculator();this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged,this._onWindowChanged,this);this._profileSamples=heapProfileHeader._profileSamples;if(heapProfileHeader.profileType().profileBeingRecorded()===heapProfileHeader){this._profileType=heapProfileHeader._profileType;this._profileType.addEventListener(WebInspector.TrackingHeapSnapshotProfileType.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.addEventListener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onStopTracking,this);}
var timestamps=this._profileSamples.timestamps;var totalTime=this._profileSamples.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.HeapTrackingOverviewGrid.SmoothScale();this._xScale=new WebInspector.HeapTrackingOverviewGrid.SmoothScale();}
WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged="IdsRangeChanged";WebInspector.HeapTrackingOverviewGrid.prototype={_onStopTracking:function(event)
{this._profileType.removeEventListener(WebInspector.TrackingHeapSnapshotProfileType.HeapStatsUpdate,this._onHeapStatsUpdate,this);this._profileType.removeEventListener(WebInspector.TrackingHeapSnapshotProfileType.TrackingStopped,this._onStopTracking,this);},_onHeapStatsUpdate:function(event)
@@ -1223,40 +1338,50 @@
continue;if(timestamps[i]>timeRight)
break;maxId=ids[i];if(timestamps[i]<timeLeft){minId=ids[i];continue;}
size+=sizes[i];}
-this.dispatchEventToListeners(WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged,{minId:minId,maxId:maxId,size:size});},__proto__:WebInspector.View.prototype}
+this.dispatchEventToListeners(WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged,{minId:minId,maxId:maxId,size:size});},__proto__:WebInspector.VBox.prototype}
WebInspector.HeapTrackingOverviewGrid.SmoothScale=function()
{this._lastUpdate=0;this._currentScale=0.0;}
WebInspector.HeapTrackingOverviewGrid.SmoothScale.prototype={nextScale:function(target){target=target||this._currentScale;if(this._currentScale){var now=Date.now();var timeDeltaMs=now-this._lastUpdate;this._lastUpdate=now;var maxChangePerSec=20;var maxChangePerDelta=Math.pow(maxChangePerSec,timeDeltaMs/1000);var scaleChange=target/this._currentScale;this._currentScale*=Number.constrain(scaleChange,1/maxChangePerDelta,maxChangePerDelta);}else
this._currentScale=target;return this._currentScale;}}
WebInspector.HeapTrackingOverviewGrid.OverviewCalculator=function()
{}
-WebInspector.HeapTrackingOverviewGrid.OverviewCalculator.prototype={_updateBoundaries:function(chart)
+WebInspector.HeapTrackingOverviewGrid.OverviewCalculator.prototype={paddingLeft:function()
+{return 0;},_updateBoundaries:function(chart)
{this._minimumBoundaries=0;this._maximumBoundaries=chart._profileSamples.totalTime;this._xScaleFactor=chart._overviewContainer.clientWidth/this._maximumBoundaries;},computePosition:function(time)
-{return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(value,hires)
-{return Number.secondsToString((value+this._minimumBoundaries)/1000,hires);},maximumBoundary:function()
+{return(time-this._minimumBoundaries)*this._xScaleFactor;},formatTime:function(value,precision)
+{return Number.secondsToString(value/1000,!!precision);},maximumBoundary:function()
{return this._maximumBoundaries;},minimumBoundary:function()
{return this._minimumBoundaries;},zeroTime:function()
{return this._minimumBoundaries;},boundarySpan:function()
-{return this._maximumBoundaries-this._minimumBoundaries;}};WebInspector.ProfileLauncherView=function(profilesPanel)
-{WebInspector.View.call(this);this._panel=profilesPanel;this.element.classList.add("profile-launcher-view");this.element.classList.add("panel-enabler-view");this._contentElement=this.element.createChild("div","profile-launcher-view-content");this._innerContentElement=this._contentElement.createChild("div");this._controlButton=this._contentElement.createChild("button","control-profiling");this._controlButton.addEventListener("click",this._controlButtonClicked.bind(this),false);}
+{return this._maximumBoundaries-this._minimumBoundaries;}}
+WebInspector.HeapSnapshotStatisticsView=function()
+{WebInspector.VBox.call(this);this.setMinimumSize(50,25);this._pieChart=new WebInspector.PieChart();this._pieChart.setSize(150);this.element.appendChild(this._pieChart.element);this._labels=this.element.createChild("div","heap-snapshot-stats-legend");}
+WebInspector.HeapSnapshotStatisticsView.prototype={setTotal:function(value)
+{this._pieChart.setTotal(value);},addRecord:function(value,name,color)
+{if(color)
+this._pieChart.addSlice(value,color);var node=this._labels.createChild("div");var swatchDiv=node.createChild("div","heap-snapshot-stats-swatch");var nameDiv=node.createChild("div","heap-snapshot-stats-name");var sizeDiv=node.createChild("div","heap-snapshot-stats-size");if(color)
+swatchDiv.style.backgroundColor=color;else
+swatchDiv.classList.add("heap-snapshot-stats-empty-swatch");nameDiv.textContent=name;sizeDiv.textContent=WebInspector.UIString("%s KB",Number.withThousandsSeparator(Math.round(value/1024)));},__proto__:WebInspector.VBox.prototype};WebInspector.ProfileLauncherView=function(profilesPanel)
+{WebInspector.VBox.call(this);this._panel=profilesPanel;this.element.classList.add("profile-launcher-view");this.element.classList.add("panel-enabler-view");this._contentElement=this.element.createChild("div","profile-launcher-view-content");this._innerContentElement=this._contentElement.createChild("div");this._controlButton=this._contentElement.createChild("button","control-profiling");this._controlButton.addEventListener("click",this._controlButtonClicked.bind(this),false);this._loadButton=this._contentElement.createChild("button","load-profile");this._loadButton.textContent=WebInspector.UIString("Load");this._loadButton.addEventListener("click",this._loadButtonClicked.bind(this),false);}
WebInspector.ProfileLauncherView.prototype={addProfileType:function(profileType)
{var descriptionElement=this._innerContentElement.createChild("h1");descriptionElement.textContent=profileType.description;var decorationElement=profileType.decorationElement();if(decorationElement)
this._innerContentElement.appendChild(decorationElement);this._isInstantProfile=profileType.isInstantProfile();this._isEnabled=profileType.isEnabled();this._profileTypeId=profileType.id;},_controlButtonClicked:function()
-{this._panel.toggleRecordButton();},_updateControls:function()
+{this._panel.toggleRecordButton();},_loadButtonClicked:function()
+{this._panel.showLoadFromFileDialog();},_updateControls:function()
{if(this._isEnabled)
this._controlButton.removeAttribute("disabled");else
this._controlButton.setAttribute("disabled","");if(this._isInstantProfile){this._controlButton.classList.remove("running");this._controlButton.textContent=WebInspector.UIString("Take Snapshot");}else if(this._isProfiling){this._controlButton.classList.add("running");this._controlButton.textContent=WebInspector.UIString("Stop");}else{this._controlButton.classList.remove("running");this._controlButton.textContent=WebInspector.UIString("Start");}},profileStarted:function()
{this._isProfiling=true;this._updateControls();},profileFinished:function()
{this._isProfiling=false;this._updateControls();},updateProfileType:function(profileType)
-{this._isInstantProfile=profileType.isInstantProfile();this._isEnabled=profileType.isEnabled();this._profileTypeId=profileType.id;this._updateControls();},__proto__:WebInspector.View.prototype}
+{this._isInstantProfile=profileType.isInstantProfile();this._isEnabled=profileType.isEnabled();this._profileTypeId=profileType.id;this._updateControls();},__proto__:WebInspector.VBox.prototype}
WebInspector.MultiProfileLauncherView=function(profilesPanel)
{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=this._innerContentElement.createChild("form");this._innerContentElement.createChild("div","flexible-space");this._typeIdToOptionElement={};}
WebInspector.MultiProfileLauncherView.EventTypes={ProfileTypeSelected:"profile-type-selected"}
WebInspector.MultiProfileLauncherView.prototype={addProfileType:function(profileType)
-{var labelElement=this._profileTypeSelectorForm.createChild("label");labelElement.textContent=profileType.name;var optionElement=document.createElement("input");labelElement.insertBefore(optionElement,labelElement.firstChild);this._typeIdToOptionElement[profileType.id]=optionElement;optionElement.type="radio";optionElement.name="profile-type";optionElement.style.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)
+{var labelElement=this._profileTypeSelectorForm.createChild("label");labelElement.textContent=profileType.name;var optionElement=document.createElement("input");labelElement.insertBefore(optionElement,labelElement.firstChild);this._typeIdToOptionElement[profileType.id]=optionElement;optionElement._profileType=profileType;optionElement.type="radio";optionElement.name="profile-type";optionElement.style.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)
labelElement.appendChild(decorationElement);},restoreSelectedProfileType:function()
-{var typeName=WebInspector.settings.selectedProfileType.get();if(!(typeName in this._typeIdToOptionElement))
-typeName=Object.keys(this._typeIdToOptionElement)[0];this._typeIdToOptionElement[typeName].checked=true;this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,this._panel.getProfileType(typeName));},_controlButtonClicked:function()
+{var typeId=WebInspector.settings.selectedProfileType.get();if(!(typeId in this._typeIdToOptionElement))
+typeId=Object.keys(this._typeIdToOptionElement)[0];this._typeIdToOptionElement[typeId].checked=true;var type=this._typeIdToOptionElement[typeId]._profileType;this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,type);},_controlButtonClicked:function()
{this._panel.toggleRecordButton();},_updateControls:function()
{WebInspector.ProfileLauncherView.prototype._updateControls.call(this);var items=this._profileTypeSelectorForm.elements;for(var i=0;i<items.length;++i){if(items[i].type==="radio")
items[i].disabled=this._isProfiling;}},_profileTypeChanged:function(profileType,event)
@@ -1281,17 +1406,15 @@
this.sort(this.lastComparator,true);},restore:function()
{if(!this._savedChildren)
return;this.children[0].restorePosition();WebInspector.ProfileDataGridTree.prototype.restore.call(this);},_merge:WebInspector.TopDownProfileDataGridNode.prototype._merge,_sharedPopulate:WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate,__proto__:WebInspector.ProfileDataGridTree.prototype};WebInspector.CanvasProfileView=function(profile)
-{WebInspector.View.call(this);this.registerRequiredCSS("canvasProfiler.css");this.element.classList.add("canvas-profile-view");this._profile=profile;this._traceLogId=profile.traceLogId();this._traceLogPlayer=(profile.traceLogPlayer());this._linkifier=new WebInspector.Linkifier();const defaultReplayLogWidthPercent=0.34;this._replayInfoSplitView=new WebInspector.SplitView(true,"canvasProfileViewReplaySplitLocation",defaultReplayLogWidthPercent);this._replayInfoSplitView.setMainElementConstraints(defaultReplayLogWidthPercent,defaultReplayLogWidthPercent);this._replayInfoSplitView.show(this.element);this._imageSplitView=new WebInspector.SplitView(false,"canvasProfileViewSplitLocation",300);this._replayInfoSplitView.setFirstView(this._imageSplitView);var replayImageContainer=this._imageSplitView.firstElement().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.createChild("img","canvas-spinner-icon hidden");var replayLogContainer=this._imageSplitView.secondElement();var controlsContainer=replayLogContainer.createChild("div","status-bar");var logGridContainer=replayLogContainer.createChild("div","canvas-replay-log");this._createControlButton(controlsContainer,"canvas-replay-first-step",WebInspector.UIString("First call."),this._onReplayFirstStepClick.bind(this));this._createControlButton(controlsContainer,"canvas-replay-prev-step",WebInspector.UIString("Previous call."),this._onReplayStepClick.bind(this,false));this._createControlButton(controlsContainer,"canvas-replay-next-step",WebInspector.UIString("Next call."),this._onReplayStepClick.bind(this,true));this._createControlButton(controlsContainer,"canvas-replay-prev-draw",WebInspector.UIString("Previous drawing call."),this._onReplayDrawingCallClick.bind(this,false));this._createControlButton(controlsContainer,"canvas-replay-next-draw",WebInspector.UIString("Next drawing call."),this._onReplayDrawingCallClick.bind(this,true));this._createControlButton(controlsContainer,"canvas-replay-last-step",WebInspector.UIString("Last call."),this._onReplayLastStepClick.bind(this));this._replayContextSelector=new WebInspector.StatusBarComboBox(this._onReplayContextChanged.bind(this));this._replayContextSelector.createOption(WebInspector.UIString("<screenshot auto>"),WebInspector.UIString("Show screenshot of the last replayed resource."),"");controlsContainer.appendChild(this._replayContextSelector.element);this._installReplayInfoSidebarWidgets(controlsContainer);this._replayStateView=new WebInspector.CanvasReplayStateView(this._traceLogPlayer);this._replayInfoSplitView.setSecondView(this._replayStateView);this._replayContexts={};var columns=[{title:"#",sortable:false,width:"5%"},{title:WebInspector.UIString("Call"),sortable:false,width:"75%",disclosure:true},{title:WebInspector.UIString("Location"),sortable:false,width:"20%"}];this._logGrid=new WebInspector.DataGrid(columns);this._logGrid.element.classList.add("fill");this._logGrid.show(logGridContainer);this._logGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._replayTraceLog,this);this.element.addEventListener("mousedown",this._onMouseClick.bind(this),true);this._popoverHelper=new WebInspector.ObjectPopoverHelper(this.element,this._popoverAnchor.bind(this),this._resolveObjectForPopover.bind(this),this._onHidePopover.bind(this),true);this._popoverHelper.setRemoteObjectFormatter(this._hexNumbersFormatter.bind(this));this._requestTraceLog(0);}
+{WebInspector.VBox.call(this);this.registerRequiredCSS("canvasProfiler.css");this.element.classList.add("canvas-profile-view");this._profile=profile;this._traceLogId=profile.traceLogId();this._traceLogPlayer=(profile.traceLogPlayer());this._linkifier=new WebInspector.Linkifier();this._replayInfoSplitView=new WebInspector.SplitView(true,true,"canvasProfileViewReplaySplitViewState",0.34);this._replayInfoSplitView.show(this.element);this._imageSplitView=new WebInspector.SplitView(false,true,"canvasProfileViewSplitViewState",300);this._imageSplitView.show(this._replayInfoSplitView.mainElement());var replayImageContainerView=new WebInspector.VBox();replayImageContainerView.setMinimumSize(50,28);replayImageContainerView.show(this._imageSplitView.mainElement());var replayImageContainer=replayImageContainerView.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.createChild("div","spinner-icon small hidden");var replayLogContainerView=new WebInspector.VBox();replayLogContainerView.setMinimumSize(22,22);replayLogContainerView.show(this._imageSplitView.sidebarElement());var replayLogContainer=replayLogContainerView.element;var controlsContainer=replayLogContainer.createChild("div","status-bar");var logGridContainer=replayLogContainer.createChild("div","canvas-replay-log");this._createControlButton(controlsContainer,"canvas-replay-first-step",WebInspector.UIString("First call."),this._onReplayFirstStepClick.bind(this));this._createControlButton(controlsContainer,"canvas-replay-prev-step",WebInspector.UIString("Previous call."),this._onReplayStepClick.bind(this,false));this._createControlButton(controlsContainer,"canvas-replay-next-step",WebInspector.UIString("Next call."),this._onReplayStepClick.bind(this,true));this._createControlButton(controlsContainer,"canvas-replay-prev-draw",WebInspector.UIString("Previous drawing call."),this._onReplayDrawingCallClick.bind(this,false));this._createControlButton(controlsContainer,"canvas-replay-next-draw",WebInspector.UIString("Next drawing call."),this._onReplayDrawingCallClick.bind(this,true));this._createControlButton(controlsContainer,"canvas-replay-last-step",WebInspector.UIString("Last call."),this._onReplayLastStepClick.bind(this));this._replayContextSelector=new WebInspector.StatusBarComboBox(this._onReplayContextChanged.bind(this));this._replayContextSelector.createOption(WebInspector.UIString("<screenshot auto>"),WebInspector.UIString("Show screenshot of the last replayed resource."),"");controlsContainer.appendChild(this._replayContextSelector.element);this._installReplayInfoSidebarWidgets(controlsContainer);this._replayStateView=new WebInspector.CanvasReplayStateView(this._traceLogPlayer);this._replayStateView.show(this._replayInfoSplitView.sidebarElement());this._replayContexts={};var columns=[{title:"#",sortable:false,width:"5%"},{title:WebInspector.UIString("Call"),sortable:false,width:"75%",disclosure:true},{title:WebInspector.UIString("Location"),sortable:false,width:"20%"}];this._logGrid=new WebInspector.DataGrid(columns);this._logGrid.element.classList.add("fill");this._logGrid.show(logGridContainer);this._logGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,this._replayTraceLog,this);this.element.addEventListener("mousedown",this._onMouseClick.bind(this),true);this._popoverHelper=new WebInspector.ObjectPopoverHelper(this.element,this._popoverAnchor.bind(this),this._resolveObjectForPopover.bind(this),this._onHidePopover.bind(this),true);this._popoverHelper.setRemoteObjectFormatter(this._hexNumbersFormatter.bind(this));this._requestTraceLog(0);}
WebInspector.CanvasProfileView.TraceLogPollingInterval=500;WebInspector.CanvasProfileView.prototype={dispose:function()
{this._linkifier.reset();},get statusBarItems()
{return[];},get profile()
{return this._profile;},elementsToRestoreScrollPositionsFor:function()
{return[this._logGrid.scrollContainer];},_installReplayInfoSidebarWidgets:function(controlsContainer)
-{this._replayInfoResizeWidgetElement=controlsContainer.createChild("div","resizer-widget");this._replayInfoSplitView.installResizer(this._replayInfoResizeWidgetElement);this._toggleReplayStateSidebarButton=new WebInspector.StatusBarButton("","right-sidebar-show-hide-button canvas-sidebar-show-hide-button",3);this._toggleReplayStateSidebarButton.addEventListener("click",clickHandler,this);controlsContainer.appendChild(this._toggleReplayStateSidebarButton.element);this._enableReplayInfoSidebar(false);function clickHandler()
-{this._enableReplayInfoSidebar(this._toggleReplayStateSidebarButton.state==="left");}},_enableReplayInfoSidebar:function(show)
-{if(show){this._toggleReplayStateSidebarButton.state="right";this._toggleReplayStateSidebarButton.title=WebInspector.UIString("Hide sidebar.");this._replayInfoSplitView.showBoth();}else{this._toggleReplayStateSidebarButton.state="left";this._toggleReplayStateSidebarButton.title=WebInspector.UIString("Show sidebar.");this._replayInfoSplitView.showOnlyFirst();}
-this._replayInfoResizeWidgetElement.enableStyleClass("hidden",!show);},_onMouseClick:function(event)
-{var resourceLinkElement=event.target.enclosingNodeOrSelfWithClass("canvas-formatted-resource");if(resourceLinkElement){this._enableReplayInfoSidebar(true);this._replayStateView.selectResource(resourceLinkElement.__resourceId);event.consume(true);return;}
+{this._replayInfoResizeWidgetElement=controlsContainer.createChild("div","resizer-widget");this._replayInfoSplitView.addEventListener(WebInspector.SplitView.Events.ShowModeChanged,this._updateReplayInfoResizeWidget,this);this._updateReplayInfoResizeWidget();this._replayInfoSplitView.installResizer(this._replayInfoResizeWidgetElement);this._toggleReplayStateSidebarButton=this._replayInfoSplitView.createShowHideSidebarButton("sidebar","canvas-sidebar-show-hide-button");controlsContainer.appendChild(this._toggleReplayStateSidebarButton.element);this._replayInfoSplitView.hideSidebar();},_updateReplayInfoResizeWidget:function()
+{this._replayInfoResizeWidgetElement.classList.toggle("hidden",this._replayInfoSplitView.showMode()!==WebInspector.SplitView.ShowMode.Both);},_onMouseClick:function(event)
+{var resourceLinkElement=event.target.enclosingNodeOrSelfWithClass("canvas-formatted-resource");if(resourceLinkElement){this._replayInfoSplitView.showBoth();this._replayStateView.selectResource(resourceLinkElement.__resourceId);event.consume(true);return;}
if(event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link"))
event.consume(false);},_createControlButton:function(parent,className,title,clickCallback)
{var button=new WebInspector.StatusBarButton(title,className+" canvas-replay-button");parent.appendChild(button.element);button.makeLongClickEnabled();button.addEventListener("click",clickCallback,this);button.addEventListener("longClickDown",clickCallback,this);button.addEventListener("longClickPress",clickCallback,this);},_onReplayContextChanged:function()
@@ -1314,7 +1437,7 @@
return;while(lastNode.expanded){var lastChild=lastNode.children.peekLast();if(!lastChild)
break;lastNode=lastChild;}
lastNode.revealAndSelect();},_enableWaitIcon:function(enable)
-{this._spinnerIcon.enableStyleClass("hidden",!enable);this._debugInfoElement.enableStyleClass("hidden",enable);},_replayTraceLog:function()
+{this._spinnerIcon.classList.toggle("hidden",!enable);this._debugInfoElement.classList.toggle("hidden",enable);},_replayTraceLog:function()
{if(this._pendingReplayTraceLogEvent)
return;var index=this._selectedCallIndex();if(index===-1||index===this._lastReplayCallIndex)
return;this._lastReplayCallIndex=index;this._pendingReplayTraceLogEvent=true;function didReplayTraceLog(resourceState,replayTime)
@@ -1370,9 +1493,9 @@
delete this._popoverAnchorElement;}},_flattenSingleFrameNode:function()
{var rootNode=this._logGrid.rootNode();if(rootNode.children.length!==1)
return;var frameNode=rootNode.children[0];while(frameNode.children[0])
-rootNode.appendChild(frameNode.children[0]);rootNode.removeChild(frameNode);},__proto__:WebInspector.View.prototype}
+rootNode.appendChild(frameNode.children[0]);rootNode.removeChild(frameNode);},__proto__:WebInspector.VBox.prototype}
WebInspector.CanvasProfileType=function()
-{WebInspector.ProfileType.call(this,WebInspector.CanvasProfileType.TypeId,WebInspector.UIString("Capture Canvas Frame"));this._nextProfileUid=1;this._recording=false;this._lastProfileHeader=null;this._capturingModeSelector=new WebInspector.StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this));this._capturingModeSelector.element.title=WebInspector.UIString("Canvas capture mode.");this._capturingModeSelector.createOption(WebInspector.UIString("Single Frame"),WebInspector.UIString("Capture a single canvas frame."),"");this._capturingModeSelector.createOption(WebInspector.UIString("Consecutive Frames"),WebInspector.UIString("Capture consecutive canvas frames."),"1");this._frameOptions={};this._framesWithCanvases={};this._frameSelector=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");WebInspector.runtimeModel.contextLists().forEach(this._addFrame,this);WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListAdded,this._frameAdded,this);WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListRemoved,this._frameRemoved,this);this._dispatcher=new WebInspector.CanvasDispatcher(this);this._canvasAgentEnabled=false;this._decorationElement=document.createElement("div");this._decorationElement.className="profile-canvas-decoration";this._updateDecorationElement();}
+{WebInspector.ProfileType.call(this,WebInspector.CanvasProfileType.TypeId,WebInspector.UIString("Capture Canvas Frame"));this._recording=false;this._lastProfileHeader=null;this._capturingModeSelector=new WebInspector.StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this));this._capturingModeSelector.element.title=WebInspector.UIString("Canvas capture mode.");this._capturingModeSelector.createOption(WebInspector.UIString("Single Frame"),WebInspector.UIString("Capture a single canvas frame."),"");this._capturingModeSelector.createOption(WebInspector.UIString("Consecutive Frames"),WebInspector.UIString("Capture consecutive canvas frames."),"1");this._frameOptions={};this._framesWithCanvases={};this._frameSelector=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");WebInspector.resourceTreeModel.frames().forEach(this._addFrame,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded,this._frameAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this._frameRemoved,this);this._dispatcher=new WebInspector.CanvasDispatcher(this);this._canvasAgentEnabled=false;this._decorationElement=document.createElement("div");this._decorationElement.className="profile-canvas-decoration";this._updateDecorationElement();}
WebInspector.CanvasProfileType.TypeId="CANVAS_PROFILE";WebInspector.CanvasProfileType.prototype={get statusBarItems()
{return[this._capturingModeSelector.element,this._frameSelector.element];},get buttonTooltip()
{if(this._isSingleFrameMode())
@@ -1386,19 +1509,18 @@
{if(!this._lastProfileHeader)
return;var profileHeader=this._lastProfileHeader;var traceLogId=profileHeader.traceLogId();this._lastProfileHeader=null;function didStopCapturing()
{profileHeader._updateCapturingStatus();}
-CanvasAgent.stopCapturing(traceLogId,didStopCapturing.bind(this));},_didStartCapturingFrame:function(frameId,error,traceLogId)
+CanvasAgent.stopCapturing(traceLogId,didStopCapturing);},_didStartCapturingFrame:function(frameId,error,traceLogId)
{if(error||this._lastProfileHeader&&this._lastProfileHeader.traceLogId()===traceLogId)
-return;var profileHeader=new WebInspector.CanvasProfileHeader(this,WebInspector.UIString("Trace Log %d",this._nextProfileUid),this._nextProfileUid,traceLogId,frameId);++this._nextProfileUid;this._lastProfileHeader=profileHeader;this.addProfile(profileHeader);profileHeader._updateCapturingStatus();},get treeItemTitle()
+return;var profileHeader=new WebInspector.CanvasProfileHeader(this,traceLogId,frameId);this._lastProfileHeader=profileHeader;this.addProfile(profileHeader);profileHeader._updateCapturingStatus();},get treeItemTitle()
{return WebInspector.UIString("CANVAS PROFILE");},get description()
{return WebInspector.UIString("Canvas calls instrumentation");},decorationElement:function()
-{return this._decorationElement;},_reset:function()
-{WebInspector.ProfileType.prototype._reset.call(this);this._nextProfileUid=1;},removeProfile:function(profile)
+{return this._decorationElement;},removeProfile:function(profile)
{WebInspector.ProfileType.prototype.removeProfile.call(this,profile);if(this._recording&&profile===this._lastProfileHeader)
this._recording=false;},_updateDecorationElement:function(forcePageReload)
{this._decorationElement.removeChildren();this._decorationElement.createChild("div","warning-icon-small");this._decorationElement.appendChild(document.createTextNode(this._canvasAgentEnabled?WebInspector.UIString("Canvas Profiler is enabled."):WebInspector.UIString("Canvas Profiler is disabled.")));var button=this._decorationElement.createChild("button");button.type="button";button.textContent=this._canvasAgentEnabled?WebInspector.UIString("Disable"):WebInspector.UIString("Enable");button.addEventListener("click",this._onProfilerEnableButtonClick.bind(this,!this._canvasAgentEnabled),false);function hasUninstrumentedCanvasesCallback(error,result)
{if(error||result)
WebInspector.resourceTreeModel.reloadPage();}
-if(forcePageReload){if(this._canvasAgentEnabled){CanvasAgent.hasUninstrumentedCanvases(hasUninstrumentedCanvasesCallback.bind(this));}else{for(var frameId in this._framesWithCanvases){if(this._framesWithCanvases.hasOwnProperty(frameId)){WebInspector.resourceTreeModel.reloadPage();break;}}}}},_onProfilerEnableButtonClick:function(enable)
+if(forcePageReload){if(this._canvasAgentEnabled){CanvasAgent.hasUninstrumentedCanvases(hasUninstrumentedCanvasesCallback);}else{for(var frameId in this._framesWithCanvases){if(this._framesWithCanvases.hasOwnProperty(frameId)){WebInspector.resourceTreeModel.reloadPage();break;}}}}},_onProfilerEnableButtonClick:function(enable)
{if(this._canvasAgentEnabled===enable)
return;function callback(error)
{if(error)
@@ -1407,9 +1529,9 @@
CanvasAgent.enable(callback.bind(this));else
CanvasAgent.disable(callback.bind(this));},_isSingleFrameMode:function()
{return!this._capturingModeSelector.selectedOption().value;},_frameAdded:function(event)
-{var contextList=(event.data);this._addFrame(contextList);},_addFrame:function(contextList)
-{var frameId=contextList.frameId;var option=document.createElement("option");option.text=contextList.displayName;option.title=contextList.url;option.value=frameId;this._frameOptions[frameId]=option;if(this._framesWithCanvases[frameId]){this._frameSelector.addOption(option);this._dispatchViewUpdatedEvent();}},_frameRemoved:function(event)
-{var contextList=(event.data);var frameId=contextList.frameId;var option=this._frameOptions[frameId];if(option&&this._framesWithCanvases[frameId]){this._frameSelector.removeOption(option);this._dispatchViewUpdatedEvent();}
+{var frame=(event.data);this._addFrame(frame);},_addFrame:function(frame)
+{var frameId=frame.id;var option=document.createElement("option");option.text=frame.displayName();option.title=frame.url;option.value=frameId;this._frameOptions[frameId]=option;if(this._framesWithCanvases[frameId]){this._frameSelector.addOption(option);this._dispatchViewUpdatedEvent();}},_frameRemoved:function(event)
+{var frame=(event.data);var frameId=frame.id;var option=this._frameOptions[frameId];if(option&&this._framesWithCanvases[frameId]){this._frameSelector.removeOption(option);this._dispatchViewUpdatedEvent();}
delete this._frameOptions[frameId];delete this._framesWithCanvases[frameId];},_contextCreated:function(frameId)
{if(this._framesWithCanvases[frameId])
return;this._framesWithCanvases[frameId]=true;var option=this._frameOptions[frameId];if(option){this._frameSelector.addOption(option);this._dispatchViewUpdatedEvent();}},_traceLogsRemoved:function(frameId,traceLogId)
@@ -1420,7 +1542,7 @@
for(var i=0,n=sidebarElementsToDelete.length;i<n;++i)
sidebarElementsToDelete[i].ondelete();},_selectedFrameId:function()
{var option=this._frameSelector.selectedOption();return option?option.value:undefined;},_dispatchViewUpdatedEvent:function()
-{this._frameSelector.element.enableStyleClass("hidden",this._frameSelector.size()<=1);this.dispatchEventToListeners(WebInspector.ProfileType.Events.ViewUpdated);},isInstantProfile:function()
+{this._frameSelector.element.classList.toggle("hidden",this._frameSelector.size()<=1);this.dispatchEventToListeners(WebInspector.ProfileType.Events.ViewUpdated);},isInstantProfile:function()
{return this._isSingleFrameMode();},isEnabled:function()
{return this._canvasAgentEnabled;},__proto__:WebInspector.ProfileType.prototype}
WebInspector.CanvasDispatcher=function(profileType)
@@ -1428,19 +1550,19 @@
WebInspector.CanvasDispatcher.prototype={contextCreated:function(frameId)
{this._profileType._contextCreated(frameId);},traceLogsRemoved:function(frameId,traceLogId)
{this._profileType._traceLogsRemoved(frameId,traceLogId);}}
-WebInspector.CanvasProfileHeader=function(type,title,uid,traceLogId,frameId)
-{WebInspector.ProfileHeader.call(this,type,title,uid);this._traceLogId=traceLogId||"";this._frameId=frameId;this._alive=true;this._traceLogSize=0;this._traceLogPlayer=traceLogId?new WebInspector.CanvasTraceLogPlayerProxy(traceLogId):null;}
+WebInspector.CanvasProfileHeader=function(type,traceLogId,frameId)
+{WebInspector.ProfileHeader.call(this,type,WebInspector.UIString("Trace Log %d",type._nextProfileUid));this._traceLogId=traceLogId||"";this._frameId=frameId;this._alive=true;this._traceLogSize=0;this._traceLogPlayer=traceLogId?new WebInspector.CanvasTraceLogPlayerProxy(traceLogId):null;}
WebInspector.CanvasProfileHeader.prototype={traceLogId:function()
{return this._traceLogId;},traceLogPlayer:function()
{return this._traceLogPlayer;},frameId:function()
{return this._frameId;},createSidebarTreeElement:function()
-{return new WebInspector.ProfileSidebarTreeElement(this,"profile-sidebar-tree-item");},createView:function(profilesPanel)
+{return new WebInspector.ProfileSidebarTreeElement(this,"profile-sidebar-tree-item");},createView:function()
{return new WebInspector.CanvasProfileView(this);},dispose:function()
{if(this._traceLogPlayer)
this._traceLogPlayer.dispose();clearTimeout(this._requestStatusTimer);this._alive=false;},_updateCapturingStatus:function(traceLog)
-{if(!this.sidebarElement||!this._traceLogId)
+{if(!this._traceLogId)
return;if(traceLog){this._alive=traceLog.alive;this._traceLogSize=traceLog.totalAvailableCalls;}
-this.sidebarElement.subtitle=this._alive?WebInspector.UIString("Capturing\u2026 %d calls",this._traceLogSize):WebInspector.UIString("Captured %d calls",this._traceLogSize);this.sidebarElement.wait=this._alive;if(this._alive){clearTimeout(this._requestStatusTimer);this._requestStatusTimer=setTimeout(this._requestCapturingStatus.bind(this),WebInspector.CanvasProfileView.TraceLogPollingInterval);}},_requestCapturingStatus:function()
+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._requestStatusTimer);this._requestStatusTimer=setTimeout(this._requestCapturingStatus.bind(this),WebInspector.CanvasProfileView.TraceLogPollingInterval);}},_requestCapturingStatus:function()
{function didReceiveTraceLog(traceLog)
{if(!traceLog)
return;this._alive=traceLog.alive;this._traceLogSize=traceLog.totalAvailableCalls;this._updateCapturingStatus();}
@@ -1476,7 +1598,7 @@
this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasResourceStateReceived,resourceState);}
CanvasAgent.replayTraceLog(this._traceLogId,index,callback.bind(this));},clearResourceStates:function()
{this._currentResourceStates={};this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasReplayStateChanged);},__proto__:WebInspector.Object.prototype};WebInspector.CanvasReplayStateView=function(traceLogPlayer)
-{WebInspector.View.call(this);this.registerRequiredCSS("canvasProfiler.css");this.element.classList.add("canvas-replay-state-view");this._traceLogPlayer=traceLogPlayer;var controlsContainer=this.element.createChild("div","status-bar");this._prevButton=this._createControlButton(controlsContainer,"canvas-replay-state-prev",WebInspector.UIString("Previous resource."),this._onResourceNavigationClick.bind(this,false));this._nextButton=this._createControlButton(controlsContainer,"canvas-replay-state-next",WebInspector.UIString("Next resource."),this._onResourceNavigationClick.bind(this,true));this._createControlButton(controlsContainer,"canvas-replay-state-refresh",WebInspector.UIString("Refresh."),this._onStateRefreshClick.bind(this));this._resourceSelector=new WebInspector.StatusBarComboBox(this._onReplayResourceChanged.bind(this));this._currentOption=this._resourceSelector.createOption(WebInspector.UIString("<auto>"),WebInspector.UIString("Show state of the last replayed resource."),"");controlsContainer.appendChild(this._resourceSelector.element);this._resourceIdToDescription={};this._gridNodesExpandedState={};this._gridScrollPositions={};this._currentResourceId=null;this._prevOptionsStack=[];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._stateGrid=new WebInspector.DataGrid(columns);this._stateGrid.element.classList.add("fill");this._stateGrid.show(this.element);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasReplayStateChanged,this._onReplayResourceChanged,this);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasTraceLogReceived,this._onCanvasTraceLogReceived,this);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasResourceStateReceived,this._onCanvasResourceStateReceived,this);this._updateButtonsEnabledState();}
+{WebInspector.VBox.call(this);this.registerRequiredCSS("canvasProfiler.css");this.element.classList.add("canvas-replay-state-view");this._traceLogPlayer=traceLogPlayer;var controlsContainer=this.element.createChild("div","status-bar");this._prevButton=this._createControlButton(controlsContainer,"canvas-replay-state-prev",WebInspector.UIString("Previous resource."),this._onResourceNavigationClick.bind(this,false));this._nextButton=this._createControlButton(controlsContainer,"canvas-replay-state-next",WebInspector.UIString("Next resource."),this._onResourceNavigationClick.bind(this,true));this._createControlButton(controlsContainer,"canvas-replay-state-refresh",WebInspector.UIString("Refresh."),this._onStateRefreshClick.bind(this));this._resourceSelector=new WebInspector.StatusBarComboBox(this._onReplayResourceChanged.bind(this));this._currentOption=this._resourceSelector.createOption(WebInspector.UIString("<auto>"),WebInspector.UIString("Show state of the last replayed resource."),"");controlsContainer.appendChild(this._resourceSelector.element);this._resourceIdToDescription={};this._gridNodesExpandedState={};this._gridScrollPositions={};this._currentResourceId=null;this._prevOptionsStack=[];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._stateGrid=new WebInspector.DataGrid(columns);this._stateGrid.element.classList.add("fill");this._stateGrid.show(this.element);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasReplayStateChanged,this._onReplayResourceChanged,this);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasTraceLogReceived,this._onCanvasTraceLogReceived,this);this._traceLogPlayer.addEventListener(WebInspector.CanvasTraceLogPlayerProxy.Events.CanvasResourceStateReceived,this._onCanvasResourceStateReceived,this);this._updateButtonsEnabledState();}
WebInspector.CanvasReplayStateView.prototype={selectResource:function(resourceId)
{if(resourceId===this._resourceSelector.selectedOption().value)
return;var option=this._resourceSelector.selectElement().firstChild;for(var index=0;option;++index,option=option.nextSibling){if(resourceId===option.value){this._resourceSelector.setSelectedIndex(index);this._onReplayResourceChanged();break;}}},_createControlButton:function(parent,className,title,clickCallback)
@@ -1522,8 +1644,8 @@
{descriptors=descriptors||[];descriptors.sort(comparator);var oldChildren=nameToOldChildren||{};for(var i=0,n=descriptors.length;i<n;++i){var descriptor=descriptors[i];var childNode=this._createDataGridNode(descriptor);parent.appendChild(childNode);var oldChildrenItem=oldChildren[childNode.name]||{};var oldChildNode=oldChildrenItem.node;if(!oldChildNode||oldChildNode.element.textContent!==childNode.element.textContent)
nodesToHighlight.push(childNode);appendResourceStateDescriptors.call(this,descriptor.values,childNode,oldChildrenItem.children);}}
appendResourceStateDescriptors.call(this,resourceState.descriptors,rootNode,nameToOldGridNodes);var shouldHighlightChanges=(this._resourceKindId(this._currentResourceId)===this._resourceKindId(resourceState.id));this._currentResourceId=resourceState.id;this._restoreExpandedState();this._updateDataGridHighlights(shouldHighlightChanges?nodesToHighlight:[]);this._restoreScrollState();},_updateDataGridHighlights:function(nodes)
-{for(var i=0,n=this._highlightedGridNodes.length;i<n;++i){var node=this._highlightedGridNodes[i];node.element.classList.remove("canvas-grid-node-highlighted");}
-this._highlightedGridNodes=nodes;for(var i=0,n=this._highlightedGridNodes.length;i<n;++i){var node=this._highlightedGridNodes[i];node.element.classList.add("canvas-grid-node-highlighted");node.reveal();}},_resourceKindId:function(resourceId)
+{for(var i=0,n=this._highlightedGridNodes.length;i<n;++i)
+this._highlightedGridNodes[i].element.classList.remove("canvas-grid-node-highlighted");this._highlightedGridNodes=nodes;for(var i=0,n=this._highlightedGridNodes.length;i<n;++i){var node=this._highlightedGridNodes[i];WebInspector.runCSSAnimationOnce(node.element,"canvas-grid-node-highlighted");node.reveal();}},_resourceKindId:function(resourceId)
{var description=(resourceId&&this._resourceIdToDescription[resourceId])||"";return description.replace(/\d+/g,"");},_forEachGridNode:function(callback)
{function processRecursively(node,key)
{for(var i=0,child;child=node.children[i];++i){var childKey=key+"#"+child.name;callback(child,childKey);processRecursively(child,childKey);}}
@@ -1547,4 +1669,13 @@
{var name=descriptor.name;var callArgument=descriptor.value;var valueElement=callArgument?WebInspector.CanvasProfileDataGridHelper.createCallArgumentElement(callArgument):"";var nameElement=name;if(typeof descriptor.enumValueForName!=="undefined")
nameElement=WebInspector.CanvasProfileDataGridHelper.createEnumValueElement(name,+descriptor.enumValueForName);if(descriptor.isArray&&descriptor.values){if(typeof nameElement==="string")
nameElement+="["+descriptor.values.length+"]";else{var element=document.createElement("span");element.appendChild(nameElement);element.createTextChild("["+descriptor.values.length+"]");nameElement=element;}}
-var data={};data[0]=nameElement;data[1]=valueElement;var node=new WebInspector.DataGridNode(data);node.selectable=false;node.name=name;return node;},__proto__:WebInspector.View.prototype};
+var data={};data[0]=nameElement;data[1]=valueElement;var node=new WebInspector.DataGridNode(data);node.selectable=false;node.name=name;return node;},__proto__:WebInspector.VBox.prototype};WebInspector.PieChart=function(totalValue,formatter)
+{const shadowOffset=0.04;this.element=document.createElementWithClass("div","pie-chart");var svg=this._createSVGChild(this.element,"svg");svg.setAttribute("width","100%");svg.setAttribute("height",(100*(1+shadowOffset))+"%");this._group=this._createSVGChild(svg,"g");var shadow=this._createSVGChild(this._group,"circle");shadow.setAttribute("r",1);shadow.setAttribute("cy",shadowOffset);shadow.setAttribute("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):totalValue;this._totalElement=this.element.createChild("div","pie-chart-foreground");this._totalElement.textContent=totalString;this._totalValue=totalValue;}
+this._lastAngle=-Math.PI/2;this.setSize(100);}
+WebInspector.PieChart.prototype={setTotal:function(value)
+{this._totalValue=value;},setSize:function(value)
+{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)
+this._totalElement.style.lineHeight=size;},addSlice:function(value,color)
+{var sliceAngle=value/this._totalValue*2*Math.PI;if(!isFinite(sliceAngle))
+return;sliceAngle=Math.min(sliceAngle,2*Math.PI*0.9999);var path=this._createSVGChild(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.setAttribute("fill",color);},_createSVGChild:function(parent,childType)
+{var child=document.createElementNS("http://www.w3.org/2000/svg",childType);parent.appendChild(child);return child;}};WebInspector.ProfileTypeRegistry.instance=new WebInspector.ProfileTypeRegistry();
« 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