Changeset 66117 in webkit
- Timestamp:
- Aug 26, 2010 11:27:24 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 deleted
- 27 edited
- 2 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r66115 r66117 1 2010-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 1 170 2010-08-25 David Hyatt <hyatt@apple.com> 2 171 -
trunk/WebCore/GNUmakefile.am
r66108 r66117 774 774 WebCore/bindings/js/ScriptGCEvent.cpp \ 775 775 WebCore/bindings/js/ScriptGCEvent.h \ 776 WebCore/bindings/js/ScriptHeapSnapshot.h \ 776 777 WebCore/bindings/js/ScriptInstance.h \ 777 778 WebCore/bindings/js/ScriptObject.cpp \ -
trunk/WebCore/WebCore.gypi
r66037 r66117 855 855 'bindings/v8/ScriptGCEvent.cpp', 856 856 'bindings/v8/ScriptGCEvent.h', 857 'bindings/v8/ScriptHeapSnapshot.cpp', 858 'bindings/v8/ScriptHeapSnapshot.h', 857 859 'bindings/v8/ScriptInstance.cpp', 858 860 'bindings/v8/ScriptInstance.h', … … 4181 4183 'inspector/front-end/FontView.js', 4182 4184 'inspector/front-end/HAREntry.js', 4185 'inspector/front-end/HeapSnapshotView.js', 4183 4186 'inspector/front-end/HelpScreen.js', 4184 4187 'inspector/front-end/ImageView.js', -
trunk/WebCore/WebCore.pro
r66037 r66117 1157 1157 bindings/js/ScriptFunctionCall.h \ 1158 1158 bindings/js/ScriptGCEvent.h \ 1159 bindings/js/ScriptHeapSnapshot.h \ 1159 1160 bindings/js/ScriptObject.h \ 1160 1161 bindings/js/ScriptProfile.h \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r66054 r66117 49237 49237 </File> 49238 49238 <File 49239 RelativePath="..\bindings\js\ScriptHeapSnapshot.h" 49240 > 49241 </File> 49242 <File 49239 49243 RelativePath="..\bindings\js\ScriptInstance.h" 49240 49244 > … … 52166 52170 <File 52167 52171 RelativePath="..\inspector\front-end\inspectorSyntaxHighlight.css" 52172 > 52173 </File> 52174 <File 52175 RelativePath="..\inspector\front-end\HeapSnapshotView.js" 52168 52176 > 52169 52177 </File> -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r66037 r66117 2756 2756 9F0D6B2E121BFEBA006C0288 /* InspectorProfilerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F0D6B2C121BFEBA006C0288 /* InspectorProfilerAgent.cpp */; }; 2757 2757 9F0D6B2F121BFEBA006C0288 /* InspectorProfilerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F0D6B2D121BFEBA006C0288 /* InspectorProfilerAgent.h */; }; 2758 9F3B947E12241758005304E7 /* ScriptHeapSnapshot.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F3B947D12241758005304E7 /* ScriptHeapSnapshot.h */; }; 2758 2759 9F6FC1961122E82A00E80196 /* ScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */; }; 2759 2760 9F6FC1971122E82A00E80196 /* ScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 8624 8625 9F0D6B2C121BFEBA006C0288 /* InspectorProfilerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorProfilerAgent.cpp; sourceTree = "<group>"; }; 8625 8626 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>"; }; 8626 8628 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptDebugServer.cpp; sourceTree = "<group>"; }; 8627 8629 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugServer.h; sourceTree = "<group>"; }; … … 16124 16126 4FD8D0F0119C718B002FA825 /* ScriptGCEvent.cpp */, 16125 16127 4FD8D0F1119C718B002FA825 /* ScriptGCEvent.h */, 16128 9F3B947D12241758005304E7 /* ScriptHeapSnapshot.h */, 16126 16129 934CC1160EDCAC7300A658F2 /* ScriptInstance.h */, 16127 16130 41F066E30F64BCF600A07EAC /* ScriptObject.cpp */, … … 20373 20376 8947A83C122234F400D95F2D /* Metadata.h in Headers */, 20374 20377 8947A83D122234F900D95F2D /* MetadataCallback.h in Headers */, 20378 9F3B947E12241758005304E7 /* ScriptHeapSnapshot.h in Headers */, 20375 20379 ); 20376 20380 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/js/ScriptHeapSnapshot.h
r66116 r66117 29 29 */ 30 30 31 #ifndef Script Profiler_h32 #define Script Profiler_h31 #ifndef ScriptHeapSnapshot_h 32 #define ScriptHeapSnapshot_h 33 33 34 #include "InspectorValues.h" 34 35 #include "PlatformString.h" 35 #include "ScriptProfile.h"36 #include "ScriptState.h"37 38 #include <wtf/Noncopyable.h>39 36 40 37 namespace WebCore { 41 38 42 class Script Profiler : public Noncopyable{39 class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> { 43 40 public: 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 48 private: 49 ScriptHeapSnapshot() {} 49 50 }; 50 51 51 52 } // namespace WebCore 52 53 53 #endif // Script Profiler_h54 #endif // ScriptHeapSnapshot_h -
trunk/WebCore/bindings/js/ScriptProfiler.h
r65797 r66117 29 29 30 30 #if ENABLE(JAVASCRIPT_DEBUGGER) 31 #include "ScriptHeapSnapshot.h" 31 32 #include "ScriptProfile.h" 32 33 #include "ScriptState.h" … … 40 41 static void start(ScriptState* state, const String& title); 41 42 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; } 44 44 static bool isProfilerAlwaysEnabled(); 45 45 }; -
trunk/WebCore/bindings/v8/ScriptHeapSnapshot.h
r66116 r66117 29 29 */ 30 30 31 #ifndef Script Profiler_h32 #define Script Profiler_h31 #ifndef ScriptHeapSnapshot_h 32 #define ScriptHeapSnapshot_h 33 33 34 34 #include "PlatformString.h" 35 #include "ScriptProfile.h"36 #include "ScriptState.h"37 35 38 #include <wtf/Noncopyable.h> 36 namespace v8 { 37 class HeapSnapshot; 38 } 39 39 40 40 namespace WebCore { 41 41 42 class ScriptProfiler : public Noncopyable { 42 class InspectorObject; 43 44 class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> { 43 45 public: 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 57 private: 58 ScriptHeapSnapshot(const v8::HeapSnapshot* snapshot) 59 : m_snapshot(snapshot) 60 {} 61 62 const v8::HeapSnapshot* m_snapshot; 49 63 }; 50 64 51 65 } // namespace WebCore 52 66 53 #endif // Script Profiler_h67 #endif // ScriptHeapSnapshot_h -
trunk/WebCore/bindings/v8/ScriptProfile.cpp
r66098 r66117 76 76 } 77 77 result->setArray("children", children); 78 return result ;78 return result.release(); 79 79 } 80 80 -
trunk/WebCore/bindings/v8/ScriptProfiler.cpp
r65797 r66117 30 30 31 31 #include "config.h" 32 #include "ScriptProfiler.h" 32 33 33 #include " ScriptProfiler.h"34 #include "InspectorValues.h" 34 35 #include "ScriptString.h" 35 36 … … 53 54 } 54 55 55 void ScriptProfiler::takeHeapSnapshot()56 PassRefPtr<ScriptHeapSnapshot> ScriptProfiler::takeHeapSnapshot(const String& title) 56 57 { 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; 70 61 } 71 62 -
trunk/WebCore/bindings/v8/ScriptProfiler.h
r65797 r66117 33 33 34 34 #include "PlatformString.h" 35 #include "ScriptHeapSnapshot.h" 35 36 #include "ScriptProfile.h" 36 37 #include "ScriptState.h" … … 40 41 namespace WebCore { 41 42 43 class InspectorObject; 44 42 45 class ScriptProfiler : public Noncopyable { 43 46 public: 44 47 static void start(ScriptState* state, const String& title); 45 48 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); 48 50 static bool isProfilerAlwaysEnabled(); 49 51 }; -
trunk/WebCore/inspector/Inspector.idl
r66106 r66117 151 151 152 152 [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); 156 156 [handler=Profiler] void clearProfiles(); 157 157 158 [handler=Backend] void takeHeapSnapshot(); 159 [handler=Backend] void getProfilerLogLines(in long inPosition, out long outPosition, out String log); 158 [handler=Profiler] void takeHeapSnapshot(); 160 159 #endif 161 160 [handler=Backend] void setInjectedScriptSource(in String scriptSource); -
trunk/WebCore/inspector/InspectorBackend.cpp
r65891 r66117 69 69 } 70 70 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 one79 // https://bugs.webkit.org/show_bug.cgi?id=4335780 *outPosition = ScriptProfiler::getProfilerLogLines(position, data);81 }82 71 #endif 83 72 -
trunk/WebCore/inspector/InspectorBackend.h
r65891 r66117 61 61 #if ENABLE(JAVASCRIPT_DEBUGGER) 62 62 void enableDebugger(bool always); 63 void takeHeapSnapshot();64 void getProfilerLogLines(long position, long* outPosition, String* data);65 63 #endif 66 64 -
trunk/WebCore/inspector/InspectorProfilerAgent.cpp
r65891 r66117 40 40 #include "Page.h" 41 41 #include "ScriptDebugServer.h" 42 #include "ScriptHeapSnapshot.h" 42 43 #include "ScriptProfile.h" 43 44 #include "ScriptProfiler.h" … … 52 53 static const char* const UserInitiatedProfileName = "org.webkit.profiles.user-initiated"; 53 54 static const char* const CPUProfileType = "CPU"; 55 static const char* const HeapProfileType = "HEAP"; 54 56 55 57 PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InspectorController* inspectorController) … … 66 68 , m_currentUserInitiatedProfileNumber(-1) 67 69 , m_nextUserInitiatedProfileNumber(1) 70 , m_nextUserInitiatedHeapSnapshotNumber(1) 68 71 { 69 72 } … … 105 108 } 106 109 110 PassRefPtr<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 107 119 void InspectorProfilerAgent::disable() 108 120 { … … 139 151 for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it) 140 152 (*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 158 void 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 175 void 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 } 156 184 } 157 185 … … 159 187 { 160 188 m_profiles.clear(); 189 m_snapshots.clear(); 161 190 m_currentUserInitiatedProfileNumber = 1; 162 191 m_nextUserInitiatedProfileNumber = 1; 192 m_nextUserInitiatedHeapSnapshotNumber = 1; 163 193 if (m_frontend) 164 194 m_frontend->resetProfilesPanel(); … … 200 230 } 201 231 232 void 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 202 243 void InspectorProfilerAgent::toggleRecordButton(bool isProfiling) 203 244 { -
trunk/WebCore/inspector/InspectorProfilerAgent.h
r65891 r66117 45 45 class InspectorFrontend; 46 46 class InspectorObject; 47 class ScriptHeapSnapshot; 47 48 class ScriptProfile; 48 49 … … 61 62 String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false); 62 63 void getProfileHeaders(RefPtr<InspectorArray>* headers); 63 void getProfile( unsigned uid, RefPtr<InspectorObject>* profileObject);64 void getProfile(const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject); 64 65 bool isRecordingUserInitiatedProfile() { return m_recordingUserInitiatedProfile; } 65 void removeProfile( unsigned uid);66 void removeProfile(const String& type, unsigned uid); 66 67 void resetState(); 67 68 void setFrontend(InspectorFrontend* frontend) { m_frontend = frontend; } … … 70 71 void stopProfiling() { stopUserInitiatedProfiling(); } 71 72 void stopUserInitiatedProfiling(); 73 void takeHeapSnapshot(); 72 74 void toggleRecordButton(bool isProfiling); 73 75 74 76 private: 75 77 typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap; 78 typedef HashMap<unsigned int, RefPtr<ScriptHeapSnapshot> > HeapSnapshotsMap; 76 79 77 80 InspectorProfilerAgent(InspectorController*); 78 81 PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile); 82 PassRefPtr<InspectorObject> createSnapshotHeader(const ScriptHeapSnapshot& snapshot); 79 83 80 84 InspectorController* m_inspectorController; … … 84 88 int m_currentUserInitiatedProfileNumber; 85 89 unsigned m_nextUserInitiatedProfileNumber; 90 unsigned m_nextUserInitiatedHeapSnapshotNumber; 86 91 ProfilesMap m_profiles; 92 HeapSnapshotsMap m_snapshots; 87 93 }; 88 94 -
trunk/WebCore/inspector/front-end/HeapSnapshotView.js
-
Property
svn:eol-style
set to
LF
r66116 r66117 29 29 */ 30 30 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 else47 this.addProfileHeader(snapshot);48 49 this.dispatchEventToListeners("snapshot added");50 }51 52 53 31 WebInspector.HeapSnapshotView = function(parent, profile) 54 32 { … … 58 36 59 37 this.parent = parent; 60 this.parent.addEventListener(" snapshotadded", this._updateBaseOptions, this);38 this.parent.addEventListener("profile added", this._updateBaseOptions, this); 61 39 62 40 this.showCountAsPercent = false; … … 93 71 this.element.appendChild(summaryContainer); 94 72 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 }; 100 81 101 82 this.dataGrid = new WebInspector.DataGrid(columns); … … 110 91 this.baseSelectElement.addEventListener("change", this._changeBase.bind(this), false); 111 92 this._updateBaseOptions(); 112 if (this.profile.listIndex > 0)113 this.baseSelectElement.selectedIndex = this.profile.listIndex - 1;114 else115 this.baseSelectElement.selectedIndex = this.profile.listIndex;116 this._resetDataGridList();117 93 118 94 this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item status-bar-item"); 119 95 this.percentButton.addEventListener("click", this._percentClicked.bind(this), false); 120 96 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 } 125 121 126 122 WebInspector.HeapSnapshotView.prototype = { 127 128 123 get statusBarItems() 129 124 { … … 265 260 // so recursive expansion will be infinite, since a graph is being traversed. 266 261 // So default to a recursion cap of 2 levels. 267 varmaxDepth = 2;262 const maxDepth = 2; 268 263 269 264 while (current) { … … 277 272 }, 278 273 274 // FIXME: move these methods to a superclass, inherit both views from it. 279 275 jumpToFirstSearchResult: WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult, 280 276 jumpToLastSearchResult: WebInspector.CPUProfileView.prototype.jumpToLastSearchResult, … … 295 291 }, 296 292 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) 299 296 return; 300 297 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 } 312 312 }, 313 313 … … 319 319 this._snapshotDataGridList = new WebInspector.HeapSnapshotDataGridList(this, this.baseSnapshot.entries, this.profile.entries); 320 320 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 } 321 346 }, 322 347 … … 360 385 }, 361 386 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 } 370 434 }, 371 435 … … 375 439 var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier; 376 440 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"] 382 446 }[sortColumnIdentifier]; 383 447 … … 389 453 _updateBaseOptions: function() 390 454 { 391 var list = WebInspector.HeapSnapshotProfileType.snapshots;455 var list = this._getProfiles(); 392 456 // We're assuming that snapshots can only be added. 393 457 if (this.baseSelectElement.length === list.length) … … 396 460 for (var i = this.baseSelectElement.length, n = list.length; i < n; ++i) { 397 461 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); 399 466 this.baseSelectElement.appendChild(baseOption); 400 467 } … … 426 493 WebInspector.HeapSnapshotView.SearchHelper = { 427 494 // 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 }, 438 509 439 510 parseOperationAndNumber: function(query) … … 467 538 computeSummaryValues: function(lowLevels) 468 539 { 469 var highLevels = { data: 0, code: 0};540 var highLevels = { data: 0, code: 0 }; 470 541 this.total = 0; 471 542 for (var item in lowLevels) { … … 477 548 } 478 549 } 479 var result = { categoryValues: highLevels};550 var result = { categoryValues: highLevels }; 480 551 if (!this.showAsPercent) 481 552 result.total = this.total; … … 508 579 509 580 WebInspector.HeapSummaryCountCalculator.prototype = { 510 _highFromLow: function(type) { 581 _highFromLow: function(type) 582 { 511 583 if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE") return "code"; 512 584 if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/)) return "data"; … … 514 586 }, 515 587 516 _valueToString: function(value) { 588 _valueToString: function(value) 589 { 517 590 return value.toString(); 518 591 } … … 527 600 528 601 WebInspector.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"; 532 608 return null; 533 609 }, … … 537 613 538 614 WebInspector.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;565 615 566 616 WebInspector.HeapSnapshotDataGridNodeWithRetainers = function(owningTree) … … 594 644 _populate: function(event) 595 645 { 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)); 600 652 601 653 if (this._parent) { … … 642 694 return "+"; 643 695 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 { 649 701 if (value === Number.POSITIVE_INFINITY) 650 702 return WebInspector.UIString("new"); … … 656 708 }, 657 709 658 getTotalCount: function() { 710 getTotalCount: function() 711 { 659 712 if (!this._count) { 660 713 this._count = 0; … … 665 718 }, 666 719 667 getTotalSize: function() { 720 getTotalSize: function() 721 { 668 722 if (!this._size) { 669 723 this._size = 0; … … 763 817 764 818 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; 767 821 this.count = snapshotEntry.count; 768 822 this.size = snapshotEntry.size; … … 809 863 populateChildren: function(baseEntries, snapshotEntries) 810 864 { 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)); 815 870 }, 816 871 … … 845 900 846 901 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; 849 904 this.count = snapshotEntry.count; 850 905 this.retainers = this._calculateRetainers(this.snapshotView.profile, snapshotEntry.clusters); … … 873 928 }, 874 929 875 _calculateRetainers: function(snapshot, clusters) { 930 _calculateRetainers: function(snapshot, clusters) 931 { 876 932 var retainers = {}; 877 933 if (this.isEmptySet(clusters)) { … … 896 952 var clusterRetainerEntry = clusterRetainers[clusterRetainer]; 897 953 if (!(clusterRetainer in retainers)) 898 retainers[clusterRetainer] = { cons : clusterRetainerEntry.cons, count: 0, clusters: {} };954 retainers[clusterRetainer] = { constructorName: clusterRetainerEntry.constructorName, count: 0, clusters: {} }; 899 955 retainers[clusterRetainer].count += clusterRetainerEntry.count; 900 956 for (var clusterRetainerCluster in clusterRetainerEntry.clusters) … … 918 974 WebInspector.HeapSnapshotProfileType.TypeId = "HEAP"; 919 975 920 WebInspector.HeapSnapshotProfileType.snapshots = [];921 922 976 WebInspector.HeapSnapshotProfileType.prototype = { 923 977 get buttonTooltip() … … 933 987 buttonClicked: function() 934 988 { 935 devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT);989 InspectorBackend.takeHeapSnapshot(); 936 990 }, 937 991 … … 943 997 createSidebarTreeElementForProfile: function(profile) 944 998 { 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"); 948 1000 }, 949 1001 … … 955 1007 956 1008 WebInspector.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 })(); -
Property
svn:eol-style
set to
-
trunk/WebCore/inspector/front-end/ProfileView.js
r66087 r66117 95 95 } 96 96 97 InspectorBackend.getProfile(this.profile. uid, profileCallback);97 InspectorBackend.getProfile(this.profile.typeId, this.profile.uid, profileCallback); 98 98 } 99 99 … … 611 611 createSidebarTreeElementForProfile: function(profile) 612 612 { 613 return new WebInspector.ProfileSidebarTreeElement(profile );613 return new WebInspector.ProfileSidebarTreeElement(profile, WebInspector.UIString("Profile %d"), "profile-sidebar-tree-item"); 614 614 }, 615 615 -
trunk/WebCore/inspector/front-end/ProfilesPanel.js
r66112 r66117 321 321 if (!this.visibleView) 322 322 this.showProfile(profile); 323 this.dispatchEventToListeners("profile added"); 323 324 } 324 325 }, … … 345 346 346 347 if (!profile.isTemporary) 347 InspectorBackend.removeProfile(profile. uid);348 InspectorBackend.removeProfile(profile.typeId, profile.uid); 348 349 349 350 // No other item will be selected if there aren't any other profiles, so … … 374 375 for (var i = 0; i < statusBarItems.length; ++i) 375 376 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 } 376 398 }, 377 399 … … 536 558 WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype; 537 559 538 WebInspector.ProfileSidebarTreeElement = function(profile )560 WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, className) 539 561 { 540 562 this.profile = profile; 563 this._titleFormat = titleFormat; 541 564 542 565 if (this.profile.title.indexOf(UserInitiatedProfileName) === 0) 543 566 this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1); 544 567 545 WebInspector.SidebarTreeElement.call(this, "profile-sidebar-tree-item", "", "", profile, false);568 WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false); 546 569 547 570 this.refreshTitles(); … … 565 588 return this._mainTitle; 566 589 if (this.profile.title.indexOf(UserInitiatedProfileName) === 0) 567 return WebInspector.UIString( "Profile %d", this._profileNumber);590 return WebInspector.UIString(this._titleFormat, this._profileNumber); 568 591 return this.profile.title; 569 592 }, -
trunk/WebCore/inspector/front-end/WebKit.qrc
r65608 r66117 41 41 <file>FontView.js</file> 42 42 <file>HAREntry.js</file> 43 <file>HeapSnapshotView.js</file> 43 44 <file>HelpScreen.js</file> 44 45 <file>ImageView.js</file> -
trunk/WebCore/inspector/front-end/inspector.css
r65905 r66117 3911 3911 } 3912 3912 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 3913 4022 .delete-storage-status-bar-item .glyph { 3914 4023 -webkit-mask-image: url(Images/excludeButtonGlyph.png); -
trunk/WebCore/inspector/front-end/inspector.html
r65248 r66117 126 126 <script type="text/javascript" src="TopDownProfileDataGridTree.js"></script> 127 127 <script type="text/javascript" src="ProfileView.js"></script> 128 <script type="text/javascript" src="HeapSnapshotView.js"></script> 128 129 <script type="text/javascript" src="DOMAgent.js"></script> 129 130 <script type="text/javascript" src="InjectedScript.js"></script> -
trunk/WebCore/inspector/front-end/inspector.js
r66106 r66117 234 234 this.panels.profiles = new WebInspector.ProfilesPanel(); 235 235 this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType()); 236 if (Preferences.heapProfilerPresent) 237 this.panels.profiles.registerProfileType(new WebInspector.HeapSnapshotProfileType()); 236 238 } 237 239 if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1) -
trunk/WebKit/chromium/ChangeLog
r66106 r66117 1 2010-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 1 22 2010-08-26 Yury Semikhatsky <yurys@chromium.org> 2 23 -
trunk/WebKit/chromium/DEPS
r65991 r66117 33 33 vars = { 34 34 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', 35 'chromium_rev': '57 298',35 'chromium_rev': '57489', 36 36 } 37 37 -
trunk/WebKit/chromium/WebKit.gypi
r64124 r66117 34 34 # for copying them to resource dir, and for generating 'devtools.html' file. 35 35 'devtools_js_files': [ 36 'src/js/ProfilerAgent.js',37 'src/js/ProfilerProcessor.js',38 'src/js/HeapProfilerPanel.js',39 36 'src/js/DevTools.js', 40 37 'src/js/DevToolsHostStub.js', -
trunk/WebKit/chromium/src/js/DevTools.js
r65731 r66117 35 35 * WebInspector functionality while it is getting upstreamed into WebCore. 36 36 */ 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 59 37 60 38 var context = {}; // Used by WebCore's inspector routines. 61 39 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 () { 70 41 Preferences.ignoreWhitespace = false; 71 42 Preferences.samplingCPUProfiler = true; … … 76 47 Preferences.onlineDetectionEnabled = false; 77 48 Preferences.domBreakpointsEnabled = true; 78 79 oldLoaded.call(WebInspector); 80 } 49 })(); 81 50 82 51 devtools.domContentLoaded = function() … … 89 58 90 59 60 // FIXME: This needs to be upstreamed. 91 61 (function InterceptProfilesPanelEvents() 92 62 { … … 94 64 WebInspector.ProfilesPanel.prototype.show = function() 95 65 { 96 devtools.tools.getProfilerAgent().initializeProfiling();97 66 this.enableToggleButton.visible = false; 98 67 oldShow.call(this); -
trunk/WebKit/chromium/src/js/devTools.css
r63547 r66117 36 36 font-weight: normal; 37 37 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%;150 38 } 151 39
Note: See TracChangeset
for help on using the changeset viewer.