Bug 1153049: Part2. Fix const-ness. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 14 Apr 2015 15:15:46 +1000
changeset 238950 3e617cb207c5261e89a35d364753726b69d721cd
parent 238949 0a4a18ee6c8267d685243851a485c96030211ec4
child 238951 d6e188e8872e86f3fa4b514631e4e3e31442674e
push id58375
push userjyavenard@mozilla.com
push dateTue, 14 Apr 2015 05:41:04 +0000
treeherdermozilla-inbound@65492fe83362 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1153049
milestone40.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 1153049: Part2. Fix const-ness. r=cpearce
dom/media/MediaData.cpp
dom/media/MediaData.h
--- a/dom/media/MediaData.cpp
+++ b/dom/media/MediaData.cpp
@@ -147,50 +147,50 @@ VideoData::SizeOfIncludingThis(MallocSiz
     size += img->SizeOfIncludingThis(aMallocSizeOf);
   }
 
   return size;
 }
 
 /* static */
 already_AddRefed<VideoData>
-VideoData::ShallowCopyUpdateDuration(VideoData* aOther,
+VideoData::ShallowCopyUpdateDuration(const VideoData* aOther,
                                      int64_t aDuration)
 {
   nsRefPtr<VideoData> v = new VideoData(aOther->mOffset,
                                         aOther->mTime,
                                         aDuration,
                                         aOther->mKeyframe,
                                         aOther->mTimecode,
                                         aOther->mDisplay);
   v->mDiscontinuity = aOther->mDiscontinuity;
   v->mImage = aOther->mImage;
   return v.forget();
 }
 
 /* static */
 already_AddRefed<VideoData>
-VideoData::ShallowCopyUpdateTimestamp(VideoData* aOther,
+VideoData::ShallowCopyUpdateTimestamp(const VideoData* aOther,
                                       int64_t aTimestamp)
 {
   NS_ENSURE_TRUE(aOther, nullptr);
   nsRefPtr<VideoData> v = new VideoData(aOther->mOffset,
                                         aTimestamp,
                                         aOther->GetEndTime() - aTimestamp,
                                         aOther->mKeyframe,
                                         aOther->mTimecode,
                                         aOther->mDisplay);
   v->mDiscontinuity = aOther->mDiscontinuity;
   v->mImage = aOther->mImage;
   return v.forget();
 }
 
 /* static */
 already_AddRefed<VideoData>
-VideoData::ShallowCopyUpdateTimestampAndDuration(VideoData* aOther,
+VideoData::ShallowCopyUpdateTimestampAndDuration(const VideoData* aOther,
                                                  int64_t aTimestamp,
                                                  int64_t aDuration)
 {
   NS_ENSURE_TRUE(aOther, nullptr);
   nsRefPtr<VideoData> v = new VideoData(aOther->mOffset,
                                         aTimestamp,
                                         aDuration,
                                         aOther->mKeyframe,
@@ -198,17 +198,17 @@ VideoData::ShallowCopyUpdateTimestampAnd
                                         aOther->mDisplay);
   v->mDiscontinuity = aOther->mDiscontinuity;
   v->mImage = aOther->mImage;
   return v.forget();
 }
 
 /* static */
 void VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
-                                    VideoInfo& aInfo,
+                                    const VideoInfo& aInfo,
                                     const YCbCrBuffer &aBuffer,
                                     const IntRect& aPicture,
                                     bool aCopyData)
 {
   if (!aVideoImage) {
     return;
   }
   const YCbCrBuffer::Plane &Y = aBuffer.mPlanes[0];
@@ -236,17 +236,17 @@ void VideoData::SetVideoDataToImage(Plan
     aVideoImage->SetData(data);
   } else {
     aVideoImage->SetDataNoCopy(data);
   }
 }
 
 /* static */
 already_AddRefed<VideoData>
-VideoData::Create(VideoInfo& aInfo,
+VideoData::Create(const VideoInfo& aInfo,
                   ImageContainer* aContainer,
                   Image* aImage,
                   int64_t aOffset,
                   int64_t aTime,
                   int64_t aDuration,
                   const YCbCrBuffer& aBuffer,
                   bool aKeyframe,
                   int64_t aTimecode,
@@ -352,49 +352,49 @@ VideoData::Create(VideoInfo& aInfo,
                                    true /* aCopyData */);
   }
 #endif
   return v.forget();
 }
 
 /* static */
 already_AddRefed<VideoData>
-VideoData::Create(VideoInfo& aInfo,
+VideoData::Create(const VideoInfo& aInfo,
                   ImageContainer* aContainer,
                   int64_t aOffset,
                   int64_t aTime,
                   int64_t aDuration,
                   const YCbCrBuffer& aBuffer,
                   bool aKeyframe,
                   int64_t aTimecode,
                   const IntRect& aPicture)
 {
   return Create(aInfo, aContainer, nullptr, aOffset, aTime, aDuration, aBuffer,
                 aKeyframe, aTimecode, aPicture);
 }
 
 /* static */
 already_AddRefed<VideoData>
-VideoData::Create(VideoInfo& aInfo,
+VideoData::Create(const VideoInfo& aInfo,
                   Image* aImage,
                   int64_t aOffset,
                   int64_t aTime,
                   int64_t aDuration,
                   const YCbCrBuffer& aBuffer,
                   bool aKeyframe,
                   int64_t aTimecode,
                   const IntRect& aPicture)
 {
   return Create(aInfo, nullptr, aImage, aOffset, aTime, aDuration, aBuffer,
                 aKeyframe, aTimecode, aPicture);
 }
 
 /* static */
 already_AddRefed<VideoData>
-VideoData::CreateFromImage(VideoInfo& aInfo,
+VideoData::CreateFromImage(const VideoInfo& aInfo,
                            ImageContainer* aContainer,
                            int64_t aOffset,
                            int64_t aTime,
                            int64_t aDuration,
                            const nsRefPtr<Image>& aImage,
                            bool aKeyframe,
                            int64_t aTimecode,
                            const IntRect& aPicture)
@@ -407,17 +407,17 @@ VideoData::CreateFromImage(VideoInfo& aI
                                       aInfo.mDisplay));
   v->mImage = aImage;
   return v.forget();
 }
 
 #ifdef MOZ_OMX_DECODER
 /* static */
 already_AddRefed<VideoData>
-VideoData::Create(VideoInfo& aInfo,
+VideoData::Create(const VideoInfo& aInfo,
                   ImageContainer* aContainer,
                   int64_t aOffset,
                   int64_t aTime,
                   int64_t aDuration,
                   mozilla::layers::TextureClient* aBuffer,
                   bool aKeyframe,
                   int64_t aTimecode,
                   const IntRect& aPicture)
--- a/dom/media/MediaData.h
+++ b/dom/media/MediaData.h
@@ -169,96 +169,96 @@ public:
   // Constructs a VideoData object. If aImage is nullptr, creates a new Image
   // holding a copy of the YCbCr data passed in aBuffer. If aImage is not
   // nullptr, it's stored as the underlying video image and aBuffer is assumed
   // to point to memory within aImage so no copy is made. aTimecode is a codec
   // specific number representing the timestamp of the frame of video data.
   // Returns nsnull if an error occurs. This may indicate that memory couldn't
   // be allocated to create the VideoData object, or it may indicate some
   // problem with the input data (e.g. negative stride).
-  static already_AddRefed<VideoData> Create(VideoInfo& aInfo,
+  static already_AddRefed<VideoData> Create(const VideoInfo& aInfo,
                                             ImageContainer* aContainer,
                                             Image* aImage,
                                             int64_t aOffset,
                                             int64_t aTime,
                                             int64_t aDuration,
                                             const YCbCrBuffer &aBuffer,
                                             bool aKeyframe,
                                             int64_t aTimecode,
                                             const IntRect& aPicture);
 
   // Variant that always makes a copy of aBuffer
-  static already_AddRefed<VideoData> Create(VideoInfo& aInfo,
+  static already_AddRefed<VideoData> Create(const VideoInfo& aInfo,
                                             ImageContainer* aContainer,
                                             int64_t aOffset,
                                             int64_t aTime,
                                             int64_t aDuration,
                                             const YCbCrBuffer &aBuffer,
                                             bool aKeyframe,
                                             int64_t aTimecode,
                                             const IntRect& aPicture);
 
   // Variant to create a VideoData instance given an existing aImage
-  static already_AddRefed<VideoData> Create(VideoInfo& aInfo,
+  static already_AddRefed<VideoData> Create(const VideoInfo& aInfo,
                                             Image* aImage,
                                             int64_t aOffset,
                                             int64_t aTime,
                                             int64_t aDuration,
                                             const YCbCrBuffer &aBuffer,
                                             bool aKeyframe,
                                             int64_t aTimecode,
                                             const IntRect& aPicture);
 
-  static already_AddRefed<VideoData> Create(VideoInfo& aInfo,
-                                             ImageContainer* aContainer,
-                                             int64_t aOffset,
-                                             int64_t aTime,
-                                             int64_t aDuration,
-                                             layers::TextureClient* aBuffer,
-                                             bool aKeyframe,
-                                             int64_t aTimecode,
-                                             const IntRect& aPicture);
+  static already_AddRefed<VideoData> Create(const VideoInfo& aInfo,
+                                            ImageContainer* aContainer,
+                                            int64_t aOffset,
+                                            int64_t aTime,
+                                            int64_t aDuration,
+                                            layers::TextureClient* aBuffer,
+                                            bool aKeyframe,
+                                            int64_t aTimecode,
+                                            const IntRect& aPicture);
 
-  static already_AddRefed<VideoData> CreateFromImage(VideoInfo& aInfo,
+  static already_AddRefed<VideoData> CreateFromImage(const VideoInfo& aInfo,
                                                      ImageContainer* aContainer,
                                                      int64_t aOffset,
                                                      int64_t aTime,
                                                      int64_t aDuration,
                                                      const nsRefPtr<Image>& aImage,
                                                      bool aKeyframe,
                                                      int64_t aTimecode,
                                                      const IntRect& aPicture);
 
   // Creates a new VideoData identical to aOther, but with a different
   // specified duration. All data from aOther is copied into the new
   // VideoData. The new VideoData's mImage field holds a reference to
   // aOther's mImage, i.e. the Image is not copied. This function is useful
   // in reader backends that can't determine the duration of a VideoData
   // until the next frame is decoded, i.e. it's a way to change the const
   // duration field on a VideoData.
-  static already_AddRefed<VideoData> ShallowCopyUpdateDuration(VideoData* aOther,
+  static already_AddRefed<VideoData> ShallowCopyUpdateDuration(const VideoData* aOther,
                                                                int64_t aDuration);
 
   // Creates a new VideoData identical to aOther, but with a different
   // specified timestamp. All data from aOther is copied into the new
   // VideoData, as ShallowCopyUpdateDuration() does.
-  static already_AddRefed<VideoData> ShallowCopyUpdateTimestamp(VideoData* aOther,
+  static already_AddRefed<VideoData> ShallowCopyUpdateTimestamp(const VideoData* aOther,
                                                                 int64_t aTimestamp);
 
   // Creates a new VideoData identical to aOther, but with a different
   // specified timestamp and duration. All data from aOther is copied
   // into the new VideoData, as ShallowCopyUpdateDuration() does.
   static already_AddRefed<VideoData>
-  ShallowCopyUpdateTimestampAndDuration(VideoData* aOther, int64_t aTimestamp,
+  ShallowCopyUpdateTimestampAndDuration(const VideoData* aOther, int64_t aTimestamp,
                                         int64_t aDuration);
 
   // Initialize PlanarYCbCrImage. Only When aCopyData is true,
   // video data is copied to PlanarYCbCrImage.
   static void SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
-                                  VideoInfo& aInfo,
+                                  const VideoInfo& aInfo,
                                   const YCbCrBuffer &aBuffer,
                                   const IntRect& aPicture,
                                   bool aCopyData);
 
   // Constructs a duplicate VideoData object. This intrinsically tells the
   // player that it does not need to update the displayed frame when this
   // frame is played; this frame is identical to the previous.
   static already_AddRefed<VideoData> CreateDuplicate(int64_t aOffset,