Skip to content

Commit

Permalink
Cherry-pick 261817@main (52c77ee). https://bugs.webkit.org/show_bug.c…
Browse files Browse the repository at this point in the history
…gi?id=254045

    Fix smart pointer usage when dealing with ScriptExecutionContext
    https://bugs.webkit.org/show_bug.cgi?id=254045
    rdar://106721110

    Reviewed by Ryosuke Niwa.

    This change fixes uses of ScriptExecutionContext so that it conforms
    with the smart pointer usage guidelines.

    * Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h:

    Canonical link: https://commits.webkit.org/261817@main
  • Loading branch information
chirags27 authored and aperezdc committed Apr 6, 2023
1 parent 545e08c commit 6d8bb8c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h
Expand Up @@ -30,6 +30,7 @@
#include "ContextDestructionObserver.h"
#include "EventTarget.h"
#include "PlatformSpeechSynthesisUtterance.h"
#include "ScriptExecutionContext.h"
#include "SpeechSynthesisErrorCode.h"
#include "SpeechSynthesisVoice.h"
#include <wtf/RefCounted.h>
Expand Down Expand Up @@ -80,14 +81,14 @@ class WEBCORE_EXPORT SpeechSynthesisUtterance final : public PlatformSpeechSynth
private:
SpeechSynthesisUtterance(ScriptExecutionContext&, const String&, UtteranceCompletionHandler&&);

ScriptExecutionContext* scriptExecutionContext() const final { return &m_scriptExecutionContext; }
ScriptExecutionContext* scriptExecutionContext() const final { return m_scriptExecutionContext.get(); }
EventTargetInterface eventTargetInterface() const final { return SpeechSynthesisUtteranceEventTargetInterfaceType; }
void refEventTarget() final { ref(); }
void derefEventTarget() final { deref(); }

RefPtr<PlatformSpeechSynthesisUtterance> m_platformUtterance;
RefPtr<SpeechSynthesisVoice> m_voice;
ScriptExecutionContext& m_scriptExecutionContext;
WeakPtr<ScriptExecutionContext> m_scriptExecutionContext;
UtteranceCompletionHandler m_completionHandler;
};

Expand Down

0 comments on commit 6d8bb8c

Please sign in to comment.