зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1329568 - Media...Type::SizeOf... methods - r=jya,njn
When replacing strings with MediaContentType objects, some classes will want to know about their size. MozReview-Commit-ID: LNdaaUdJac3 --HG-- extra : rebase_source : 334bdca4a9b7a5db455bb731c495fa7a96b5b03c
This commit is contained in:
Родитель
3a78522186
Коммит
8f52cbdabb
|
@ -10,6 +10,12 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
size_t
|
||||
MediaContentType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return mExtendedMIMEType.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
Maybe<MediaContentType>
|
||||
MakeMediaContentType(const nsAString& aType)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,8 @@ public:
|
|||
const MediaMIMEType& Type() const { return mExtendedMIMEType.Type(); }
|
||||
const MediaExtendedMIMEType& ExtendedType() const { return mExtendedMIMEType; }
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
MediaExtendedMIMEType mExtendedMIMEType;
|
||||
};
|
||||
|
|
|
@ -38,6 +38,12 @@ MediaMIMEType::HasVideoMajorType() const
|
|||
return StartsWith(mMIMEType, "video/");
|
||||
}
|
||||
|
||||
size_t
|
||||
MediaMIMEType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return mMIMEType.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
}
|
||||
|
||||
MediaMIMEType::MediaMIMEType(const nsACString& aType)
|
||||
: mMIMEType(aType)
|
||||
{
|
||||
|
@ -101,6 +107,13 @@ MediaCodecs::ContainsAll(const MediaCodecs& aCodecs) const
|
|||
return true;
|
||||
}
|
||||
|
||||
size_t
|
||||
MediaCodecs::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return mCodecs.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
}
|
||||
|
||||
|
||||
static int32_t
|
||||
GetParameterAsNumber(const nsContentTypeParser& aParser,
|
||||
const char* aParameter,
|
||||
|
@ -175,6 +188,13 @@ MakeMediaExtendedMIMEType(const nsAString& aType)
|
|||
framerate, bitrate));
|
||||
}
|
||||
|
||||
size_t
|
||||
MediaExtendedMIMEType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return mMIMEType.SizeOfExcludingThis(aMallocSizeOf)
|
||||
+ mCodecs.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
Maybe<MediaExtendedMIMEType>
|
||||
MakeMediaExtendedMIMEType(const nsACString& aType)
|
||||
{
|
||||
|
|
|
@ -87,6 +87,8 @@ public:
|
|||
// (e.g., "video/webm" could contain a vorbis audio track.)
|
||||
bool HasVideoMajorType() const;
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
friend Maybe<MediaMIMEType> MakeMediaMIMEType(const nsAString& aType);
|
||||
friend class MediaExtendedMIMEType;
|
||||
|
@ -133,6 +135,8 @@ public:
|
|||
bool Contains(const nsAString& aCodec) const;
|
||||
bool ContainsAll(const MediaCodecs& aCodecs) const;
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
// UTF16 comma-separated list of codecs.
|
||||
// See http://www.rfc-editor.org/rfc/rfc4281.txt for the description
|
||||
|
@ -163,6 +167,8 @@ public:
|
|||
Maybe<int32_t> GetFramerate() const { return GetMaybeNumber(mFramerate); }
|
||||
Maybe<int32_t> GetBitrate() const { return GetMaybeNumber(mBitrate); }
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
friend Maybe<MediaExtendedMIMEType> MakeMediaExtendedMIMEType(const nsAString& aType);
|
||||
MediaExtendedMIMEType(const nsACString& aMIMEType,
|
||||
|
|
Загрузка…
Ссылка в новой задаче