Changeset 242511 in webkit


Ignore:
Timestamp:
Mar 5, 2019, 2:05:15 PM (6 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Canvas: remove event listeners once a recording is ready
https://bugs.webkit.org/show_bug.cgi?id=195324

Reviewed by Matt Baker.

  • UserInterface/Models/Recording.js:

(WI.Recording):
(WI.Recording.prototype.async swizzle):
(WI.Recording.prototype.async _process):

  • UserInterface/Views/RecordingActionTreeElement.js:

(WI.RecordingActionTreeElement):
(WI.RecordingActionTreeElement.prototype._handleValidityChanged):

  • UserInterface/Views/CanvasSidebarPanel.js:

(WI.CanvasSidebarPanel.prototype.set recording):
(WI.CanvasSidebarPanel.prototype._handleRecordingProcessedAction):

  • UserInterface/Views/RecordingContentView.js:

(WI.RecordingContentView.prototype.initialLayout):
(WI.RecordingContentView.prototype._handleRecordingProcessedAction):

Location:
trunk/Source/WebInspectorUI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r242510 r242511  
     12019-03-05  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Canvas: remove event listeners once a recording is ready
     4        https://bugs.webkit.org/show_bug.cgi?id=195324
     5
     6        Reviewed by Matt Baker.
     7
     8        * UserInterface/Models/Recording.js:
     9        (WI.Recording):
     10        (WI.Recording.prototype.async swizzle):
     11        (WI.Recording.prototype.async _process):
     12
     13        * UserInterface/Views/RecordingActionTreeElement.js:
     14        (WI.RecordingActionTreeElement):
     15        (WI.RecordingActionTreeElement.prototype._handleValidityChanged):
     16
     17        * UserInterface/Views/CanvasSidebarPanel.js:
     18        (WI.CanvasSidebarPanel.prototype.set recording):
     19        (WI.CanvasSidebarPanel.prototype._handleRecordingProcessedAction):
     20
     21        * UserInterface/Views/RecordingContentView.js:
     22        (WI.RecordingContentView.prototype.initialLayout):
     23        (WI.RecordingContentView.prototype._handleRecordingProcessedAction):
     24
    1252019-03-05  Joseph Pecoraro  <pecoraro@apple.com>
    226
  • trunk/Source/WebInspectorUI/UserInterface/Models/Recording.js

    r240471 r242511  
    3737        this._displayName = WI.UIString("Recording");
    3838
    39         this._swizzle = [];
     39        this._swizzle = null;
    4040        this._actions = [new WI.RecordingInitialStateAction].concat(...this._frames.map((frame) => frame.actions));
    4141        this._visualActionIndexes = [];
     
    296296    async swizzle(index, type)
    297297    {
     298        if (!this._swizzle)
     299            this._swizzle = {};
     300
    298301        if (typeof this._swizzle[index] !== "object")
    299302            this._swizzle[index] = {};
     
    531534        }
    532535
     536        this._swizzle = null;
    533537        this._processContext = null;
    534538        this._processing = false;
  • trunk/Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js

    r242049 r242511  
    115115            return;
    116116
    117         if (this._recording) {
    118             this._recording.removeEventListener(WI.Recording.Event.ProcessedAction, this._handleRecordingProcessedAction, this);
    119             this._recording.removeEventListener(WI.Recording.Event.StartProcessingFrame, this._handleRecordingStartProcessingFrame, this);
    120         }
     117        if (this._recording)
     118            this._recording.removeEventListener(null, null, this);
    121119
    122120        if (recording)
     
    125123        this._recording = recording;
    126124
    127         if (this._recording) {
     125        if (this._recording && !this._recording.ready) {
    128126            this._recording.addEventListener(WI.Recording.Event.ProcessedAction, this._handleRecordingProcessedAction, this);
    129127            this._recording.addEventListener(WI.Recording.Event.StartProcessingFrame, this._handleRecordingStartProcessingFrame, this);
     
    580578        this._createRecordingActionTreeElement(action, index, isInitialStateAction ? this._recordingTreeOutline : this._recordingTreeOutline.children.lastValue);
    581579
    582         if (this._recording.ready && !this._recording[WI.CanvasSidebarPanel.SelectedActionSymbol])
    583             this.action = this._recording.actions[0];
    584 
    585         if (action === this._recording.actions.lastValue && this._recordingProcessingOptionsContainer) {
    586             this._recordingProcessingOptionsContainer.remove();
    587             this._recordingProcessingOptionsContainer = null;
     580        if (this._recording.ready) {
     581            this._recording.removeEventListener(null, null, this);
     582
     583            if (!this._recording[WI.CanvasSidebarPanel.SelectedActionSymbol])
     584                this.action = this._recording.actions[0];
     585
     586            if (this._recordingProcessingOptionsContainer) {
     587                this._recordingProcessingOptionsContainer.remove();
     588                this._recordingProcessingOptionsContainer = null;
     589            }
    588590        }
    589591    }
  • trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js

    r237777 r242511  
    3939        this._copyText = copyText;
    4040
    41         this.representedObject.addEventListener(WI.RecordingAction.Event.ValidityChanged, this._handleValidityChanged, this);
     41        if (this.representedObject.valid)
     42            this.representedObject.addEventListener(WI.RecordingAction.Event.ValidityChanged, this._handleValidityChanged, this);
    4243    }
    4344
     
    454455    {
    455456        this.addClassName("invalid");
     457
     458        this.representedObject.removeEventListener(null, null, this);
    456459    }
    457460};
  • trunk/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js

    r242017 r242511  
    168168        this._sliderElement.max = 0;
    169169
    170         this.representedObject.addEventListener(WI.Recording.Event.ProcessedAction, this._handleRecordingProcessedAction, this);
     170        if (!this.representedObject.ready)
     171            this.representedObject.addEventListener(WI.Recording.Event.ProcessedAction, this._handleRecordingProcessedAction, this);
    171172    }
    172173
     
    487488        this._sliderElement.max = this.representedObject.visualActionIndexes.length;
    488489        this._updateSliderValue();
     490
     491        if (this.representedObject.ready)
     492            this.representedObject.removeEventListener(null, null, this);
    489493    }
    490494};
Note: See TracChangeset for help on using the changeset viewer.