Bug 1246521: P1. Add MediaDecoderOwner::HasError method. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 08 Feb 2016 15:27:14 +1100
changeset 283427 de6c0f937e9fb8afaf90acb9f739ce412a65d0f5
parent 283426 45554120ac30245ec2d4f7a12fc203ed4ca38586
child 283428 770d1bb1ca0cc7256ebeac784b64a3c7270eae73
push id29982
push usercbook@mozilla.com
push dateMon, 08 Feb 2016 10:57:27 +0000
treeherdermozilla-central@ac338559876d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1246521
milestone47.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 1246521: P1. Add MediaDecoderOwner::HasError method. r=gerald
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
dom/media/MediaDecoderOwner.h
dom/media/gtest/MockMediaDecoderOwner.h
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -3489,16 +3489,21 @@ void HTMLMediaElement::DecodeError()
     } else {
       NS_WARNING("Should know the source we were loading from!");
     }
   } else {
     Error(nsIDOMMediaError::MEDIA_ERR_DECODE);
   }
 }
 
+bool HTMLMediaElement::HasError() const
+{
+  return GetError();
+}
+
 void HTMLMediaElement::LoadAborted()
 {
   Error(nsIDOMMediaError::MEDIA_ERR_ABORTED);
 }
 
 void HTMLMediaElement::Error(uint16_t aErrorCode)
 {
   NS_ASSERTION(aErrorCode == nsIDOMMediaError::MEDIA_ERR_DECODE ||
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -172,16 +172,19 @@ public:
   // Called by the video decoder object, on the main thread,
   // when the resource has a network error during loading.
   virtual void NetworkError() final override;
 
   // Called by the video decoder object, on the main thread, when the
   // resource has a decode error during metadata loading or decoding.
   virtual void DecodeError() final override;
 
+  // Return true if error attribute is not null.
+  virtual bool HasError() const final override;
+
   // Called by the video decoder object, on the main thread, when the
   // resource load has been cancelled.
   virtual void LoadAborted() final override;
 
   // Called by the video decoder object, on the main thread,
   // when the video playback has ended.
   virtual void PlaybackEnded() final override;
 
--- a/dom/media/MediaDecoderOwner.h
+++ b/dom/media/MediaDecoderOwner.h
@@ -59,16 +59,19 @@ public:
   // Called by the video decoder object, on the main thread,
   // when the resource has a network error during loading.
   virtual void NetworkError() = 0;
 
   // Called by the video decoder object, on the main thread, when the
   // resource has a decode error during metadata loading or decoding.
   virtual void DecodeError() = 0;
 
+  // Return true if media element error attribute is not null.
+  virtual bool HasError() const = 0;
+
   // Called by the video decoder object, on the main thread, when the
   // resource load has been cancelled.
   virtual void LoadAborted() = 0;
 
   // Called by the video decoder object, on the main thread,
   // when the video playback has ended.
   virtual void PlaybackEnded() = 0;
 
--- a/dom/media/gtest/MockMediaDecoderOwner.h
+++ b/dom/media/gtest/MockMediaDecoderOwner.h
@@ -20,16 +20,17 @@ public:
   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() 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 {}
 #ifdef MOZ_EME