Title: [118504] trunk/Source/WebCore
Revision
118504
Author
[email protected]
Date
2012-05-25 02:49:55 -0700 (Fri, 25 May 2012)

Log Message

Web Inspector: add profile type for native memory snapshots
https://bugs.webkit.org/show_bug.cgi?id=87400

Reviewed by Vsevolod Vlasov.

Introduced new profile type and view classes for native memory snapshots.
All the stuff is hidden behind an experimental setting.

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.py:
* inspector/front-end/NativeMemorySnapshotView.js: Added.
(WebInspector.NativeMemorySnapshotView):
(WebInspector.NativeMemorySnapshotView.prototype.dispose):
(WebInspector.NativeMemorySnapshotView.prototype.get statusBarItems):
(WebInspector.NativeMemorySnapshotView.prototype.get profile):
(WebInspector.NativeMemoryProfileType):
(WebInspector.NativeMemoryProfileType.prototype.get buttonTooltip):
(WebInspector.NativeMemoryProfileType.prototype.buttonClicked):
(WebInspector.NativeMemoryProfileType.prototype.get treeItemTitle):
(WebInspector.NativeMemoryProfileType.prototype.get description):
(WebInspector.NativeMemoryProfileType.prototype.createTemporaryProfile):
(WebInspector.NativeMemoryProfileType.prototype.createProfile):
(WebInspector.NativeMemoryProfileHeader):
(WebInspector.NativeMemoryProfileHeader.prototype.createSidebarTreeElement):
(WebInspector.NativeMemoryProfileHeader.prototype.createView):
* inspector/front-end/ProfilesPanel.js:
* inspector/front-end/Settings.js:
(WebInspector.ExperimentsSettings):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (118503 => 118504)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 09:44:42 UTC (rev 118503)
+++ trunk/Source/WebCore/ChangeLog	2012-05-25 09:49:55 UTC (rev 118504)
@@ -1,3 +1,37 @@
+2012-05-24  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: add profile type for native memory snapshots
+        https://bugs.webkit.org/show_bug.cgi?id=87400
+
+        Reviewed by Vsevolod Vlasov.
+
+        Introduced new profile type and view classes for native memory snapshots.
+        All the stuff is hidden behind an experimental setting.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.py:
+        * inspector/front-end/NativeMemorySnapshotView.js: Added.
+        (WebInspector.NativeMemorySnapshotView):
+        (WebInspector.NativeMemorySnapshotView.prototype.dispose):
+        (WebInspector.NativeMemorySnapshotView.prototype.get statusBarItems):
+        (WebInspector.NativeMemorySnapshotView.prototype.get profile):
+        (WebInspector.NativeMemoryProfileType):
+        (WebInspector.NativeMemoryProfileType.prototype.get buttonTooltip):
+        (WebInspector.NativeMemoryProfileType.prototype.buttonClicked):
+        (WebInspector.NativeMemoryProfileType.prototype.get treeItemTitle):
+        (WebInspector.NativeMemoryProfileType.prototype.get description):
+        (WebInspector.NativeMemoryProfileType.prototype.createTemporaryProfile):
+        (WebInspector.NativeMemoryProfileType.prototype.createProfile):
+        (WebInspector.NativeMemoryProfileHeader):
+        (WebInspector.NativeMemoryProfileHeader.prototype.createSidebarTreeElement):
+        (WebInspector.NativeMemoryProfileHeader.prototype.createView):
+        * inspector/front-end/ProfilesPanel.js:
+        * inspector/front-end/Settings.js:
+        (WebInspector.ExperimentsSettings):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+
 2012-05-25  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: make some profiler methods private

Modified: trunk/Source/WebCore/WebCore.gypi (118503 => 118504)


--- trunk/Source/WebCore/WebCore.gypi	2012-05-25 09:44:42 UTC (rev 118503)
+++ trunk/Source/WebCore/WebCore.gypi	2012-05-25 09:49:55 UTC (rev 118504)
@@ -6436,6 +6436,7 @@
             'inspector/front-end/Linkifier.js',
             'inspector/front-end/MemoryStatistics.js',
             'inspector/front-end/MetricsSidebarPane.js',
+            'inspector/front-end/NativeMemorySnapshotView.js',
             'inspector/front-end/NavigatorOverlayController.js',
             'inspector/front-end/NavigatorView.js',
             'inspector/front-end/NetworkItemView.js',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (118503 => 118504)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-05-25 09:44:42 UTC (rev 118503)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-05-25 09:49:55 UTC (rev 118504)
@@ -74630,6 +74630,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\NativeMemorySnapshotView.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\NavigatorView.js"
 					>
 				</File>

Modified: trunk/Source/WebCore/inspector/compile-front-end.py (118503 => 118504)


--- trunk/Source/WebCore/inspector/compile-front-end.py	2012-05-25 09:44:42 UTC (rev 118503)
+++ trunk/Source/WebCore/inspector/compile-front-end.py	2012-05-25 09:49:55 UTC (rev 118504)
@@ -304,6 +304,7 @@
             "HeapSnapshotView.js",
             "HeapSnapshotWorker.js",
             "HeapSnapshotWorkerDispatcher.js",
+            "NativeMemorySnapshotView.js",
             "ProfileDataGridTree.js",
             "ProfilesPanel.js",
             "ProfileLauncherView.js",

Added: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (0 => 118504)


--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-05-25 09:49:55 UTC (rev 118504)
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.View}
+ */
+WebInspector.NativeMemorySnapshotView = function(profile)
+{
+    WebInspector.View.call(this);
+    this.element.addStyleClass("memory-chart-view");
+    this.element.createChild("div").textContent = "Memory chart";
+    this._profile = profile;
+}
+
+WebInspector.NativeMemorySnapshotView.prototype = {
+    dispose: function()
+    {
+    },
+
+    get statusBarItems()
+    {
+        return [];
+    },
+
+    get profile()
+    {
+        return this._profile;
+    }
+}
+
+WebInspector.NativeMemorySnapshotView.prototype.__proto__ = WebInspector.View.prototype;
+
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileType}
+ */
+WebInspector.NativeMemoryProfileType = function()
+{
+    WebInspector.ProfileType.call(this, WebInspector.NativeMemoryProfileType.TypeId, WebInspector.UIString("Take Native Memory Snapshot"));
+    this._profileIndex = 1;
+}
+
+WebInspector.NativeMemoryProfileType.TypeId = "NATIVE_MEMORY";
+
+WebInspector.NativeMemoryProfileType.prototype = {
+    get buttonTooltip()
+    {
+        return WebInspector.UIString("Take native memory snapshot.");
+    },
+
+    /**
+     * @override
+     * @return {boolean}
+     */
+    buttonClicked: function()
+    {
+        var profilesPanel = WebInspector.panels.profiles;
+        var profileHeader = new WebInspector.NativeMemoryProfileHeader(this, WebInspector.UIString("Snapshot %d", this._profileIndex++), -1);
+        profilesPanel.addProfileHeader(profileHeader);
+        profilesPanel.dispatchEventToListeners(WebInspector.ProfilesPanel.EventTypes.ProfileStarted);
+        profilesPanel.dispatchEventToListeners(WebInspector.ProfilesPanel.EventTypes.ProfileFinished);
+        return false;
+    },
+
+    get treeItemTitle()
+    {
+        return WebInspector.UIString("MEMORY DISTRIBUTION");
+    },
+
+    get description()
+    {
+        return WebInspector.UIString("Native memory snapshot profiles show memory distribution among browser subsystems");
+    },
+
+    /**
+     * @override
+     * @param {string=} title
+     * @return {WebInspector.ProfileHeader}
+     */
+    createTemporaryProfile: function(title)
+    {
+        title = title || WebInspector.UIString("Snapshotting\u2026");
+        return new WebInspector.NativeMemoryProfileHeader(this, title);
+    },
+
+    /**
+     * @override
+     * @param {ProfilerAgent.ProfileHeader} profile
+     * @return {WebInspector.ProfileHeader}
+     */
+    createProfile: function(profile)
+    {
+        return new WebInspector.NativeMemoryProfileHeader(this, profile.title, -1);
+    }
+}
+
+WebInspector.NativeMemoryProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype;
+
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileHeader}
+ * @param {WebInspector.NativeMemoryProfileType} type
+ * @param {string} title
+ * @param {number=} uid
+ */
+WebInspector.NativeMemoryProfileHeader = function(type, title, uid)
+{
+    WebInspector.ProfileHeader.call(this, type, title, uid);
+}
+
+WebInspector.NativeMemoryProfileHeader.prototype = {
+    /**
+     * @override
+     */
+    createSidebarTreeElement: function()
+    {
+        return new WebInspector.ProfileSidebarTreeElement(this, WebInspector.UIString("Snapshot %d"), "heap-snapshot-sidebar-tree-item");
+    },
+
+    /**
+     * @override
+     */
+    createView: function()
+    {
+        return new WebInspector.NativeMemorySnapshotView();
+    }
+}
+
+WebInspector.NativeMemoryProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype;
Property changes on: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (118503 => 118504)


--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-05-25 09:44:42 UTC (rev 118503)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-05-25 09:49:55 UTC (rev 118504)
@@ -240,6 +240,8 @@
         this._registerProfileType(new WebInspector.CSSSelectorProfileType());
     if (Capabilities.heapProfilerPresent)
         this._registerProfileType(new WebInspector.HeapSnapshotProfileType());
+    if (WebInspector.experimentsSettings.nativeMemorySnapshots.isEnabled())
+        this._registerProfileType(new WebInspector.NativeMemoryProfileType());
 
     InspectorBackend.registerProfilerDispatcher(new WebInspector.ProfilerDispatcher(this));
 

Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (118503 => 118504)


--- trunk/Source/WebCore/inspector/front-end/Settings.js	2012-05-25 09:44:42 UTC (rev 118503)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js	2012-05-25 09:49:55 UTC (rev 118504)
@@ -182,6 +182,7 @@
     // Add currently running experiments here.
     this.showShadowDOM = this._createExperiment("showShadowDOM", "Show shadow DOM");
     this.snippetsSupport = this._createExperiment("snippetsSupport", "Snippets support");
+    this.nativeMemorySnapshots = this._createExperiment("nativeMemorySnapshots", "Native memory profiling");
 
     this._cleanUpSetting();
 }

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (118503 => 118504)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-05-25 09:44:42 UTC (rev 118503)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2012-05-25 09:49:55 UTC (rev 118504)
@@ -89,6 +89,7 @@
     <file>Linkifier.js</file>
     <file>MemoryStatistics.js</file>
     <file>MetricsSidebarPane.js</file>
+    <file>NativeMemorySnapshotView.js</file>
     <file>NavigatorOverlayController.js</file>
     <file>NavigatorView.js</file>
     <file>NetworkItemView.js</file>

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (118503 => 118504)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2012-05-25 09:44:42 UTC (rev 118503)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2012-05-25 09:49:55 UTC (rev 118504)
@@ -177,6 +177,7 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to