Changeset 136418 in webkit


Ignore:
Timestamp:
Dec 3, 2012, 10:59:29 AM (12 years ago)
Author:
aandrey@chromium.org
Message:

Web Inspector: [Canvas] show replay screenshot of the last call's canvas
https://bugs.webkit.org/show_bug.cgi?id=103739

Reviewed by Pavel Feldman.

When many canvases are being instrumented we'll want to show replay screenshots for each canvas.
Meanwhile, show the screenshot of the last-touched canvas during the current replay.

  • inspector/InjectedScriptCanvasModuleSource.js:

(.):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r136417 r136418  
     12012-12-03  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: [Canvas] show replay screenshot of the last call's canvas
     4        https://bugs.webkit.org/show_bug.cgi?id=103739
     5
     6        Reviewed by Pavel Feldman.
     7
     8        When many canvases are being instrumented we'll want to show replay screenshots for each canvas.
     9        Meanwhile, show the screenshot of the last-touched canvas during the current replay.
     10
     11        * inspector/InjectedScriptCanvasModuleSource.js:
     12        (.):
     13
    1142012-12-03  Joshua Bell  <jsbell@chromium.org>
    215
  • trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js

    r135711 r136418  
    24152415    },
    24162416
     2417    /**
     2418     * @return {Call}
     2419     */
    24172420    step: function()
    24182421    {
    2419         this.stepTo(this._nextReplayStep);
     2422        return this.stepTo(this._nextReplayStep);
    24202423    },
    24212424
    24222425    /**
    24232426     * @param {number} stepNum
     2427     * @return {Call}
    24242428     */
    24252429    stepTo: function(stepNum)
     
    24302434            this.reset();
    24312435        // FIXME: Replay all the cached resources first to warm-up.
     2436        var lastCall = null;
    24322437        var replayableCalls = this._traceLog.replayableCalls();
    24332438        while (this._nextReplayStep <= stepNum)
    2434             replayableCalls[this._nextReplayStep++].replay(this._replayWorldCache);
    2435     },
    2436 
     2439            lastCall = replayableCalls[this._nextReplayStep++].replay(this._replayWorldCache);
     2440        return lastCall;
     2441    },
     2442
     2443    /**
     2444     * @return {Call}
     2445     */
    24372446    replay: function()
    24382447    {
    2439         this.stepTo(this._traceLog.size() - 1);
     2448        return this.stepTo(this._traceLog.size() - 1);
    24402449    }
    24412450}
     
    27052714            this._traceLogPlayer = new TraceLogPlayer(traceLog, this._onTraceLogPlayerReset.bind(this));
    27062715        }
    2707         this._traceLogPlayer.stepTo(stepNo);
     2716        var lastCall = this._traceLogPlayer.stepTo(stepNo);
    27082717        if (!this._replayContexts.length) {
    27092718            console.error("ASSERT_NOT_REACHED: replayTraceLog failed to create a replay canvas?!");
    27102719            return "";
    27112720        }
    2712         // Return current screenshot.
    27132721        // FIXME: Support replaying several canvases simultaneously.
     2722        var lastCallResourceContext = Resource.wrappedObject(lastCall.resource());
     2723        for (var i = 0, n = this._replayContexts.length; i < n; ++i) {
     2724            var context = this._replayContexts[i].context;
     2725            if (lastCallResourceContext === context)
     2726                return context.canvas.toDataURL();
     2727        }
     2728        console.assert("ASSERT_NOT_REACHED: replayTraceLog failed to match the replaying canvas?!");
    27142729        return this._replayContexts[0].context.canvas.toDataURL();
    27152730    },
Note: See TracChangeset for help on using the changeset viewer.