Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1940)

Unified Diff: Source/platform/speech/PlatformSpeechSynthesizer.h

Issue 1148383012: Oilpan: prefer eager finalization over prefinalizers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: expand&improve comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/speech/PlatformSpeechSynthesizer.h
diff --git a/Source/platform/speech/PlatformSpeechSynthesizer.h b/Source/platform/speech/PlatformSpeechSynthesizer.h
index f808750fe3102bb50409dfa7fcb5bda64ac19400..c54e2f1849b92a6fe28c03e3c3f62be8b558b1c7 100644
--- a/Source/platform/speech/PlatformSpeechSynthesizer.h
+++ b/Source/platform/speech/PlatformSpeechSynthesizer.h
@@ -58,12 +58,10 @@ protected:
class PLATFORM_EXPORT PlatformSpeechSynthesizer : public GarbageCollectedFinalized<PlatformSpeechSynthesizer> {
WTF_MAKE_NONCOPYABLE(PlatformSpeechSynthesizer);
- USING_PRE_FINALIZER(PlatformSpeechSynthesizer, dispose);
public:
static PlatformSpeechSynthesizer* create(PlatformSpeechSynthesizerClient*);
virtual ~PlatformSpeechSynthesizer();
- void dispose();
const HeapVector<Member<PlatformSpeechSynthesisVoice>>& voiceList() const { return m_voiceList; }
virtual void speak(PlatformSpeechSynthesisUtterance*);
@@ -75,6 +73,15 @@ public:
void setVoiceList(HeapVector<Member<PlatformSpeechSynthesisVoice>>&);
+ // Eager finalization is required to promptly release the owned WebSpeechSynthesizer.
+ //
+ // If not and delayed until lazily swept, m_webSpeechSynthesizerClient may end up
+ // being lazily swept first (i.e., before this PlatformSpeechSynthesizer), leaving
+ // m_webSpeechSynthesizer with a dangling pointer to a finalized object --
+ // WebSpeechSynthesizer embedder implementations calling notification methods in the
+ // other directions by way of m_webSpeechSynthesizerClient. Eagerly releasing
+ // WebSpeechSynthesizer prevents such unsafe accesses.
+ EAGERLY_FINALIZE();
DECLARE_VIRTUAL_TRACE();
protected:
« no previous file with comments | « Source/modules/webmidi/MIDIAccessInitializer.cpp ('k') | Source/platform/speech/PlatformSpeechSynthesizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698