Bug 1274626 part 1 - add a method to HTMLMediaElement for debugging visibilty change; r=jwwang,ehsan
MozReview-Commit-ID: B1gAc0KfmCQ
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -792,16 +792,27 @@ HTMLMediaElement::GetMozDebugReaderData(
void
HTMLMediaElement::MozDumpDebugInfo()
{
if (mDecoder) {
mDecoder->DumpDebugInfo();
}
}
+void
+HTMLMediaElement::SetVisible(bool aVisible)
+{
+ if (!mDecoder) {
+ return;
+ }
+
+ mDecoder->NotifyOwnerActivityChanged(aVisible);
+
+}
+
already_AddRefed<DOMMediaStream>
HTMLMediaElement::GetSrcObject() const
{
NS_ASSERTION(!mSrcAttrStream || mSrcAttrStream->GetPlaybackStream(),
"MediaStream should have been set up properly");
RefPtr<DOMMediaStream> stream = mSrcAttrStream;
return stream.forget();
}
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -601,16 +601,18 @@ public:
already_AddRefed<MediaSource> GetMozMediaSourceObject() const;
// Returns a string describing the state of the media player internal
// data. Used for debugging purposes.
void GetMozDebugReaderData(nsAString& aString);
void MozDumpDebugInfo();
+ void SetVisible(bool aVisible);
+
already_AddRefed<DOMMediaStream> GetSrcObject() const;
void SetSrcObject(DOMMediaStream& aValue);
void SetSrcObject(DOMMediaStream* aValue);
// TODO: remove prefixed versions soon (1183495).
already_AddRefed<DOMMediaStream> GetMozSrcObject() const;
void SetMozSrcObject(DOMMediaStream& aValue);
void SetMozSrcObject(DOMMediaStream* aValue);
--- a/dom/webidl/HTMLMediaElement.webidl
+++ b/dom/webidl/HTMLMediaElement.webidl
@@ -209,8 +209,17 @@ partial interface HTMLMediaElement {
* beginning time, then the SeekToNextFrame() operation sets the media's
* currentTime to the duration of the media source and dispatches a "seeked"
* event and an "ended" event.
*/
partial interface HTMLMediaElement {
[Throws, Pref="media.seekToNextFrame.enabled"]
Promise<void> seekToNextFrame();
};
+
+/*
+ * This is an API for simulating visibility changes to help debug and write
+ * tests about suspend-video-decoding.
+ */
+partial interface HTMLMediaElement {
+ [Pref="media.test.setVisible"]
+ void setVisible(boolean aVisible);
+};