Bug 1419581 - Part 3: Guard PresentationMediaPlayer windows with MOZ_NATIVE_DEVICES. r=jchen
☠☠ backed out by a6a0d6dc6548 ☠ ☠
authorNick Alexander <nalexander@mozilla.com>
Fri, 05 Jan 2018 11:35:00 -0800
changeset 453813 d0eba5853ab6102049d1abcbb9fc863848a6b86b
parent 453812 bc4cda1cc57cf032ac373911a372f45d1c6d4da8
child 453814 8d0855cb17b7168aed64780b1fb127a5ac416661
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
@@ -1131,16 +1131,17 @@ public:
            aPixels->CopyTo(mem.get<int32_t>(), mem.Size<int32_t>());
            if (!child->ToolbarPixelsToCompositor(mem, ScreenIntSize(aWidth, aHeight))) {
                child->DeallocPixelBuffer(mem);
            }
         }
     }
 };
 
+#ifdef MOZ_NATIVE_DEVICES
 template<> const char
 nsWindow::NativePtr<nsWindow::LayerViewSupport>::sName[] = "LayerViewSupport";
 
 /* 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;
@@ -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);