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

Unified Diff: Source/modules/speech/SpeechRecognition.h

Issue 960223002: Detach SpeechRecognitionController upon page detach. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Allow controller-detached creation of SpeechRecognition objects Created 5 years, 10 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/modules/speech/SpeechRecognition.h
diff --git a/Source/modules/speech/SpeechRecognition.h b/Source/modules/speech/SpeechRecognition.h
index e22c54f6e1a8b8f3e845698fc4f8ce4ccba73822..9294213bf2aa3b9a31fbd2ea85258476c77583ff 100644
--- a/Source/modules/speech/SpeechRecognition.h
+++ b/Source/modules/speech/SpeechRecognition.h
@@ -27,10 +27,12 @@
#define SpeechRecognition_h
#include "core/dom/ActiveDOMObject.h"
+#include "core/page/PageLifecycleObserver.h"
#include "modules/EventTargetModules.h"
#include "modules/speech/SpeechGrammarList.h"
#include "modules/speech/SpeechRecognitionResult.h"
#include "platform/heap/Handle.h"
+#include "public/platform/WebPrivatePtr.h"
#include "wtf/Compiler.h"
#include "wtf/text/WTFString.h"
@@ -42,7 +44,7 @@ class MediaStreamTrack;
class SpeechRecognitionController;
class SpeechRecognitionError;
-class SpeechRecognition final : public RefCountedGarbageCollectedEventTargetWithInlineData<SpeechRecognition>, public ActiveDOMObject {
+class SpeechRecognition final : public RefCountedGarbageCollectedEventTargetWithInlineData<SpeechRecognition>, public PageLifecycleObserver, public ActiveDOMObject {
DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<SpeechRecognition>);
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechRecognition);
DEFINE_WRAPPERTYPEINFO();
@@ -105,8 +107,11 @@ public:
DECLARE_VIRTUAL_TRACE();
+ // PageLifecycleObserver
+ virtual void contextDestroyed() override;
+
private:
- explicit SpeechRecognition(ExecutionContext*);
+ SpeechRecognition(Page*, ExecutionContext*);
Member<SpeechGrammarList> m_grammars;
Member<MediaStreamTrack> m_audioTrack;
@@ -122,6 +127,18 @@ private:
HeapVector<Member<SpeechRecognitionResult>> m_finalResults;
};
+// FIXME: Oilpan: two GarbageCollectedLifetime-based subclasses introduces
+// ambiguity for WebPrivatePtr<T>'s LifeTimeOf<T> inference of lifetime.
+template<>
+class LifetimeOf<SpeechRecognition> {
+public:
+#if ENABLE(OILPAN)
+ static const LifetimeManagementType value = RefCountedGarbageCollectedLifetime;
+#else
+ static const LifetimeManagementType value = RefCountedLifetime;
+#endif
+};
+
} // namespace blink
#endif // SpeechRecognition_h

Powered by Google App Engine
This is Rietveld 408576698