mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 682216 - add a memory reporter for libnestegg's memory; r=njn,kinetik
This commit is contained in:
parent
f8eb10577d
commit
39705c09f6
@ -28,6 +28,7 @@ nestegg_track_video_params
|
||||
nestegg_tstamp_scale
|
||||
nestegg_has_cues
|
||||
nestegg_sniff
|
||||
nestegg_set_halloc_func
|
||||
#endif
|
||||
#ifdef MOZ_WEBM_ENCODER
|
||||
writeSimpleBlock
|
||||
|
@ -137,6 +137,9 @@ extern nsresult nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **)
|
||||
#ifdef MOZ_VPX
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#endif
|
||||
#ifdef MOZ_WEBM
|
||||
#include "nestegg/nestegg.h"
|
||||
#endif
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
@ -418,6 +421,28 @@ NS_IMPL_ISUPPORTS1(VPXReporter, nsIMemoryReporter)
|
||||
/* static */ template<> Atomic<size_t> CountingAllocatorBase<VPXReporter>::sAmount(0);
|
||||
#endif /* MOZ_VPX */
|
||||
|
||||
#ifdef MOZ_WEBM
|
||||
class NesteggReporter MOZ_FINAL : public nsIMemoryReporter
|
||||
, public CountingAllocatorBase<NesteggReporter>
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
private:
|
||||
NS_IMETHODIMP
|
||||
CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData)
|
||||
{
|
||||
return MOZ_COLLECT_REPORT(
|
||||
"explicit/media/libnestegg", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
|
||||
"Memory allocated through libnestegg for WebM media files.");
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(NesteggReporter, nsIMemoryReporter)
|
||||
|
||||
/* static */ template<> Atomic<size_t> CountingAllocatorBase<NesteggReporter>::sAmount(0);
|
||||
#endif /* MOZ_WEBM */
|
||||
|
||||
EXPORT_XPCOM_API(nsresult)
|
||||
NS_InitXPCOM2(nsIServiceManager* *result,
|
||||
nsIFile* binDirectory,
|
||||
@ -588,6 +613,11 @@ NS_InitXPCOM2(nsIServiceManager* *result,
|
||||
memmove);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBM
|
||||
// And for libnestegg.
|
||||
nestegg_set_halloc_func(NesteggReporter::CountingRealloc);
|
||||
#endif
|
||||
|
||||
// Initialize the JS engine.
|
||||
if (!JS_Init()) {
|
||||
NS_RUNTIMEABORT("JS_Init failed");
|
||||
@ -641,6 +671,9 @@ NS_InitXPCOM2(nsIServiceManager* *result,
|
||||
#ifdef MOZ_VPX
|
||||
RegisterStrongMemoryReporter(new VPXReporter());
|
||||
#endif
|
||||
#ifdef MOZ_WEBM
|
||||
RegisterStrongMemoryReporter(new NesteggReporter());
|
||||
#endif
|
||||
|
||||
mozilla::Telemetry::Init();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user