Bug 1419581 - Part 3: Guard PresentationMediaPlayer windows with MOZ_NATIVE_DEVICES. r=jchen

MozReview-Commit-ID: 3ZlVUMufn2g

--HG--
extra : rebase_source : e88c8b84c990574cb6b6f78ed629e7050f3807e9
extra : intermediate-source : c71bc2d65fac7df474a08e9f2c0dc7ad4e3b0bc4
extra : source : a7d75667c58ba0069bbb40ad688884a856660a60
This commit is contained in:
Nick Alexander 2018-01-05 11:35:00 -08:00
parent d9a68adc61
commit 5f1e6bc10e
2 changed files with 10 additions and 0 deletions

View File

@ -1139,6 +1139,7 @@ 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>
@ -1223,6 +1224,7 @@ public:
ANativeWindow* nsWindow::PMPMSupport::sWindow;
EGLSurface nsWindow::PMPMSupport::sSurface;
#endif
nsWindow::GeckoViewSupport::~GeckoViewSupport()
@ -1390,9 +1392,11 @@ 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();
}
@ -2074,11 +2078,13 @@ nsWindow::GetNativeData(uint32_t aDataType)
}
return nullptr;
#ifdef MOZ_NATIVE_DEVICES
case NS_PRESENTATION_WINDOW:
return PMPMSupport::sWindow;
case NS_PRESENTATION_SURFACE:
return PMPMSupport::sSurface;
#endif
}
return nullptr;
@ -2088,9 +2094,11 @@ 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
}
}

View File

@ -193,8 +193,10 @@ private:
// 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;