Bug 1390748 - Pre-declare MediaDecoder in HTMLMediaElement. r=jwwang

I noticed that touching MediaDecoder rebuilds a lot of seemingly unrelated
code. This is because HTMLMediaElement includes MediaDecoder.h, and
HTMLMediaElement is included in a number of places. Having HTMLMediaElement.h
predeclare rather than include fixes it.

MozReview-Commit-ID: I0vrPgqvvge

--HG--
extra : rebase_source : 505f9dce979aad0529b07d2c046dca5028af6de6
This commit is contained in:
Chris Pearce 2017-08-15 17:09:06 +12:00
Родитель 2e91854fcd
Коммит 60751f0b79
5 изменённых файлов: 21 добавлений и 10 удалений

Просмотреть файл

@ -22,7 +22,6 @@
#include "jsfriendapi.h" #include "jsfriendapi.h"
#include "js/Value.h" #include "js/Value.h"
#include "Layers.h" #include "Layers.h"
#include "MediaDecoder.h"
#include "nsAppRunner.h" #include "nsAppRunner.h"
// nsNPAPIPluginInstance must be included before nsIDocument.h, which is included in mozAutoDocUpdate.h. // nsNPAPIPluginInstance must be included before nsIDocument.h, which is included in mozAutoDocUpdate.h.
#include "nsNPAPIPluginInstance.h" #include "nsNPAPIPluginInstance.h"
@ -48,7 +47,6 @@
#include "mozilla/dom/FileSystemSecurity.h" #include "mozilla/dom/FileSystemSecurity.h"
#include "mozilla/dom/FileBlobImpl.h" #include "mozilla/dom/FileBlobImpl.h"
#include "mozilla/dom/HTMLInputElement.h" #include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/HTMLTemplateElement.h" #include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/HTMLContentElement.h" #include "mozilla/dom/HTMLContentElement.h"
#include "mozilla/dom/HTMLShadowElement.h" #include "mozilla/dom/HTMLShadowElement.h"

Просмотреть файл

@ -7153,6 +7153,17 @@ HTMLMediaElement::NextFrameStatus()
return NEXT_FRAME_UNINITIALIZED; return NEXT_FRAME_UNINITIALIZED;
} }
void
HTMLMediaElement::SetDecoder(MediaDecoder* aDecoder)
{
MOZ_ASSERT(aDecoder); // Use ShutdownDecoder() to clear.
if (mDecoder) {
ShutdownDecoder();
}
mDecoder = aDecoder;
}
float float
HTMLMediaElement::ComputedVolume() const HTMLMediaElement::ComputedVolume() const
{ {

Просмотреть файл

@ -9,6 +9,8 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsIDOMHTMLMediaElement.h" #include "nsIDOMHTMLMediaElement.h"
#include "nsGenericHTMLElement.h" #include "nsGenericHTMLElement.h"
#include "MediaEventSource.h"
#include "SeekTarget.h"
#include "MediaDecoderOwner.h" #include "MediaDecoderOwner.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsIObserver.h" #include "nsIObserver.h"
@ -18,7 +20,6 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/dom/TextTrackManager.h" #include "mozilla/dom/TextTrackManager.h"
#include "mozilla/WeakPtr.h" #include "mozilla/WeakPtr.h"
#include "MediaDecoder.h"
#include "mozilla/dom/MediaKeys.h" #include "mozilla/dom/MediaKeys.h"
#include "mozilla/StateWatching.h" #include "mozilla/StateWatching.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
@ -49,6 +50,9 @@ class DOMMediaStream;
class ErrorResult; class ErrorResult;
class MediaResource; class MediaResource;
class MediaDecoder; class MediaDecoder;
class MediaInputPort;
class MediaStream;
class MediaStreamGraph;
class VideoFrameContainer; class VideoFrameContainer;
namespace dom { namespace dom {
class MediaKeys; class MediaKeys;
@ -808,13 +812,7 @@ protected:
MediaDecoderOwner::NextFrameStatus NextFrameStatus(); MediaDecoderOwner::NextFrameStatus NextFrameStatus();
void SetDecoder(MediaDecoder* aDecoder) { void SetDecoder(MediaDecoder* aDecoder);
MOZ_ASSERT(aDecoder); // Use ShutdownDecoder() to clear.
if (mDecoder) {
ShutdownDecoder();
}
mDecoder = aDecoder;
}
class WakeLockBoolWrapper { class WakeLockBoolWrapper {
public: public:

Просмотреть файл

@ -11,6 +11,9 @@
#include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/HTMLMediaElement.h"
namespace mozilla { namespace mozilla {
class FrameStatistics;
namespace dom { namespace dom {
class WakeLock; class WakeLock;

Просмотреть файл

@ -33,6 +33,7 @@
#include <algorithm> #include <algorithm>
#include "nsProxyRelease.h" #include "nsProxyRelease.h"
#include "nsIContentPolicy.h" #include "nsIContentPolicy.h"
#include "mozilla/ErrorNames.h"
using mozilla::media::TimeUnit; using mozilla::media::TimeUnit;