Changeset 140678 in webkit


Ignore:
Timestamp:
Jan 24, 2013 5:42:53 AM (11 years ago)
Author:
aandrey@chromium.org
Message:

Web Inspector: [Canvas] UI: add a selector to capture a single canvas frame vs consecutive frames
https://bugs.webkit.org/show_bug.cgi?id=107688

Reviewed by Pavel Feldman.

Allow capturing several canvas frames in a row.

  • English.lproj/localizedStrings.js:
  • inspector/InjectedScriptCanvasModule.cpp:

(WebCore::InjectedScriptCanvasModule::traceLog):

  • inspector/InjectedScriptCanvasModule.h:

(InjectedScriptCanvasModule):

  • inspector/InjectedScriptCanvasModuleSource.js:

(.):

  • inspector/Inspector.json:
  • inspector/InspectorCanvasAgent.cpp:

(WebCore::InspectorCanvasAgent::getTraceLog):

  • inspector/InspectorCanvasAgent.h:

(InspectorCanvasAgent):

  • inspector/front-end/CanvasProfileView.js:

(WebInspector.CanvasProfileView):
(WebInspector.CanvasProfileView.prototype._didReceiveTraceLog):
(WebInspector.CanvasProfileView.prototype._requestTraceLog):
(WebInspector.CanvasProfileType):
(WebInspector.CanvasProfileType.prototype.get statusBarItems):
(WebInspector.CanvasProfileType.prototype.get buttonTooltip):
(WebInspector.CanvasProfileType.prototype.buttonClicked):
(WebInspector.CanvasProfileType.prototype._runSingleFrameCapturing):
(WebInspector.CanvasProfileType.prototype._startFrameCapturing):
(WebInspector.CanvasProfileType.prototype._stopFrameCapturing.didStopCapturing):
(WebInspector.CanvasProfileType.prototype._stopFrameCapturing):
(WebInspector.CanvasProfileType.prototype._didStartCapturingFrame):
(WebInspector.CanvasProfileType.prototype.setRecordingProfile):
(WebInspector.CanvasProfileType.prototype._isSingleFrameMode):
(WebInspector.CanvasProfileHeader):
(WebInspector.CanvasProfileHeader.prototype._updateCapturingStatus):
(WebInspector.CanvasProfileHeader.prototype._requestCapturingStatus):

  • inspector/front-end/ProfileLauncherView.js:

(WebInspector.ProfileLauncherView):

  • inspector/front-end/ProfilesPanel.js:

(WebInspector.ProfileType.prototype.get statusBarItems):
(WebInspector.ProfilesPanel):
(WebInspector.ProfilesPanel.prototype.get statusBarItems):
(WebInspector.ProfilesPanel.prototype._onProfileTypeSelected):
(WebInspector.ProfilesPanel.prototype._reset):
(WebInspector.ProfilesPanel.prototype._showLauncherView):
(WebInspector.ProfilesPanel.prototype.showProfile):
(WebInspector.ProfilesPanel.prototype._updateInterface):
(WebInspector.ProfilesPanel.prototype._resize):

Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140677 r140678  
     12013-01-23  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: [Canvas] UI: add a selector to capture a single canvas frame vs consecutive frames
     4        https://bugs.webkit.org/show_bug.cgi?id=107688
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Allow capturing several canvas frames in a row.
     9
     10        * English.lproj/localizedStrings.js:
     11        * inspector/InjectedScriptCanvasModule.cpp:
     12        (WebCore::InjectedScriptCanvasModule::traceLog):
     13        * inspector/InjectedScriptCanvasModule.h:
     14        (InjectedScriptCanvasModule):
     15        * inspector/InjectedScriptCanvasModuleSource.js:
     16        (.):
     17        * inspector/Inspector.json:
     18        * inspector/InspectorCanvasAgent.cpp:
     19        (WebCore::InspectorCanvasAgent::getTraceLog):
     20        * inspector/InspectorCanvasAgent.h:
     21        (InspectorCanvasAgent):
     22        * inspector/front-end/CanvasProfileView.js:
     23        (WebInspector.CanvasProfileView):
     24        (WebInspector.CanvasProfileView.prototype._didReceiveTraceLog):
     25        (WebInspector.CanvasProfileView.prototype._requestTraceLog):
     26        (WebInspector.CanvasProfileType):
     27        (WebInspector.CanvasProfileType.prototype.get statusBarItems):
     28        (WebInspector.CanvasProfileType.prototype.get buttonTooltip):
     29        (WebInspector.CanvasProfileType.prototype.buttonClicked):
     30        (WebInspector.CanvasProfileType.prototype._runSingleFrameCapturing):
     31        (WebInspector.CanvasProfileType.prototype._startFrameCapturing):
     32        (WebInspector.CanvasProfileType.prototype._stopFrameCapturing.didStopCapturing):
     33        (WebInspector.CanvasProfileType.prototype._stopFrameCapturing):
     34        (WebInspector.CanvasProfileType.prototype._didStartCapturingFrame):
     35        (WebInspector.CanvasProfileType.prototype.setRecordingProfile):
     36        (WebInspector.CanvasProfileType.prototype._isSingleFrameMode):
     37        (WebInspector.CanvasProfileHeader):
     38        (WebInspector.CanvasProfileHeader.prototype._updateCapturingStatus):
     39        (WebInspector.CanvasProfileHeader.prototype._requestCapturingStatus):
     40        * inspector/front-end/ProfileLauncherView.js:
     41        (WebInspector.ProfileLauncherView):
     42        * inspector/front-end/ProfilesPanel.js:
     43        (WebInspector.ProfileType.prototype.get statusBarItems):
     44        (WebInspector.ProfilesPanel):
     45        (WebInspector.ProfilesPanel.prototype.get statusBarItems):
     46        (WebInspector.ProfilesPanel.prototype._onProfileTypeSelected):
     47        (WebInspector.ProfilesPanel.prototype._reset):
     48        (WebInspector.ProfilesPanel.prototype._showLauncherView):
     49        (WebInspector.ProfilesPanel.prototype.showProfile):
     50        (WebInspector.ProfilesPanel.prototype._updateInterface):
     51        (WebInspector.ProfilesPanel.prototype._resize):
     52
    1532013-01-24  Andreas Kling  <akling@apple.com>
    254
  • trunk/Source/WebCore/English.lproj/localizedStrings.js

    r140428 r140678  
    775775localizedStrings["Toggle breakpoint"] = "Toggle breakpoint";
    776776localizedStrings["Capture Canvas Frame"] = "Capture Canvas Frame";
    777 localizedStrings["Capture Canvas Frame."] = "Capture Canvas Frame.";
     777localizedStrings["Capture next canvas frame."] = "Capture next canvas frame.";
     778localizedStrings["Stop capturing canvas frames."] = "Stop capturing canvas frames.";
     779localizedStrings["Start capturing canvas frames."] = "Start capturing canvas frames.";
    778780localizedStrings["Trace Log %d"] = "Trace Log %d";
    779781localizedStrings["CANVAS PROFILE"] = "CANVAS PROFILE";
    780782localizedStrings["Canvas calls instrumentation"] = "Canvas calls instrumentation";
    781783localizedStrings["Capturing\u2026"] = "Capturing\u2026";
     784localizedStrings["Capturing\u2026 %d calls"] = "Capturing\u2026 %d calls";
     785localizedStrings["Captured %d calls"] = "Captured %d calls";
    782786localizedStrings["There is an uninstrumented canvas on the page. Reload the page to instrument it."] = "There is an uninstrumented canvas on the page. Reload the page to instrument it.";
    783787localizedStrings["First call."] = "First call.";
  • trunk/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp

    r140157 r140678  
    125125}
    126126
    127 void InjectedScriptCanvasModule::traceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, RefPtr<TypeBuilder::Canvas::TraceLog>* traceLog)
     127void InjectedScriptCanvasModule::traceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, const int* maxLength, RefPtr<TypeBuilder::Canvas::TraceLog>* traceLog)
    128128{
    129129    ScriptFunctionCall function(injectedScriptObject(), "traceLog");
     
    131131    if (startOffset)
    132132        function.appendArgument(*startOffset);
     133    if (maxLength)
     134        function.appendArgument(*maxLength);
    133135    RefPtr<InspectorValue> resultValue;
    134136    makeCall(function, &resultValue);
  • trunk/Source/WebCore/inspector/InjectedScriptCanvasModule.h

    r140157 r140678  
    6060    void stopCapturing(ErrorString*, const String&);
    6161    void dropTraceLog(ErrorString*, const String&);
    62     void traceLog(ErrorString*, const String&, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>*);
     62    void traceLog(ErrorString*, const String&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>*);
    6363    void replayTraceLog(ErrorString*, const String&, int, RefPtr<TypeBuilder::Canvas::ResourceState>*);
    6464    void resourceInfo(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::ResourceInfo>*);
  • trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js

    r140428 r140678  
    30543054     * @param {CanvasAgent.TraceLogId} id
    30553055     * @param {number=} startOffset
     3056     * @param {number=} maxLength
    30563057     * @return {!CanvasAgent.TraceLog|string}
    30573058     */
    3058     traceLog: function(id, startOffset)
     3059    traceLog: function(id, startOffset, maxLength)
    30593060    {
    30603061        var traceLog = this._traceLogs[id];
    30613062        if (!traceLog)
    30623063            return "Error: Trace log with the given ID not found.";
    3063         startOffset = Math.max(0, startOffset || 0);
     3064
     3065        var replayableCalls = traceLog.replayableCalls();
     3066        if (typeof startOffset !== "number")
     3067            startOffset = 0;
     3068        if (typeof maxLength !== "number")
     3069            maxLength = replayableCalls.length;
     3070
     3071        var fromIndex = Math.max(0, startOffset);
     3072        var toIndex = Math.min(replayableCalls.length - 1, fromIndex + maxLength - 1);
     3073
    30643074        var alive = this._manager.capturing() && this._manager.lastTraceLog() === traceLog;
    30653075        var result = {
     
    30683078            calls: [],
    30693079            alive: alive,
    3070             startOffset: startOffset
     3080            startOffset: fromIndex,
     3081            totalAvailableCalls: replayableCalls.length
    30713082        };
    3072         var calls = traceLog.replayableCalls();
    3073         for (var i = startOffset, n = calls.length; i < n; ++i) {
    3074             var call = calls[i];
     3083        for (var i = fromIndex; i <= toIndex; ++i) {
     3084            var call = replayableCalls[i];
    30753085            var contextResource = call.replayableResource().replayableContextResource();
    30763086            var stackTrace = call.stackTrace();
  • trunk/Source/WebCore/inspector/Inspector.json

    r140649 r140678  
    32833283                    { "name": "id", "$ref": "TraceLogId" },
    32843284                    { "name": "calls", "type": "array", "items": { "$ref": "Call" } },
    3285                     { "name": "startOffset", "type": "integer", "optional": true },
    3286                     { "name": "alive", "type": "boolean", "optional": true }
     3285                    { "name": "startOffset", "type": "integer" },
     3286                    { "name": "alive", "type": "boolean" },
     3287                    { "name": "totalAvailableCalls", "type": "number" }
    32873288                ]
    32883289            }
     
    33323333                "parameters": [
    33333334                    { "name": "traceLogId", "$ref": "TraceLogId" },
    3334                     { "name": "startOffset", "type": "integer", "optional": true }
     3335                    { "name": "startOffset", "type": "integer", "optional": true },
     3336                    { "name": "maxLength", "type": "integer", "optional": true }
    33353337                ],
    33363338                "returns": [
  • trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp

    r140157 r140678  
    156156}
    157157
    158 void InspectorCanvasAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, RefPtr<TypeBuilder::Canvas::TraceLog>& traceLog)
    159 {
    160     if (!checkIsEnabled(errorString))
    161         return;
    162     InjectedScriptCanvasModule module = injectedScriptCanvasModuleForTraceLogId(errorString, traceLogId);
    163     if (!module.hasNoValue())
    164         module.traceLog(errorString, traceLogId, startOffset, &traceLog);
     158void InspectorCanvasAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, const int* maxLength, RefPtr<TypeBuilder::Canvas::TraceLog>& traceLog)
     159{
     160    if (!checkIsEnabled(errorString))
     161        return;
     162    InjectedScriptCanvasModule module = injectedScriptCanvasModuleForTraceLogId(errorString, traceLogId);
     163    if (!module.hasNoValue())
     164        module.traceLog(errorString, traceLogId, startOffset, maxLength, &traceLog);
    165165}
    166166
  • trunk/Source/WebCore/inspector/InspectorCanvasAgent.h

    r140157 r140678  
    8484    virtual void startCapturing(ErrorString*, String*);
    8585    virtual void stopCapturing(ErrorString*, const String&);
    86     virtual void getTraceLog(ErrorString*, const String&, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&);
     86    virtual void getTraceLog(ErrorString*, const String&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&);
    8787    virtual void replayTraceLog(ErrorString*, const String&, int, RefPtr<TypeBuilder::Canvas::ResourceState>&);
    8888    virtual void getResourceInfo(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::ResourceInfo>&);
  • trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js

    r140428 r140678  
    3232 * @constructor
    3333 * @extends {WebInspector.View}
     34 * @param {!WebInspector.CanvasProfileHeader} profile
    3435 */
    3536WebInspector.CanvasProfileView = function(profile)
     
    8990
    9091    this._splitView.show(this.element);
    91 
    92     this._enableWaitIcon(true);
    93     CanvasAgent.getTraceLog(this._traceLogId, 0, this._didReceiveTraceLog.bind(this));
     92    this._requestTraceLog();
    9493}
     94
     95/**
     96 * @const
     97 * @type {number}
     98 */
     99WebInspector.CanvasProfileView.TraceLogPollingInterval = 500;
    95100
    96101WebInspector.CanvasProfileView.prototype = {
     
    284289            var call = calls[i];
    285290            this._requestReplayContextInfo(call.contextId);
    286             var gridNode = this._createCallNode(i, call);
     291            var index = traceLog.startOffset + i;
     292            var gridNode = this._createCallNode(index, call);
    287293            this._logGrid.rootNode().appendChild(gridNode);
    288294            lastNode = gridNode;
     
    290296        if (lastNode)
    291297            lastNode.revealAndSelect();
     298        if (traceLog.alive)
     299            setTimeout(this._requestTraceLog.bind(this), WebInspector.CanvasProfileView.TraceLogPollingInterval);
     300        this._profile._updateCapturingStatus(traceLog);
     301    },
     302
     303    _requestTraceLog: function()
     304    {
     305        this._enableWaitIcon(true);
     306        CanvasAgent.getTraceLog(this._traceLogId, this._logGridNodes.length, undefined, this._didReceiveTraceLog.bind(this));
    292307    },
    293308
     
    363378    WebInspector.ProfileType.call(this, WebInspector.CanvasProfileType.TypeId, WebInspector.UIString("Capture Canvas Frame"));
    364379    this._nextProfileUid = 1;
     380    this._recording = false;
     381    this._lastProfileHeader = null;
     382
     383    this._capturingModeSelector = new WebInspector.StatusBarComboBox(null);
     384    this._capturingModeSelector.element.title = WebInspector.UIString("Canvas capture mode.");
     385    this._capturingModeSelector.createOption(WebInspector.UIString("Single Frame"), WebInspector.UIString("Capture a single canvas frame."), "");
     386    this._capturingModeSelector.createOption(WebInspector.UIString("Consecutive Frames"), WebInspector.UIString("Capture consecutive canvas frames."), "1");
    365387
    366388    this._decorationElement = document.createElement("div");
     
    381403
    382404WebInspector.CanvasProfileType.prototype = {
     405    get statusBarItems()
     406    {
     407        return [this._capturingModeSelector.element];
     408    },
     409
    383410    get buttonTooltip()
    384411    {
    385         return WebInspector.UIString("Capture Canvas Frame.");
     412        if (this._isSingleFrameMode())
     413            return WebInspector.UIString("Capture next canvas frame.");
     414        else
     415            return this._recording ? WebInspector.UIString("Stop capturing canvas frames.") : WebInspector.UIString("Start capturing canvas frames.");
    386416    },
    387417
     
    393423    buttonClicked: function(profilesPanel)
    394424    {
    395         var profileHeader = new WebInspector.CanvasProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid);
     425        if (this._recording) {
     426            this._recording = false;
     427            this._stopFrameCapturing();
     428        } else if (this._isSingleFrameMode()) {
     429            this._recording = false;
     430            this._runSingleFrameCapturing(profilesPanel);
     431        } else {
     432            this._recording = true;
     433            this._startFrameCapturing(profilesPanel);
     434        }
     435        profilesPanel.setRecordingProfile(WebInspector.CanvasProfileType.TypeId, this._recording);
     436        return this._recording;
     437    },
     438
     439    /**
     440     * @param {WebInspector.ProfilesPanel} profilesPanel
     441     */
     442    _runSingleFrameCapturing: function(profilesPanel)
     443    {
     444        CanvasAgent.captureFrame(this._didStartCapturingFrame.bind(this, profilesPanel));
     445    },
     446
     447    /**
     448     * @param {WebInspector.ProfilesPanel} profilesPanel
     449     */
     450    _startFrameCapturing: function(profilesPanel)
     451    {
     452        CanvasAgent.startCapturing(this._didStartCapturingFrame.bind(this, profilesPanel));
     453    },
     454
     455    _stopFrameCapturing: function()
     456    {
     457        if (!this._lastProfileHeader)
     458            return;
     459        var profileHeader = this._lastProfileHeader;
     460        var traceLogId = profileHeader.traceLogId();
     461        this._lastProfileHeader = null;
     462        function didStopCapturing()
     463        {
     464            profileHeader._updateCapturingStatus();
     465        }
     466        CanvasAgent.stopCapturing(traceLogId, didStopCapturing.bind(this));
     467    },
     468
     469    /**
     470     * @param {WebInspector.ProfilesPanel} profilesPanel
     471     * @param {?Protocol.Error} error
     472     * @param {CanvasAgent.TraceLogId} traceLogId
     473     */
     474    _didStartCapturingFrame: function(profilesPanel, error, traceLogId)
     475    {
     476        if (error || this._lastProfileHeader && this._lastProfileHeader.traceLogId() === traceLogId)
     477            return;
     478        var profileHeader = new WebInspector.CanvasProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid, traceLogId);
    396479        ++this._nextProfileUid;
    397         profileHeader.isTemporary = true;
     480        this._lastProfileHeader = profileHeader;
    398481        profilesPanel.addProfileHeader(profileHeader);
    399         function didStartCapturingFrame(error, traceLogId)
    400         {
    401             profileHeader._traceLogId = traceLogId;
    402             profileHeader.isTemporary = false;
    403         }
    404         CanvasAgent.captureFrame(didStartCapturingFrame.bind(this));
    405         return false;
     482        profileHeader._updateCapturingStatus();
    406483    },
    407484
     
    431508    {
    432509        this._nextProfileUid = 1;
     510    },
     511
     512    setRecordingProfile: function(isProfiling)
     513    {
     514        this._recording = isProfiling;
    433515    },
    434516
     
    456538    _updateDecorationElement: function()
    457539    {
     540        /**
     541         * @param {?Protocol.Error} error
     542         * @param {boolean} result
     543         */
    458544        function callback(error, result)
    459545        {
     
    470556    {
    471557        PageAgent.reload(event.shiftKey);
     558    },
     559
     560    /**
     561     * @return {boolean}
     562     */
     563    _isSingleFrameMode: function()
     564    {
     565        return !this._capturingModeSelector.selectedOption().value;
    472566    },
    473567
     
    481575 * @param {string} title
    482576 * @param {number=} uid
     577 * @param {CanvasAgent.TraceLogId=} traceLogId
    483578 */
    484 WebInspector.CanvasProfileHeader = function(type, title, uid)
     579WebInspector.CanvasProfileHeader = function(type, title, uid, traceLogId)
    485580{
    486581    WebInspector.ProfileHeader.call(this, type, title, uid);
    487 
    488     /**
    489      * @type {string?}
    490      */
    491     this._traceLogId = null;
     582    /** @type {CanvasAgent.TraceLogId} */
     583    this._traceLogId = traceLogId || "";
     584    this._alive = true;
     585    this._traceLogSize = 0;
    492586}
    493587
    494588WebInspector.CanvasProfileHeader.prototype = {
    495589    /**
    496      * @return {string?}
     590     * @return {CanvasAgent.TraceLogId}
    497591     */
    498592    traceLogId: function()
     
    516610    {
    517611        return new WebInspector.CanvasProfileView(this);
     612    },
     613
     614    /**
     615     * @param {CanvasAgent.TraceLog=} traceLog
     616     */
     617    _updateCapturingStatus: function(traceLog)
     618    {
     619        if (!this.sidebarElement || !this._traceLogId)
     620            return;
     621
     622        if (traceLog) {
     623            this._alive = traceLog.alive;
     624            this._traceLogSize = traceLog.totalAvailableCalls;
     625        }
     626
     627        this.sidebarElement.subtitle = this._alive ? WebInspector.UIString("Capturing\u2026 %d calls", this._traceLogSize) : WebInspector.UIString("Captured %d calls", this._traceLogSize);
     628        this.sidebarElement.wait = this._alive;
     629
     630        if (this._alive) {
     631            clearTimeout(this._requestStatusTimer);
     632            this._requestStatusTimer = setTimeout(this._requestCapturingStatus.bind(this), WebInspector.CanvasProfileView.TraceLogPollingInterval);
     633        }
     634    },
     635
     636    _requestCapturingStatus: function()
     637    {
     638        /**
     639         * @param {?Protocol.Error} error
     640         * @param {CanvasAgent.TraceLog} traceLog
     641         */
     642        function didReceiveTraceLog(error, traceLog)
     643        {
     644            if (error)
     645                return;
     646            this._alive = traceLog.alive;
     647            this._traceLogSize = traceLog.totalAvailableCalls;
     648            this._updateCapturingStatus();
     649        }
     650        CanvasAgent.getTraceLog(this._traceLogId, 0, 0, didReceiveTraceLog.bind(this));
    518651    },
    519652
  • trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js

    r139408 r140678  
    4343    this.element.addStyleClass("panel-enabler-view");
    4444
    45     this._contentElement = document.createElement("div");
    46     this._contentElement.className = "profile-launcher-view-content";
    47     this.element.appendChild(this._contentElement);
     45    this._contentElement = this.element.createChild("div", "profile-launcher-view-content");
    4846
    4947    var header = this._contentElement.createChild("h1");
     
    5351
    5452    if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled()) {
    55         this._nativeMemoryElement = document.createElement("div");
    56         this._contentElement.appendChild(this._nativeMemoryElement);
     53        this._nativeMemoryElement = this._contentElement.createChild("div");
    5754        this._nativeMemoryLiveChart = new WebInspector.NativeMemoryBarChart();
    5855        this._nativeMemoryLiveChart.show(this._nativeMemoryElement);
  • trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js

    r140390 r140678  
    4242
    4343WebInspector.ProfileType.prototype = {
     44    get statusBarItems()
     45    {
     46        return [];
     47    },
     48
    4449    get buttonTooltip()
    4550    {
     
    247252    }
    248253
    249     this.profileViewStatusBarItemsContainer = document.createElement("div");
    250     this.profileViewStatusBarItemsContainer.className = "status-bar-items";
     254    this._profileTypeStatusBarItemsContainer = document.createElement("div");
     255    this._profileTypeStatusBarItemsContainer.className = "status-bar-items";
     256
     257    this._profileViewStatusBarItemsContainer = document.createElement("div");
     258    this._profileViewStatusBarItemsContainer.className = "status-bar-items";
    251259
    252260    this._profiles = [];
     
    312320    get statusBarItems()
    313321    {
    314         return this._statusBarButtons.select("element").concat([this.profileViewStatusBarItemsContainer]);
     322        return this._statusBarButtons.select("element").concat(this._profileTypeStatusBarItemsContainer, this._profileViewStatusBarItemsContainer);
    315323    },
    316324
     
    360368        this._selectedProfileType = /** @type {!WebInspector.ProfileType} */ (event.data);
    361369        this.recordButton.title = this._selectedProfileType.buttonTooltip;
     370
     371        this._profileTypeStatusBarItemsContainer.removeChildren();
     372        var statusBarItems = this._selectedProfileType.statusBarItems;
     373        if (statusBarItems) {
     374            for (var i = 0; i < statusBarItems.length; ++i)
     375                this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]);
     376        }
     377        this._resize(this.splitView.sidebarWidth());
    362378    },
    363379
     
    400416
    401417        this.profileViews.removeChildren();
    402         this.profileViewStatusBarItemsContainer.removeChildren();
     418        this._profileViewStatusBarItemsContainer.removeChildren();
    403419
    404420        this.removeAllListeners();
     
    412428    {
    413429        this.closeVisibleView();
    414         this.profileViewStatusBarItemsContainer.removeChildren();
     430        this._profileViewStatusBarItemsContainer.removeChildren();
    415431        this._launcherView.show(this.splitView.mainElement);
    416432        this.visibleView = this._launcherView;
     
    607623        this.visibleView = view;
    608624
    609         this.profileViewStatusBarItemsContainer.removeChildren();
     625        this._profileViewStatusBarItemsContainer.removeChildren();
    610626
    611627        var statusBarItems = view.statusBarItems;
    612628        if (statusBarItems)
    613629            for (var i = 0; i < statusBarItems.length; ++i)
    614                 this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
     630                this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
    615631    },
    616632
     
    976992            this.enableToggleButton.toggled = true;
    977993            this.recordButton.visible = true;
    978             this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");
     994            this._profileViewStatusBarItemsContainer.removeStyleClass("hidden");
    979995            this.clearResultsButton.element.removeStyleClass("hidden");
    980996            this.panelEnablerView.detach();
     
    983999            this.enableToggleButton.toggled = false;
    9841000            this.recordButton.visible = false;
    985             this.profileViewStatusBarItemsContainer.addStyleClass("hidden");
     1001            this._profileViewStatusBarItemsContainer.addStyleClass("hidden");
    9861002            this.clearResultsButton.element.addStyleClass("hidden");
    9871003            this.panelEnablerView.show(this.element);
     
    10751091    {
    10761092        var lastItemElement = this._statusBarButtons[this._statusBarButtons.length - 1].element;
    1077         var minFloatingStatusBarItemsOffset = lastItemElement.totalOffsetLeft() + lastItemElement.offsetWidth;
    1078         this.profileViewStatusBarItemsContainer.style.left = Math.max(minFloatingStatusBarItemsOffset, sidebarWidth) + "px";
     1093        var left = lastItemElement.totalOffsetLeft() + lastItemElement.offsetWidth;
     1094        this._profileTypeStatusBarItemsContainer.style.left = left + "px";
     1095        left += this._profileTypeStatusBarItemsContainer.offsetWidth - 1;
     1096        this._profileViewStatusBarItemsContainer.style.left = Math.max(left, sidebarWidth) + "px";
    10791097    },
    10801098
Note: See TracChangeset for help on using the changeset viewer.