Bug 1262808: Refactor |PrincipalID| to |PrincipalHandle| in Gonk media code, r=rjesup
authorThomas Zimmermann <tdz@users.sourceforge.net>
Tue, 12 Apr 2016 16:54:41 +0200
changeset 330711 0199400f20b2d0d88089b24e90a53d48b5a18d17
parent 330710 6ddce5c0e641b0b60998a306f426c465079b42c2
child 330712 fe1b68c64b74a9fc9c70bd052153afbc0b77a5cd
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrjesup
bugs1262808
milestone48.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 1262808: Refactor |PrincipalID| to |PrincipalHandle| in Gonk media code, r=rjesup This patch renames |PrincipalID| to |PrincipalHandle| and fixes related media code of Gonk.
dom/media/DOMMediaStream.cpp
dom/media/DOMMediaStream.h
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -1342,26 +1342,26 @@ DOMAudioNodeMediaStream::CreateTrackUnio
 }
 
 DOMHwMediaStream::DOMHwMediaStream(nsPIDOMWindowInner* aWindow)
   : DOMLocalMediaStream(aWindow, nullptr)
 {
 #ifdef MOZ_WIDGET_GONK
   if (!mWindow) {
     NS_ERROR("Expected window here.");
-    mPrincipalHandle = PRINCIPAL_ID_NONE;
+    mPrincipalHandle = PRINCIPAL_HANDLE_NONE;
     return;
   }
-  nsIDocument* doc = mWindow->GetDoc();
+  nsIDocument* doc = mWindow->GetExtantDoc();
   if (!doc) {
     NS_ERROR("Expected document here.");
-    mPrincipalHandle = PRINCIPAL_ID_NONE;
+    mPrincipalHandle = PRINCIPAL_HANDLE_NONE;
     return;
   }
-  mPrincipalHandle = ConvertPrincipalToID(doc->GetPrincipal());
+  mPrincipalHandle = MakePrincipalHandle(doc->NodePrincipal());
 #endif
 }
 
 DOMHwMediaStream::~DOMHwMediaStream()
 {
 }
 
 already_AddRefed<DOMHwMediaStream>
@@ -1459,17 +1459,17 @@ DOMHwMediaStream::SetImageSize(uint32_t 
   track->GetSegment()->Clear();
 
   // Change the image size.
   const StreamTime delta = STREAM_TIME_MAX;
   RefPtr<Image> image = static_cast<Image*>(mOverlayImage.get());
   mozilla::gfx::IntSize size = image->GetSize();
   VideoSegment segment;
 
-  segment.AppendFrame(image.forget(), delta, size, PRINCIPAL_ID_NONE);
+  segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle);
   srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment);
 #endif
 }
 
 void
 DOMHwMediaStream::SetOverlayImage(OverlayImage* aImage)
 {
   if (!aImage) {
@@ -1495,17 +1495,17 @@ DOMHwMediaStream::SetOverlayImage(Overla
   track->GetSegment()->Clear();
 
   // Change the image size.
   const StreamTime delta = STREAM_TIME_MAX;
   RefPtr<Image> image = static_cast<Image*>(mOverlayImage.get());
   mozilla::gfx::IntSize size = image->GetSize();
   VideoSegment segment;
 
-  segment.AppendFrame(image.forget(), delta, size, PRINCIPAL_ID_NONE);
+  segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle);
   srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment);
 #endif
 }
 
 void
 DOMHwMediaStream::SetOverlayId(int32_t aOverlayId)
 {
 #ifdef MOZ_WIDGET_GONK
--- a/dom/media/DOMMediaStream.h
+++ b/dom/media/DOMMediaStream.h
@@ -791,15 +791,15 @@ protected:
 private:
   void Init(MediaStream* aStream, OverlayImage* aImage);
 
 #ifdef MOZ_WIDGET_GONK
   const int DEFAULT_IMAGE_ID = 0x01;
   const int DEFAULT_IMAGE_WIDTH = 400;
   const int DEFAULT_IMAGE_HEIGHT = 300;
   RefPtr<OverlayImage> mOverlayImage;
-  PrincipalID mPrincipalHandle;
+  PrincipalHandle mPrincipalHandle;
 #endif
 };
 
 } // namespace mozilla
 
 #endif /* NSDOMMEDIASTREAM_H_ */