Bug 1274626 part 1 - add a method to HTMLMediaElement for debugging visibilty change; r=jwwang,ehsan
authorKaku Kuo <tkuo@mozilla.com>
Thu, 28 Jul 2016 16:09:02 +0800
changeset 307884 ee3afceea687fa74a16316dfe2ee90bb6ebc0a59
parent 307883 a69237267b62336d8c30bb268a3dd410f844b1f1
child 307885 876f15c4bfffec79a2d66e46704daf86df7a8c40
push id80212
push usercbook@mozilla.com
push dateWed, 03 Aug 2016 13:50:13 +0000
treeherdermozilla-inbound@91c0b3e80825 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang, ehsan
bugs1274626
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1274626 part 1 - add a method to HTMLMediaElement for debugging visibilty change; r=jwwang,ehsan MozReview-Commit-ID: B1gAc0KfmCQ
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
dom/webidl/HTMLMediaElement.webidl
--- 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);
+};