Changeset 66117 in webkit


Ignore:
Timestamp:
Aug 26, 2010 11:27:24 AM (14 years ago)
Author:
mnaganov@chromium.org
Message:

2010-08-26 Mikhail Naganov <mnaganov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Store heap snapshots in InspectorProfilerAgent.

Change the way heap snapshots are transported to Inspector
to be aligned with CPU profiles. As a result, the Heap snapshots
view of Profiles panel was upstreamed into WebCore.

https://bugs.webkit.org/show_bug.cgi?id=44531

  • English.lproj/localizedStrings.js:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/ScriptHeapSnapshot.h: Added. (WebCore::ScriptHeapSnapshot::~ScriptHeapSnapshot): (WebCore::ScriptHeapSnapshot::title): (WebCore::ScriptHeapSnapshot::uid): (WebCore::ScriptHeapSnapshot::buildInspectorObjectForHead): (WebCore::ScriptHeapSnapshot::ScriptHeapSnapshot):
  • bindings/js/ScriptProfiler.h: (WebCore::ScriptProfiler::takeHeapSnapshot):
  • bindings/v8/ScriptHeapSnapshot.cpp: Added. (WebCore::ScriptHeapSnapshot::title): (WebCore::ScriptHeapSnapshot::uid): (WebCore::buildInspectorObjectFor): (WebCore::ScriptHeapSnapshot::buildInspectorObjectForHead):
  • bindings/v8/ScriptHeapSnapshot.h: Added. (WebCore::ScriptHeapSnapshot::create): (WebCore::ScriptHeapSnapshot::~ScriptHeapSnapshot): (WebCore::ScriptHeapSnapshot::ScriptHeapSnapshot):
  • bindings/v8/ScriptProfile.cpp: (WebCore::buildInspectorObjectFor):
  • bindings/v8/ScriptProfiler.cpp: (WebCore::ScriptProfiler::takeHeapSnapshot):
  • bindings/v8/ScriptProfiler.h:
  • inspector/Inspector.idl:
  • inspector/InspectorBackend.cpp:
  • inspector/InspectorBackend.h:
  • inspector/InspectorProfilerAgent.cpp: (WebCore::InspectorProfilerAgent::InspectorProfilerAgent): (WebCore::InspectorProfilerAgent::createSnapshotHeader): (WebCore::InspectorProfilerAgent::getProfileHeaders): (WebCore::InspectorProfilerAgent::getProfile): (WebCore::InspectorProfilerAgent::removeProfile): (WebCore::InspectorProfilerAgent::resetState): (WebCore::InspectorProfilerAgent::takeHeapSnapshot):
  • inspector/InspectorProfilerAgent.h:
  • inspector/front-end/HeapSnapshotView.js: Added. (WebInspector.HeapSnapshotView.profileCallback): (WebInspector.HeapSnapshotView.resetCompleted): (WebInspector.HeapSnapshotView): (WebInspector.HeapSnapshotView.prototype.get statusBarItems): (WebInspector.HeapSnapshotView.prototype.get profile): (WebInspector.HeapSnapshotView.prototype.set profile): (WebInspector.HeapSnapshotView.prototype.show): (WebInspector.HeapSnapshotView.prototype.hide): (WebInspector.HeapSnapshotView.prototype.resize): (WebInspector.HeapSnapshotView.prototype.refresh): (WebInspector.HeapSnapshotView.prototype.refreshShowAsPercents): (WebInspector.HeapSnapshotView.prototype._deleteSearchMatchedFlags): (WebInspector.HeapSnapshotView.prototype.searchCanceled): (WebInspector.HeapSnapshotView.prototype.performSearch): (WebInspector.HeapSnapshotView.prototype.jumpToFirstSearchResult.WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult.jumpToLastSearchResult.WebInspector.CPUProfileView.prototype.jumpToLastSearchResult.jumpToNextSearchResult.WebInspector.CPUProfileView.prototype.jumpToNextSearchResult.jumpToPreviousSearchResult.WebInspector.CPUProfileView.prototype.jumpToPreviousSearchResult.showingFirstSearchResult.WebInspector.CPUProfileView.prototype.showingFirstSearchResult.showingLastSearchResult.WebInspector.CPUProfileView.prototype.showingLastSearchResult._jumpToSearchResult.WebInspector.CPUProfileView.prototype._jumpToSearchResult.refreshVisibleData): (WebInspector.HeapSnapshotView.prototype._changeBase.resetCompleted): (WebInspector.HeapSnapshotView.prototype._changeBase): (WebInspector.HeapSnapshotView.prototype._createSnapshotDataGridList): (WebInspector.HeapSnapshotView.prototype._getProfiles): (WebInspector.HeapSnapshotView.prototype._loadProfile.loadedCallback): (WebInspector.HeapSnapshotView.prototype._loadProfile): (WebInspector.HeapSnapshotView.prototype._mouseDownInDataGrid): (WebInspector.HeapSnapshotView.prototype.get _isShowingAsPercent): (WebInspector.HeapSnapshotView.prototype._percentClicked): (WebInspector.HeapSnapshotView.prototype._prepareProfile.mergeRetainers): (WebInspector.HeapSnapshotView.prototype._prepareProfile): (WebInspector.HeapSnapshotView.prototype._resetDataGridList.profileLoaded): (WebInspector.HeapSnapshotView.prototype._resetDataGridList): (WebInspector.HeapSnapshotView.prototype._sortData): (WebInspector.HeapSnapshotView.prototype._updateBaseOptions): (WebInspector.HeapSnapshotView.prototype._updatePercentButton): (WebInspector.HeapSnapshotView.prototype._updateSummaryGraph): (WebInspector.HeapSnapshotView.SearchHelper.operations.LESS): (WebInspector.HeapSnapshotView.SearchHelper.operations.LESS_OR_EQUAL): (WebInspector.HeapSnapshotView.SearchHelper.operations.EQUAL): (WebInspector.HeapSnapshotView.SearchHelper.operations.GREATER_OR_EQUAL): (WebInspector.HeapSnapshotView.SearchHelper.operations.GREATER): (WebInspector.HeapSnapshotView.SearchHelper.parseOperationAndNumber): (WebInspector.HeapSummaryCalculator): (WebInspector.HeapSummaryCalculator.prototype.computeSummaryValues): (WebInspector.HeapSummaryCalculator.prototype.formatValue): (WebInspector.HeapSummaryCalculator.prototype.get showAsPercent): (WebInspector.HeapSummaryCalculator.prototype.set showAsPercent): (WebInspector.HeapSummaryCountCalculator): (WebInspector.HeapSummaryCountCalculator.prototype._highFromLow): (WebInspector.HeapSummaryCountCalculator.prototype._valueToString): (WebInspector.HeapSummarySizeCalculator): (WebInspector.HeapSummarySizeCalculator.prototype._highFromLow): (WebInspector.HeapSnapshotDataGridNodeWithRetainers): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get _hasRetainers): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get _parent): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype._populate): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.produceDiff): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.sort): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.signForDelta): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.showDeltaAsPercent): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalCount): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalSize): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get countPercent): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get sizePercent): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get countDeltaPercent): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get sizeDeltaPercent): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get data): (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.createCell): (WebInspector.HeapSnapshotDataGridNode): (WebInspector.HeapSnapshotDataGridList): (WebInspector.HeapSnapshotDataGridList.prototype.appendChild): (WebInspector.HeapSnapshotDataGridList.prototype.insertChild): (WebInspector.HeapSnapshotDataGridList.prototype.removeChildren): (WebInspector.HeapSnapshotDataGridList.prototype.populateChildren): (WebInspector.HeapSnapshotDataGridList.propertyComparator.comparator): (WebInspector.HeapSnapshotDataGridList.propertyComparator): (WebInspector.HeapSnapshotDataGridRetainerNode): (WebInspector.HeapSnapshotDataGridRetainerNode.prototype.get sizePercent): (WebInspector.HeapSnapshotDataGridRetainerNode.prototype.get sizeDeltaPercent): (WebInspector.HeapSnapshotDataGridRetainerNode.prototype._calculateRetainers): (WebInspector.HeapSnapshotProfileType): (WebInspector.HeapSnapshotProfileType.prototype.get buttonTooltip): (WebInspector.HeapSnapshotProfileType.prototype.get buttonStyle): (WebInspector.HeapSnapshotProfileType.prototype.buttonClicked): (WebInspector.HeapSnapshotProfileType.prototype.get welcomeMessage): (WebInspector.HeapSnapshotProfileType.prototype.createSidebarTreeElementForProfile): (WebInspector.HeapSnapshotProfileType.prototype.createView):
  • inspector/front-end/ProfileView.js: (WebInspector.CPUProfileView): (WebInspector.CPUProfileType.prototype.createSidebarTreeElementForProfile):
  • inspector/front-end/ProfilesPanel.js: (WebInspector.ProfilesPanel.prototype.addProfileHeader): (WebInspector.ProfilesPanel.prototype.removeProfileHeader): (WebInspector.ProfilesPanel.prototype.getProfiles): (WebInspector.ProfilesPanel.prototype.updateProfile): (WebInspector.ProfileSidebarTreeElement): (WebInspector.ProfileSidebarTreeElement.prototype.get mainTitle):
  • inspector/front-end/WebKit.qrc:
  • inspector/front-end/inspector.css: (.heap-snapshot-sidebar-tree-item .icon): (.heap-snapshot-sidebar-tree-item.small .icon): (.heap-snapshot-view): (.heap-snapshot-view.visible): (.heap-snapshot-view .data-grid): (.heap-snapshot-view .data-grid th.count-column): (.heap-snapshot-view .data-grid td.count-column): (.heap-snapshot-view .data-grid th.size-column): (.heap-snapshot-view .data-grid td.size-column): (.heap-snapshot-view .data-grid th.countDelta-column): (.heap-snapshot-view .data-grid td.countDelta-column): (.heap-snapshot-view .data-grid th.sizeDelta-column): (.heap-snapshot-view .data-grid td.sizeDelta-column): (#heap-snapshot-summary-container): (.heap-snapshot-summary): (.heap-snapshot-summary canvas.summary-graph): (.heap-snapshot-summary-label):
  • inspector/front-end/inspector.html:
  • inspector/front-end/inspector.js: (WebInspector._createPanels):
  • DEPS:
  • WebKit.gypi:
  • src/js/DevTools.js: ():
  • src/js/HeapProfilerPanel.js: Removed.
  • src/js/ProfilerAgent.js: Removed.
  • src/js/ProfilerProcessor.js: Removed.
  • src/js/devTools.css:
Location:
trunk
Files:
1 added
2 deleted
27 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r66115 r66117  
     12010-08-26  Mikhail Naganov  <mnaganov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Store heap snapshots in InspectorProfilerAgent.
     6
     7        Change the way heap snapshots are transported to Inspector
     8        to be aligned with CPU profiles. As a result, the Heap snapshots
     9        view of Profiles panel was upstreamed into WebCore.
     10
     11        https://bugs.webkit.org/show_bug.cgi?id=44531
     12
     13        * English.lproj/localizedStrings.js:
     14        * GNUmakefile.am:
     15        * WebCore.gypi:
     16        * WebCore.pro:
     17        * WebCore.vcproj/WebCore.vcproj:
     18        * WebCore.xcodeproj/project.pbxproj:
     19        * bindings/js/ScriptHeapSnapshot.h: Added.
     20        (WebCore::ScriptHeapSnapshot::~ScriptHeapSnapshot):
     21        (WebCore::ScriptHeapSnapshot::title):
     22        (WebCore::ScriptHeapSnapshot::uid):
     23        (WebCore::ScriptHeapSnapshot::buildInspectorObjectForHead):
     24        (WebCore::ScriptHeapSnapshot::ScriptHeapSnapshot):
     25        * bindings/js/ScriptProfiler.h:
     26        (WebCore::ScriptProfiler::takeHeapSnapshot):
     27        * bindings/v8/ScriptHeapSnapshot.cpp: Added.
     28        (WebCore::ScriptHeapSnapshot::title):
     29        (WebCore::ScriptHeapSnapshot::uid):
     30        (WebCore::buildInspectorObjectFor):
     31        (WebCore::ScriptHeapSnapshot::buildInspectorObjectForHead):
     32        * bindings/v8/ScriptHeapSnapshot.h: Added.
     33        (WebCore::ScriptHeapSnapshot::create):
     34        (WebCore::ScriptHeapSnapshot::~ScriptHeapSnapshot):
     35        (WebCore::ScriptHeapSnapshot::ScriptHeapSnapshot):
     36        * bindings/v8/ScriptProfile.cpp:
     37        (WebCore::buildInspectorObjectFor):
     38        * bindings/v8/ScriptProfiler.cpp:
     39        (WebCore::ScriptProfiler::takeHeapSnapshot):
     40        * bindings/v8/ScriptProfiler.h:
     41        * inspector/Inspector.idl:
     42        * inspector/InspectorBackend.cpp:
     43        * inspector/InspectorBackend.h:
     44        * inspector/InspectorProfilerAgent.cpp:
     45        (WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
     46        (WebCore::InspectorProfilerAgent::createSnapshotHeader):
     47        (WebCore::InspectorProfilerAgent::getProfileHeaders):
     48        (WebCore::InspectorProfilerAgent::getProfile):
     49        (WebCore::InspectorProfilerAgent::removeProfile):
     50        (WebCore::InspectorProfilerAgent::resetState):
     51        (WebCore::InspectorProfilerAgent::takeHeapSnapshot):
     52        * inspector/InspectorProfilerAgent.h:
     53        * inspector/front-end/HeapSnapshotView.js: Added.
     54        (WebInspector.HeapSnapshotView.profileCallback):
     55        (WebInspector.HeapSnapshotView.resetCompleted):
     56        (WebInspector.HeapSnapshotView):
     57        (WebInspector.HeapSnapshotView.prototype.get statusBarItems):
     58        (WebInspector.HeapSnapshotView.prototype.get profile):
     59        (WebInspector.HeapSnapshotView.prototype.set profile):
     60        (WebInspector.HeapSnapshotView.prototype.show):
     61        (WebInspector.HeapSnapshotView.prototype.hide):
     62        (WebInspector.HeapSnapshotView.prototype.resize):
     63        (WebInspector.HeapSnapshotView.prototype.refresh):
     64        (WebInspector.HeapSnapshotView.prototype.refreshShowAsPercents):
     65        (WebInspector.HeapSnapshotView.prototype._deleteSearchMatchedFlags):
     66        (WebInspector.HeapSnapshotView.prototype.searchCanceled):
     67        (WebInspector.HeapSnapshotView.prototype.performSearch):
     68        (WebInspector.HeapSnapshotView.prototype.jumpToFirstSearchResult.WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult.jumpToLastSearchResult.WebInspector.CPUProfileView.prototype.jumpToLastSearchResult.jumpToNextSearchResult.WebInspector.CPUProfileView.prototype.jumpToNextSearchResult.jumpToPreviousSearchResult.WebInspector.CPUProfileView.prototype.jumpToPreviousSearchResult.showingFirstSearchResult.WebInspector.CPUProfileView.prototype.showingFirstSearchResult.showingLastSearchResult.WebInspector.CPUProfileView.prototype.showingLastSearchResult._jumpToSearchResult.WebInspector.CPUProfileView.prototype._jumpToSearchResult.refreshVisibleData):
     69        (WebInspector.HeapSnapshotView.prototype._changeBase.resetCompleted):
     70        (WebInspector.HeapSnapshotView.prototype._changeBase):
     71        (WebInspector.HeapSnapshotView.prototype._createSnapshotDataGridList):
     72        (WebInspector.HeapSnapshotView.prototype._getProfiles):
     73        (WebInspector.HeapSnapshotView.prototype._loadProfile.loadedCallback):
     74        (WebInspector.HeapSnapshotView.prototype._loadProfile):
     75        (WebInspector.HeapSnapshotView.prototype._mouseDownInDataGrid):
     76        (WebInspector.HeapSnapshotView.prototype.get _isShowingAsPercent):
     77        (WebInspector.HeapSnapshotView.prototype._percentClicked):
     78        (WebInspector.HeapSnapshotView.prototype._prepareProfile.mergeRetainers):
     79        (WebInspector.HeapSnapshotView.prototype._prepareProfile):
     80        (WebInspector.HeapSnapshotView.prototype._resetDataGridList.profileLoaded):
     81        (WebInspector.HeapSnapshotView.prototype._resetDataGridList):
     82        (WebInspector.HeapSnapshotView.prototype._sortData):
     83        (WebInspector.HeapSnapshotView.prototype._updateBaseOptions):
     84        (WebInspector.HeapSnapshotView.prototype._updatePercentButton):
     85        (WebInspector.HeapSnapshotView.prototype._updateSummaryGraph):
     86        (WebInspector.HeapSnapshotView.SearchHelper.operations.LESS):
     87        (WebInspector.HeapSnapshotView.SearchHelper.operations.LESS_OR_EQUAL):
     88        (WebInspector.HeapSnapshotView.SearchHelper.operations.EQUAL):
     89        (WebInspector.HeapSnapshotView.SearchHelper.operations.GREATER_OR_EQUAL):
     90        (WebInspector.HeapSnapshotView.SearchHelper.operations.GREATER):
     91        (WebInspector.HeapSnapshotView.SearchHelper.parseOperationAndNumber):
     92        (WebInspector.HeapSummaryCalculator):
     93        (WebInspector.HeapSummaryCalculator.prototype.computeSummaryValues):
     94        (WebInspector.HeapSummaryCalculator.prototype.formatValue):
     95        (WebInspector.HeapSummaryCalculator.prototype.get showAsPercent):
     96        (WebInspector.HeapSummaryCalculator.prototype.set showAsPercent):
     97        (WebInspector.HeapSummaryCountCalculator):
     98        (WebInspector.HeapSummaryCountCalculator.prototype._highFromLow):
     99        (WebInspector.HeapSummaryCountCalculator.prototype._valueToString):
     100        (WebInspector.HeapSummarySizeCalculator):
     101        (WebInspector.HeapSummarySizeCalculator.prototype._highFromLow):
     102        (WebInspector.HeapSnapshotDataGridNodeWithRetainers):
     103        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get _hasRetainers):
     104        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get _parent):
     105        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype._populate):
     106        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.produceDiff):
     107        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.sort):
     108        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.signForDelta):
     109        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.showDeltaAsPercent):
     110        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalCount):
     111        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalSize):
     112        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get countPercent):
     113        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get sizePercent):
     114        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get countDeltaPercent):
     115        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get sizeDeltaPercent):
     116        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.get data):
     117        (WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.createCell):
     118        (WebInspector.HeapSnapshotDataGridNode):
     119        (WebInspector.HeapSnapshotDataGridList):
     120        (WebInspector.HeapSnapshotDataGridList.prototype.appendChild):
     121        (WebInspector.HeapSnapshotDataGridList.prototype.insertChild):
     122        (WebInspector.HeapSnapshotDataGridList.prototype.removeChildren):
     123        (WebInspector.HeapSnapshotDataGridList.prototype.populateChildren):
     124        (WebInspector.HeapSnapshotDataGridList.propertyComparator.comparator):
     125        (WebInspector.HeapSnapshotDataGridList.propertyComparator):
     126        (WebInspector.HeapSnapshotDataGridRetainerNode):
     127        (WebInspector.HeapSnapshotDataGridRetainerNode.prototype.get sizePercent):
     128        (WebInspector.HeapSnapshotDataGridRetainerNode.prototype.get sizeDeltaPercent):
     129        (WebInspector.HeapSnapshotDataGridRetainerNode.prototype._calculateRetainers):
     130        (WebInspector.HeapSnapshotProfileType):
     131        (WebInspector.HeapSnapshotProfileType.prototype.get buttonTooltip):
     132        (WebInspector.HeapSnapshotProfileType.prototype.get buttonStyle):
     133        (WebInspector.HeapSnapshotProfileType.prototype.buttonClicked):
     134        (WebInspector.HeapSnapshotProfileType.prototype.get welcomeMessage):
     135        (WebInspector.HeapSnapshotProfileType.prototype.createSidebarTreeElementForProfile):
     136        (WebInspector.HeapSnapshotProfileType.prototype.createView):
     137        * inspector/front-end/ProfileView.js:
     138        (WebInspector.CPUProfileView):
     139        (WebInspector.CPUProfileType.prototype.createSidebarTreeElementForProfile):
     140        * inspector/front-end/ProfilesPanel.js:
     141        (WebInspector.ProfilesPanel.prototype.addProfileHeader):
     142        (WebInspector.ProfilesPanel.prototype.removeProfileHeader):
     143        (WebInspector.ProfilesPanel.prototype.getProfiles):
     144        (WebInspector.ProfilesPanel.prototype.updateProfile):
     145        (WebInspector.ProfileSidebarTreeElement):
     146        (WebInspector.ProfileSidebarTreeElement.prototype.get mainTitle):
     147        * inspector/front-end/WebKit.qrc:
     148        * inspector/front-end/inspector.css:
     149        (.heap-snapshot-sidebar-tree-item .icon):
     150        (.heap-snapshot-sidebar-tree-item.small .icon):
     151        (.heap-snapshot-view):
     152        (.heap-snapshot-view.visible):
     153        (.heap-snapshot-view .data-grid):
     154        (.heap-snapshot-view .data-grid th.count-column):
     155        (.heap-snapshot-view .data-grid td.count-column):
     156        (.heap-snapshot-view .data-grid th.size-column):
     157        (.heap-snapshot-view .data-grid td.size-column):
     158        (.heap-snapshot-view .data-grid th.countDelta-column):
     159        (.heap-snapshot-view .data-grid td.countDelta-column):
     160        (.heap-snapshot-view .data-grid th.sizeDelta-column):
     161        (.heap-snapshot-view .data-grid td.sizeDelta-column):
     162        (#heap-snapshot-summary-container):
     163        (.heap-snapshot-summary):
     164        (.heap-snapshot-summary canvas.summary-graph):
     165        (.heap-snapshot-summary-label):
     166        * inspector/front-end/inspector.html:
     167        * inspector/front-end/inspector.js:
     168        (WebInspector._createPanels):
     169
    11702010-08-25  David Hyatt  <hyatt@apple.com>
    2171
  • trunk/WebCore/GNUmakefile.am

    r66108 r66117  
    774774        WebCore/bindings/js/ScriptGCEvent.cpp \
    775775        WebCore/bindings/js/ScriptGCEvent.h \
     776        WebCore/bindings/js/ScriptHeapSnapshot.h \
    776777        WebCore/bindings/js/ScriptInstance.h \
    777778        WebCore/bindings/js/ScriptObject.cpp \
  • trunk/WebCore/WebCore.gypi

    r66037 r66117  
    855855            'bindings/v8/ScriptGCEvent.cpp',
    856856            'bindings/v8/ScriptGCEvent.h',
     857            'bindings/v8/ScriptHeapSnapshot.cpp',
     858            'bindings/v8/ScriptHeapSnapshot.h',
    857859            'bindings/v8/ScriptInstance.cpp',
    858860            'bindings/v8/ScriptInstance.h',
     
    41814183            'inspector/front-end/FontView.js',
    41824184            'inspector/front-end/HAREntry.js',
     4185            'inspector/front-end/HeapSnapshotView.js',
    41834186            'inspector/front-end/HelpScreen.js',
    41844187            'inspector/front-end/ImageView.js',
  • trunk/WebCore/WebCore.pro

    r66037 r66117  
    11571157    bindings/js/ScriptFunctionCall.h \
    11581158    bindings/js/ScriptGCEvent.h \
     1159    bindings/js/ScriptHeapSnapshot.h \
    11591160    bindings/js/ScriptObject.h \
    11601161    bindings/js/ScriptProfile.h \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r66054 r66117  
    4923749237                                </File>
    4923849238                                <File
     49239                                        RelativePath="..\bindings\js\ScriptHeapSnapshot.h"
     49240                                        >
     49241                                </File>
     49242                                <File
    4923949243                                        RelativePath="..\bindings\js\ScriptInstance.h"
    4924049244                                        >
     
    5216652170                                <File
    5216752171                                        RelativePath="..\inspector\front-end\inspectorSyntaxHighlight.css"
     52172                                        >
     52173                                </File>
     52174                                <File
     52175                                        RelativePath="..\inspector\front-end\HeapSnapshotView.js"
    5216852176                                        >
    5216952177                                </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r66037 r66117  
    27562756                9F0D6B2E121BFEBA006C0288 /* InspectorProfilerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F0D6B2C121BFEBA006C0288 /* InspectorProfilerAgent.cpp */; };
    27572757                9F0D6B2F121BFEBA006C0288 /* InspectorProfilerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F0D6B2D121BFEBA006C0288 /* InspectorProfilerAgent.h */; };
     2758                9F3B947E12241758005304E7 /* ScriptHeapSnapshot.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F3B947D12241758005304E7 /* ScriptHeapSnapshot.h */; };
    27582759                9F6FC1961122E82A00E80196 /* ScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */; };
    27592760                9F6FC1971122E82A00E80196 /* ScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    86248625                9F0D6B2C121BFEBA006C0288 /* InspectorProfilerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorProfilerAgent.cpp; sourceTree = "<group>"; };
    86258626                9F0D6B2D121BFEBA006C0288 /* InspectorProfilerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorProfilerAgent.h; sourceTree = "<group>"; };
     8627                9F3B947D12241758005304E7 /* ScriptHeapSnapshot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptHeapSnapshot.h; sourceTree = "<group>"; };
    86268628                9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptDebugServer.cpp; sourceTree = "<group>"; };
    86278629                9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugServer.h; sourceTree = "<group>"; };
     
    1612416126                                4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */,
    1612516127                                4FD8D0F1119C718B002FA825 /* ScriptGCEvent.h */,
     16128                                9F3B947D12241758005304E7 /* ScriptHeapSnapshot.h */,
    1612616129                                934CC1160EDCAC7300A658F2 /* ScriptInstance.h */,
    1612716130                                41F066E30F64BCF600A07EAC /* ScriptObject.cpp */,
     
    2037320376                                8947A83C122234F400D95F2D /* Metadata.h in Headers */,
    2037420377                                8947A83D122234F900D95F2D /* MetadataCallback.h in Headers */,
     20378                                9F3B947E12241758005304E7 /* ScriptHeapSnapshot.h in Headers */,
    2037520379                        );
    2037620380                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/js/ScriptHeapSnapshot.h

    r66116 r66117  
    2929 */
    3030
    31 #ifndef ScriptProfiler_h
    32 #define ScriptProfiler_h
     31#ifndef ScriptHeapSnapshot_h
     32#define ScriptHeapSnapshot_h
    3333
     34#include "InspectorValues.h"
    3435#include "PlatformString.h"
    35 #include "ScriptProfile.h"
    36 #include "ScriptState.h"
    37 
    38 #include <wtf/Noncopyable.h>
    3936
    4037namespace WebCore {
    4138
    42 class ScriptProfiler : public Noncopyable {
     39class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> {
    4340public:
    44     static void start(ScriptState* state, const String& title);
    45     static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
    46     static void takeHeapSnapshot();
    47     static long getProfilerLogLines(long position, String* data);
    48     static bool isProfilerAlwaysEnabled();
     41    virtual ~ScriptHeapSnapshot() {}
     42
     43    String title() const { return ""; }
     44    unsigned int uid() const { return 0; }
     45
     46    PassRefPtr<InspectorObject> buildInspectorObjectForHead() const { return InspectorObject::create(); }
     47
     48private:
     49    ScriptHeapSnapshot() {}
    4950};
    5051
    5152} // namespace WebCore
    5253
    53 #endif // ScriptProfiler_h
     54#endif // ScriptHeapSnapshot_h
  • trunk/WebCore/bindings/js/ScriptProfiler.h

    r65797 r66117  
    2929
    3030#if ENABLE(JAVASCRIPT_DEBUGGER)
     31#include "ScriptHeapSnapshot.h"
    3132#include "ScriptProfile.h"
    3233#include "ScriptState.h"
     
    4041    static void start(ScriptState* state, const String& title);
    4142    static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
    42     static void takeHeapSnapshot() { }
    43     static long getProfilerLogLines(long, String*) { return 0; }
     43    static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String&) { return 0; }
    4444    static bool isProfilerAlwaysEnabled();
    4545};
  • trunk/WebCore/bindings/v8/ScriptHeapSnapshot.h

    r66116 r66117  
    2929 */
    3030
    31 #ifndef ScriptProfiler_h
    32 #define ScriptProfiler_h
     31#ifndef ScriptHeapSnapshot_h
     32#define ScriptHeapSnapshot_h
    3333
    3434#include "PlatformString.h"
    35 #include "ScriptProfile.h"
    36 #include "ScriptState.h"
    3735
    38 #include <wtf/Noncopyable.h>
     36namespace v8 {
     37class HeapSnapshot;
     38}
    3939
    4040namespace WebCore {
    4141
    42 class ScriptProfiler : public Noncopyable {
     42class InspectorObject;
     43
     44class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> {
    4345public:
    44     static void start(ScriptState* state, const String& title);
    45     static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
    46     static void takeHeapSnapshot();
    47     static long getProfilerLogLines(long position, String* data);
    48     static bool isProfilerAlwaysEnabled();
     46    static PassRefPtr<ScriptHeapSnapshot> create(const v8::HeapSnapshot* snapshot)
     47    {
     48        return adoptRef(new ScriptHeapSnapshot(snapshot));
     49    }
     50    virtual ~ScriptHeapSnapshot() {}
     51
     52    String title() const;
     53    unsigned int uid() const;
     54
     55    PassRefPtr<InspectorObject> buildInspectorObjectForHead() const;
     56
     57private:
     58    ScriptHeapSnapshot(const v8::HeapSnapshot* snapshot)
     59        : m_snapshot(snapshot)
     60    {}
     61
     62    const v8::HeapSnapshot* m_snapshot;
    4963};
    5064
    5165} // namespace WebCore
    5266
    53 #endif // ScriptProfiler_h
     67#endif // ScriptHeapSnapshot_h
  • trunk/WebCore/bindings/v8/ScriptProfile.cpp

    r66098 r66117  
    7676    }
    7777    result->setArray("children", children);
    78     return result;
     78    return result.release();
    7979}
    8080
  • trunk/WebCore/bindings/v8/ScriptProfiler.cpp

    r65797 r66117  
    3030
    3131#include "config.h"
     32#include "ScriptProfiler.h"
    3233
    33 #include "ScriptProfiler.h"
     34#include "InspectorValues.h"
    3435#include "ScriptString.h"
    3536
     
    5354}
    5455
    55 void ScriptProfiler::takeHeapSnapshot()
     56PassRefPtr<ScriptHeapSnapshot> ScriptProfiler::takeHeapSnapshot(const String& title)
    5657{
    57     v8::V8::ResumeProfilerEx(v8::PROFILER_MODULE_HEAP_SNAPSHOT
    58                              | v8::PROFILER_MODULE_HEAP_STATS
    59                              | v8::PROFILER_MODULE_JS_CONSTRUCTORS);
    60 }
    61 
    62 long ScriptProfiler::getProfilerLogLines(long position, String* data)
    63 {
    64     static char buffer[65536];
    65     const int readSize = v8::V8::GetLogLines(position, buffer, sizeof(buffer) - 1);
    66     buffer[readSize] = '\0';
    67     position += readSize;
    68     *data = buffer;
    69     return position;
     58    v8::HandleScope hs;
     59    const v8::HeapSnapshot* snapshot = v8::HeapProfiler::TakeSnapshot(v8String(title), v8::HeapSnapshot::kAggregated);
     60    return snapshot ? ScriptHeapSnapshot::create(snapshot) : 0;
    7061}
    7162
  • trunk/WebCore/bindings/v8/ScriptProfiler.h

    r65797 r66117  
    3333
    3434#include "PlatformString.h"
     35#include "ScriptHeapSnapshot.h"
    3536#include "ScriptProfile.h"
    3637#include "ScriptState.h"
     
    4041namespace WebCore {
    4142
     43class InspectorObject;
     44
    4245class ScriptProfiler : public Noncopyable {
    4346public:
    4447    static void start(ScriptState* state, const String& title);
    4548    static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
    46     static void takeHeapSnapshot();
    47     static long getProfilerLogLines(long position, String* data);
     49    static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String& title);
    4850    static bool isProfilerAlwaysEnabled();
    4951};
  • trunk/WebCore/inspector/Inspector.idl

    r66106 r66117  
    151151
    152152        [handler=Profiler] void getProfileHeaders(out Array headers);
    153         [handler=Profiler] void getProfile(in unsigned long uid, out Object profile);
    154 
    155         [handler=Profiler] void removeProfile(in unsigned long uid);
     153        [handler=Profiler] void getProfile(in String type, in unsigned long uid, out Object profile);
     154
     155        [handler=Profiler] void removeProfile(in String type, in unsigned long uid);
    156156        [handler=Profiler] void clearProfiles();
    157157
    158         [handler=Backend] void takeHeapSnapshot();
    159         [handler=Backend] void getProfilerLogLines(in long inPosition, out long outPosition, out String log);
     158        [handler=Profiler] void takeHeapSnapshot();
    160159#endif
    161160        [handler=Backend] void setInjectedScriptSource(in String scriptSource);
  • trunk/WebCore/inspector/InspectorBackend.cpp

    r65891 r66117  
    6969}
    7070
    71 void InspectorBackend::takeHeapSnapshot()
    72 {
    73     ScriptProfiler::takeHeapSnapshot();
    74 }
    75 
    76 void InspectorBackend::getProfilerLogLines(long position, long* outPosition, String* data)
    77 {
    78     // FIXME: we should make inspector dispatcher pluggable, so that embedders could contribute APIs instead of polluting the core one
    79     // https://bugs.webkit.org/show_bug.cgi?id=43357
    80     *outPosition = ScriptProfiler::getProfilerLogLines(position, data);
    81 }
    8271#endif
    8372
  • trunk/WebCore/inspector/InspectorBackend.h

    r65891 r66117  
    6161#if ENABLE(JAVASCRIPT_DEBUGGER)
    6262    void enableDebugger(bool always);
    63     void takeHeapSnapshot();
    64     void getProfilerLogLines(long position, long* outPosition, String* data);
    6563#endif
    6664
  • trunk/WebCore/inspector/InspectorProfilerAgent.cpp

    r65891 r66117  
    4040#include "Page.h"
    4141#include "ScriptDebugServer.h"
     42#include "ScriptHeapSnapshot.h"
    4243#include "ScriptProfile.h"
    4344#include "ScriptProfiler.h"
     
    5253static const char* const UserInitiatedProfileName = "org.webkit.profiles.user-initiated";
    5354static const char* const CPUProfileType = "CPU";
     55static const char* const HeapProfileType = "HEAP";
    5456
    5557PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InspectorController* inspectorController)
     
    6668    , m_currentUserInitiatedProfileNumber(-1)
    6769    , m_nextUserInitiatedProfileNumber(1)
     70    , m_nextUserInitiatedHeapSnapshotNumber(1)
    6871{
    6972}
     
    105108}
    106109
     110PassRefPtr<InspectorObject> InspectorProfilerAgent::createSnapshotHeader(const ScriptHeapSnapshot& snapshot)
     111{
     112    RefPtr<InspectorObject> header = InspectorObject::create();
     113    header->setString("title", snapshot.title());
     114    header->setNumber("uid", snapshot.uid());
     115    header->setString("typeId", String(HeapProfileType));
     116    return header;
     117}
     118
    107119void InspectorProfilerAgent::disable()
    108120{
     
    139151    for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it)
    140152        (*headers)->pushObject(createProfileHeader(*it->second));
    141 }
    142 
    143 void InspectorProfilerAgent::getProfile(unsigned uid, RefPtr<InspectorObject>* profileObject)
    144 {
    145     ProfilesMap::iterator it = m_profiles.find(uid);
    146     if (it != m_profiles.end()) {
    147         *profileObject = createProfileHeader(*it->second);
    148         (*profileObject)->setObject("head", it->second->buildInspectorObjectForHead());
    149     }
    150 }
    151 
    152 void InspectorProfilerAgent::removeProfile(unsigned uid)
    153 {
    154     if (m_profiles.contains(uid))
    155         m_profiles.remove(uid);
     153    HeapSnapshotsMap::iterator snapshotsEnd = m_snapshots.end();
     154    for (HeapSnapshotsMap::iterator it = m_snapshots.begin(); it != snapshotsEnd; ++it)
     155        (*headers)->pushObject(createSnapshotHeader(*it->second));
     156}
     157
     158void InspectorProfilerAgent::getProfile(const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject)
     159{
     160    if (type == CPUProfileType) {
     161        ProfilesMap::iterator it = m_profiles.find(uid);
     162        if (it != m_profiles.end()) {
     163            *profileObject = createProfileHeader(*it->second);
     164            (*profileObject)->setObject("head", it->second->buildInspectorObjectForHead());
     165        }
     166    } else if (type == HeapProfileType) {
     167        HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
     168        if (it != m_snapshots.end()) {
     169            *profileObject = createSnapshotHeader(*it->second);
     170            (*profileObject)->setObject("head", it->second->buildInspectorObjectForHead());
     171        }
     172    }
     173}
     174
     175void InspectorProfilerAgent::removeProfile(const String& type, unsigned uid)
     176{
     177    if (type == CPUProfileType) {
     178        if (m_profiles.contains(uid))
     179            m_profiles.remove(uid);
     180    } else if (type == HeapProfileType) {
     181        if (m_snapshots.contains(uid))
     182            m_snapshots.remove(uid);
     183    }
    156184}
    157185
     
    159187{
    160188    m_profiles.clear();
     189    m_snapshots.clear();
    161190    m_currentUserInitiatedProfileNumber = 1;
    162191    m_nextUserInitiatedProfileNumber = 1;
     192    m_nextUserInitiatedHeapSnapshotNumber = 1;
    163193    if (m_frontend)
    164194        m_frontend->resetProfilesPanel();
     
    200230}
    201231
     232void InspectorProfilerAgent::takeHeapSnapshot()
     233{
     234    String title = String::format("%s.%d", UserInitiatedProfileName, m_nextUserInitiatedHeapSnapshotNumber++);
     235    RefPtr<ScriptHeapSnapshot> snapshot = ScriptProfiler::takeHeapSnapshot(title);
     236    if (snapshot) {
     237        m_snapshots.add(snapshot->uid(), snapshot);
     238        if (m_frontend)
     239            m_frontend->addProfileHeader(createSnapshotHeader(*snapshot));
     240    }
     241}
     242
    202243void InspectorProfilerAgent::toggleRecordButton(bool isProfiling)
    203244{
  • trunk/WebCore/inspector/InspectorProfilerAgent.h

    r65891 r66117  
    4545class InspectorFrontend;
    4646class InspectorObject;
     47class ScriptHeapSnapshot;
    4748class ScriptProfile;
    4849
     
    6162    String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
    6263    void getProfileHeaders(RefPtr<InspectorArray>* headers);
    63     void getProfile(unsigned uid, RefPtr<InspectorObject>* profileObject);
     64    void getProfile(const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject);
    6465    bool isRecordingUserInitiatedProfile() { return m_recordingUserInitiatedProfile; }
    65     void removeProfile(unsigned uid);
     66    void removeProfile(const String& type, unsigned uid);
    6667    void resetState();
    6768    void setFrontend(InspectorFrontend* frontend) { m_frontend = frontend; }
     
    7071    void stopProfiling() { stopUserInitiatedProfiling(); }
    7172    void stopUserInitiatedProfiling();
     73    void takeHeapSnapshot();
    7274    void toggleRecordButton(bool isProfiling);
    7375
    7476private:
    7577    typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
     78    typedef HashMap<unsigned int, RefPtr<ScriptHeapSnapshot> > HeapSnapshotsMap;
    7679
    7780    InspectorProfilerAgent(InspectorController*);
    7881    PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile);
     82    PassRefPtr<InspectorObject> createSnapshotHeader(const ScriptHeapSnapshot& snapshot);
    7983
    8084    InspectorController* m_inspectorController;
     
    8488    int m_currentUserInitiatedProfileNumber;
    8589    unsigned m_nextUserInitiatedProfileNumber;
     90    unsigned m_nextUserInitiatedHeapSnapshotNumber;
    8691    ProfilesMap m_profiles;
     92    HeapSnapshotsMap m_snapshots;
    8793};
    8894
  • trunk/WebCore/inspector/front-end/HeapSnapshotView.js

    • Property svn:eol-style set to LF
    r66116 r66117  
    2929 */
    3030
    31 /**
    32  * @fileoverview Heap profiler panel implementation.
    33  */
    34 
    35 WebInspector.ProfilesPanel.prototype.addSnapshot = function(snapshot) {
    36     snapshot.title = WebInspector.UIString("Snapshot %d", snapshot.number);
    37     snapshot.typeId = WebInspector.HeapSnapshotProfileType.TypeId;
    38 
    39     var snapshots = WebInspector.HeapSnapshotProfileType.snapshots;
    40     snapshots.push(snapshot);
    41 
    42     snapshot.listIndex = snapshots.length - 1;
    43 
    44     if (WebInspector.CPUProfile)
    45         this.addProfileHeader(WebInspector.HeapSnapshotProfileType.TypeId, snapshot);
    46     else
    47         this.addProfileHeader(snapshot);
    48 
    49     this.dispatchEventToListeners("snapshot added");
    50 }
    51 
    52 
    5331WebInspector.HeapSnapshotView = function(parent, profile)
    5432{
     
    5836
    5937    this.parent = parent;
    60     this.parent.addEventListener("snapshot added", this._updateBaseOptions, this);
     38    this.parent.addEventListener("profile added", this._updateBaseOptions, this);
    6139
    6240    this.showCountAsPercent = false;
     
    9371    this.element.appendChild(summaryContainer);
    9472
    95     var columns = { "cons": { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
    96                     "count": { title: WebInspector.UIString("Count"), width: "54px", sortable: true },
    97                     "size": { title: WebInspector.UIString("Size"), width: "72px", sort: "descending", sortable: true },
    98                     "countDelta": { title: WebInspector.UIString("\xb1 Count"), width: "72px", sortable: true },
    99                     "sizeDelta": { title: WebInspector.UIString("\xb1 Size"), width: "72px", sortable: true } };
     73    var columns = {
     74        cons: { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
     75        count: { title: WebInspector.UIString("Count"), width: "54px", sortable: true },
     76        size: { title: WebInspector.UIString("Size"), width: "72px", sort: "descending", sortable: true },
     77        // \xb1 is a "plus-minus" sign.
     78        countDelta: { title: WebInspector.UIString("\xb1 Count"), width: "72px", sortable: true },
     79        sizeDelta: { title: WebInspector.UIString("\xb1 Size"), width: "72px", sortable: true }
     80    };
    10081
    10182    this.dataGrid = new WebInspector.DataGrid(columns);
     
    11091    this.baseSelectElement.addEventListener("change", this._changeBase.bind(this), false);
    11192    this._updateBaseOptions();
    112     if (this.profile.listIndex > 0)
    113         this.baseSelectElement.selectedIndex = this.profile.listIndex - 1;
    114     else
    115         this.baseSelectElement.selectedIndex = this.profile.listIndex;
    116     this._resetDataGridList();
    11793
    11894    this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item status-bar-item");
    11995    this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
    12096
    121     this.refresh();
    122 
    123     this._updatePercentButton();
    124 };
     97    this._loadProfile(this.profile, profileCallback.bind(this));
     98
     99    function profileCallback(profile)
     100    {
     101        var list = this._getProfiles();
     102        var profileIndex;
     103        for (var i = 0; i < list.length; ++i)
     104            if (list[i].uid === profile.uid) {
     105                profileIndex = i;
     106                break;
     107            }
     108        if (profileIndex > 0)
     109            this.baseSelectElement.selectedIndex = profileIndex - 1;
     110        else
     111            this.baseSelectElement.selectedIndex = profileIndex;
     112        this._resetDataGridList(resetCompleted.bind(this));
     113    }
     114
     115    function resetCompleted()
     116    {
     117        this.refresh();
     118        this._updatePercentButton();
     119    }
     120}
    125121
    126122WebInspector.HeapSnapshotView.prototype = {
    127 
    128123    get statusBarItems()
    129124    {
     
    265260        // so recursive expansion will be infinite, since a graph is being traversed.
    266261        // So default to a recursion cap of 2 levels.
    267         var maxDepth = 2;
     262        const maxDepth = 2;
    268263
    269264        while (current) {
     
    277272    },
    278273
     274    // FIXME: move these methods to a superclass, inherit both views from it.
    279275    jumpToFirstSearchResult: WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult,
    280276    jumpToLastSearchResult: WebInspector.CPUProfileView.prototype.jumpToLastSearchResult,
     
    295291    },
    296292
    297     _changeBase: function() {
    298         if (this.baseSnapshot === WebInspector.HeapSnapshotProfileType.snapshots[this.baseSelectElement.selectedIndex])
     293    _changeBase: function()
     294    {
     295        if (this.baseSnapshot.uid === this._getProfiles()[this.baseSelectElement.selectedIndex].uid)
    299296            return;
    300297
    301         this._resetDataGridList();
    302         this.refresh();
    303 
    304         if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
    305             return;
    306 
    307         // The current search needs to be performed again. First negate out previous match
    308         // count by calling the search finished callback with a negative number of matches.
    309         // Then perform the search again with the same query and callback.
    310         this._searchFinishedCallback(this, -this._searchResults.length);
    311         this.performSearch(this.currentQuery, this._searchFinishedCallback);
     298        this._resetDataGridList(resetCompleted.bind(this));
     299
     300        function resetCompleted() {
     301            this.refresh();
     302
     303            if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
     304                return;
     305
     306            // The current search needs to be performed again. First negate out previous match
     307            // count by calling the search finished callback with a negative number of matches.
     308            // Then perform the search again with the same query and callback.
     309            this._searchFinishedCallback(this, -this._searchResults.length);
     310            this.performSearch(this.currentQuery, this._searchFinishedCallback);
     311        }
    312312    },
    313313
     
    319319        this._snapshotDataGridList = new WebInspector.HeapSnapshotDataGridList(this, this.baseSnapshot.entries, this.profile.entries);
    320320        return this._snapshotDataGridList;
     321    },
     322
     323    _getProfiles: function()
     324    {
     325        return WebInspector.panels.profiles.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
     326    },
     327
     328    _loadProfile: function(profile, callback)
     329    {
     330        if (profile._loaded) {
     331            callback(profile);
     332            return;
     333        }
     334
     335        InspectorBackend.getProfile(profile.typeId, profile.uid, loadedCallback.bind(this));
     336
     337        function loadedCallback(loadedSnapshot) {
     338            profile.children = loadedSnapshot.head.children;
     339            profile.entries = loadedSnapshot.head.entries;
     340            profile.lowlevels = loadedSnapshot.head.lowlevels;
     341            this._prepareProfile(profile);
     342            profile._loaded = true;
     343            this.parent.updateProfile(profile);
     344            callback(profile);
     345        }
    321346    },
    322347
     
    360385    },
    361386
    362     _resetDataGridList: function()
    363     {
    364         this.baseSnapshot = WebInspector.HeapSnapshotProfileType.snapshots[this.baseSelectElement.selectedIndex];
    365         var lastComparator = WebInspector.HeapSnapshotDataGridList.propertyComparator("size", false);
    366         if (this.snapshotDataGridList)
    367             lastComparator = this.snapshotDataGridList.lastComparator;
    368         this.snapshotDataGridList = this._createSnapshotDataGridList();
    369         this.snapshotDataGridList.sort(lastComparator, true);
     387    _prepareProfile: function(profile)
     388    {
     389        for (var profileEntry in profile.entries)
     390            profile.entries[profileEntry].retainers = {};
     391        profile.clusters = {};
     392
     393        for (var addr in profile.children) {
     394            var retainer = profile.children[addr];
     395            var retainerId = retainer.constructorName + ':' + addr;
     396            for (var childAddr in retainer) {
     397                if (childAddr === 'constructorName') continue;
     398                var item = retainer[childAddr];
     399                var itemId = item.constructorName + ':' + childAddr;
     400                if ((item.constructorName === 'Object' || item.constructorName === 'Array')) {
     401                    if (!(itemId in profile.clusters))
     402                        profile.clusters[itemId] = { constructorName: itemId, retainers: {} };
     403                    mergeRetainers(profile.clusters[itemId], item);
     404                }
     405                mergeRetainers(profile.entries[item.constructorName], item);
     406            }
     407        }
     408
     409        function mergeRetainers(entry, item)
     410        {
     411            if (!(retainer.constructorName in entry.retainers))
     412               entry.retainers[retainer.constructorName] = { constructorName: retainer.constructorName, count: 0, clusters: {} };
     413            var retainerEntry = entry.retainers[retainer.constructorName];
     414            retainerEntry.count += item.count;
     415            if (retainer.constructorName === 'Object' || retainer.constructorName === 'Array')
     416                retainerEntry.clusters[retainerId] = true;
     417        }
     418    },
     419
     420    _resetDataGridList: function(callback)
     421    {
     422        this._loadProfile(this._getProfiles()[this.baseSelectElement.selectedIndex], profileLoaded.bind(this));
     423
     424        function profileLoaded(profile)
     425        {
     426            this.baseSnapshot = profile;
     427            var lastComparator = WebInspector.HeapSnapshotDataGridList.propertyComparator("size", false);
     428            if (this.snapshotDataGridList)
     429                lastComparator = this.snapshotDataGridList.lastComparator;
     430            this.snapshotDataGridList = this._createSnapshotDataGridList();
     431            this.snapshotDataGridList.sort(lastComparator, true);
     432            callback();
     433        }
    370434    },
    371435
     
    375439        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
    376440        var sortProperty = {
    377                 "cons": ["constructorName", null],
    378                 "count": ["count", null],
    379                 "size": ["size", "count"],
    380                 "countDelta": this.showCountDeltaAsPercent ? ["countDeltaPercent", null] : ["countDelta", null],
    381                 "sizeDelta": this.showSizeDeltaAsPercent ? ["sizeDeltaPercent", "countDeltaPercent"] : ["sizeDelta", "sizeDeltaPercent"]
     441            cons: ["cons", null],
     442            count: ["count", null],
     443            size: ["size", "count"],
     444            countDelta: this.showCountDeltaAsPercent ? ["countDeltaPercent", null] : ["countDelta", null],
     445            sizeDelta: this.showSizeDeltaAsPercent ? ["sizeDeltaPercent", "countDeltaPercent"] : ["sizeDelta", "sizeDeltaPercent"]
    382446        }[sortColumnIdentifier];
    383447
     
    389453    _updateBaseOptions: function()
    390454    {
    391         var list = WebInspector.HeapSnapshotProfileType.snapshots;
     455        var list = this._getProfiles();
    392456        // We're assuming that snapshots can only be added.
    393457        if (this.baseSelectElement.length === list.length)
     
    396460        for (var i = this.baseSelectElement.length, n = list.length; i < n; ++i) {
    397461            var baseOption = document.createElement("option");
    398             baseOption.label = WebInspector.UIString("Compared to %s", list[i].title);
     462            var title = list[i].title;
     463            if (!title.indexOf(UserInitiatedProfileName))
     464                title = WebInspector.UIString("Snapshot %d", title.substring(UserInitiatedProfileName.length + 1));
     465            baseOption.label = WebInspector.UIString("Compared to %s", title);
    399466            this.baseSelectElement.appendChild(baseOption);
    400467        }
     
    426493WebInspector.HeapSnapshotView.SearchHelper = {
    427494    // In comparators, we assume that a value from a node is passed as the first parameter.
    428     operations: { LESS: function (a, b) { return a !== null && a < b; },
    429                   LESS_OR_EQUAL: function (a, b) { return a !== null && a <= b; },
    430                   EQUAL: function (a, b) { return a !== null && a === b; },
    431                   GREATER_OR_EQUAL: function (a, b) { return a !== null && a >= b; },
    432                   GREATER: function (a, b) { return a !== null && a > b; } },
    433 
    434     operationParsers: { LESS: /^<(\d+)/,
    435                         LESS_OR_EQUAL: /^<=(\d+)/,
    436                         GREATER_OR_EQUAL: /^>=(\d+)/,
    437                         GREATER: /^>(\d+)/ },
     495    operations: {
     496        LESS: function (a, b) { return a !== null && a < b; },
     497        LESS_OR_EQUAL: function (a, b) { return a !== null && a <= b; },
     498        EQUAL: function (a, b) { return a !== null && a === b; },
     499        GREATER_OR_EQUAL: function (a, b) { return a !== null && a >= b; },
     500        GREATER: function (a, b) { return a !== null && a > b; }
     501    },
     502
     503    operationParsers: {
     504        LESS: /^<(\d+)/,
     505        LESS_OR_EQUAL: /^<=(\d+)/,
     506        GREATER_OR_EQUAL: /^>=(\d+)/,
     507        GREATER: /^>(\d+)/
     508    },
    438509
    439510    parseOperationAndNumber: function(query)
     
    467538    computeSummaryValues: function(lowLevels)
    468539    {
    469         var highLevels = {data: 0, code: 0};
     540        var highLevels = { data: 0, code: 0 };
    470541        this.total = 0;
    471542        for (var item in lowLevels) {
     
    477548            }
    478549        }
    479         var result = {categoryValues: highLevels};
     550        var result = { categoryValues: highLevels };
    480551        if (!this.showAsPercent)
    481552            result.total = this.total;
     
    508579
    509580WebInspector.HeapSummaryCountCalculator.prototype = {
    510     _highFromLow: function(type) {
     581    _highFromLow: function(type)
     582    {
    511583        if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE") return "code";
    512584        if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/)) return "data";
     
    514586    },
    515587
    516     _valueToString: function(value) {
     588    _valueToString: function(value)
     589    {
    517590        return value.toString();
    518591    }
     
    527600
    528601WebInspector.HeapSummarySizeCalculator.prototype = {
    529     _highFromLow: function(type) {
    530         if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE") return "code";
    531         if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/) || type.match(/_ARRAY_TYPE$/)) return "data";
     602    _highFromLow: function(type)
     603    {
     604        if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE")
     605            return "code";
     606        if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/) || type.match(/_ARRAY_TYPE$/))
     607            return "data";
    532608        return null;
    533609    },
     
    537613
    538614WebInspector.HeapSummarySizeCalculator.prototype.__proto__ = WebInspector.HeapSummaryCalculator.prototype;
    539 
    540 WebInspector.HeapSnapshotSidebarTreeElement = function(snapshot)
    541 {
    542     this.profile = snapshot;
    543 
    544     WebInspector.SidebarTreeElement.call(this, "heap-snapshot-sidebar-tree-item", "", "", snapshot, false);
    545 
    546     this.refreshTitles();
    547 };
    548 
    549 WebInspector.HeapSnapshotSidebarTreeElement.prototype = {
    550     get mainTitle()
    551     {
    552         if (this._mainTitle)
    553             return this._mainTitle;
    554         return this.profile.title;
    555     },
    556 
    557     set mainTitle(x)
    558     {
    559         this._mainTitle = x;
    560         this.refreshTitles();
    561     }
    562 };
    563 
    564 WebInspector.HeapSnapshotSidebarTreeElement.prototype.__proto__ = WebInspector.ProfileSidebarTreeElement.prototype;
    565615
    566616WebInspector.HeapSnapshotDataGridNodeWithRetainers = function(owningTree)
     
    594644    _populate: function(event)
    595645    {
    596         var self = this;
    597         this.produceDiff(this.baseRetainers, this.retainers, function(baseItem, snapshotItem) {
    598             self.appendChild(new WebInspector.HeapSnapshotDataGridRetainerNode(self.snapshotView, baseItem, snapshotItem, self.tree));
    599         });
     646        function appendDiffEntry(baseItem, snapshotItem)
     647        {
     648            this.appendChild(new WebInspector.HeapSnapshotDataGridRetainerNode(this.snapshotView, baseItem, snapshotItem, this.tree));
     649        }
     650
     651        this.produceDiff(this.baseRetainers, this.retainers, appendDiffEntry.bind(this));
    600652
    601653        if (this._parent) {
     
    642694            return "+";
    643695        else
    644             // Math minus sign, same width as plus.
    645             return "\u2212";
    646     },
    647 
    648     showDeltaAsPercent: function(value) {
     696            return "\u2212";  // Math minus sign, same width as plus.
     697    },
     698
     699    showDeltaAsPercent: function(value)
     700    {
    649701        if (value === Number.POSITIVE_INFINITY)
    650702            return WebInspector.UIString("new");
     
    656708    },
    657709
    658     getTotalCount: function() {
     710    getTotalCount: function()
     711    {
    659712        if (!this._count) {
    660713            this._count = 0;
     
    665718    },
    666719
    667     getTotalSize: function() {
     720    getTotalSize: function()
     721    {
    668722        if (!this._size) {
    669723            this._size = 0;
     
    763817
    764818    if (!snapshotEntry)
    765         snapshotEntry = { cons: baseEntry.cons, count: 0, size: 0, retainers: {} };
    766     this.constructorName = snapshotEntry.cons;
     819        snapshotEntry = { constructorName: baseEntry.constructorName, count: 0, size: 0, retainers: {} };
     820    this.constructorName = snapshotEntry.constructorName;
    767821    this.count = snapshotEntry.count;
    768822    this.size = snapshotEntry.size;
     
    809863    populateChildren: function(baseEntries, snapshotEntries)
    810864    {
    811         var self = this;
    812         this.produceDiff(baseEntries, snapshotEntries, function(baseItem, snapshotItem) {
    813             self.appendChild(new WebInspector.HeapSnapshotDataGridNode(self.snapshotView, baseItem, snapshotItem, self));
    814         });
     865        function appendListEntry(baseItem, snapshotItem)
     866        {
     867            this.appendChild(new WebInspector.HeapSnapshotDataGridNode(this.snapshotView, baseItem, snapshotItem, this));
     868        }
     869        this.produceDiff(baseEntries, snapshotEntries, appendListEntry.bind(this));
    815870    },
    816871
     
    845900
    846901    if (!snapshotEntry)
    847         snapshotEntry = { cons: baseEntry.cons, count: 0, clusters: {} };
    848     this.constructorName = snapshotEntry.cons;
     902        snapshotEntry = { constructorName: baseEntry.constructorName, count: 0, clusters: {} };
     903    this.constructorName = snapshotEntry.constructorName;
    849904    this.count = snapshotEntry.count;
    850905    this.retainers = this._calculateRetainers(this.snapshotView.profile, snapshotEntry.clusters);
     
    873928    },
    874929
    875     _calculateRetainers: function(snapshot, clusters) {
     930    _calculateRetainers: function(snapshot, clusters)
     931    {
    876932        var retainers = {};
    877933        if (this.isEmptySet(clusters)) {
     
    896952                        var clusterRetainerEntry = clusterRetainers[clusterRetainer];
    897953                        if (!(clusterRetainer in retainers))
    898                             retainers[clusterRetainer] = { cons: clusterRetainerEntry.cons, count: 0, clusters: {} };
     954                            retainers[clusterRetainer] = { constructorName: clusterRetainerEntry.constructorName, count: 0, clusters: {} };
    899955                        retainers[clusterRetainer].count += clusterRetainerEntry.count;
    900956                        for (var clusterRetainerCluster in clusterRetainerEntry.clusters)
     
    918974WebInspector.HeapSnapshotProfileType.TypeId = "HEAP";
    919975
    920 WebInspector.HeapSnapshotProfileType.snapshots = [];
    921 
    922976WebInspector.HeapSnapshotProfileType.prototype = {
    923977    get buttonTooltip()
     
    933987    buttonClicked: function()
    934988    {
    935         devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT);
     989        InspectorBackend.takeHeapSnapshot();
    936990    },
    937991
     
    943997    createSidebarTreeElementForProfile: function(profile)
    944998    {
    945         var element = new WebInspector.HeapSnapshotSidebarTreeElement(profile);
    946         element.small = false;
    947         return element;
     999        return new WebInspector.ProfileSidebarTreeElement(profile, WebInspector.UIString("Snapshot %d"), "heap-snapshot-sidebar-tree-item");
    9481000    },
    9491001
     
    9551007
    9561008WebInspector.HeapSnapshotProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype;
    957 
    958 
    959 (function() {
    960     var originalCreatePanels = WebInspector._createPanels;
    961     WebInspector._createPanels = function() {
    962         originalCreatePanels.apply(this, arguments);
    963         if (WebInspector.panels.profiles)
    964             WebInspector.panels.profiles.registerProfileType(new WebInspector.HeapSnapshotProfileType());
    965     }
    966 })();
  • trunk/WebCore/inspector/front-end/ProfileView.js

    r66087 r66117  
    9595    }
    9696
    97     InspectorBackend.getProfile(this.profile.uid, profileCallback);
     97    InspectorBackend.getProfile(this.profile.typeId, this.profile.uid, profileCallback);
    9898}
    9999
     
    611611    createSidebarTreeElementForProfile: function(profile)
    612612    {
    613         return new WebInspector.ProfileSidebarTreeElement(profile);
     613        return new WebInspector.ProfileSidebarTreeElement(profile, WebInspector.UIString("Profile %d"), "profile-sidebar-tree-item");
    614614    },
    615615
  • trunk/WebCore/inspector/front-end/ProfilesPanel.js

    r66112 r66117  
    321321            if (!this.visibleView)
    322322                this.showProfile(profile);
     323            this.dispatchEventToListeners("profile added");
    323324        }
    324325    },
     
    345346
    346347        if (!profile.isTemporary)
    347             InspectorBackend.removeProfile(profile.uid);
     348            InspectorBackend.removeProfile(profile.typeId, profile.uid);
    348349
    349350        // No other item will be selected if there aren't any other profiles, so
     
    374375        for (var i = 0; i < statusBarItems.length; ++i)
    375376            this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
     377    },
     378
     379    getProfiles: function(typeId)
     380    {
     381        var result = [];
     382        var profilesCount = this._profiles.length;
     383        for (var i = 0; i < profilesCount; ++i)
     384            if (this._profiles[i].typeId === typeId)
     385                result.push(this._profiles[i]);
     386        return result;
     387    },
     388
     389    updateProfile: function(profile)
     390    {
     391        var profilesCount = this._profiles.length;
     392        for (var i = 0; i < profilesCount; ++i)
     393            if (this._profiles[i].typeId === profile.typeId
     394                && this._profiles[i].uid === profile.uid) {
     395                this._profiles[i] = profile;
     396                break;
     397            }
    376398    },
    377399
     
    536558WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
    537559
    538 WebInspector.ProfileSidebarTreeElement = function(profile)
     560WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, className)
    539561{
    540562    this.profile = profile;
     563    this._titleFormat = titleFormat;
    541564
    542565    if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)
    543566        this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1);
    544567
    545     WebInspector.SidebarTreeElement.call(this, "profile-sidebar-tree-item", "", "", profile, false);
     568    WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false);
    546569
    547570    this.refreshTitles();
     
    565588            return this._mainTitle;
    566589        if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)
    567             return WebInspector.UIString("Profile %d", this._profileNumber);
     590            return WebInspector.UIString(this._titleFormat, this._profileNumber);
    568591        return this.profile.title;
    569592    },
  • trunk/WebCore/inspector/front-end/WebKit.qrc

    r65608 r66117  
    4141    <file>FontView.js</file>
    4242    <file>HAREntry.js</file>
     43    <file>HeapSnapshotView.js</file>
    4344    <file>HelpScreen.js</file>
    4445    <file>ImageView.js</file>
  • trunk/WebCore/inspector/front-end/inspector.css

    r65905 r66117  
    39113911}
    39123912
     3913/* Heap Snapshot View Styles */
     3914
     3915/* FIXME: move to a separate css file */
     3916.heap-snapshot-sidebar-tree-item .icon {
     3917    content: url(Images/profileIcon.png);
     3918}
     3919
     3920.heap-snapshot-sidebar-tree-item.small .icon {
     3921    content: url(Images/profileSmallIcon.png);
     3922}
     3923
     3924.heap-snapshot-view {
     3925    display: none;
     3926    overflow: hidden;
     3927    position: absolute;
     3928    top: 0;
     3929    left: 0;
     3930    right: 0;
     3931    bottom: 0;
     3932}
     3933
     3934.heap-snapshot-view.visible {
     3935    display: block;
     3936}
     3937
     3938.heap-snapshot-view .data-grid {
     3939    border: none;
     3940    max-height: 100%;
     3941    position: absolute;
     3942    left: 0;
     3943    right: 0;
     3944    top: 0;
     3945    bottom: 93px;
     3946}
     3947
     3948.heap-snapshot-view .data-grid th.count-column {
     3949    text-align: center;
     3950}
     3951
     3952.heap-snapshot-view .data-grid td.count-column {
     3953    text-align: right;
     3954}
     3955
     3956.heap-snapshot-view .data-grid th.size-column {
     3957    text-align: center;
     3958}
     3959
     3960.heap-snapshot-view .data-grid td.size-column {
     3961    text-align: right;
     3962}
     3963
     3964.heap-snapshot-view .data-grid th.countDelta-column {
     3965    text-align: center;
     3966}
     3967
     3968.heap-snapshot-view .data-grid td.countDelta-column {
     3969    text-align: right;
     3970}
     3971
     3972.heap-snapshot-view .data-grid th.sizeDelta-column {
     3973    text-align: center;
     3974}
     3975
     3976.heap-snapshot-view .data-grid td.sizeDelta-column {
     3977    text-align: right;
     3978}
     3979
     3980#heap-snapshot-summary-container {
     3981    position: absolute;
     3982    padding-top: 20px;
     3983    bottom: 0;
     3984    left: 0;
     3985    right: 0;
     3986    height: 93px;
     3987    margin-left: -1px;
     3988    border-left: 1px solid rgb(102, 102, 102);
     3989    background-color: rgb(101, 111, 130);
     3990    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));
     3991    background-repeat: repeat-x;
     3992    background-position: top;
     3993    text-align: center;
     3994    text-shadow: black 0 1px 1px;
     3995    white-space: nowrap;
     3996    color: white;
     3997    -webkit-background-size: 1px 6px;
     3998    -webkit-background-origin: padding;
     3999    -webkit-background-clip: padding;
     4000}
     4001
     4002.heap-snapshot-summary {
     4003    display: inline-block;
     4004    width: 50%;
     4005    min-width: 300px;
     4006    position: relative;
     4007}
     4008
     4009.heap-snapshot-summary canvas.summary-graph {
     4010    width: 225px;
     4011}
     4012
     4013.heap-snapshot-summary-label {
     4014    font-size: 12px;
     4015    font-weight: bold;
     4016    position: absolute;
     4017    top: 1px;
     4018    width: 50%;
     4019    left: 25%;
     4020}
     4021
    39134022.delete-storage-status-bar-item .glyph {
    39144023    -webkit-mask-image: url(Images/excludeButtonGlyph.png);
  • trunk/WebCore/inspector/front-end/inspector.html

    r65248 r66117  
    126126    <script type="text/javascript" src="TopDownProfileDataGridTree.js"></script>
    127127    <script type="text/javascript" src="ProfileView.js"></script>
     128    <script type="text/javascript" src="HeapSnapshotView.js"></script>
    128129    <script type="text/javascript" src="DOMAgent.js"></script>
    129130    <script type="text/javascript" src="InjectedScript.js"></script>
  • trunk/WebCore/inspector/front-end/inspector.js

    r66106 r66117  
    234234            this.panels.profiles = new WebInspector.ProfilesPanel();
    235235            this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType());
     236            if (Preferences.heapProfilerPresent)
     237                this.panels.profiles.registerProfileType(new WebInspector.HeapSnapshotProfileType());
    236238        }
    237239        if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1)
  • trunk/WebKit/chromium/ChangeLog

    r66106 r66117  
     12010-08-26  Mikhail Naganov  <mnaganov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Store heap snapshots in InspectorProfilerAgent.
     6
     7        Change the way heap snapshots are transported to Inspector
     8        to be aligned with CPU profiles. As a result, the Heap snapshots
     9        view of Profiles panel was upstreamed into WebCore.
     10
     11        https://bugs.webkit.org/show_bug.cgi?id=44531
     12
     13        * DEPS:
     14        * WebKit.gypi:
     15        * src/js/DevTools.js:
     16        ():
     17        * src/js/HeapProfilerPanel.js: Removed.
     18        * src/js/ProfilerAgent.js: Removed.
     19        * src/js/ProfilerProcessor.js: Removed.
     20        * src/js/devTools.css:
     21
    1222010-08-26  Yury Semikhatsky  <yurys@chromium.org>
    223
  • trunk/WebKit/chromium/DEPS

    r65991 r66117  
    3333vars = {
    3434  'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
    35   'chromium_rev': '57298',
     35  'chromium_rev': '57489',
    3636}
    3737
  • trunk/WebKit/chromium/WebKit.gypi

    r64124 r66117  
    3434        # for copying them to resource dir, and for generating 'devtools.html' file.
    3535        'devtools_js_files': [
    36             'src/js/ProfilerAgent.js',
    37             'src/js/ProfilerProcessor.js',
    38             'src/js/HeapProfilerPanel.js',
    3936            'src/js/DevTools.js',
    4037            'src/js/DevToolsHostStub.js',
  • trunk/WebKit/chromium/src/js/DevTools.js

    r65731 r66117  
    3535 * WebInspector functionality while it is getting upstreamed into WebCore.
    3636 */
    37 devtools.ToolsAgent = function()
    38 {
    39     this.profilerAgent_ = new devtools.ProfilerAgent();
    40 };
    41 
    42 
    43 /**
    44  * @return {devtools.ProfilerAgent} Profiler agent instance.
    45  */
    46 devtools.ToolsAgent.prototype.getProfilerAgent = function()
    47 {
    48     return this.profilerAgent_;
    49 };
    50 
    51 
    52 
    53 /**
    54  * Global instance of the tools agent.
    55  * @type {devtools.ToolsAgent}
    56  */
    57 devtools.tools = null;
    58 
    5937
    6038var context = {};  // Used by WebCore's inspector routines.
    6139
    62 ///////////////////////////////////////////////////////////////////////////////
    63 // Here and below are overrides to existing WebInspector methods only.
    64 // TODO(pfeldman): Patch WebCore and upstream changes.
    65 var oldLoaded = WebInspector.loaded;
    66 WebInspector.loaded = function()
    67 {
    68     devtools.tools = new devtools.ToolsAgent();
    69 
     40(function () {
    7041    Preferences.ignoreWhitespace = false;
    7142    Preferences.samplingCPUProfiler = true;
     
    7647    Preferences.onlineDetectionEnabled = false;
    7748    Preferences.domBreakpointsEnabled = true;
    78 
    79     oldLoaded.call(WebInspector);
    80 }
     49})();
    8150
    8251devtools.domContentLoaded = function()
     
    8958
    9059
     60// FIXME: This needs to be upstreamed.
    9161(function InterceptProfilesPanelEvents()
    9262{
     
    9464    WebInspector.ProfilesPanel.prototype.show = function()
    9565    {
    96         devtools.tools.getProfilerAgent().initializeProfiling();
    9766        this.enableToggleButton.visible = false;
    9867        oldShow.call(this);
  • trunk/WebKit/chromium/src/js/devTools.css

    r63547 r66117  
    3636    font-weight: normal;
    3737    line-height: 12px;
    38 }
    39 
    40 /* Heap Profiler Styles */
    41 
    42 .heap-snapshot-status-bar-item .glyph {
    43     -webkit-mask-image: url(Images/focusButtonGlyph.png);
    44 }
    45 
    46 .heap-snapshot-sidebar-tree-item .icon {
    47     content: url(Images/profileIcon.png);
    48 }
    49 
    50 .heap-snapshot-sidebar-tree-item.small .icon {
    51     content: url(Images/profileSmallIcon.png);
    52 }
    53 
    54 .heap-snapshot-view {
    55     display: none;
    56     overflow: hidden;
    57     position: absolute;
    58     top: 0;
    59     left: 0;
    60     right: 0;
    61     bottom: 0;
    62 }
    63 
    64 .heap-snapshot-view.visible {
    65     display: block;
    66 }
    67 
    68 .heap-snapshot-view .data-grid {
    69     border: none;
    70     max-height: 100%;
    71     position: absolute;
    72     left: 0;
    73     right: 0;
    74     top: 0;
    75     bottom: 93px;
    76 }
    77 
    78 .heap-snapshot-view .data-grid th.count-column {
    79     text-align: center;
    80 }
    81 
    82 .heap-snapshot-view .data-grid td.count-column {
    83     text-align: right;
    84 }
    85 
    86 .heap-snapshot-view .data-grid th.size-column {
    87     text-align: center;
    88 }
    89 
    90 .heap-snapshot-view .data-grid td.size-column {
    91     text-align: right;
    92 }
    93 
    94 .heap-snapshot-view .data-grid th.countDelta-column {
    95     text-align: center;
    96 }
    97 
    98 .heap-snapshot-view .data-grid td.countDelta-column {
    99     text-align: right;
    100 }
    101 
    102 .heap-snapshot-view .data-grid th.sizeDelta-column {
    103     text-align: center;
    104 }
    105 
    106 .heap-snapshot-view .data-grid td.sizeDelta-column {
    107     text-align: right;
    108 }
    109 
    110 #heap-snapshot-summary-container {
    111     position: absolute;
    112     padding-top: 20px;
    113     bottom: 0;
    114     left: 0;
    115     right: 0;
    116     height: 93px;
    117     margin-left: -1px;
    118     border-left: 1px solid rgb(102, 102, 102);
    119     background-color: rgb(101, 111, 130);
    120     background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));
    121     background-repeat: repeat-x;
    122     background-position: top;
    123     text-align: center;
    124     text-shadow: black 0 1px 1px;
    125     white-space: nowrap;
    126     color: white;
    127     -webkit-background-size: 1px 6px;
    128     -webkit-background-origin: padding;
    129     -webkit-background-clip: padding;
    130 }
    131 
    132 .heap-snapshot-summary {
    133     display: inline-block;
    134     width: 50%;
    135     min-width: 300px;
    136     position: relative;
    137 }
    138 
    139 .heap-snapshot-summary canvas.summary-graph {
    140     width: 225px;
    141 }
    142 
    143 .heap-snapshot-summary-label {
    144     font-size: 12px;
    145     font-weight: bold;
    146     position: absolute;
    147     top: 1px;
    148     width: 50%;
    149     left: 25%;
    15038}
    15139
Note: See TracChangeset for help on using the changeset viewer.