зеркало из https://github.com/mozilla/gecko-dev.git
Bug 936964 (part 4) - Make MediaMemoryTracker ref-counted. r=kinetik.
--HG-- extra : rebase_source : fced8b650971a152299fcf07a9ee75936d1810a2
This commit is contained in:
Родитель
49c091bbb1
Коммит
d4402aa2cd
|
@ -18,6 +18,7 @@
|
|||
#include "MediaResource.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsITimer.h"
|
||||
|
@ -53,11 +54,13 @@ PRLogModuleInfo* gMediaDecoderLog;
|
|||
#define DECODER_LOG(type, msg)
|
||||
#endif
|
||||
|
||||
class MediaMemoryTracker
|
||||
class MediaMemoryTracker : public nsISupports
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
MediaMemoryTracker();
|
||||
~MediaMemoryTracker();
|
||||
static MediaMemoryTracker* sUniqueInstance;
|
||||
virtual ~MediaMemoryTracker();
|
||||
static StaticRefPtr<MediaMemoryTracker> sUniqueInstance;
|
||||
|
||||
static MediaMemoryTracker* UniqueInstance() {
|
||||
if (!sUniqueInstance) {
|
||||
|
@ -86,7 +89,6 @@ public:
|
|||
DecodersArray& decoders = Decoders();
|
||||
decoders.RemoveElement(aDecoder);
|
||||
if (decoders.IsEmpty()) {
|
||||
delete sUniqueInstance;
|
||||
sUniqueInstance = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +105,9 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
MediaMemoryTracker* MediaMemoryTracker::sUniqueInstance = nullptr;
|
||||
StaticRefPtr<MediaMemoryTracker> MediaMemoryTracker::sUniqueInstance;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(MediaMemoryTracker, nsISupports)
|
||||
|
||||
NS_IMPL_ISUPPORTS1(MediaDecoder, nsIObserver)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче