Diff
Modified: trunk/Source/WebCore/ChangeLog (126854 => 126855)
--- trunk/Source/WebCore/ChangeLog 2012-08-28 07:59:34 UTC (rev 126854)
+++ trunk/Source/WebCore/ChangeLog 2012-08-28 08:32:29 UTC (rev 126855)
@@ -1,3 +1,49 @@
+2012-08-28 Andrey Adaikin <[email protected]>
+
+ Web Inspector: [WebGL] Simple experimental frontend implementation
+ https://bugs.webkit.org/show_bug.cgi?id=94696
+
+ Reviewed by Vsevolod Vlasov.
+
+ A simple experimental frontend for WebGL instrumentation.
+ This is a draft unpolished UI just to start with. Iterations on the UI will follow.
+
+ * WebCore.gypi:
+ * inspector/front-end/Settings.js:
+ (WebInspector.ExperimentsSettings):
+ * inspector/front-end/WebGLPanel.js: Added.
+ (WebInspector.WebGLPanel):
+ (WebInspector.WebGLPanel.prototype.get toolbarItemLabel):
+ (WebInspector.WebGLPanel.prototype.get statusBarItems):
+ (WebInspector.WebGLPanel.prototype.wasShown):
+ (WebInspector.WebGLPanel.prototype.willHide):
+ (WebInspector.WebGLPanel.prototype._toggleWebGLInspection):
+ (WebInspector.WebGLPanel.prototype._onCaptureFrameButtonClick):
+ (WebInspector.WebGLPanel.prototype._onTraceLogListItemClick):
+ (WebInspector.WebGLPanel.prototype._onFunctionCallItemClick):
+ (WebInspector.WebGLManager):
+ (WebInspector.WebGLManager.prototype.start):
+ (WebInspector.WebGLManager.prototype.stop):
+ (WebInspector.WebGLManager.prototype.dropTraceLog):
+ (WebInspector.WebGLManager.prototype.captureFrame):
+ (WebInspector.WebGLManager.prototype.getTraceLog):
+ (WebInspector.WebGLManager.prototype.replayTraceLog):
+ (WebInspector.WebGLManager.prototype._started):
+ (WebInspector.WebGLManager.prototype._stopped):
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/inspector.html:
+ * inspector/front-end/inspector.js:
+ (WebInspector._panelDescriptors):
+ * inspector/front-end/webGLPanel.css: Added.
+ (.webgl-toggle-status-bar-item .glyph):
+ (.webgl-toggle-status-bar-item.toggled-on .glyph):
+ (.webgl-trace-logs-list):
+ (.webgl-trace-log):
+ (.webgl-trace-logs-list div, .webgl-trace-log div):
+ (#webgl-capture-frame-button):
+ (#webgl-replay-image-container):
+ (#webgl-replay-image):
+
2012-08-28 Kentaro Hara <[email protected]>
Unreviewed, rolling out r126852.
Modified: trunk/Source/WebCore/WebCore.gypi (126854 => 126855)
--- trunk/Source/WebCore/WebCore.gypi 2012-08-28 07:59:34 UTC (rev 126854)
+++ trunk/Source/WebCore/WebCore.gypi 2012-08-28 08:32:29 UTC (rev 126855)
@@ -6448,6 +6448,7 @@
'inspector/front-end/textEditor.css',
'inspector/front-end/textPrompt.css',
'inspector/front-end/timelinePanel.css',
+ 'inspector/front-end/webGLProfiler.css',
],
'webinspector_elements_js_files': [
'inspector/front-end/ElementsPanel.js',
@@ -6524,6 +6525,7 @@
'inspector/front-end/ProfilesPanel.js',
'inspector/front-end/ProfileLauncherView.js',
'inspector/front-end/TopDownProfileDataGridTree.js',
+ 'inspector/front-end/WebGLProfileView.js',
],
'webinspector_audits_js_files': [
Modified: trunk/Source/WebCore/inspector/compile-front-end.py (126854 => 126855)
--- trunk/Source/WebCore/inspector/compile-front-end.py 2012-08-28 07:59:34 UTC (rev 126854)
+++ trunk/Source/WebCore/inspector/compile-front-end.py 2012-08-28 08:32:29 UTC (rev 126855)
@@ -329,6 +329,7 @@
"ProfilesPanel.js",
"ProfileLauncherView.js",
"TopDownProfileDataGridTree.js",
+ "WebGLProfileView.js",
]
},
{
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (126854 => 126855)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-08-28 07:59:34 UTC (rev 126854)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-08-28 08:32:29 UTC (rev 126855)
@@ -248,6 +248,8 @@
this._registerProfileType(new WebInspector.HeapSnapshotProfileType());
if (WebInspector.experimentsSettings.nativeMemorySnapshots.isEnabled())
this._registerProfileType(new WebInspector.NativeMemoryProfileType());
+ if (WebInspector.experimentsSettings.webGLInspection.isEnabled())
+ this._registerProfileType(new WebInspector.WebGLProfileType());
InspectorBackend.registerProfilerDispatcher(new WebInspector.ProfilerDispatcher(this));
@@ -1317,3 +1319,4 @@
importScript("NativeMemorySnapshotView.js");
importScript("ProfileLauncherView.js");
importScript("TopDownProfileDataGridTree.js");
+importScript("WebGLProfileView.js");
Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (126854 => 126855)
--- trunk/Source/WebCore/inspector/front-end/Settings.js 2012-08-28 07:59:34 UTC (rev 126854)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js 2012-08-28 08:32:29 UTC (rev 126855)
@@ -191,6 +191,7 @@
this.nativeMemorySnapshots = this._createExperiment("nativeMemorySnapshots", "Native memory profiling");
this.liveNativeMemoryChart = this._createExperiment("liveNativeMemoryChart", "Live native memory chart");
this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection");
+ this.webGLInspection = this._createExperiment("webGLInspection ", "WebGL inspection");
this.mainThreadMonitoring = this._createExperiment("mainThreadMonitoring", "Show CPU activity in Timeline");
this.geolocationOverride = this._createExperiment("geolocationOverride", "Override Device Geolocation");
this.deviceOrientationOverride = this._createExperiment("deviceOrientationOverride", "Override Device Orientation");
Added: trunk/Source/WebCore/inspector/front-end/WebGLProfileView.js (0 => 126855)
--- trunk/Source/WebCore/inspector/front-end/WebGLProfileView.js (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/WebGLProfileView.js 2012-08-28 08:32:29 UTC (rev 126855)
@@ -0,0 +1,261 @@
+/*
+ * 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.WebGLProfileView = function(profile)
+{
+ WebInspector.View.call(this);
+ this.registerRequiredCSS("webGLProfiler.css");
+ this._profile = profile;
+ this.element.addStyleClass("webgl-profile-view");
+
+ this._traceLogElement = document.createElement("div");
+ this._traceLogElement.className = "webgl-trace-log";
+ this._traceLogElement.addEventListener("click", this._onTraceLogItemClick.bind(this), false);
+ this.element.appendChild(this._traceLogElement);
+
+ var replayImageContainer = document.createElement("div");
+ replayImageContainer.id = "webgl-replay-image-container";
+ this.element.appendChild(replayImageContainer);
+
+ this._replayImageElement = document.createElement("image");
+ this._replayImageElement.id = "webgl-replay-image";
+ replayImageContainer.appendChild(this._replayImageElement);
+
+ this._debugInfoElement = document.createElement("div");
+ replayImageContainer.appendChild(this._debugInfoElement);
+
+ this._showTraceLog();
+}
+
+WebInspector.WebGLProfileView.prototype = {
+ dispose: function()
+ {
+ WebGLAgent.dropTraceLog(this._profile.traceLogId());
+ },
+
+ get statusBarItems()
+ {
+ return [];
+ },
+
+ get profile()
+ {
+ return this._profile;
+ },
+
+ wasShown: function()
+ {
+ var scrollPosition = this._traceLogElementScrollPosition;
+ delete this._traceLogElementScrollPosition;
+ if (scrollPosition) {
+ this._traceLogElement.scrollTop = scrollPosition.top;
+ this._traceLogElement.scrollLeft = scrollPosition.left;
+ }
+ },
+
+ willHide: function()
+ {
+ this._traceLogElementScrollPosition = {
+ top: this._traceLogElement.scrollTop,
+ left: this._traceLogElement.scrollLeft
+ };
+ },
+
+ _showTraceLog: function()
+ {
+ function didReceiveTraceLog(error, traceLog)
+ {
+ this._traceLogElement.innerHTML = "";
+ if (!traceLog)
+ return;
+ var calls = traceLog.calls;
+ for (var i = 0, n = calls.length; i < n; ++i) {
+ var call = calls[i];
+ var traceLogItem = document.createElement("div");
+ traceLogItem.traceLogId = traceLog.id;
+ traceLogItem.stepNo = i;
+ traceLogItem.textContent = "(" + (i+1) + ") " + call.functionName;
+ this._traceLogElement.appendChild(traceLogItem);
+ }
+ }
+ WebGLAgent.getTraceLog(this._profile.traceLogId(), didReceiveTraceLog.bind(this));
+ },
+
+ _onTraceLogItemClick: function(e)
+ {
+ var item = e.target;
+ if (!item || !item.traceLogId)
+ return;
+ var time = Date.now();
+ function didReplayTraceLog(error, dataURL)
+ {
+ this._debugInfoElement.textContent = "Replay time: " + (Date.now() - time) + "ms";
+ if (this._activeTraceLogItem)
+ this._activeTraceLogItem.style.backgroundColor = "";
+ this._activeTraceLogItem = item;
+ this._activeTraceLogItem.style.backgroundColor = "yellow";
+ this._replayImageElement.src = ""
+ }
+ WebGLAgent.replayTraceLog(item.traceLogId, item.stepNo, didReplayTraceLog.bind(this));
+ }
+}
+
+WebInspector.WebGLProfileView.prototype.__proto__ = WebInspector.View.prototype;
+
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileType}
+ */
+WebInspector.WebGLProfileType = function()
+{
+ WebInspector.ProfileType.call(this, WebInspector.WebGLProfileType.TypeId, WebInspector.UIString("Capture WebGL Frame"));
+ this._nextProfileUid = 1;
+ // FIXME: enable/disable by a UI action?
+ WebGLAgent.enable();
+}
+
+WebInspector.WebGLProfileType.TypeId = "WEBGL_PROFILE";
+
+WebInspector.WebGLProfileType.prototype = {
+ get buttonTooltip()
+ {
+ return WebInspector.UIString("Capture WebGL frame.");
+ },
+
+ /**
+ * @override
+ * @param {WebInspector.ProfilesPanel} profilesPanel
+ * @return {boolean}
+ */
+ buttonClicked: function(profilesPanel)
+ {
+ var profileHeader = new WebInspector.WebGLProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid);
+ ++this._nextProfileUid;
+ profileHeader.isTemporary = true;
+ profilesPanel.addProfileHeader(profileHeader);
+ function didStartCapturingFrame(error, traceLogId)
+ {
+ profileHeader._traceLogId = traceLogId;
+ profileHeader.isTemporary = false;
+ }
+ WebGLAgent.captureFrame(didStartCapturingFrame.bind(this));
+ return false;
+ },
+
+ get treeItemTitle()
+ {
+ return WebInspector.UIString("WEBGL PROFILE");
+ },
+
+ get description()
+ {
+ return WebInspector.UIString("WebGL calls instrumentation");
+ },
+
+ /**
+ * @override
+ */
+ reset: function()
+ {
+ this._nextProfileUid = 1;
+ },
+
+ /**
+ * @override
+ * @param {string=} title
+ * @return {WebInspector.ProfileHeader}
+ */
+ createTemporaryProfile: function(title)
+ {
+ title = title || WebInspector.UIString("Capturing\u2026");
+ return new WebInspector.WebGLProfileHeader(this, title);
+ },
+
+ /**
+ * @override
+ * @param {ProfilerAgent.ProfileHeader} profile
+ * @return {WebInspector.ProfileHeader}
+ */
+ createProfile: function(profile)
+ {
+ return new WebInspector.WebGLProfileHeader(this, profile.title, -1);
+ }
+}
+
+WebInspector.WebGLProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype;
+
+/**
+ * @constructor
+ * @extends {WebInspector.ProfileHeader}
+ * @param {WebInspector.WebGLProfileType} type
+ * @param {string} title
+ * @param {number=} uid
+ */
+WebInspector.WebGLProfileHeader = function(type, title, uid)
+{
+ WebInspector.ProfileHeader.call(this, type, title, uid);
+
+ /**
+ * @type {string?}
+ */
+ this._traceLogId = null;
+}
+
+WebInspector.WebGLProfileHeader.prototype = {
+ /**
+ * @return {string?}
+ */
+ traceLogId: function() {
+ return this._traceLogId;
+ },
+
+ /**
+ * @override
+ */
+ createSidebarTreeElement: function()
+ {
+ return new WebInspector.ProfileSidebarTreeElement(this, WebInspector.UIString("Trace Log %d"), "profile-sidebar-tree-item");
+ },
+
+ /**
+ * @override
+ * @param {WebInspector.ProfilesPanel} profilesPanel
+ */
+ createView: function(profilesPanel)
+ {
+ return new WebInspector.WebGLProfileView(this);
+ }
+}
+
+WebInspector.WebGLProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype;
Property changes on: trunk/Source/WebCore/inspector/front-end/WebGLProfileView.js
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (126854 => 126855)
--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2012-08-28 07:59:34 UTC (rev 126854)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2012-08-28 08:32:29 UTC (rev 126855)
@@ -207,6 +207,7 @@
<file>utilities.js</file>
<file>View.js</file>
<file>WatchExpressionsSidebarPane.js</file>
+ <file>WebGLProfileView.js</file>
<file>WorkerManager.js</file>
<file>WorkersSidebarPane.js</file>
<file>Workspace.js</file>
@@ -240,6 +241,7 @@
<file>textEditor.css</file>
<file>textPrompt.css</file>
<file>timelinePanel.css</file>
+ <file>webGLProfiler.css</file>
<file>Images/applicationCache.png</file>
<file>Images/back.png</file>
<file>Images/breakpointBorder.png</file>
Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (126854 => 126855)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2012-08-28 07:59:34 UTC (rev 126854)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2012-08-28 08:32:29 UTC (rev 126855)
@@ -58,7 +58,7 @@
var allDescriptors = [elements, resources, network, scripts, timeline, profiles, audits, console];
var hiddenPanels = InspectorFrontendHost.hiddenPanels();
for (var i = 0; i < allDescriptors.length; ++i) {
- if (hiddenPanels.indexOf(allDescriptors[i].name) === -1)
+ if (hiddenPanels.indexOf(allDescriptors[i].name()) === -1)
panelDescriptors.push(allDescriptors[i]);
}
return panelDescriptors;
Added: trunk/Source/WebCore/inspector/front-end/webGLProfiler.css (0 => 126855)
--- trunk/Source/WebCore/inspector/front-end/webGLProfiler.css (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/webGLProfiler.css 2012-08-28 08:32:29 UTC (rev 126855)
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+.webgl-profile-view {
+ overflow: hidden;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+
+.webgl-trace-log {
+ position: absolute;
+ top: 10px;
+ left: 0;
+ bottom: 10px;
+ font-size: 13px;
+ overflow: auto;
+ white-space: nowrap;
+ padding: 0 20px;
+}
+
+.webgl-trace-log div {
+ padding-bottom: 4px;
+}
+
+#webgl-replay-image-container {
+ position: absolute;
+ right: 0;
+ top: 0;
+ padding: 10px;
+ background-color: white;
+}
+
+#webgl-replay-image {
+ width: 400px;
+ height: 400px;
+ display: block;
+}
Property changes on: trunk/Source/WebCore/inspector/front-end/webGLProfiler.css
___________________________________________________________________
Added: svn:eol-style