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

Issue 940963005: Revert of WebAudio: Fix AudioNode leak in a case that AudioNode is not disconnected from the ... (Closed)

Created:
5 years, 10 months ago by tkent
Modified:
5 years, 8 months ago
CC:
blink-reviews, oilpan-reviews, kouhei+heap_chromium.org, Mads Ager (chromium)
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Revert of WebAudio: Fix AudioNode leak in a case that AudioNode is not disconnected from the graph explicitly. (patchset #5 id:100001 of https://codereview.chromium.org/802593004/) Reason for revert: Caused multiple problems. crbug.com/459605 crbug.com/459862 crbug.com/460254 Original issue's description: > WebAudio: Fix AudioNode leak in a case that AudioNode is not disconnected from the graph explicitly. > > The main purpose of this CL is to introduce ThreadState::markAsZombie > and ThreadState::purifyZombies, and to apply them for WebAudio. > Objects marked as zombies are not finalized until purifyZombies is > called. > > This CL also adds MarkingTasks, which enable to run tasks before/ > after Oilpan marking. AudioContext implements MarkingTask in order to > call purifyZombie before marking, and simplify AudioContext::trace. > > > BUG=434136, 455993 > > Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=190366 TBR=oilpan-reviews@chromium.org,rtoy@chromium.org,haraken@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=434136, 455993, 459605, 459862, 460254

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+24 lines, -184 lines) Patch
M Source/modules/webaudio/AudioContext.h View 4 chunks +1 line, -14 lines 0 comments Download
M Source/modules/webaudio/AudioContext.cpp View 7 chunks +8 lines, -37 lines 0 comments Download
M Source/modules/webaudio/AudioNode.cpp View 1 chunk +0 lines, -5 lines 0 comments Download
M Source/modules/webaudio/AudioSummingJunction.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M Source/platform/heap/Heap.h View 1 chunk +0 lines, -1 line 0 comments Download
M Source/platform/heap/Heap.cpp View 3 chunks +8 lines, -26 lines 0 comments Download
M Source/platform/heap/HeapTest.cpp View 1 chunk +0 lines, -14 lines 0 comments Download
M Source/platform/heap/ThreadState.h View 6 chunks +2 lines, -29 lines 0 comments Download
M Source/platform/heap/ThreadState.cpp View 4 chunks +0 lines, -58 lines 0 comments Download

Messages

Total messages: 8 (4 generated)
tkent
Created Revert of WebAudio: Fix AudioNode leak in a case that AudioNode is not disconnected ...
5 years, 10 months ago (2015-02-20 00:47:19 UTC) #1
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/940963005/1
5 years, 10 months ago (2015-02-20 00:51:18 UTC) #3
haraken
LGTM Thank you very much for being persistent on this work!
5 years, 10 months ago (2015-02-20 00:51:33 UTC) #4
commit-bot: I haz the power
5 years, 10 months ago (2015-02-20 00:52:13 UTC) #7
Failed to apply patch for Source/modules/webaudio/AudioContext.cpp:
While running patch -p1 --forward --force --no-backup-if-mismatch;
  patching file Source/modules/webaudio/AudioContext.cpp
  Hunk #1 FAILED at 111.
  Hunk #2 FAILED at 135.
  Hunk #3 FAILED at 173.
  Hunk #4 FAILED at 244.
  Hunk #5 FAILED at 996.
  Hunk #6 FAILED at 1294.
  Hunk #7 FAILED at 1371.
  7 out of 7 hunks FAILED -- saving rejects to file
Source/modules/webaudio/AudioContext.cpp.rej

Patch:       Source/modules/webaudio/AudioContext.cpp
Index: Source/modules/webaudio/AudioContext.cpp
diff --git a/Source/modules/webaudio/AudioContext.cpp
b/Source/modules/webaudio/AudioContext.cpp
index
c83cd758fc603b2600c1117d77e63367f65402c7..54f7637fbe38c9998269b4929c17998691a8f5a8
100644
--- a/Source/modules/webaudio/AudioContext.cpp
+++ b/Source/modules/webaudio/AudioContext.cpp
@@ -111,8 +111,6 @@
     , m_connectionCount(0)
     , m_didInitializeContextGraphMutex(false)
     , m_audioThread(0)
-    , m_lastZombie(nullptr)
-    , m_lastRemovableZombie(nullptr)
     , m_isOfflineContext(false)
     , m_contextState(Suspended)
     , m_cachedSampleFrame(0)
@@ -135,8 +133,6 @@
     , m_connectionCount(0)
     , m_didInitializeContextGraphMutex(false)
     , m_audioThread(0)
-    , m_lastZombie(nullptr)
-    , m_lastRemovableZombie(nullptr)
     , m_isOfflineContext(true)
     , m_contextState(Suspended)
     , m_cachedSampleFrame(0)
@@ -173,7 +169,6 @@
     if (isInitialized())
         return;
 
-    ThreadState::current()->addMarkingTask(this);
     FFTFrame::initialize();
     m_listener = AudioListener::create();
 
@@ -244,12 +239,6 @@
     m_listener->waitForHRTFDatabaseLoaderThreadCompletion();
 
     clear();
-
-    ThreadState::current()->removeMarkingTask(this);
-    if (m_lastZombie)
-        ThreadState::current()->purifyZombies();
-    m_lastZombie = nullptr;
-    m_lastRemovableZombie = nullptr;
 }
 
 void AudioContext::stop()
@@ -996,8 +985,6 @@
         // Dynamically clean up nodes which are no longer needed.
         derefFinishedSourceNodes();
 
-        m_lastRemovableZombie = m_lastZombie;
-
         // Fixup the state of any dirty AudioSummingJunctions and
AudioNodeOutputs.
         handleDirtyAudioSummingJunctions();
         handleDirtyAudioNodeOutputs();
@@ -1294,7 +1281,14 @@
     visitor->trace(m_renderTarget);
     visitor->trace(m_destinationNode);
     visitor->trace(m_listener);
-    visitor->trace(m_referencedNodes);
+    // trace() can be called in AudioContext constructor, and
+    // m_contextGraphMutex might be unavailable.
+    if (m_didInitializeContextGraphMutex) {
+        AutoLocker lock(this);
+        visitor->trace(m_referencedNodes);
+    } else {
+        visitor->trace(m_referencedNodes);
+    }
     visitor->trace(m_resumeResolvers);
     visitor->trace(m_suspendResolvers);
     visitor->trace(m_liveNodes);
@@ -1371,29 +1365,6 @@
     return promise;
 }
 
-void AudioContext::setLastZombie(void* object)
-{
-    ASSERT(isGraphOwner());
-    m_lastZombie = object;
-}
-
-void AudioContext::willStartMarking(ThreadState& threadState)
-{
-    lock();
-    if (!m_lastRemovableZombie)
-        return;
-    if (m_lastZombie != m_lastRemovableZombie)
-        return;
-    threadState.purifyZombies();
-    m_lastZombie = nullptr;
-    m_lastRemovableZombie = nullptr;
-}
-
-void AudioContext::didFinishMarking(ThreadState&)
-{
-    unlock();
-}
-
 } // namespace blink
 
 #endif // ENABLE(WEB_AUDIO)

Powered by Google App Engine
This is Rietveld 408576698