Bug 1419581 - Part 3: Guard PresentationMediaPlayer windows with MOZ_NATIVE_DEVICES. r=jchen
authorNick Alexander <nalexander@mozilla.com>
Fri, 05 Jan 2018 11:35:00 -0800
changeset 453844 a7d75667c58ba0069bbb40ad688884a856660a60
parent 453843 2ea82ff4a757a0aeb7bdd8cff611d5b92dec14eb
child 453845 44bcb609e721598135a19bf41ba7ff94f3051553
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1419581
milestone59.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 1419581 - Part 3: Guard PresentationMediaPlayer windows with MOZ_NATIVE_DEVICES. r=jchen MozReview-Commit-ID: 3ZlVUMufn2g
widget/android/nsWindow.cpp
widget/android/nsWindow.h
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1134,16 +1134,17 @@ public:
            }
         }
     }
 };
 
 template<> const char
 nsWindow::NativePtr<nsWindow::LayerViewSupport>::sName[] = "LayerViewSupport";
 
+#ifdef MOZ_NATIVE_DEVICES
 /* PresentationMediaPlayerManager native calls access inner nsWindow functionality so PMPMSupport is a child class of nsWindow */
 class nsWindow::PMPMSupport final
     : public PresentationMediaPlayerManager::Natives<PMPMSupport>
 {
     PMPMSupport() = delete;
 
     static LayerViewSupport* GetLayerViewSupport(jni::Object::Param aSession)
     {
@@ -1218,16 +1219,17 @@ public:
             ANativeWindow_release(sWindow);
             sWindow = nullptr;
         }
     }
 };
 
 ANativeWindow* nsWindow::PMPMSupport::sWindow;
 EGLSurface nsWindow::PMPMSupport::sSurface;
+#endif
 
 
 nsWindow::GeckoViewSupport::~GeckoViewSupport()
 {
     // Disassociate our GeckoEditable instance with our native object.
     if (window.mEditableSupport) {
         window.mEditableSupport.Detach();
         window.mEditableParent = nullptr;
@@ -1385,19 +1387,21 @@ nsWindow::GeckoViewSupport::AttachEditab
 }
 
 void
 nsWindow::InitNatives()
 {
     nsWindow::GeckoViewSupport::Base::Init();
     nsWindow::LayerViewSupport::Init();
     nsWindow::NPZCSupport::Init();
+#ifdef MOZ_NATIVE_DEVICES
     if (jni::IsFennec()) {
         nsWindow::PMPMSupport::Init();
     }
+#endif
 
     GeckoEditableSupport::Init();
 }
 
 nsWindow*
 nsWindow::TopWindow()
 {
     if (!gTopLevelWindows.IsEmpty())
@@ -2069,33 +2073,37 @@ nsWindow::GetNativeData(uint32_t aDataTy
         }
 
         case NS_JAVA_SURFACE:
             if (NativePtr<LayerViewSupport>::Locked lvs{mLayerViewSupport}) {
                 return lvs->GetSurface().Get();
             }
             return nullptr;
 
+#ifdef MOZ_NATIVE_DEVICES
         case NS_PRESENTATION_WINDOW:
             return PMPMSupport::sWindow;
 
         case NS_PRESENTATION_SURFACE:
             return PMPMSupport::sSurface;
+#endif
     }
 
     return nullptr;
 }
 
 void
 nsWindow::SetNativeData(uint32_t aDataType, uintptr_t aVal)
 {
     switch (aDataType) {
+#ifdef MOZ_NATIVE_DEVICES
         case NS_PRESENTATION_SURFACE:
             PMPMSupport::sSurface = reinterpret_cast<EGLSurface>(aVal);
             break;
+#endif
     }
 }
 
 void
 nsWindow::DispatchHitTest(const WidgetTouchEvent& aEvent)
 {
     if (aEvent.mMessage == eTouchStart && aEvent.mTouches.Length() == 1) {
         // Since touch events don't get retargeted by PositionedEventTargeting.cpp
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -188,18 +188,20 @@ private:
 
     class GeckoViewSupport;
     // Object that implements native GeckoView calls and associated states.
     // nullptr for nsWindows that were not opened from GeckoView.
     // Because other objects get destroyed in the mGeckOViewSupport destructor,
     // keep it last in the list, so its destructor is called first.
     mozilla::UniquePtr<GeckoViewSupport> mGeckoViewSupport;
 
+#ifdef MOZ_NATIVE_DEVICES
     // Class that implements native PresentationMediaPlayerManager calls.
     class PMPMSupport;
+#endif
 
     mozilla::Atomic<bool, mozilla::ReleaseAcquire> mContentDocumentDisplayed;
 
 public:
     static nsWindow* TopWindow();
 
     static mozilla::Modifiers GetModifiers(int32_t aMetaState);
     static mozilla::TimeStamp GetEventTimeStamp(int64_t aEventTime);