<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[248536] trunk/Source/WebInspectorUI</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/248536">248536</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2019-08-12 11:45:13 -0700 (Mon, 12 Aug 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Better organize manager / observer API groups
https://bugs.webkit.org/show_bug.cgi?id=200594

Reviewed by Devin Rousso.

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype.globalObjectCleared):
(WI.DebuggerManager.prototype.reset): Deleted.
Renamed.

* UserInterface/Protocol/DebuggerObserver.js:
(WI.DebuggerObserver.prototype.globalObjectCleared):

* UserInterface/Controllers/CSSManager.js:
* UserInterface/Controllers/CanvasManager.js:
* UserInterface/Controllers/ConsoleManager.js:
* UserInterface/Controllers/DOMManager.js:
* UserInterface/Controllers/DOMStorageManager.js:
* UserInterface/Controllers/LayerTreeManager.js:
* UserInterface/Controllers/NetworkManager.js:
* UserInterface/Controllers/TargetManager.js:
* UserInterface/Controllers/TimelineManager.js:
* UserInterface/Controllers/WorkerManager.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersCSSManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersCanvasManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersConsoleManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersDOMManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersDOMStorageManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersDebuggerManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersLayerTreeManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersNetworkManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersTargetManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersWorkerManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolDebuggerObserverjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog    2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/ChangeLog       2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2019-08-09  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Better organize manager / observer API groups
+        https://bugs.webkit.org/show_bug.cgi?id=200594
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Controllers/DebuggerManager.js:
+        (WI.DebuggerManager.prototype.globalObjectCleared):
+        (WI.DebuggerManager.prototype.reset): Deleted.
+        Renamed.
+
+        * UserInterface/Protocol/DebuggerObserver.js:
+        (WI.DebuggerObserver.prototype.globalObjectCleared):
+
+        * UserInterface/Controllers/CSSManager.js:
+        * UserInterface/Controllers/CanvasManager.js:
+        * UserInterface/Controllers/ConsoleManager.js:
+        * UserInterface/Controllers/DOMManager.js:
+        * UserInterface/Controllers/DOMStorageManager.js:
+        * UserInterface/Controllers/LayerTreeManager.js:
+        * UserInterface/Controllers/NetworkManager.js:
+        * UserInterface/Controllers/TargetManager.js:
+        * UserInterface/Controllers/TimelineManager.js:
+        * UserInterface/Controllers/WorkerManager.js:
+
</ins><span class="cx"> 2019-08-10  Devin Rousso  <drousso@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: REGRESSION(r248454): WK1 inspector frontend client doesn't queue messages to the frontend before it's loaded
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersCSSManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js      2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js 2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -401,10 +401,30 @@
</span><span class="cx">         this.mediaQueryResultChanged();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    get modifiedStyles()
+    {
+        return Array.from(this._modifiedStyles.values());
+    }
+
+    addModifiedStyle(style)
+    {
+        this._modifiedStyles.set(style.stringId, style);
+    }
+
+    getModifiedStyle(style)
+    {
+        return this._modifiedStyles.get(style.stringId);
+    }
+
+    removeModifiedStyle(style)
+    {
+        this._modifiedStyles.delete(style.stringId);
+    }
+
+    // PageObserver
+
</ins><span class="cx">     defaultAppearanceDidChange(protocolName)
</span><span class="cx">     {
</span><del>-        // Called from WI.PageObserver.
-
</del><span class="cx">         let appearance = null;
</span><span class="cx"> 
</span><span class="cx">         switch (protocolName) {
</span><span class="lines">@@ -428,32 +448,10 @@
</span><span class="cx">         this.dispatchEventToListeners(WI.CSSManager.Event.DefaultAppearanceDidChange, {appearance});
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    get modifiedStyles()
-    {
-        return Array.from(this._modifiedStyles.values());
-    }
</del><ins>+    // CSSObserver
</ins><span class="cx"> 
</span><del>-    addModifiedStyle(style)
-    {
-        this._modifiedStyles.set(style.stringId, style);
-    }
-
-    getModifiedStyle(style)
-    {
-        return this._modifiedStyles.get(style.stringId);
-    }
-
-    removeModifiedStyle(style)
-    {
-        this._modifiedStyles.delete(style.stringId);
-    }
-
-    // Protected
-
</del><span class="cx">     mediaQueryResultChanged()
</span><span class="cx">     {
</span><del>-        // Called from WI.CSSObserver.
-
</del><span class="cx">         for (var key in this._nodeStylesMap)
</span><span class="cx">             this._nodeStylesMap[key].mediaQueryResultDidChange();
</span><span class="cx">     }
</span><span class="lines">@@ -460,7 +458,6 @@
</span><span class="cx"> 
</span><span class="cx">     styleSheetChanged(styleSheetIdentifier)
</span><span class="cx">     {
</span><del>-        // Called from WI.CSSObserver.
</del><span class="cx">         var styleSheet = this.styleSheetForIdentifier(styleSheetIdentifier);
</span><span class="cx">         console.assert(styleSheet);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersCanvasManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js   2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js      2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -152,10 +152,10 @@
</span><span class="cx">         WI.settings.canvasRecordingAutoCaptureFrameCount.value = count;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // CanvasObserver
+
</ins><span class="cx">     canvasAdded(canvasPayload)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         console.assert(!this._canvasIdentifierMap.has(canvasPayload.canvasId), `Canvas already exists with id ${canvasPayload.canvasId}.`);
</span><span class="cx"> 
</span><span class="cx">         let canvas = WI.Canvas.fromPayload(canvasPayload);
</span><span class="lines">@@ -166,8 +166,6 @@
</span><span class="cx"> 
</span><span class="cx">     canvasRemoved(canvasIdentifier)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let canvas = this._canvasIdentifierMap.take(canvasIdentifier);
</span><span class="cx">         console.assert(canvas);
</span><span class="cx">         if (!canvas)
</span><span class="lines">@@ -178,8 +176,6 @@
</span><span class="cx"> 
</span><span class="cx">     canvasMemoryChanged(canvasIdentifier, memoryCost)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
</span><span class="cx">         console.assert(canvas);
</span><span class="cx">         if (!canvas)
</span><span class="lines">@@ -190,8 +186,6 @@
</span><span class="cx"> 
</span><span class="cx">     cssCanvasClientNodesChanged(canvasIdentifier)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
</span><span class="cx">         console.assert(canvas);
</span><span class="cx">         if (!canvas)
</span><span class="lines">@@ -202,8 +196,6 @@
</span><span class="cx"> 
</span><span class="cx">     recordingStarted(canvasIdentifier, initiator)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
</span><span class="cx">         console.assert(canvas);
</span><span class="cx">         if (!canvas)
</span><span class="lines">@@ -214,8 +206,6 @@
</span><span class="cx"> 
</span><span class="cx">     recordingProgress(canvasIdentifier, framesPayload, bufferUsed)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
</span><span class="cx">         console.assert(canvas);
</span><span class="cx">         if (!canvas)
</span><span class="lines">@@ -226,8 +216,6 @@
</span><span class="cx"> 
</span><span class="cx">     recordingFinished(canvasIdentifier, recordingPayload)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
</span><span class="cx">         console.assert(canvas);
</span><span class="cx">         if (!canvas)
</span><span class="lines">@@ -238,8 +226,6 @@
</span><span class="cx"> 
</span><span class="cx">     extensionEnabled(canvasIdentifier, extension)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
</span><span class="cx">         console.assert(canvas);
</span><span class="cx">         if (!canvas)
</span><span class="lines">@@ -250,8 +236,6 @@
</span><span class="cx"> 
</span><span class="cx">     programCreated(canvasIdentifier, programIdentifier)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
</span><span class="cx">         console.assert(canvas);
</span><span class="cx">         if (!canvas)
</span><span class="lines">@@ -267,8 +251,6 @@
</span><span class="cx"> 
</span><span class="cx">     programDeleted(programIdentifier)
</span><span class="cx">     {
</span><del>-        // Called from WI.CanvasObserver.
-
</del><span class="cx">         let program = this._shaderProgramIdentifierMap.take(programIdentifier);
</span><span class="cx">         console.assert(program);
</span><span class="cx">         if (!program)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersConsoleManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js  2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js     2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -85,10 +85,10 @@
</span><span class="cx">         this._remoteObjectsToRelease.add(remoteObject);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // ConsoleObserver
+
</ins><span class="cx">     messageWasAdded(target, source, level, text, type, url, line, column, repeatCount, parameters, stackTrace, requestId)
</span><span class="cx">     {
</span><del>-        // Called from WI.ConsoleObserver.
-
</del><span class="cx">         // FIXME: Get a request from request ID.
</span><span class="cx"> 
</span><span class="cx">         if (parameters)
</span><span class="lines">@@ -108,8 +108,6 @@
</span><span class="cx"> 
</span><span class="cx">     messagesCleared()
</span><span class="cx">     {
</span><del>-        // Called from WI.ConsoleObserver.
-
</del><span class="cx">         if (this._remoteObjectsToRelease) {
</span><span class="cx">             for (let remoteObject of this._remoteObjectsToRelease)
</span><span class="cx">                 remoteObject.release();
</span><span class="lines">@@ -134,25 +132,8 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _delayedMessagesCleared()
-    {
-        if (this._isNewPageOrReload) {
-            this._isNewPageOrReload = false;
-
-            if (!WI.settings.clearLogOnNavigate.value)
-                return;
-        }
-
-        this._issues = [];
-
-        // A console.clear() or command line clear() happened.
-        this.dispatchEventToListeners(WI.ConsoleManager.Event.Cleared);
-    }
-
</del><span class="cx">     messageRepeatCountUpdated(count)
</span><span class="cx">     {
</span><del>-        // Called from WI.ConsoleObserver.
-
</del><span class="cx">         this.dispatchEventToListeners(WI.ConsoleManager.Event.PreviousMessageRepeatCountUpdated, {count});
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -188,6 +169,21 @@
</span><span class="cx"> 
</span><span class="cx">     // Private
</span><span class="cx"> 
</span><ins>+    _delayedMessagesCleared()
+    {
+        if (this._isNewPageOrReload) {
+            this._isNewPageOrReload = false;
+
+            if (!WI.settings.clearLogOnNavigate.value)
+                return;
+        }
+
+        this._issues = [];
+
+        // A console.clear() or command line clear() happened.
+        this.dispatchEventToListeners(WI.ConsoleManager.Event.Cleared);
+    }
+
</ins><span class="cx">     _mainResourceDidChange(event)
</span><span class="cx">     {
</span><span class="cx">         console.assert(event.target instanceof WI.Frame);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersDOMManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js      2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js 2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -145,10 +145,10 @@
</span><span class="cx">         this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bind(DOMAgent, path), callback);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // DOMObserver
+
</ins><span class="cx">     didAddEventListener(nodeId)
</span><span class="cx">     {
</span><del>-        // Called from WI.DOMObserver.
-
</del><span class="cx">         let node = this._idToDOMNode[nodeId];
</span><span class="cx">         if (!node)
</span><span class="cx">             return;
</span><span class="lines">@@ -158,8 +158,6 @@
</span><span class="cx"> 
</span><span class="cx">     willRemoveEventListener(nodeId)
</span><span class="cx">     {
</span><del>-        // Called from WI.DOMObserver.
-
</del><span class="cx">         let node = this._idToDOMNode[nodeId];
</span><span class="cx">         if (!node)
</span><span class="cx">             return;
</span><span class="lines">@@ -169,8 +167,6 @@
</span><span class="cx"> 
</span><span class="cx">     didFireEvent(nodeId, eventName, timestamp, data)
</span><span class="cx">     {
</span><del>-        // Called from WI.DOMObserver.
-
</del><span class="cx">         let node = this._idToDOMNode[nodeId];
</span><span class="cx">         if (!node)
</span><span class="cx">             return;
</span><span class="lines">@@ -180,8 +176,6 @@
</span><span class="cx"> 
</span><span class="cx">     powerEfficientPlaybackStateChanged(nodeId, timestamp, isPowerEfficient)
</span><span class="cx">     {
</span><del>-        // Called from WI.DOMObserver.
-
</del><span class="cx">         let node = this._idToDOMNode[nodeId];
</span><span class="cx">         if (!node)
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersDOMStorageManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js       2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js  2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -140,10 +140,10 @@
</span><span class="cx">             domStorage.itemUpdated(key, oldValue, value);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // InspectorObserver
+
</ins><span class="cx">     inspectDOMStorage(id)
</span><span class="cx">     {
</span><del>-        // Called from WI.InspectorObserver.
-
</del><span class="cx">         console.assert(this._enabled);
</span><span class="cx"> 
</span><span class="cx">         var domStorage = this._domStorageForIdentifier(id);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersDebuggerManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js    2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -548,12 +548,10 @@
</span><span class="cx">         return this._nextBreakpointActionIdentifier++;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Protected (Called from WI.DebuggerObserver)
</del><ins>+    // DebuggerObserver
</ins><span class="cx"> 
</span><span class="cx">     breakpointResolved(target, breakpointIdentifier, location)
</span><span class="cx">     {
</span><del>-        // Called from WI.DebuggerObserver.
-
</del><span class="cx">         let breakpoint = this._breakpointIdMap.get(breakpointIdentifier);
</span><span class="cx">         console.assert(breakpoint);
</span><span class="cx">         if (!breakpoint)
</span><span class="lines">@@ -569,10 +567,8 @@
</span><span class="cx">         breakpoint.resolved = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    reset()
</del><ins>+    globalObjectCleared()
</ins><span class="cx">     {
</span><del>-        // Called from WI.DebuggerObserver.
-
</del><span class="cx">         let wasPaused = this.paused;
</span><span class="cx"> 
</span><span class="cx">         WI.Script.resetUniqueDisplayNameNumbers();
</span><span class="lines">@@ -600,8 +596,6 @@
</span><span class="cx"> 
</span><span class="cx">     debuggerDidPause(target, callFramesPayload, reason, data, asyncStackTracePayload)
</span><span class="cx">     {
</span><del>-        // Called from WI.DebuggerObserver.
-
</del><span class="cx">         if (this._delayedResumeTimeout) {
</span><span class="cx">             clearTimeout(this._delayedResumeTimeout);
</span><span class="cx">             this._delayedResumeTimeout = undefined;
</span><span class="lines">@@ -674,8 +668,6 @@
</span><span class="cx"> 
</span><span class="cx">     debuggerDidResume(target)
</span><span class="cx">     {
</span><del>-        // Called from WI.DebuggerObserver.
-
</del><span class="cx">         // COMPATIBILITY (iOS 10): Debugger.resumed event was ambiguous. When stepping
</span><span class="cx">         // we would receive a Debugger.resumed and we would not know if it really meant
</span><span class="cx">         // the backend resumed or would pause again due to a step. Legacy backends wait
</span><span class="lines">@@ -692,15 +684,11 @@
</span><span class="cx"> 
</span><span class="cx">     playBreakpointActionSound(breakpointActionIdentifier)
</span><span class="cx">     {
</span><del>-        // Called from WI.DebuggerObserver.
-
</del><span class="cx">         InspectorFrontendHost.beep();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     scriptDidParse(target, scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, sourceURL, sourceMapURL)
</span><span class="cx">     {
</span><del>-        // Called from WI.DebuggerObserver.
-
</del><span class="cx">         // Don't add the script again if it is already known.
</span><span class="cx">         let targetData = this.dataForTarget(target);
</span><span class="cx">         let existingScript = targetData.scriptForIdentifier(scriptIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersLayerTreeManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js        2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js   2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -90,6 +90,8 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // LayerTreeObserver
+
</ins><span class="cx">     layerTreeDidChange()
</span><span class="cx">     {
</span><span class="cx">         this.dispatchEventToListeners(WI.LayerTreeManager.Event.LayerTreeDidChange);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersNetworkManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js  2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js     2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -168,10 +168,80 @@
</span><span class="cx">         loadAndParseSourceMap();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    localResourceForURL(url)
+    {
+        return this._localResourcesMap.get(url);
+    }
+
+    resourceForURL(url)
+    {
+        if (!this._mainFrame)
+            return null;
+
+        if (this._mainFrame.mainResource.url === url)
+            return this._mainFrame.mainResource;
+
+        return this._mainFrame.resourceForURL(url, true);
+    }
+
+    adoptOrphanedResourcesForTarget(target)
+    {
+        let resources = this._orphanedResources.take(target.identifier);
+        if (!resources)
+            return;
+
+        for (let resource of resources)
+            target.adoptResource(resource);
+    }
+
+    processHAR({json, error})
+    {
+        if (error) {
+            WI.NetworkManager.synthesizeImportError(error);
+            return null;
+        }
+
+        if (typeof json !== "object" || json === null) {
+            WI.NetworkManager.synthesizeImportError(WI.UIString("invalid JSON"));
+            return null;
+        }
+
+        if (typeof json.log !== "object" || typeof json.log.version !== "string") {
+            WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
+            return null;
+        }
+
+        if (json.log.version !== "1.2") {
+            WI.NetworkManager.synthesizeImportError(WI.UIString("unsupported HAR version"));
+            return null;
+        }
+
+        if (!Array.isArray(json.log.entries) || !Array.isArray(json.log.pages) || !json.log.pages[0] || !json.log.pages[0].startedDateTime) {
+            WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
+            return null;
+        }
+
+        let mainResourceSentWalltime = WI.HARBuilder.dateFromHARDate(json.log.pages[0].startedDateTime) / 1000;
+        if (isNaN(mainResourceSentWalltime)) {
+            WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
+            return null;
+        }
+
+        let localResources = [];
+
+        for (let entry of json.log.entries) {
+            let localResource = WI.LocalResource.fromHAREntry(entry, mainResourceSentWalltime);
+            this._localResourcesMap.set(localResource.url, localResource);
+            localResources.push(localResource);
+        }
+
+        return localResources;
+    }
+
+    // PageObserver
+
</ins><span class="cx">     frameDidNavigate(framePayload)
</span><span class="cx">     {
</span><del>-        // Called from WI.PageObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -244,8 +314,6 @@
</span><span class="cx"> 
</span><span class="cx">     frameDidDetach(frameId)
</span><span class="cx">     {
</span><del>-        // Called from WI.PageObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -272,10 +340,10 @@
</span><span class="cx">             this._mainFrameDidChange(oldMainFrame);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // NetworkObserver
+
</ins><span class="cx">     resourceRequestWillBeSent(requestIdentifier, frameIdentifier, loaderIdentifier, request, type, redirectResponse, timestamp, walltime, initiator, targetId)
</span><span class="cx">     {
</span><del>-        // Called from WI.NetworkObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -417,8 +485,6 @@
</span><span class="cx"> 
</span><span class="cx">     markResourceRequestAsServedFromMemoryCache(requestIdentifier)
</span><span class="cx">     {
</span><del>-        // Called from WI.NetworkObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -436,8 +502,6 @@
</span><span class="cx"> 
</span><span class="cx">     resourceRequestWasServedFromMemoryCache(requestIdentifier, frameIdentifier, loaderIdentifier, cachedResourcePayload, timestamp, initiator)
</span><span class="cx">     {
</span><del>-        // Called from WI.NetworkObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -475,8 +539,6 @@
</span><span class="cx"> 
</span><span class="cx">     resourceRequestDidReceiveResponse(requestIdentifier, frameIdentifier, loaderIdentifier, type, response, timestamp)
</span><span class="cx">     {
</span><del>-        // Called from WI.NetworkObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -525,8 +587,6 @@
</span><span class="cx"> 
</span><span class="cx">     resourceRequestDidReceiveData(requestIdentifier, dataLength, encodedDataLength, timestamp)
</span><span class="cx">     {
</span><del>-        // Called from WI.NetworkObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -548,8 +608,6 @@
</span><span class="cx"> 
</span><span class="cx">     resourceRequestDidFinishLoading(requestIdentifier, timestamp, sourceMapURL, metrics)
</span><span class="cx">     {
</span><del>-        // Called from WI.NetworkObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -575,8 +633,6 @@
</span><span class="cx"> 
</span><span class="cx">     resourceRequestDidFailLoading(requestIdentifier, canceled, timestamp, errorText)
</span><span class="cx">     {
</span><del>-        // Called from WI.NetworkObserver.
-
</del><span class="cx">         // Ignore this while waiting for the whole frame/resource tree.
</span><span class="cx">         if (this._waitingForMainFrameResourceTreePayload)
</span><span class="cx">             return;
</span><span class="lines">@@ -597,10 +653,10 @@
</span><span class="cx">         this._resourceRequestIdentifierMap.delete(requestIdentifier);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // RuntimeObserver
+
</ins><span class="cx">     executionContextCreated(contextPayload)
</span><span class="cx">     {
</span><del>-        // Called from WI.RuntimeObserver.
-
</del><span class="cx">         let frame = this.frameForIdentifier(contextPayload.frameId);
</span><span class="cx">         console.assert(frame);
</span><span class="cx">         if (!frame)
</span><span class="lines">@@ -612,76 +668,6 @@
</span><span class="cx">         frame.addExecutionContext(executionContext);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    localResourceForURL(url)
-    {
-        return this._localResourcesMap.get(url);
-    }
-
-    resourceForURL(url)
-    {
-        if (!this._mainFrame)
-            return null;
-
-        if (this._mainFrame.mainResource.url === url)
-            return this._mainFrame.mainResource;
-
-        return this._mainFrame.resourceForURL(url, true);
-    }
-
-    adoptOrphanedResourcesForTarget(target)
-    {
-        let resources = this._orphanedResources.take(target.identifier);
-        if (!resources)
-            return;
-
-        for (let resource of resources)
-            target.adoptResource(resource);
-    }
-
-    processHAR({json, error})
-    {
-        if (error) {
-            WI.NetworkManager.synthesizeImportError(error);
-            return null;
-        }
-
-        if (typeof json !== "object" || json === null) {
-            WI.NetworkManager.synthesizeImportError(WI.UIString("invalid JSON"));
-            return null;
-        }
-
-        if (typeof json.log !== "object" || typeof json.log.version !== "string") {
-            WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
-            return null;
-        }
-
-        if (json.log.version !== "1.2") {
-            WI.NetworkManager.synthesizeImportError(WI.UIString("unsupported HAR version"));
-            return null;
-        }
-
-        if (!Array.isArray(json.log.entries) || !Array.isArray(json.log.pages) || !json.log.pages[0] || !json.log.pages[0].startedDateTime) {
-            WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
-            return null;
-        }
-
-        let mainResourceSentWalltime = WI.HARBuilder.dateFromHARDate(json.log.pages[0].startedDateTime) / 1000;
-        if (isNaN(mainResourceSentWalltime)) {
-            WI.NetworkManager.synthesizeImportError(WI.UIString("invalid HAR"));
-            return null;
-        }
-
-        let localResources = [];
-
-        for (let entry of json.log.entries) {
-            let localResource = WI.LocalResource.fromHAREntry(entry, mainResourceSentWalltime);
-            this._localResourcesMap.set(localResource.url, localResource);
-            localResources.push(localResource);
-        }
-
-        return localResources;
-    }
-
</del><span class="cx">     // Private
</span><span class="cx"> 
</span><span class="cx">     _addNewResourceToFrameOrTarget(url, frameIdentifier, resourceOptions = {}, frameOptions = {})
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersTargetManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js   2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js      2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -62,45 +62,6 @@
</span><span class="cx">         return null;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    targetCreated(targetInfo)
-    {
-        // Called from WI.TargetObserver.
-
-        // FIXME: Eliminate this once the local inspector is configured to use
-        // the Multiplexing code path. Then we can perform this immediately
-        // in `WI.loaded` if a TargetAgent exists.
-        if (this._targets.size === 0)
-            this.createMultiplexingBackendTarget(targetInfo);
-
-        let connection = new InspectorBackend.TargetConnection(targetInfo.targetId);
-        let target = this._createTarget(targetInfo, connection);
-        this._checkAndHandlePageTargetTransition(target);
-        target.initialize();
-
-        this.addTarget(target);
-    }
-
-    targetDestroyed(targetId)
-    {
-        // Called from WI.TargetObserver.
-
-        let target = this._targets.get(targetId);
-        this._checkAndHandlePageTargetTermination(target);
-        this.removeTarget(target);
-    }
-
-    dispatchMessageFromTarget(targetId, message)
-    {
-        // Called from WI.TargetObserver.
-
-        let target = this._targets.get(targetId);
-        console.assert(target);
-        if (!target)
-            return;
-
-        target.connection.dispatch(message);
-    }
-
</del><span class="cx">     addTarget(target)
</span><span class="cx">     {
</span><span class="cx">         console.assert(target);
</span><span class="lines">@@ -147,6 +108,41 @@
</span><span class="cx">         this.addTarget(target);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // TargetObserver
+
+    targetCreated(targetInfo)
+    {
+        // FIXME: Eliminate this once the local inspector is configured to use
+        // the Multiplexing code path. Then we can perform this immediately
+        // in `WI.loaded` if a TargetAgent exists.
+        if (this._targets.size === 0)
+            this.createMultiplexingBackendTarget(targetInfo);
+
+        let connection = new InspectorBackend.TargetConnection(targetInfo.targetId);
+        let target = this._createTarget(targetInfo, connection);
+        this._checkAndHandlePageTargetTransition(target);
+        target.initialize();
+
+        this.addTarget(target);
+    }
+
+    targetDestroyed(targetId)
+    {
+        let target = this._targets.get(targetId);
+        this._checkAndHandlePageTargetTermination(target);
+        this.removeTarget(target);
+    }
+
+    dispatchMessageFromTarget(targetId, message)
+    {
+        let target = this._targets.get(targetId);
+        console.assert(target);
+        if (!target)
+            return;
+
+        target.connection.dispatch(message);
+    }
+
</ins><span class="cx">     // Private
</span><span class="cx"> 
</span><span class="cx">     _createTarget(targetInfo, connection)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js 2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js    2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -379,6 +379,8 @@
</span><span class="cx">         return this._scriptProfilerRecords !== null;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // ConsoleObserver
+
</ins><span class="cx">     heapSnapshotAdded(timestamp, snapshot)
</span><span class="cx">     {
</span><span class="cx">         if (!this._enabled)
</span><span class="lines">@@ -603,6 +605,102 @@
</span><span class="cx">         this.capturingStopped(timestamp);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // ScriptProfilerObserver
+
+    scriptProfilerTrackingStarted(timestamp)
+    {
+        this._scriptProfilerRecords = [];
+
+        this.capturingStarted(timestamp);
+    }
+
+    scriptProfilerTrackingUpdated(event)
+    {
+        if (!this._enabled)
+            return;
+
+        let {startTime, endTime, type} = event;
+        let scriptRecordType = this._scriptProfilerTypeToScriptTimelineRecordType(type);
+        let record = new WI.ScriptTimelineRecord(scriptRecordType, startTime, endTime, null, null, null, null);
+        record.__scriptProfilerType = type;
+        this._scriptProfilerRecords.push(record);
+
+        // "Other" events, generated by Web content, will have wrapping Timeline records
+        // and need to be merged. Non-Other events, generated purely by the JavaScript
+        // engine or outside of the page via APIs, will not have wrapping Timeline
+        // records, so these records can just be added right now.
+        if (type !== ScriptProfilerAgent.EventType.Other)
+            this._addRecord(record);
+    }
+
+    scriptProfilerTrackingCompleted(timestamp, samples)
+    {
+        if (this._enabled) {
+            console.assert(!this._webTimelineScriptRecordsExpectingScriptProfilerEvents || this._scriptProfilerRecords.length >= this._webTimelineScriptRecordsExpectingScriptProfilerEvents.length);
+
+            if (samples) {
+                let {stackTraces} = samples;
+                let topDownCallingContextTree = this._activeRecording.topDownCallingContextTree;
+
+                // Calculate a per-sample duration.
+                let timestampIndex = 0;
+                let timestampCount = stackTraces.length;
+                let sampleDurations = new Array(timestampCount);
+                let sampleDurationIndex = 0;
+                const defaultDuration = 1 / 1000; // 1ms.
+                for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
+                    let record = this._scriptProfilerRecords[i];
+
+                    // Use a default duration for timestamps recorded outside of ScriptProfiler events.
+                    while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.startTime) {
+                        sampleDurations[sampleDurationIndex++] = defaultDuration;
+                        timestampIndex++;
+                    }
+
+                    // Average the duration per sample across all samples during the record.
+                    let samplesInRecord = 0;
+                    while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.endTime) {
+                        timestampIndex++;
+                        samplesInRecord++;
+                    }
+                    if (samplesInRecord) {
+                        let averageDuration = (record.endTime - record.startTime) / samplesInRecord;
+                        sampleDurations.fill(averageDuration, sampleDurationIndex, sampleDurationIndex + samplesInRecord);
+                        sampleDurationIndex += samplesInRecord;
+                    }
+                }
+
+                // Use a default duration for timestamps recorded outside of ScriptProfiler events.
+                if (timestampIndex < timestampCount)
+                    sampleDurations.fill(defaultDuration, sampleDurationIndex);
+
+                this._activeRecording.initializeCallingContextTrees(stackTraces, sampleDurations);
+
+                // FIXME: This transformation should not be needed after introducing ProfileView.
+                // Once we eliminate ProfileNodeTreeElements and ProfileNodeDataGridNodes.
+                // <https://webkit.org/b/154973> Web Inspector: Timelines UI redesign: Remove TimelineSidebarPanel
+                for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
+                    let record = this._scriptProfilerRecords[i];
+                    record.profilePayload = topDownCallingContextTree.toCPUProfilePayload(record.startTime, record.endTime);
+                }
+            }
+
+            // Associate the ScriptProfiler created records with Web Timeline records.
+            // Filter out the already added ScriptProfiler events which should not have been wrapped.
+            if (WI.sharedApp.debuggableType !== WI.DebuggableType.JavaScript) {
+                this._scriptProfilerRecords = this._scriptProfilerRecords.filter((x) => x.__scriptProfilerType === ScriptProfilerAgent.EventType.Other);
+                this._mergeScriptProfileRecords();
+            }
+
+            this._scriptProfilerRecords = null;
+
+            let timeline = this._activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
+            timeline.refresh();
+        }
+
+        this.capturingStopped(timestamp);
+    }
+
</ins><span class="cx">     // MemoryObserver
</span><span class="cx"> 
</span><span class="cx">     memoryTrackingStarted(timestamp)
</span><span class="lines">@@ -1130,100 +1228,6 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    scriptProfilerTrackingStarted(timestamp)
-    {
-        this._scriptProfilerRecords = [];
-
-        this.capturingStarted(timestamp);
-    }
-
-    scriptProfilerTrackingUpdated(event)
-    {
-        if (!this._enabled)
-            return;
-
-        let {startTime, endTime, type} = event;
-        let scriptRecordType = this._scriptProfilerTypeToScriptTimelineRecordType(type);
-        let record = new WI.ScriptTimelineRecord(scriptRecordType, startTime, endTime, null, null, null, null);
-        record.__scriptProfilerType = type;
-        this._scriptProfilerRecords.push(record);
-
-        // "Other" events, generated by Web content, will have wrapping Timeline records
-        // and need to be merged. Non-Other events, generated purely by the JavaScript
-        // engine or outside of the page via APIs, will not have wrapping Timeline
-        // records, so these records can just be added right now.
-        if (type !== ScriptProfilerAgent.EventType.Other)
-            this._addRecord(record);
-    }
-
-    scriptProfilerTrackingCompleted(timestamp, samples)
-    {
-        if (this._enabled) {
-            console.assert(!this._webTimelineScriptRecordsExpectingScriptProfilerEvents || this._scriptProfilerRecords.length >= this._webTimelineScriptRecordsExpectingScriptProfilerEvents.length);
-
-            if (samples) {
-                let {stackTraces} = samples;
-                let topDownCallingContextTree = this._activeRecording.topDownCallingContextTree;
-
-                // Calculate a per-sample duration.
-                let timestampIndex = 0;
-                let timestampCount = stackTraces.length;
-                let sampleDurations = new Array(timestampCount);
-                let sampleDurationIndex = 0;
-                const defaultDuration = 1 / 1000; // 1ms.
-                for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
-                    let record = this._scriptProfilerRecords[i];
-
-                    // Use a default duration for timestamps recorded outside of ScriptProfiler events.
-                    while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.startTime) {
-                        sampleDurations[sampleDurationIndex++] = defaultDuration;
-                        timestampIndex++;
-                    }
-
-                    // Average the duration per sample across all samples during the record.
-                    let samplesInRecord = 0;
-                    while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.endTime) {
-                        timestampIndex++;
-                        samplesInRecord++;
-                    }
-                    if (samplesInRecord) {
-                        let averageDuration = (record.endTime - record.startTime) / samplesInRecord;
-                        sampleDurations.fill(averageDuration, sampleDurationIndex, sampleDurationIndex + samplesInRecord);
-                        sampleDurationIndex += samplesInRecord;
-                    }
-                }
-
-                // Use a default duration for timestamps recorded outside of ScriptProfiler events.
-                if (timestampIndex < timestampCount)
-                    sampleDurations.fill(defaultDuration, sampleDurationIndex);
-
-                this._activeRecording.initializeCallingContextTrees(stackTraces, sampleDurations);
-
-                // FIXME: This transformation should not be needed after introducing ProfileView.
-                // Once we eliminate ProfileNodeTreeElements and ProfileNodeDataGridNodes.
-                // <https://webkit.org/b/154973> Web Inspector: Timelines UI redesign: Remove TimelineSidebarPanel
-                for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
-                    let record = this._scriptProfilerRecords[i];
-                    record.profilePayload = topDownCallingContextTree.toCPUProfilePayload(record.startTime, record.endTime);
-                }
-            }
-
-            // Associate the ScriptProfiler created records with Web Timeline records.
-            // Filter out the already added ScriptProfiler events which should not have been wrapped.
-            if (WI.sharedApp.debuggableType !== WI.DebuggableType.JavaScript) {
-                this._scriptProfilerRecords = this._scriptProfilerRecords.filter((x) => x.__scriptProfilerType === ScriptProfilerAgent.EventType.Other);
-                this._mergeScriptProfileRecords();
-            }
-
-            this._scriptProfilerRecords = null;
-
-            let timeline = this._activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
-            timeline.refresh();
-        }
-
-        this.capturingStopped(timestamp);
-    }
-
</del><span class="cx">     _mergeScriptProfileRecords()
</span><span class="cx">     {
</span><span class="cx">         let nextRecord = function(list) { return list.shift() || null; };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersWorkerManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js   2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js      2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -40,12 +40,10 @@
</span><span class="cx">             target.WorkerAgent.enable();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Public
</del><ins>+    // WorkerObserver
</ins><span class="cx"> 
</span><span class="cx">     workerCreated(workerId, url)
</span><span class="cx">     {
</span><del>-        // Called from WI.WorkerObserver.
-
</del><span class="cx">         let connection = new InspectorBackend.WorkerConnection(workerId);
</span><span class="cx">         let workerTarget = new WI.WorkerTarget(workerId, url, connection);
</span><span class="cx">         workerTarget.initialize();
</span><span class="lines">@@ -61,8 +59,6 @@
</span><span class="cx"> 
</span><span class="cx">     workerTerminated(workerId)
</span><span class="cx">     {
</span><del>-        // Called from WI.WorkerObserver.
-
</del><span class="cx">         let connection = this._connections.take(workerId);
</span><span class="cx"> 
</span><span class="cx">         WI.targetManager.removeTarget(connection.target);
</span><span class="lines">@@ -70,8 +66,6 @@
</span><span class="cx"> 
</span><span class="cx">     dispatchMessageFromWorker(workerId, message)
</span><span class="cx">     {
</span><del>-        // Called from WI.WorkerObserver.
-
</del><span class="cx">         let connection = this._connections.get(workerId);
</span><span class="cx"> 
</span><span class="cx">         console.assert(connection);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolDebuggerObserverjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js (248535 => 248536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js   2019-08-12 18:42:20 UTC (rev 248535)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js      2019-08-12 18:45:13 UTC (rev 248536)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx">     globalObjectCleared()
</span><span class="cx">     {
</span><del>-        WI.debuggerManager.reset();
</del><ins>+        WI.debuggerManager.globalObjectCleared();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL, isModule)
</span></span></pre>
</div>
</div>

</body>
</html>