webaudio: leak: AudioContext objects are leaking. They retain 36mb of shared data.
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2012 06:10:35 +0000 (06:10 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2012 06:10:35 +0000 (06:10 +0000)
commite0a59edf453159a7f6b306548fe2677cf3abcad7
tree702749c835d693c607bfaf639c9b1281755513f1
parentb85f582e3a967ef407730ba913ccf38897085bab
webaudio: leak: AudioContext objects are leaking. They retain 36mb of shared data.
https://bugs.webkit.org/show_bug.cgi?id=102356

Reviewed by Adam Barth.

A clean-up code was moved from uninitialize to clear method.
AudioContext marks itself as hasPendingActivity in method constructCommon and unmarks itself in method clear.
m_isStopScheduled filters out second ActiveDOMObject::stop call.
markForDeletion appends AudioNode pointer to m_nodesToDelete array if there is no active audio thread.
adoptRef was added in createOfflineContext method.

Source/WebCore:

Test: inspector-protocol/nmi-webaudio-leak-test.html

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createOfflineContext):
(WebCore::AudioContext::AudioContext):
(WebCore::AudioContext::constructCommon):
(WebCore::AudioContext::~AudioContext):
(WebCore::AudioContext::clear):
(WebCore::AudioContext::uninitialize):
(WebCore::AudioContext::stopDispatch):
(WebCore::AudioContext::stop):
(WebCore::AudioContext::markForDeletion):
(WebCore::AudioContext::scheduleNodeDeletion):
(WebCore::AudioContext::deleteMarkedNodes):
* Modules/webaudio/AudioContext.h:
(AudioContext):
* bindings/v8/custom/V8AudioContextCustom.cpp:
(WebCore::V8AudioContext::constructorCallback):
* inspector/InspectorMemoryAgent.cpp:
(WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
* platform/PlatformMemoryInstrumentation.cpp:
(WebCore::PlatformMemoryInstrumentation::reportMemoryUsage):
(WebCore):
* platform/PlatformMemoryInstrumentation.h:
(PlatformMemoryInstrumentation):
(WebCore):

LayoutTests:

* inspector-protocol/nmi-webaudio-leak-test-expected.txt: Added.
* inspector-protocol/nmi-webaudio-leak-test.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135111 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector-protocol/nmi-webaudio-leak-test-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/nmi-webaudio-leak-test.html [new file with mode: 0644]
LayoutTests/platform/chromium-android/TestExpectations
LayoutTests/platform/efl-wk2/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/Modules/webaudio/AudioContext.h
Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp
Source/WebCore/inspector/InspectorMemoryAgent.cpp
Source/WebCore/platform/PlatformMemoryInstrumentation.cpp
Source/WebCore/platform/PlatformMemoryInstrumentation.h