| Differences between
and this patch
- a/Source/WebCore/ChangeLog +15 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-08-11  Brian J. Burg  <burg@cs.washington.edu>
2
3
        Web Inspector: add eject current recording button to the replay dashboard
4
        https://bugs.webkit.org/show_bug.cgi?id=135225
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add a protocol method that creates an empty replay session. To eject, the
9
        frontend creates an empty session and then switches to it.
10
11
        * inspector/InspectorReplayAgent.cpp:
12
        (WebCore::InspectorReplayAgent::createSession):
13
        * inspector/InspectorReplayAgent.h:
14
        * inspector/protocol/Replay.json:
15
1
2014-08-11  Beth Dakin  <bdakin@apple.com>
16
2014-08-11  Beth Dakin  <bdakin@apple.com>
2
17
3
        Fixed backgrounds don't paint in blurred inset areas
18
        Fixed backgrounds don't paint in blurred inset areas
- a/Source/WebInspectorUI/ChangeLog +32 lines
Lines 1-5 a/Source/WebInspectorUI/ChangeLog_sec1
1
2014-08-11  Brian J. Burg  <burg@cs.washington.edu>
1
2014-08-11  Brian J. Burg  <burg@cs.washington.edu>
2
2
3
        Web Inspector: add eject current recording button to the replay dashboard
4
        https://bugs.webkit.org/show_bug.cgi?id=135225
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add a new eject button item to the replay dashboard's embedded navigation bar.
9
        The eject button's visibility is mutually exclusive with that of the record button.
10
11
        When the eject button is clicked, a new, empty session is created and then loaded.
12
13
        * Localizations/en.lproj/localizedStrings.js:
14
        * UserInterface/Controllers/ReplayManager.js: Implement an asynchronous API for creating sessions.
15
        (WebInspector.ReplayManager.prototype.createSession.var):
16
        (WebInspector.ReplayManager.prototype.createSession.return):
17
        (WebInspector.ReplayManager.prototype.createSession):
18
        (WebInspector.ReplayManager.prototype.sessionLoaded):
19
        * UserInterface/Images/ReplayEjectButton.svg: Added.
20
        * UserInterface/Views/ReplayDashboardView.css: Fix styles for the placeholder recording container.
21
        This will be replaced soon with a mini-timeline content view.
22
        (.toolbar .dashboard.replay div.navigation-bar):
23
        (.toolbar .dashboard.replay > .recording-container):
24
        (.toolbar.small-size .dashboard.replay > .recording-container):
25
        * UserInterface/Views/ReplayDashboardView.js: Add an eject button and click listeners.
26
        (WebInspector.ReplayDashboardView):
27
        (WebInspector.ReplayDashboardView.prototype._ejectButtonItemClicked):
28
        (WebInspector.ReplayDashboardView.prototype._captureStarted):
29
        (WebInspector.ReplayDashboardView.prototype._captureStopped):
30
        (WebInspector.ReplayDashboardView.prototype._playbackFinished):
31
        (WebInspector.ReplayDashboardView.prototype._activeSessionChanged):
32
33
2014-08-11  Brian J. Burg  <burg@cs.washington.edu>
34
3
        Web Inspector: show a replay dashboard when capturing or replaying
35
        Web Inspector: show a replay dashboard when capturing or replaying
4
        https://bugs.webkit.org/show_bug.cgi?id=135170
36
        https://bugs.webkit.org/show_bug.cgi?id=135170
5
37
- a/Source/WebCore/inspector/InspectorReplayAgent.cpp +7 lines
Lines 388-393 void InspectorReplayAgent::cancelPlayback(ErrorString* errorString) a/Source/WebCore/inspector/InspectorReplayAgent.cpp_sec1
388
    m_page.replayController().cancelPlayback();
388
    m_page.replayController().cancelPlayback();
389
}
389
}
390
390
391
void InspectorReplayAgent::createSession(ErrorString*, SessionIdentifier* identifier)
392
{
393
    RefPtr<ReplaySession> session = ReplaySession::create();
394
    sessionCreated(session);
395
    *identifier = WTF::safeCast<int>(session->identifier());
396
}
397
391
void InspectorReplayAgent::switchSession(ErrorString* errorString, SessionIdentifier identifier)
398
void InspectorReplayAgent::switchSession(ErrorString* errorString, SessionIdentifier identifier)
392
{
399
{
393
    ASSERT(identifier > 0);
400
    ASSERT(identifier > 0);
- a/Source/WebCore/inspector/InspectorReplayAgent.h +1 lines
Lines 100-105 public: a/Source/WebCore/inspector/InspectorReplayAgent.h_sec1
100
    virtual void pausePlayback(ErrorString*) override;
100
    virtual void pausePlayback(ErrorString*) override;
101
    virtual void cancelPlayback(ErrorString*) override;
101
    virtual void cancelPlayback(ErrorString*) override;
102
102
103
    virtual void createSession(ErrorString*, SessionIdentifier*) override;
103
    virtual void switchSession(ErrorString*, SessionIdentifier) override;
104
    virtual void switchSession(ErrorString*, SessionIdentifier) override;
104
    virtual void insertSessionSegment(ErrorString*, SessionIdentifier, SegmentIdentifier, int segmentIndex) override;
105
    virtual void insertSessionSegment(ErrorString*, SessionIdentifier, SegmentIdentifier, int segmentIndex) override;
105
    virtual void removeSessionSegment(ErrorString*, SessionIdentifier, int segmentIndex) override;
106
    virtual void removeSessionSegment(ErrorString*, SessionIdentifier, int segmentIndex) override;
- a/Source/WebCore/inspector/protocol/Replay.json +7 lines
Lines 97-102 a/Source/WebCore/inspector/protocol/Replay.json_sec1
97
            "description": "Cancels playback of the current segment. Further replaying will start from the beginning of the current segment."
97
            "description": "Cancels playback of the current segment. Further replaying will start from the beginning of the current segment."
98
        },
98
        },
99
        {
99
        {
100
            "name": "createSession",
101
            "description": "Creates a new and empty session.",
102
            "returns": [
103
                { "name": "sessionIdentifier", "$ref": "SessionIdentifier", "description": "The newly-created session's identifier." }
104
            ]
105
        },
106
        {
100
            "name": "switchSession",
107
            "name": "switchSession",
101
            "description": "Unloads the current replay session and loads the specified session",
108
            "description": "Unloads the current replay session and loads the specified session",
102
            "parameters": [
109
            "parameters": [
- a/Source/WebInspectorUI/UserInterface/Controllers/ReplayManager.js +33 lines
Lines 232-237 WebInspector.ReplayManager.prototype = { a/Source/WebInspectorUI/UserInterface/Controllers/ReplayManager.js_sec1
232
        return result;
232
        return result;
233
    },
233
    },
234
234
235
    // Create a new, empty session.
236
    // Returns a promise that resolves when the session is loaded.
237
    createSession: function() // --> (sessionId)
238
    {
239
        var listener = new WebInspector.EventListener(this, true);
240
241
        var managerResult = new Promise(function(resolve, reject) {
242
            listener.connect(WebInspector.replayManager, WebInspector.ReplayManager.Event.SessionAdded, resolve);
243
        });
244
245
        var protocolResult = ReplayAgent.createSession()
246
            .catch(function(error) {
247
                listener.disconnect();
248
                console.error("ReplayManager.createSession failed: ", error);
249
                throw error;
250
            });
251
252
        return Promise.all([this.waitUntilInitialized(), protocolResult, managerResult])
253
            .then(function(results) {
254
                var event = results.lastValue;
255
                return event.data.sessionId;
256
            });
257
    },
258
235
    // Start capturing into the current session as soon as possible.
259
    // Start capturing into the current session as soon as possible.
236
    // Returns a promise that resolves when capturing begins.
260
    // Returns a promise that resolves when capturing begins.
237
    startCapturing: function() // --> ()
261
    startCapturing: function() // --> ()
Lines 532-537 WebInspector.ReplayManager.prototype = { a/Source/WebInspectorUI/UserInterface/Controllers/ReplayManager.js_sec2
532
            });
556
            });
533
    },
557
    },
534
558
559
    sessionLoaded: function(sessionId)
560
    {
561
        if (!this._initialized)
562
            return this.waitUntilInitialized().then(this.sessionLoaded.bind(this, sessionId));
563
564
        this._activeSessionIdentifier = sessionId;
565
        this.dispatchEventToListeners(WebInspector.ReplayManager.Event.ActiveSessionChanged, {sessionId: sessionId});
566
    },
567
535
    segmentCreated: function(segmentId)
568
    segmentCreated: function(segmentId)
536
    {
569
    {
537
        if (!this._initialized)
570
        if (!this._initialized)
- a/Source/WebInspectorUI/UserInterface/Images/ReplayEjectButton.svg +8 lines
Line 0 a/Source/WebInspectorUI/UserInterface/Images/ReplayEjectButton.svg_sec1
1
<?xml version="1.0" encoding="utf-8"?>
2
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363)  -->
3
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
	 width="36px" height="36px" viewBox="0 0 36 36" enable-background="new 0 0 36 36" xml:space="preserve">
6
<rect x="4.395" y="26.764" width="27.211" height="5"/>
7
<polygon points="4.576,21.709 18,4.658 31.424,21.709 "/>
8
</svg>
- a/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.css +13 lines
Lines 36-41 a/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.css_sec1
36
36
37
.toolbar .dashboard.replay div.navigation-bar {
37
.toolbar .dashboard.replay div.navigation-bar {
38
    border-bottom: none !important;
38
    border-bottom: none !important;
39
    box-shadow: none !important;
40
}
41
42
.toolbar .dashboard.replay > .recording-container {
43
    -webkit-flex-grow: 1;
44
    -webkit-order: 2;
45
    border: 1px solid #aaa;
46
    height: 22px;
47
    margin: 0 14px 0 4px;
48
}
49
50
.toolbar.small-size .dashboard.replay > .recording-container {
51
    height: 16px;
39
}
52
}
40
53
41
.toolbar .dashboard.replay .item.button > .glyph {
54
.toolbar .dashboard.replay .item.button > .glyph {
- a/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js -1 / +47 lines
Lines 42-59 WebInspector.ReplayDashboardView = function(representedObject) a/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js_sec1
42
    this._replayButtonItem.hidden = true;
42
    this._replayButtonItem.hidden = true;
43
    this._navigationBar.addNavigationItem(this._replayButtonItem);
43
    this._navigationBar.addNavigationItem(this._replayButtonItem);
44
44
45
    this._ejectButtonItem = new WebInspector.ButtonNavigationItem("replay-dashboard-eject", WebInspector.UIString("Eject Recording"), "Images/ReplayEjectButton.svg", 16, 16);
46
    this._ejectButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._ejectButtonItemClicked, this);
47
    this._ejectButtonItem.hidden = true;
48
    this._navigationBar.addNavigationItem(this._ejectButtonItem);
49
50
    var recordingContainerElement = this._recordingContainerElement = this.element.appendChild(document.createElement("div"));
51
    recordingContainerElement.className = WebInspector.ReplayDashboardView.RecordingContainerStyleClassName;
52
45
    // Add events required to track capture and replay state.
53
    // Add events required to track capture and replay state.
46
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.CaptureStarted, this._captureStarted, this);
54
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.CaptureStarted, this._captureStarted, this);
47
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.CaptureStopped, this._captureStopped, this);
55
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.CaptureStopped, this._captureStopped, this);
48
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackStarted, this._playbackStarted, this);
56
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackStarted, this._playbackStarted, this);
49
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackPaused, this._playbackPaused, this);
57
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackPaused, this._playbackPaused, this);
50
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackFinished, this._playbackFinished, this);
58
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackFinished, this._playbackFinished, this);
59
    WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.ActiveSessionChanged, this._activeSessionChanged, this);
51
60
52
    // Manually initialize style classes by querying current replay state.
61
    // Manually initialize style classes by querying current replay state.
53
    if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Capturing)
62
    if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Capturing)
54
        this._captureStarted();
63
        this._captureStarted();
55
    else if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Inactive)
64
    else if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Inactive)
56
        this._captureStopped();
65
        this._activeSessionChanged();
57
    // ReplayManager.sessionState must be Replaying.
66
    // ReplayManager.sessionState must be Replaying.
58
    else if (WebInspector.replayManager.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching)
67
    else if (WebInspector.replayManager.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching)
59
        this._playbackStarted();
68
        this._playbackStarted();
Lines 95-105 WebInspector.ReplayDashboardView.prototype = { a/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js_sec2
95
            WebInspector.replayManager.replayToCompletion();
104
            WebInspector.replayManager.replayToCompletion();
96
    },
105
    },
97
106
107
    _ejectButtonItemClicked: function(event)
108
    {
109
        console.assert(WebInspector.replayManager.sessionState !== WebInspector.ReplayManager.SessionState.Capturing, "Tried to eject session while SessionState is Capturing!");
110
111
        // Debounce.
112
        this._ejectButtonItem.enabled = false;
113
114
        var button = this._ejectButtonItem;
115
116
        WebInspector.replayManager.createSession()
117
        .then(function switchToEmptySession(sessionId) {
118
            button.enabled = true;
119
            return WebInspector.replayManager.switchSession(sessionId);
120
        }).catch(function(error) {
121
            console.error("Failed to eject current recording: ", error);
122
        });
123
    },
124
98
    _captureStarted: function()
125
    _captureStarted: function()
99
    {
126
    {
100
        this._captureButtonItem.hidden = false;
127
        this._captureButtonItem.hidden = false;
101
        this._captureButtonItem.activated = true;
128
        this._captureButtonItem.activated = true;
102
        this._replayButtonItem.hidden = true;
129
        this._replayButtonItem.hidden = true;
130
        this._ejectButtonItem.hidden = true;
103
    },
131
    },
104
132
105
    _captureStopped: function()
133
    _captureStopped: function()
Lines 107-112 WebInspector.ReplayDashboardView.prototype = { a/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js_sec3
107
        this._captureButtonItem.activated = false;
135
        this._captureButtonItem.activated = false;
108
        this._captureButtonItem.hidden = true;
136
        this._captureButtonItem.hidden = true;
109
        this._replayButtonItem.hidden = false;
137
        this._replayButtonItem.hidden = false;
138
        this._ejectButtonItem.hidden = false;
110
    },
139
    },
111
140
112
    _playbackStarted: function()
141
    _playbackStarted: function()
Lines 122-126 WebInspector.ReplayDashboardView.prototype = { a/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js_sec4
122
    _playbackFinished: function()
151
    _playbackFinished: function()
123
    {
152
    {
124
        this._replayButtonItem.toggled = false;
153
        this._replayButtonItem.toggled = false;
154
    },
155
156
    _activeSessionChanged: function()
157
    {
158
        var view = this;
159
        WebInspector.replayManager.getSession(WebInspector.replayManager.activeSessionIdentifier)
160
            .then(function(session) {
161
                if (!session.segments.length) {
162
                    view._captureButtonItem.hidden = false;
163
                    view._replayButtonItem.hidden = true;
164
                    view._ejectButtonItem.hidden = true;
165
                } else {
166
                    view._captureButtonItem.hidden = true;
167
                    view._replayButtonItem.hidden = false;
168
                    view._ejectButtonItem.hidden = false;
169
                }
170
            });
125
    }
171
    }
126
};
172
};

Return to Bug 135225