gecko-dev/dom/media/gtest/MockMediaDecoderOwner.h
Kaku Kuo b06e8a5370 Bug 1344357 P1 - move the MediaDecoder::mSeekDOMPromise to HTMLMediaElement; r=jwwang
There was a cycle amoung a window object -> a HTMLMediaElement -> a MediaDecoder -> a Promise (-> back to the window object).
And we have no way to break the cycle since the MediaDecoder does not participate into the collection.

By moving the Promise form MediaDecoder to HTMLMediaElement, we will be able to break the cycle since the HTMLMediaElement is in the collection.

We'll implement the cycle collection in the next patch.

MozReview-Commit-ID: CyVXBl6IMI3

--HG--
extra : rebase_source : 195a322ce3e6fe933e72be4aec5d2ebfa1f54865
2017-04-17 18:25:26 +08:00

67 lines
2.2 KiB
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOCK_MEDIA_DECODER_OWNER_H_
#define MOCK_MEDIA_DECODER_OWNER_H_
#include "MediaDecoderOwner.h"
#include "mozilla/AbstractThread.h"
#include "nsAutoPtr.h"
namespace mozilla
{
class MockMediaDecoderOwner : public MediaDecoderOwner
{
public:
nsresult DispatchAsyncEvent(const nsAString& aName) override
{
return NS_OK;
}
void FireTimeUpdate(bool aPeriodic) override {}
bool GetPaused() override { return false; }
void MetadataLoaded(const MediaInfo* aInfo,
nsAutoPtr<const MetadataTags> aTags) override
{
}
void NetworkError() override {}
void DecodeError(const MediaResult& aError) override {}
bool HasError() const override { return false; }
void LoadAborted() override {}
void PlaybackEnded() override {}
void SeekStarted() override {}
void SeekCompleted() override {}
void DownloadProgressed() override {}
void UpdateReadyState() override {}
void FirstFrameLoaded() override {}
void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
const nsAString& aInitDataType) override {}
bool IsActive() const override { return true; }
bool IsHidden() const override { return false; }
void DownloadSuspended() override {}
void DownloadResumed(bool aForceNetworkLoading) override {}
void NotifySuspendedByCache(bool aIsSuspended) override {}
void NotifyDecoderPrincipalChanged() override {}
VideoFrameContainer* GetVideoFrameContainer() override
{
return nullptr;
}
void SetAudibleState(bool aAudible) override {}
void NotifyXPCOMShutdown() override {}
AbstractThread* AbstractMainThread() const override
{
// Non-DocGroup version for Mock.
return AbstractThread::MainThread();
}
nsIDocument* GetDocument() const { return nullptr; }
void ConstructMediaTracks(const MediaInfo* aInfo) {}
void RemoveMediaTracks() {}
already_AddRefed<GMPCrashHelper> CreateGMPCrashHelper() { return nullptr; }
void AsyncResolveSeekDOMPromiseIfExists() override {}
void AsyncRejectSeekDOMPromiseIfExists() override {}
};
}
#endif