mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1074387 - Fix double-counting of WebAudio PannerNode memory. r=jessup
--HG-- extra : rebase_source : a23a8d204e6eea6c1fca424343e4cb9569b012e1
This commit is contained in:
parent
6ccf9b780f
commit
0f68e93b1e
@ -32,6 +32,8 @@
|
||||
#include "AudioOutputObserver.h"
|
||||
#endif
|
||||
|
||||
#include "webaudio/blink/HRTFDatabaseLoader.h"
|
||||
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
@ -2911,6 +2913,15 @@ MediaStreamGraphImpl::CollectReports(nsIHandleReportCallback* aHandleReport,
|
||||
|
||||
}
|
||||
|
||||
size_t hrtfLoaders = WebCore::HRTFDatabaseLoader::sizeOfLoaders(MallocSizeOf);
|
||||
if (hrtfLoaders) {
|
||||
|
||||
REPORT(NS_LITERAL_CSTRING(
|
||||
"explicit/webaudio/audio-node/PannerNode/hrtf-databases"),
|
||||
hrtfLoaders,
|
||||
"Memory used by PannerNode databases (Web Audio).");
|
||||
}
|
||||
|
||||
#undef REPORT
|
||||
|
||||
return NS_OK;
|
||||
|
@ -37,6 +37,11 @@ namespace WebCore {
|
||||
nsTHashtable<HRTFDatabaseLoader::LoaderByRateEntry>*
|
||||
HRTFDatabaseLoader::s_loaderMap = nullptr;
|
||||
|
||||
size_t HRTFDatabaseLoader::sizeOfLoaders(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
{
|
||||
return s_loaderMap ? s_loaderMap->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
}
|
||||
|
||||
TemporaryRef<HRTFDatabaseLoader> HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(float sampleRate)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -94,13 +94,16 @@ public:
|
||||
// Called in asynchronous loading thread.
|
||||
void load();
|
||||
|
||||
size_t sizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
// Sums the size of all cached database loaders.
|
||||
static size_t sizeOfLoaders(mozilla::MallocSizeOf aMallocSizeOf);
|
||||
|
||||
private:
|
||||
// Both constructor and destructor must be called from the main thread.
|
||||
explicit HRTFDatabaseLoader(float sampleRate);
|
||||
~HRTFDatabaseLoader();
|
||||
|
||||
|
||||
size_t sizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
void ProxyRelease(); // any thread
|
||||
void MainThreadRelease(); // main thread only
|
||||
class ProxyReleaseEvent;
|
||||
@ -117,6 +120,12 @@ private:
|
||||
, mLoader() // so PutEntry() will zero-initialize
|
||||
{
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return mLoader ? mLoader->sizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
}
|
||||
|
||||
HRTFDatabaseLoader* mLoader;
|
||||
};
|
||||
|
||||
|
@ -74,10 +74,7 @@ size_t HRTFPanner::sizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) cons
|
||||
{
|
||||
size_t amount = aMallocSizeOf(this);
|
||||
|
||||
if (m_databaseLoader) {
|
||||
m_databaseLoader->sizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
// NB: m_databaseLoader can be shared, so it is not measured here
|
||||
amount += m_convolverL1.sizeOfExcludingThis(aMallocSizeOf);
|
||||
amount += m_convolverR1.sizeOfExcludingThis(aMallocSizeOf);
|
||||
amount += m_convolverL2.sizeOfExcludingThis(aMallocSizeOf);
|
||||
|
Loading…
Reference in New Issue
Block a user