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

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

Issue 1002453004: Merge 190993 "Detach SpeechRecognitionController upon page detach." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2272/
Patch Set: Created 5 years, 9 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
===================================================================
--- Source/modules/speech/SpeechRecognition.h (revision 191726)
+++ Source/modules/speech/SpeechRecognition.h (working copy)
@@ -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 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 @@
virtual void trace(Visitor*) override;
+ // PageLifecycleObserver
+ virtual void contextDestroyed() override;
+
private:
- explicit SpeechRecognition(ExecutionContext*);
+ SpeechRecognition(Page*, ExecutionContext*);
Member<SpeechGrammarList> m_grammars;
Member<MediaStreamTrack> m_audioTrack;
@@ -122,6 +127,18 @@
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