Web Inspector: Type Profiler and Code Coverage Profiler should work in Workers
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Nov 2016 05:38:58 +0000 (05:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Nov 2016 05:38:58 +0000 (05:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164682

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-11-12
Reviewed by Darin Adler.

* UserInterface/Controllers/BasicBlockAnnotator.js:
* UserInterface/Models/ScriptSyntaxTree.js:
(WebInspector.ScriptSyntaxTree.prototype.updateTypes):
Use the target associated with the Script.

* UserInterface/Protocol/Target.js:
(WebInspector.WorkerTarget.prototype.initialize):
When initializing a Worker Target, match the existing state
of the Page for these profilers.

* UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._tokenTrackingControllerHighlightedJavaScriptTypeInformation):
(WebInspector.SourceCodeTextEditor.prototype.willDismissPopover):
Use the correct target for this Script / Resource.

(WebInspector.SourceCodeTextEditor.prototype._setTypeTokenAnnotatorEnabledState):
(WebInspector.SourceCodeTextEditor.prototype.set _basicBlockAnnotatorEnabled):
Enable / disable for all targets when toggling profilers.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208664 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/BasicBlockAnnotator.js
Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js
Source/WebInspectorUI/UserInterface/Protocol/Target.js
Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

index ac40d79..74df6c4 100644 (file)
@@ -1,3 +1,30 @@
+2016-11-12  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Type Profiler and Code Coverage Profiler should work in Workers
+        https://bugs.webkit.org/show_bug.cgi?id=164682
+
+        Reviewed by Darin Adler.
+
+        * UserInterface/Controllers/BasicBlockAnnotator.js:
+        * UserInterface/Models/ScriptSyntaxTree.js:
+        (WebInspector.ScriptSyntaxTree.prototype.updateTypes):
+        Use the target associated with the Script.
+
+        * UserInterface/Protocol/Target.js:
+        (WebInspector.WorkerTarget.prototype.initialize):
+        When initializing a Worker Target, match the existing state
+        of the Page for these profilers.
+
+        * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype._tokenTrackingControllerHighlightedJavaScriptTypeInformation):
+        (WebInspector.SourceCodeTextEditor.prototype.willDismissPopover):
+        Use the correct target for this Script / Resource.
+
+        (WebInspector.SourceCodeTextEditor.prototype._setTypeTokenAnnotatorEnabledState):
+        (WebInspector.SourceCodeTextEditor.prototype.set _basicBlockAnnotatorEnabled):
+        Enable / disable for all targets when toggling profilers.
+
 2016-11-11  Anthony Ricaud  <rik@webkit.org>
 
         Web Inspector: Whitespace in Editor should be less visible than regular content
index 359dee0..b4b86f9 100644 (file)
@@ -56,7 +56,7 @@ WebInspector.BasicBlockAnnotator = class BasicBlockAnnotator extends WebInspecto
         var sourceID = this._script.id;
         var startTime = Date.now();
 
-        RuntimeAgent.getBasicBlocks(sourceID, function(error, basicBlocks) {
+        this._script.target.RuntimeAgent.getBasicBlocks(sourceID, function(error, basicBlocks) {
             if (error) {
                 console.error("Error in getting basic block locations: " + error);
                 return;
index 49dfc6a..0507028 100644 (file)
@@ -253,7 +253,7 @@ WebInspector.ScriptSyntaxTree = class ScriptSyntaxTree extends WebInspector.Obje
             callback(allRequestNodes);
         }
 
-        RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests, handleTypes);
+        this._script.target.RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests, handleTypes);
     }
 
     // Private
index ac77b36..df94664 100644 (file)
@@ -142,10 +142,12 @@ WebInspector.WorkerTarget = class WorkerTarget extends WebInspector.Target
         WebInspector.frameResourceManager.adoptOrphanedResourcesForTarget(this);
 
         if (this.RuntimeAgent) {
-            this.RuntimeAgent.enable();
             this._executionContext = new WebInspector.ExecutionContext(this, WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier, this.displayName, false, null);
-            // FIXME: Enable Type Profiler
-            // FIXME: Enable Code Coverage Profiler
+            this.RuntimeAgent.enable();
+            if (WebInspector.showJavaScriptTypeInformationSetting && WebInspector.showJavaScriptTypeInformationSetting.value)
+                this.RuntimeAgent.enableTypeProfiler();
+            if (WebInspector.enableControlFlowProfilerSetting && WebInspector.enableControlFlowProfilerSetting.value)
+                this.RuntimeAgent.enableControlFlowProfiler();
         }
 
         if (this.DebuggerAgent)
index be5129f..0df9ab5 100644 (file)
@@ -268,12 +268,14 @@ WebInspector.ScopeChainDetailsSidebarPanel = class ScopeChainDetailsSidebarPanel
         if (!watchExpressions.length) {
             if (this._usedWatchExpressionsObjectGroup) {
                 this._usedWatchExpressionsObjectGroup = false;
-                RuntimeAgent.releaseObjectGroup(WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);
+                for (let target of WebInspector.targets)
+                    target.RuntimeAgent.releaseObjectGroup(WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);
             }
             return Promise.resolve(null);
         }
 
-        RuntimeAgent.releaseObjectGroup(WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);
+        for (let target of WebInspector.targets)
+            target.RuntimeAgent.releaseObjectGroup(WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);
         this._usedWatchExpressionsObjectGroup = true;
 
         let watchExpressionsRemoteObject = WebInspector.RemoteObject.createFakeRemoteObject();
index 8ab589b..bc813e1 100644 (file)
@@ -1589,7 +1589,7 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
             }
         }
 
-        RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests, handler.bind(this));
+        this.target.RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests, handler.bind(this));
     }
 
     _showPopover(content, bounds)
@@ -1731,7 +1731,7 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
     {
         this.tokenTrackingController.removeHighlightedRange();
 
-        RuntimeAgent.releaseObjectGroup("popover");
+        this.target.RuntimeAgent.releaseObjectGroup("popover");
     }
 
     _dismissPopover()
@@ -1870,13 +1870,18 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
 
         if (shouldActivate) {
             console.assert(this.visible, "Annotators should not be enabled if the TextEditor is not visible");
-            RuntimeAgent.enableTypeProfiler();
+
+            for (let target of WebInspector.targets)
+                target.RuntimeAgent.enableTypeProfiler();
+
             this._typeTokenAnnotator.reset();
 
             if (!this._typeTokenScrollHandler)
                 this._enableScrollEventsForTypeTokenAnnotator();
         } else {
-            RuntimeAgent.disableTypeProfiler();
+            for (let target of WebInspector.targets)
+                target.RuntimeAgent.disableTypeProfiler();
+
             this._typeTokenAnnotator.clear();
 
             if (this._typeTokenScrollHandler)
@@ -1896,7 +1901,8 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
         if (shouldActivate) {
             console.assert(this.visible, "Annotators should not be enabled if the TextEditor is not visible");
 
-            RuntimeAgent.enableControlFlowProfiler();
+            for (let target of WebInspector.targets)
+                target.RuntimeAgent.enableControlFlowProfiler();
 
             console.assert(!this._basicBlockAnnotator.isActive());
             this._basicBlockAnnotator.reset();
@@ -1904,7 +1910,9 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
             if (!this._controlFlowScrollHandler)
                 this._enableScrollEventsForControlFlowAnnotator();
         } else {
-            RuntimeAgent.disableControlFlowProfiler();
+            for (let target of WebInspector.targets)
+                target.RuntimeAgent.disableControlFlowProfiler();
+
             this._basicBlockAnnotator.clear();
 
             if (this._controlFlowScrollHandler)