<!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>[172161] trunk/Source</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/172161">172161</a></dd>
<dt>Author</dt> <dd>burg@cs.washington.edu</dd>
<dt>Date</dt> <dd>2014-08-06 11:30:01 -0700 (Wed, 06 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: convert ReplayManager to a promise-based API
https://bugs.webkit.org/show_bug.cgi?id=135249

Reviewed by Timothy Hatcher.

Source/WebCore:

Fix some assertions to match ReplayController's preconditions.

* inspector/InspectorReplayAgent.cpp:
(WebCore::InspectorReplayAgent::replayToPosition):
(WebCore::InspectorReplayAgent::replayToCompletion):

Source/WebInspectorUI:

Convert replay commands to an asynchronous, promise-based API. This addresses
two problems with a synchronous replay API: clients can only use the synchronous
API if session and segment state are exactly correct, and trying to change state
to match this requirement requires chaining multiple commands and events.

The asynchronous API allows clients to issue replay commands with impunity,
as long as they can be unambiguously handled. For example, issuing
pausePlayback() while capturing is not allowed, but issuing startCapturing()
while replaying is allowed. The API also hides implementation details that
are not important, such as steps to unpause or temporarily disable the debugger.

This patch also cleans up uses of promises, such as adding error re-throwing.
It adds return type annotations to public ReplayManager asynchronous methods.

* UserInterface/Controllers/ReplayManager.js:
(WebInspector.ReplayManager.catch):
(WebInspector.ReplayManager):
(WebInspector.ReplayManager.prototype.createSession):
(WebInspector.ReplayManager.prototype.switchSession):
(WebInspector.ReplayManager.prototype.startCapturing):
(WebInspector.ReplayManager.prototype.stopCapturing):
(WebInspector.ReplayManager.prototype.replayToPosition):
(WebInspector.ReplayManager.prototype.replayToCompletion):
(WebInspector.ReplayManager.prototype.sessionCreated.catch): re-throw.
(WebInspector.ReplayManager.prototype.segmentCompleted.catch): re-throw.
(WebInspector.ReplayManager.prototype.segmentCompleted.catch): re-throw.
(WebInspector.ReplayManager.prototype.segmentUnloaded.catch): re-throw.
(WebInspector.ReplayManager.prototype.sessionCreated.catech): re-throw.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorReplayAgentcpp">trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersReplayManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/ReplayManager.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (172160 => 172161)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-08-06 18:25:08 UTC (rev 172160)
+++ trunk/Source/WebCore/ChangeLog        2014-08-06 18:30:01 UTC (rev 172161)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-08-06  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
+        Web Inspector: convert ReplayManager to a promise-based API
+        https://bugs.webkit.org/show_bug.cgi?id=135249
+
+        Reviewed by Timothy Hatcher.
+
+        Fix some assertions to match ReplayController's preconditions.
+
+        * inspector/InspectorReplayAgent.cpp:
+        (WebCore::InspectorReplayAgent::replayToPosition):
+        (WebCore::InspectorReplayAgent::replayToCompletion):
+
</ins><span class="cx"> 2014-08-05  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Mac] Unable to scroll to bottom of nested scrollable areas
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorReplayAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp (172160 => 172161)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp        2014-08-06 18:25:08 UTC (rev 172160)
+++ trunk/Source/WebCore/inspector/InspectorReplayAgent.cpp        2014-08-06 18:30:01 UTC (rev 172161)
</span><span class="lines">@@ -353,8 +353,8 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (sessionState() != SessionState::Inactive) {
-        *errorString = ASCIILiteral(&quot;Can't start replay while capture or playback is in progress.&quot;);
</del><ins>+    if (sessionState() == SessionState::Capturing) {
+        *errorString = ASCIILiteral(&quot;Can't start replay while capture is in progress.&quot;);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -363,8 +363,8 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorReplayAgent::replayToCompletion(ErrorString* errorString, bool fastReplay)
</span><span class="cx"> {
</span><del>-    if (sessionState() != SessionState::Inactive) {
-        *errorString = ASCIILiteral(&quot;Can't start replay while capture or playback is in progress.&quot;);
</del><ins>+    if (sessionState() == SessionState::Capturing) {
+        *errorString = ASCIILiteral(&quot;Can't start replay while capture is in progress.&quot;);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (172160 => 172161)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-08-06 18:25:08 UTC (rev 172160)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-08-06 18:30:01 UTC (rev 172161)
</span><span class="lines">@@ -1,5 +1,41 @@
</span><span class="cx"> 2014-08-06  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: convert ReplayManager to a promise-based API
+        https://bugs.webkit.org/show_bug.cgi?id=135249
+
+        Reviewed by Timothy Hatcher.
+
+        Convert replay commands to an asynchronous, promise-based API. This addresses
+        two problems with a synchronous replay API: clients can only use the synchronous
+        API if session and segment state are exactly correct, and trying to change state
+        to match this requirement requires chaining multiple commands and events.
+
+        The asynchronous API allows clients to issue replay commands with impunity,
+        as long as they can be unambiguously handled. For example, issuing
+        pausePlayback() while capturing is not allowed, but issuing startCapturing()
+        while replaying is allowed. The API also hides implementation details that
+        are not important, such as steps to unpause or temporarily disable the debugger.
+
+        This patch also cleans up uses of promises, such as adding error re-throwing.
+        It adds return type annotations to public ReplayManager asynchronous methods.
+
+        * UserInterface/Controllers/ReplayManager.js:
+        (WebInspector.ReplayManager.catch):
+        (WebInspector.ReplayManager):
+        (WebInspector.ReplayManager.prototype.createSession):
+        (WebInspector.ReplayManager.prototype.switchSession):
+        (WebInspector.ReplayManager.prototype.startCapturing):
+        (WebInspector.ReplayManager.prototype.stopCapturing):
+        (WebInspector.ReplayManager.prototype.replayToPosition):
+        (WebInspector.ReplayManager.prototype.replayToCompletion):
+        (WebInspector.ReplayManager.prototype.sessionCreated.catch): re-throw.
+        (WebInspector.ReplayManager.prototype.segmentCompleted.catch): re-throw.
+        (WebInspector.ReplayManager.prototype.segmentCompleted.catch): re-throw.
+        (WebInspector.ReplayManager.prototype.segmentUnloaded.catch): re-throw.
+        (WebInspector.ReplayManager.prototype.sessionCreated.catech): re-throw.
+
+2014-08-06  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
</ins><span class="cx">         Web Inspector: protocol command invocations should return a promise if no callback is supplied
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=130702
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersReplayManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/ReplayManager.js (172160 => 172161)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/ReplayManager.js        2014-08-06 18:25:08 UTC (rev 172160)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/ReplayManager.js        2014-08-06 18:30:01 UTC (rev 172161)
</span><span class="lines">@@ -69,8 +69,9 @@
</span><span class="cx">         }).then(function(payload) {
</span><span class="cx">             for (var sessionId of payload.ids)
</span><span class="cx">                 instance.sessionCreated(sessionId);
</span><del>-        }).catch(function(err) {
-            console.error(&quot;ReplayManager initialization failed: &quot;, err);
</del><ins>+        }).catch(function(error) {
+            console.error(&quot;ReplayManager initialization failed: &quot;, error);
+            throw error;
</ins><span class="cx">         });
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -162,12 +163,13 @@
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     // These return promises even if the relevant instance is already created.
</span><del>-    waitUntilInitialized: function()
</del><ins>+    waitUntilInitialized: function()  // --&gt; ()
</ins><span class="cx">     {
</span><span class="cx">         return this._initializationPromise;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    getSession: function(sessionId)
</del><ins>+    // Return a promise that resolves to a session, if it exists.
+    getSession: function(sessionId) // --&gt; (WebInspector.ReplaySession)
</ins><span class="cx">     {
</span><span class="cx">         if (this._sessionPromises.has(sessionId))
</span><span class="cx">             return this._sessionPromises.get(sessionId);
</span><span class="lines">@@ -181,7 +183,8 @@
</span><span class="cx">         return newPromise;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    getSegment: function(segmentId)
</del><ins>+    // Return a promise that resolves to a session segment, if it exists.
+    getSegment: function(segmentId)  // --&gt; (WebInspector.ReplaySessionSegment)
</ins><span class="cx">     {
</span><span class="cx">         if (this._segmentPromises.has(segmentId))
</span><span class="cx">             return this._segmentPromises.get(segmentId);
</span><span class="lines">@@ -195,6 +198,193 @@
</span><span class="cx">         return newPromise;
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    // Switch to the specified session.
+    // Returns a promise that resolves when the switch completes.
+    switchSession: function(sessionId) // --&gt; ()
+    {
+        var manager = this;
+        var result = this.waitUntilInitialized();
+
+        if (this.sessionState === WebInspector.ReplayManager.SessionState.Capturing) {
+            result = result.then(function() {
+                return WebInspector.replayManager.stopCapturing();
+            });
+        }
+
+        if (this.sessionState === WebInspector.ReplayManager.SessionState.Replaying) {
+            result = result.then(function() {
+                return WebInspector.replayManager.stopPlayback();
+            });
+        }
+
+        result = result.then(function() {
+                console.assert(manager.sessionState === WebInspector.ReplayManager.SessionState.Inactive);
+                console.assert(manager.segmentState === WebInspector.ReplayManager.SegmentState.Unloaded);
+
+                return manager.getSession(sessionId);
+            }).then(function ensureSessionDataIsLoaded(session) {
+                return ReplayAgent.switchSession(session.identifier);
+            }).catch(function(error) {
+                console.error(&quot;Failed to switch to session: &quot;, error);
+                throw error;
+            });
+
+        return result;
+    },
+
+    // Start capturing into the current session as soon as possible.
+    // Returns a promise that resolves when capturing begins.
+    startCapturing: function() // --&gt; ()
+    {
+        var manager = this;
+        var result = this.waitUntilInitialized();
+
+        if (this.sessionState === WebInspector.ReplayManager.SessionState.Capturing)
+            return result; // Already capturing.
+
+        if (this.sessionState === WebInspector.ReplayManager.SessionState.Replaying) {
+            result = result.then(function() {
+                return WebInspector.replayManager.stopPlayback();
+            });
+        }
+
+        result = result.then(function() {
+                console.assert(manager.sessionState === WebInspector.ReplayManager.SessionState.Inactive);
+                console.assert(manager.segmentState === WebInspector.ReplayManager.SegmentState.Unloaded);
+
+                return ReplayAgent.startCapturing();
+            }).catch(function(error) {
+                console.error(&quot;Failed to start capturing: &quot;, error);
+                throw error;
+            });
+
+        return result;
+    },
+
+    // Stop capturing into the current session as soon as possible.
+    // Returns a promise that resolves when capturing ends.
+    stopCapturing: function() // --&gt; ()
+    {
+        console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Capturing, &quot;Cannot stop capturing unless capture is active.&quot;);
+        console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Appending);
+
+        return ReplayAgent.stopCapturing()
+            .catch(function(error) {
+                console.error(&quot;Failed to stop capturing: &quot;, error);
+                throw error;
+            });
+    },
+
+    // Pause playback as soon as possible.
+    // Returns a promise that resolves when playback is paused.
+    pausePlayback: function() // --&gt; ()
+    {
+        console.assert(this.sessionState !== WebInspector.ReplayManager.SessionState.Capturing, &quot;Cannot pause playback while capturing.&quot;);
+
+        var manager = this;
+        var result = this.waitUntilInitialized();
+
+        if (this.sessionState === WebInspector.ReplayManager.SessionState.Inactive)
+            return result; // Already stopped.
+
+        if (this.sessionState !== WebInspector.ReplayManager.SegmentState.Dispatching)
+            return result; // Already stopped.
+
+        result = result.then(function() {
+                console.assert(manager.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
+                console.assert(manager.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching);
+
+                return ReplayAgent.pausePlayback();
+            }).catch(function(error) {
+                console.error(&quot;Failed to pause playback: &quot;, error);
+                throw error;
+            });
+
+        return result;
+    },
+
+    // Pause playback and unload the current session segment as soon as possible.
+    // Returns a promise that resolves when the current segment is unloaded.
+    stopPlayback: function() // --&gt; ()
+    {
+        console.assert(this.sessionState !== WebInspector.ReplayManager.SessionState.Capturing, &quot;Cannot stop playback while capturing.&quot;);
+
+        var manager = this;
+        var result = this.waitUntilInitialized();
+
+        if (this.sessionState === WebInspector.ReplayManager.SessionState.Inactive)
+            return result; // Already stopped.
+
+        result = result.then(function() {
+                console.assert(manager.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
+                console.assert(manager.segmentState !== WebInspector.ReplayManager.SegmentState.Appending);
+
+                return ReplayAgent.stopPlayback();
+            }).catch(function(error) {
+                console.error(&quot;Failed to stop playback: &quot;, error);
+                throw error;
+            });
+
+        return result;
+    },
+
+    // Replay to the specified position as soon as possible using the current replay speed.
+    // Returns a promise that resolves when replay has begun (NOT when the position is reached).
+    replayToPosition: function(replayPosition) // --&gt; ()
+    {
+        console.assert(replayPosition instanceof WebInspector.ReplayPosition, &quot;Cannot replay to a position while capturing.&quot;);
+
+        var manager = this;
+        var result = this.waitUntilInitialized();
+
+        if (this.sessionState === WebInspector.ReplayManager.SessionState.Capturing) {
+            result = result.then(function() {
+                return WebInspector.replayManager.stopCapturing();
+            });
+        }
+
+        result = result.then(function() {
+                console.assert(manager.sessionState !== WebInspector.ReplayManager.SessionState.Capturing);
+                console.assert(manager.segmentState !== WebInspector.ReplayManager.SegmentState.Appending);
+
+                return ReplayAgent.replayToPosition(replayPosition, manager.playbackSpeed === WebInspector.ReplayManager.PlaybackSpeed.FastForward);
+            }).catch(function(error) {
+                console.error(&quot;Failed to start playback to position: &quot;, replayPosition, error);
+                throw error;
+            });
+
+        return result;
+    },
+
+    // Replay to the end of the session as soon as possible using the current replay speed.
+    // Returns a promise that resolves when replay has begun (NOT when the end is reached).
+    replayToCompletion: function() // --&gt; ()
+    {
+        var manager = this;
+        var result = this.waitUntilInitialized();
+
+        if (this.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching)
+            return result; // Already running.
+
+        if (this.sessionState === WebInspector.ReplayManager.SessionState.Capturing) {
+            result = result.then(function() {
+                return WebInspector.replayManager.stopCapturing();
+            });
+        }
+
+        result = result.then(function() {
+                console.assert(manager.sessionState !== WebInspector.ReplayManager.SessionState.Capturing);
+                console.assert(manager.segmentState === WebInspector.ReplayManager.SegmentState.Loaded || manager.segmentState === WebInspector.ReplayManager.SegmentState.Unloaded);
+
+                return ReplayAgent.replayToCompletion(manager.playbackSpeed === WebInspector.ReplayManager.PlaybackSpeed.FastForward)
+            }).catch(function(error) {
+                console.error(&quot;Failed to start playback to completion: &quot;, error);
+                throw error;
+            });
+
+        return result;
+    },
+
</ins><span class="cx">     // Protected (called by ReplayObserver)
</span><span class="cx"> 
</span><span class="cx">     // Since these methods update session and segment state, they depend on the manager
</span><span class="lines">@@ -282,6 +472,7 @@
</span><span class="cx">                 sessionMap.set(sessionId, session);
</span><span class="cx">             }).catch(function(error) {
</span><span class="cx">                 console.error(&quot;Error obtaining session data: &quot;, error);
</span><ins>+                throw error;
</ins><span class="cx">             });
</span><span class="cx"> 
</span><span class="cx">         this.dispatchEventToListeners(WebInspector.ReplayManager.Event.SessionAdded, {sessionId: sessionId});
</span><span class="lines">@@ -309,10 +500,9 @@
</span><span class="cx"> 
</span><span class="cx">         var manager = this;
</span><span class="cx"> 
</span><del>-        // Wait for any outstanding promise to settle so it doesn't get re-added.
</del><span class="cx">         this.getSession(sessionId)
</span><span class="cx">             .catch(function(error) {
</span><del>-                return Promise.resolve();
</del><ins>+                // Wait for any outstanding promise to settle so it doesn't get re-added.
</ins><span class="cx">             }).then(function() {
</span><span class="cx">                 manager._sessionPromises.delete(sessionId);
</span><span class="cx">                 var removedSession = manager._sessions.take(sessionId);
</span><span class="lines">@@ -354,6 +544,7 @@
</span><span class="cx">                 segmentMap.set(segmentId, segment);
</span><span class="cx">             }).catch(function(error) {
</span><span class="cx">                 console.error(&quot;Error obtaining segment data: &quot;, error);
</span><ins>+                throw error;
</ins><span class="cx">             });
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -411,62 +602,6 @@
</span><span class="cx"> 
</span><span class="cx">     // Private
</span><span class="cx"> 
</span><del>-    // FIXME: these methods should be private and only accessed by implementations of the public API,
-    // which should properly chain async calls leading up to these low-level backend calls. Otherwise,
-    // their preconditions on session and segment state are too strong for scenarios triggered by the UI.
-
-    startCapturing: function()
-    {
-        console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Inactive);
-        console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Unloaded);
-
-        ReplayAgent.startCapturing();
-    },
-
-    stopCapturing: function()
-    {
-        console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Capturing);
-        console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Appending);
-
-        ReplayAgent.stopCapturing();
-    },
-
-    replayToMarkIndex: function(replayPosition)
-    {
-        console.assert(replayPosition instanceof WebInspector.ReplayPosition);
-
-        console.assert(this.sessionState !== WebInspector.ReplayManager.SessionState.Capturing);
-        // FIXME: Once the public API is asynchronous, we should assert that segmentState is Loaded.
-
-        ReplayAgent.replayToPosition(replayPosition, this.playbackSpeed === WebInspector.ReplayManager.PlaybackSpeed.FastForward);
-    },
-
-    replayToCompletion: function()
-    {
-        console.assert(this.sessionState !== WebInspector.ReplayManager.SessionState.Capturing);
-        // FIXME: Once the public API is asynchronous, we should assert that segmentState is Loaded.
-
-        ReplayAgent.replayToCompletion(this.playbackSpeed === WebInspector.ReplayManager.PlaybackSpeed.FastForward);
-    },
-
-    pausePlayback: function()
-    {
-        console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
-        console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching);
-
-        ReplayAgent.pausePlayback();
-    },
-
-    stopPlayback: function()
-    {
-        console.assert(this.sessionState === WebInspector.ReplayManager.SessionState.Replaying);
-        console.assert(this.segmentState === WebInspector.ReplayManager.SegmentState.Loaded);
-
-        ReplayAgent.stopPlayback();
-    },
-
-    // Private
-
</del><span class="cx">     _changeSessionState: function(newState)
</span><span class="cx">     {
</span><span class="cx">         // Warn about no-op state changes. We shouldn't be seeing them.
</span></span></pre>
</div>
</div>

</body>
</html>