[webkit-changes] [WebKit/WebKit] cf6c75: Refactor noise injection policy types to be an Opt...

Wenson Hsieh noreply at github.com
Mon Aug 26 09:13:08 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cf6c75850aaa8928a7d37e4fff79b278277047f3
      https://github.com/WebKit/WebKit/commit/cf6c75850aaa8928a7d37e4fff79b278277047f3
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-08-26 (Mon, 26 Aug 2024)

  Changed paths:
    M Source/WebCore/Modules/webaudio/AnalyserNode.cpp
    M Source/WebCore/Modules/webaudio/AudioNode.cpp
    M Source/WebCore/Modules/webaudio/AudioNode.h
    M Source/WebCore/Modules/webaudio/AudioWorkletNode.cpp
    M Source/WebCore/Modules/webaudio/BaseAudioContext.cpp
    M Source/WebCore/Modules/webaudio/BaseAudioContext.h
    M Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp
    M Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp
    M Source/WebCore/Modules/webaudio/RealtimeAnalyser.h
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/EmptyScriptExecutionContext.h
    M Source/WebCore/dom/ScriptExecutionContext.h
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/html/CanvasBase.h
    M Source/WebCore/html/CustomPaintCanvas.cpp
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/OffscreenCanvas.cpp
    M Source/WebCore/platform/NoiseInjectionPolicy.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/workers/WorkerOrWorkletGlobalScope.cpp
    M Source/WebCore/workers/WorkerOrWorkletGlobalScope.h

  Log Message:
  -----------
  Refactor noise injection policy types to be an OptionSet
https://bugs.webkit.org/show_bug.cgi?id=278628

Reviewed by Abrar Rahman Protyasha.

Refactor the `NoiseInjectionPolicy` enum type, such that it can hold up to 2 different types (the
existing `Minimal` type and a new `Enhanced` type) in a single option set. Populate the `OptionSet`
in `Document` and propagate it to the relevant web audio and canvas noise injection codepaths.

No change in behavior.

* Source/WebCore/Modules/webaudio/AnalyserNode.cpp:
(WebCore::AnalyserNode::AnalyserNode):
* Source/WebCore/Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::noiseInjectionPolicies const):
(WebCore::AudioNode::noiseInjectionPolicy const): Deleted.
* Source/WebCore/Modules/webaudio/AudioNode.h:
* Source/WebCore/Modules/webaudio/AudioWorkletNode.cpp:
(WebCore::AudioWorkletNode::process):
* Source/WebCore/Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::BaseAudioContext):
* Source/WebCore/Modules/webaudio/BaseAudioContext.h:
(WebCore::BaseAudioContext::noiseInjectionPolicies const):
(WebCore::BaseAudioContext::noiseInjectionPolicy const): Deleted.
* Source/WebCore/Modules/webaudio/OfflineAudioContext.cpp:
(WebCore::OfflineAudioContext::OfflineAudioContext):
(WebCore::OfflineAudioContext::increaseNoiseMultiplierIfNeeded):
* Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp:
(WebCore::RealtimeAnalyser::RealtimeAnalyser):
(WebCore::RealtimeAnalyser::doFFTAnalysisIfNecessary):
* Source/WebCore/Modules/webaudio/RealtimeAnalyser.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::noiseInjectionPolicies const):
(WebCore::Document::noiseInjectionHashSalt const):
(WebCore::Document::noiseInjectionPolicy const): Deleted.
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/EmptyScriptExecutionContext.h:
* Source/WebCore/dom/ScriptExecutionContext.h:
* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::CanvasBase):
* Source/WebCore/html/CanvasBase.h:

Pass the `ScriptExecutionContext` into the constructor to avoid duplicating code for extracting the
hash salt for minimal noise injection.

* Source/WebCore/html/CustomPaintCanvas.cpp:
(WebCore::CustomPaintCanvas::CustomPaintCanvas):
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::HTMLCanvasElement):
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::OffscreenCanvas):
* Source/WebCore/platform/NoiseInjectionPolicy.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::setCanvasNoiseInjectionSalt):
* Source/WebCore/workers/WorkerOrWorkletGlobalScope.cpp:
(WebCore::WorkerOrWorkletGlobalScope::noiseInjectionPolicies const):
* Source/WebCore/workers/WorkerOrWorkletGlobalScope.h:

Canonical link: https://commits.webkit.org/282742@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list