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

Unified Diff: Source/modules/webaudio/AudioContext.h

Issue 802593004: WebAudio: Fix AudioNode leak in a case that AudioNode is not disconnected from the graph explicitly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: New marking mode, simpify WebAudio code 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
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.cpp » ('j') | Source/modules/webaudio/AudioContext.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioContext.h
diff --git a/Source/modules/webaudio/AudioContext.h b/Source/modules/webaudio/AudioContext.h
index ca8a882dc9fc9f0baf5f4810ccf1e8beb2ecb112..a37b2a39412b5f34e0997e6f531788fd0375d674 100644
--- a/Source/modules/webaudio/AudioContext.h
+++ b/Source/modules/webaudio/AudioContext.h
@@ -77,7 +77,10 @@ class WaveShaperNode;
// AudioContext is the cornerstone of the web audio API and all AudioNodes are created from it.
// For thread safety between the audio thread and the main thread, it has a rendering graph locking mechanism.
-class AudioContext : public RefCountedGarbageCollectedEventTargetWithInlineData<AudioContext>, public ActiveDOMObject {
+class AudioContext
+ : public RefCountedGarbageCollectedEventTargetWithInlineData<AudioContext>
+ , public ActiveDOMObject
+ , private ThreadState::MarkingTask {
DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<AudioContext>);
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(AudioContext);
DEFINE_WRAPPERTYPEINFO();
@@ -101,6 +104,8 @@ public:
bool isInitialized() const { return m_isInitialized; }
bool isOfflineContext() { return m_isOfflineContext; }
+ AudioContextState contextState() const { return m_contextState; }
+ void setLastZombie(void*);
// Document notification
virtual void stop() override final;
@@ -280,6 +285,10 @@ private:
void initialize();
void uninitialize();
+ // ThreadState::MarkingTask functions.
+ void willStartMarking(ThreadState&) override;
+ void didFinishMarking(ThreadState&) override;
+
// ExecutionContext calls stop twice.
// We'd like to schedule only one stop action for them.
bool m_isStopScheduled;
@@ -387,6 +396,10 @@ private:
bool m_didInitializeContextGraphMutex;
RecursiveMutex m_contextGraphMutex;
volatile ThreadIdentifier m_audioThread;
+ // Accessing m_last*Zombie should be protected by
+ // m_didInitializeContextGraphMutex.
+ void* m_lastZombie;
+ void* m_lastRemovableZombie;
// Only accessed in the audio thread.
// Oilpan: Since items are added to these vectors by the audio thread (not registered to Oilpan),
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.cpp » ('j') | Source/modules/webaudio/AudioContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698