diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /widget/android/fennec | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'widget/android/fennec')
-rw-r--r-- | widget/android/fennec/FennecJNINatives.h | 244 | ||||
-rw-r--r-- | widget/android/fennec/FennecJNIWrappers.cpp | 443 | ||||
-rw-r--r-- | widget/android/fennec/FennecJNIWrappers.h | 1469 | ||||
-rw-r--r-- | widget/android/fennec/MemoryMonitor.h | 27 | ||||
-rw-r--r-- | widget/android/fennec/Telemetry.h | 100 | ||||
-rw-r--r-- | widget/android/fennec/ThumbnailHelper.h | 302 | ||||
-rw-r--r-- | widget/android/fennec/moz.build | 21 |
7 files changed, 2606 insertions, 0 deletions
diff --git a/widget/android/fennec/FennecJNINatives.h b/widget/android/fennec/FennecJNINatives.h new file mode 100644 index 000000000..9d0cdd77c --- /dev/null +++ b/widget/android/fennec/FennecJNINatives.h @@ -0,0 +1,244 @@ +// GENERATED CODE +// Generated by the Java program at /build/annotationProcessors at compile time +// from annotations on Java methods. To update, change the annotations on the +// corresponding Java methods and rerun the build. Manually updating this file +// will cause your build to fail. + +#ifndef FennecJNINatives_h +#define FennecJNINatives_h + +#include "FennecJNIWrappers.h" +#include "mozilla/jni/Natives.h" + +namespace mozilla { +namespace java { + +template<class Impl> +class ANRReporter::Natives : public mozilla::jni::NativeImpl<ANRReporter, Impl> +{ +public: + static const JNINativeMethod methods[3]; +}; + +template<class Impl> +const JNINativeMethod ANRReporter::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<ANRReporter::GetNativeStack_t>( + mozilla::jni::NativeStub<ANRReporter::GetNativeStack_t, Impl> + ::template Wrap<&Impl::GetNativeStack>), + + mozilla::jni::MakeNativeMethod<ANRReporter::ReleaseNativeStack_t>( + mozilla::jni::NativeStub<ANRReporter::ReleaseNativeStack_t, Impl> + ::template Wrap<&Impl::ReleaseNativeStack>), + + mozilla::jni::MakeNativeMethod<ANRReporter::RequestNativeStack_t>( + mozilla::jni::NativeStub<ANRReporter::RequestNativeStack_t, Impl> + ::template Wrap<&Impl::RequestNativeStack>) +}; + +template<class Impl> +class GeckoJavaSampler::Natives : public mozilla::jni::NativeImpl<GeckoJavaSampler, Impl> +{ +public: + static const JNINativeMethod methods[1]; +}; + +template<class Impl> +const JNINativeMethod GeckoJavaSampler::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<GeckoJavaSampler::GetProfilerTime_t>( + mozilla::jni::NativeStub<GeckoJavaSampler::GetProfilerTime_t, Impl> + ::template Wrap<&Impl::GetProfilerTime>) +}; + +template<class Impl> +class MemoryMonitor::Natives : public mozilla::jni::NativeImpl<MemoryMonitor, Impl> +{ +public: + static const JNINativeMethod methods[1]; +}; + +template<class Impl> +const JNINativeMethod MemoryMonitor::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<MemoryMonitor::DispatchMemoryPressure_t>( + mozilla::jni::NativeStub<MemoryMonitor::DispatchMemoryPressure_t, Impl> + ::template Wrap<&Impl::DispatchMemoryPressure>) +}; + +template<class Impl> +class PresentationMediaPlayerManager::Natives : public mozilla::jni::NativeImpl<PresentationMediaPlayerManager, Impl> +{ +public: + static const JNINativeMethod methods[3]; +}; + +template<class Impl> +const JNINativeMethod PresentationMediaPlayerManager::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<PresentationMediaPlayerManager::AddPresentationSurface_t>( + mozilla::jni::NativeStub<PresentationMediaPlayerManager::AddPresentationSurface_t, Impl> + ::template Wrap<&Impl::AddPresentationSurface>), + + mozilla::jni::MakeNativeMethod<PresentationMediaPlayerManager::InvalidateAndScheduleComposite_t>( + mozilla::jni::NativeStub<PresentationMediaPlayerManager::InvalidateAndScheduleComposite_t, Impl> + ::template Wrap<&Impl::InvalidateAndScheduleComposite>), + + mozilla::jni::MakeNativeMethod<PresentationMediaPlayerManager::RemovePresentationSurface_t>( + mozilla::jni::NativeStub<PresentationMediaPlayerManager::RemovePresentationSurface_t, Impl> + ::template Wrap<&Impl::RemovePresentationSurface>) +}; + +template<class Impl> +class ScreenManagerHelper::Natives : public mozilla::jni::NativeImpl<ScreenManagerHelper, Impl> +{ +public: + static const JNINativeMethod methods[2]; +}; + +template<class Impl> +const JNINativeMethod ScreenManagerHelper::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<ScreenManagerHelper::AddDisplay_t>( + mozilla::jni::NativeStub<ScreenManagerHelper::AddDisplay_t, Impl> + ::template Wrap<&Impl::AddDisplay>), + + mozilla::jni::MakeNativeMethod<ScreenManagerHelper::RemoveDisplay_t>( + mozilla::jni::NativeStub<ScreenManagerHelper::RemoveDisplay_t, Impl> + ::template Wrap<&Impl::RemoveDisplay>) +}; + +template<class Impl> +class Telemetry::Natives : public mozilla::jni::NativeImpl<Telemetry, Impl> +{ +public: + static const JNINativeMethod methods[5]; +}; + +template<class Impl> +const JNINativeMethod Telemetry::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<Telemetry::AddHistogram_t>( + mozilla::jni::NativeStub<Telemetry::AddHistogram_t, Impl> + ::template Wrap<&Impl::AddHistogram>), + + mozilla::jni::MakeNativeMethod<Telemetry::AddKeyedHistogram_t>( + mozilla::jni::NativeStub<Telemetry::AddKeyedHistogram_t, Impl> + ::template Wrap<&Impl::AddKeyedHistogram>), + + mozilla::jni::MakeNativeMethod<Telemetry::AddUIEvent_t>( + mozilla::jni::NativeStub<Telemetry::AddUIEvent_t, Impl> + ::template Wrap<&Impl::AddUIEvent>), + + mozilla::jni::MakeNativeMethod<Telemetry::StartUISession_t>( + mozilla::jni::NativeStub<Telemetry::StartUISession_t, Impl> + ::template Wrap<&Impl::StartUISession>), + + mozilla::jni::MakeNativeMethod<Telemetry::StopUISession_t>( + mozilla::jni::NativeStub<Telemetry::StopUISession_t, Impl> + ::template Wrap<&Impl::StopUISession>) +}; + +template<class Impl> +class ThumbnailHelper::Natives : public mozilla::jni::NativeImpl<ThumbnailHelper, Impl> +{ +public: + static const JNINativeMethod methods[1]; +}; + +template<class Impl> +const JNINativeMethod ThumbnailHelper::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<ThumbnailHelper::RequestThumbnail_t>( + mozilla::jni::NativeStub<ThumbnailHelper::RequestThumbnail_t, Impl> + ::template Wrap<&Impl::RequestThumbnail>) +}; + +template<class Impl> +class ZoomedView::Natives : public mozilla::jni::NativeImpl<ZoomedView, Impl> +{ +public: + static const JNINativeMethod methods[1]; +}; + +template<class Impl> +const JNINativeMethod ZoomedView::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<ZoomedView::RequestZoomedViewData_t>( + mozilla::jni::NativeStub<ZoomedView::RequestZoomedViewData_t, Impl> + ::template Wrap<&Impl::RequestZoomedViewData>) +}; + +template<class Impl> +class CodecProxy::NativeCallbacks::Natives : public mozilla::jni::NativeImpl<NativeCallbacks, Impl> +{ +public: + static const JNINativeMethod methods[5]; +}; + +template<class Impl> +const JNINativeMethod CodecProxy::NativeCallbacks::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<CodecProxy::NativeCallbacks::DisposeNative_t>( + mozilla::jni::NativeStub<CodecProxy::NativeCallbacks::DisposeNative_t, Impl> + ::template Wrap<&Impl::DisposeNative>), + + mozilla::jni::MakeNativeMethod<CodecProxy::NativeCallbacks::OnError_t>( + mozilla::jni::NativeStub<CodecProxy::NativeCallbacks::OnError_t, Impl> + ::template Wrap<&Impl::OnError>), + + mozilla::jni::MakeNativeMethod<CodecProxy::NativeCallbacks::OnInputExhausted_t>( + mozilla::jni::NativeStub<CodecProxy::NativeCallbacks::OnInputExhausted_t, Impl> + ::template Wrap<&Impl::OnInputExhausted>), + + mozilla::jni::MakeNativeMethod<CodecProxy::NativeCallbacks::OnOutput_t>( + mozilla::jni::NativeStub<CodecProxy::NativeCallbacks::OnOutput_t, Impl> + ::template Wrap<&Impl::OnOutput>), + + mozilla::jni::MakeNativeMethod<CodecProxy::NativeCallbacks::OnOutputFormatChanged_t>( + mozilla::jni::NativeStub<CodecProxy::NativeCallbacks::OnOutputFormatChanged_t, Impl> + ::template Wrap<&Impl::OnOutputFormatChanged>) +}; + +template<class Impl> +class MediaDrmProxy::NativeMediaDrmProxyCallbacks::Natives : public mozilla::jni::NativeImpl<NativeMediaDrmProxyCallbacks, Impl> +{ +public: + static const JNINativeMethod methods[7]; +}; + +template<class Impl> +const JNINativeMethod MediaDrmProxy::NativeMediaDrmProxyCallbacks::Natives<Impl>::methods[] = { + + mozilla::jni::MakeNativeMethod<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnRejectPromise_t>( + mozilla::jni::NativeStub<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnRejectPromise_t, Impl> + ::template Wrap<&Impl::OnRejectPromise>), + + mozilla::jni::MakeNativeMethod<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionBatchedKeyChanged_t>( + mozilla::jni::NativeStub<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionBatchedKeyChanged_t, Impl> + ::template Wrap<&Impl::OnSessionBatchedKeyChanged>), + + mozilla::jni::MakeNativeMethod<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionClosed_t>( + mozilla::jni::NativeStub<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionClosed_t, Impl> + ::template Wrap<&Impl::OnSessionClosed>), + + mozilla::jni::MakeNativeMethod<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionCreated_t>( + mozilla::jni::NativeStub<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionCreated_t, Impl> + ::template Wrap<&Impl::OnSessionCreated>), + + mozilla::jni::MakeNativeMethod<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionError_t>( + mozilla::jni::NativeStub<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionError_t, Impl> + ::template Wrap<&Impl::OnSessionError>), + + mozilla::jni::MakeNativeMethod<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionMessage_t>( + mozilla::jni::NativeStub<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionMessage_t, Impl> + ::template Wrap<&Impl::OnSessionMessage>), + + mozilla::jni::MakeNativeMethod<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionUpdated_t>( + mozilla::jni::NativeStub<MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionUpdated_t, Impl> + ::template Wrap<&Impl::OnSessionUpdated>) +}; + +} /* java */ +} /* mozilla */ +#endif // FennecJNINatives_h diff --git a/widget/android/fennec/FennecJNIWrappers.cpp b/widget/android/fennec/FennecJNIWrappers.cpp new file mode 100644 index 000000000..f8be6833b --- /dev/null +++ b/widget/android/fennec/FennecJNIWrappers.cpp @@ -0,0 +1,443 @@ +// GENERATED CODE +// Generated by the Java program at /build/annotationProcessors at compile time +// from annotations on Java methods. To update, change the annotations on the +// corresponding Java methods and rerun the build. Manually updating this file +// will cause your build to fail. + +#include "FennecJNIWrappers.h" +#include "mozilla/jni/Accessors.h" + +namespace mozilla { +namespace java { + +const char ANRReporter::name[] = + "org/mozilla/gecko/ANRReporter"; + +constexpr char ANRReporter::GetNativeStack_t::name[]; +constexpr char ANRReporter::GetNativeStack_t::signature[]; + +constexpr char ANRReporter::ReleaseNativeStack_t::name[]; +constexpr char ANRReporter::ReleaseNativeStack_t::signature[]; + +constexpr char ANRReporter::RequestNativeStack_t::name[]; +constexpr char ANRReporter::RequestNativeStack_t::signature[]; + +const char DownloadsIntegration::name[] = + "org/mozilla/gecko/DownloadsIntegration"; + +constexpr char DownloadsIntegration::GetTemporaryDownloadDirectory_t::name[]; +constexpr char DownloadsIntegration::GetTemporaryDownloadDirectory_t::signature[]; + +auto DownloadsIntegration::GetTemporaryDownloadDirectory() -> mozilla::jni::String::LocalRef +{ + return mozilla::jni::Method<GetTemporaryDownloadDirectory_t>::Call(DownloadsIntegration::Context(), nullptr); +} + +constexpr char DownloadsIntegration::ScanMedia_t::name[]; +constexpr char DownloadsIntegration::ScanMedia_t::signature[]; + +auto DownloadsIntegration::ScanMedia(mozilla::jni::String::Param a0, mozilla::jni::String::Param a1) -> void +{ + return mozilla::jni::Method<ScanMedia_t>::Call(DownloadsIntegration::Context(), nullptr, a0, a1); +} + +const char GeckoJavaSampler::name[] = + "org/mozilla/gecko/GeckoJavaSampler"; + +constexpr char GeckoJavaSampler::GetFrameName_t::name[]; +constexpr char GeckoJavaSampler::GetFrameName_t::signature[]; + +auto GeckoJavaSampler::GetFrameName(int32_t a0, int32_t a1, int32_t a2) -> mozilla::jni::String::LocalRef +{ + return mozilla::jni::Method<GetFrameName_t>::Call(GeckoJavaSampler::Context(), nullptr, a0, a1, a2); +} + +constexpr char GeckoJavaSampler::GetProfilerTime_t::name[]; +constexpr char GeckoJavaSampler::GetProfilerTime_t::signature[]; + +constexpr char GeckoJavaSampler::GetSampleTime_t::name[]; +constexpr char GeckoJavaSampler::GetSampleTime_t::signature[]; + +auto GeckoJavaSampler::GetSampleTime(int32_t a0, int32_t a1) -> double +{ + return mozilla::jni::Method<GetSampleTime_t>::Call(GeckoJavaSampler::Context(), nullptr, a0, a1); +} + +constexpr char GeckoJavaSampler::GetThreadName_t::name[]; +constexpr char GeckoJavaSampler::GetThreadName_t::signature[]; + +auto GeckoJavaSampler::GetThreadName(int32_t a0) -> mozilla::jni::String::LocalRef +{ + return mozilla::jni::Method<GetThreadName_t>::Call(GeckoJavaSampler::Context(), nullptr, a0); +} + +constexpr char GeckoJavaSampler::Pause_t::name[]; +constexpr char GeckoJavaSampler::Pause_t::signature[]; + +auto GeckoJavaSampler::Pause() -> void +{ + return mozilla::jni::Method<Pause_t>::Call(GeckoJavaSampler::Context(), nullptr); +} + +constexpr char GeckoJavaSampler::Start_t::name[]; +constexpr char GeckoJavaSampler::Start_t::signature[]; + +auto GeckoJavaSampler::Start(int32_t a0, int32_t a1) -> void +{ + return mozilla::jni::Method<Start_t>::Call(GeckoJavaSampler::Context(), nullptr, a0, a1); +} + +constexpr char GeckoJavaSampler::Stop_t::name[]; +constexpr char GeckoJavaSampler::Stop_t::signature[]; + +auto GeckoJavaSampler::Stop() -> void +{ + return mozilla::jni::Method<Stop_t>::Call(GeckoJavaSampler::Context(), nullptr); +} + +constexpr char GeckoJavaSampler::Unpause_t::name[]; +constexpr char GeckoJavaSampler::Unpause_t::signature[]; + +auto GeckoJavaSampler::Unpause() -> void +{ + return mozilla::jni::Method<Unpause_t>::Call(GeckoJavaSampler::Context(), nullptr); +} + +const char MemoryMonitor::name[] = + "org/mozilla/gecko/MemoryMonitor"; + +constexpr char MemoryMonitor::DispatchMemoryPressure_t::name[]; +constexpr char MemoryMonitor::DispatchMemoryPressure_t::signature[]; + +const char PresentationMediaPlayerManager::name[] = + "org/mozilla/gecko/PresentationMediaPlayerManager"; + +constexpr char PresentationMediaPlayerManager::AddPresentationSurface_t::name[]; +constexpr char PresentationMediaPlayerManager::AddPresentationSurface_t::signature[]; + +constexpr char PresentationMediaPlayerManager::InvalidateAndScheduleComposite_t::name[]; +constexpr char PresentationMediaPlayerManager::InvalidateAndScheduleComposite_t::signature[]; + +constexpr char PresentationMediaPlayerManager::RemovePresentationSurface_t::name[]; +constexpr char PresentationMediaPlayerManager::RemovePresentationSurface_t::signature[]; + +const char ScreenManagerHelper::name[] = + "org/mozilla/gecko/ScreenManagerHelper"; + +constexpr char ScreenManagerHelper::AddDisplay_t::name[]; +constexpr char ScreenManagerHelper::AddDisplay_t::signature[]; + +constexpr char ScreenManagerHelper::RemoveDisplay_t::name[]; +constexpr char ScreenManagerHelper::RemoveDisplay_t::signature[]; + +const char Telemetry::name[] = + "org/mozilla/gecko/Telemetry"; + +constexpr char Telemetry::AddHistogram_t::name[]; +constexpr char Telemetry::AddHistogram_t::signature[]; + +constexpr char Telemetry::AddKeyedHistogram_t::name[]; +constexpr char Telemetry::AddKeyedHistogram_t::signature[]; + +constexpr char Telemetry::AddUIEvent_t::name[]; +constexpr char Telemetry::AddUIEvent_t::signature[]; + +constexpr char Telemetry::StartUISession_t::name[]; +constexpr char Telemetry::StartUISession_t::signature[]; + +constexpr char Telemetry::StopUISession_t::name[]; +constexpr char Telemetry::StopUISession_t::signature[]; + +const char ThumbnailHelper::name[] = + "org/mozilla/gecko/ThumbnailHelper"; + +constexpr char ThumbnailHelper::NotifyThumbnail_t::name[]; +constexpr char ThumbnailHelper::NotifyThumbnail_t::signature[]; + +auto ThumbnailHelper::NotifyThumbnail(mozilla::jni::ByteBuffer::Param a0, mozilla::jni::Object::Param a1, bool a2, bool a3) -> void +{ + return mozilla::jni::Method<NotifyThumbnail_t>::Call(ThumbnailHelper::Context(), nullptr, a0, a1, a2, a3); +} + +constexpr char ThumbnailHelper::RequestThumbnail_t::name[]; +constexpr char ThumbnailHelper::RequestThumbnail_t::signature[]; + +const char ZoomedView::name[] = + "org/mozilla/gecko/ZoomedView"; + +constexpr char ZoomedView::RequestZoomedViewData_t::name[]; +constexpr char ZoomedView::RequestZoomedViewData_t::signature[]; + +const char AudioFocusAgent::name[] = + "org/mozilla/gecko/media/AudioFocusAgent"; + +constexpr char AudioFocusAgent::NotifyStartedPlaying_t::name[]; +constexpr char AudioFocusAgent::NotifyStartedPlaying_t::signature[]; + +auto AudioFocusAgent::NotifyStartedPlaying() -> void +{ + return mozilla::jni::Method<NotifyStartedPlaying_t>::Call(AudioFocusAgent::Context(), nullptr); +} + +constexpr char AudioFocusAgent::NotifyStoppedPlaying_t::name[]; +constexpr char AudioFocusAgent::NotifyStoppedPlaying_t::signature[]; + +auto AudioFocusAgent::NotifyStoppedPlaying() -> void +{ + return mozilla::jni::Method<NotifyStoppedPlaying_t>::Call(AudioFocusAgent::Context(), nullptr); +} + +const char CodecProxy::name[] = + "org/mozilla/gecko/media/CodecProxy"; + +constexpr char CodecProxy::Create_t::name[]; +constexpr char CodecProxy::Create_t::signature[]; + +auto CodecProxy::Create(mozilla::jni::Object::Param a0, mozilla::jni::Object::Param a1, mozilla::jni::Object::Param a2) -> CodecProxy::LocalRef +{ + return mozilla::jni::Method<Create_t>::Call(CodecProxy::Context(), nullptr, a0, a1, a2); +} + +constexpr char CodecProxy::Flush_t::name[]; +constexpr char CodecProxy::Flush_t::signature[]; + +auto CodecProxy::Flush() const -> bool +{ + return mozilla::jni::Method<Flush_t>::Call(CodecProxy::mCtx, nullptr); +} + +constexpr char CodecProxy::Input_t::name[]; +constexpr char CodecProxy::Input_t::signature[]; + +auto CodecProxy::Input(mozilla::jni::ByteBuffer::Param a0, mozilla::jni::Object::Param a1, mozilla::jni::Object::Param a2) const -> bool +{ + return mozilla::jni::Method<Input_t>::Call(CodecProxy::mCtx, nullptr, a0, a1, a2); +} + +constexpr char CodecProxy::Release_t::name[]; +constexpr char CodecProxy::Release_t::signature[]; + +auto CodecProxy::Release() const -> bool +{ + return mozilla::jni::Method<Release_t>::Call(CodecProxy::mCtx, nullptr); +} + +const char CodecProxy::NativeCallbacks::name[] = + "org/mozilla/gecko/media/CodecProxy$NativeCallbacks"; + +constexpr char CodecProxy::NativeCallbacks::New_t::name[]; +constexpr char CodecProxy::NativeCallbacks::New_t::signature[]; + +auto CodecProxy::NativeCallbacks::New() -> NativeCallbacks::LocalRef +{ + return mozilla::jni::Constructor<New_t>::Call(NativeCallbacks::Context(), nullptr); +} + +constexpr char CodecProxy::NativeCallbacks::DisposeNative_t::name[]; +constexpr char CodecProxy::NativeCallbacks::DisposeNative_t::signature[]; + +constexpr char CodecProxy::NativeCallbacks::OnError_t::name[]; +constexpr char CodecProxy::NativeCallbacks::OnError_t::signature[]; + +constexpr char CodecProxy::NativeCallbacks::OnInputExhausted_t::name[]; +constexpr char CodecProxy::NativeCallbacks::OnInputExhausted_t::signature[]; + +constexpr char CodecProxy::NativeCallbacks::OnOutput_t::name[]; +constexpr char CodecProxy::NativeCallbacks::OnOutput_t::signature[]; + +constexpr char CodecProxy::NativeCallbacks::OnOutputFormatChanged_t::name[]; +constexpr char CodecProxy::NativeCallbacks::OnOutputFormatChanged_t::signature[]; + +const char MediaDrmProxy::name[] = + "org/mozilla/gecko/media/MediaDrmProxy"; + +constexpr char MediaDrmProxy::CanDecode_t::name[]; +constexpr char MediaDrmProxy::CanDecode_t::signature[]; + +auto MediaDrmProxy::CanDecode(mozilla::jni::String::Param a0) -> bool +{ + return mozilla::jni::Method<CanDecode_t>::Call(MediaDrmProxy::Context(), nullptr, a0); +} + +constexpr char MediaDrmProxy::IsCryptoSchemeSupported_t::name[]; +constexpr char MediaDrmProxy::IsCryptoSchemeSupported_t::signature[]; + +auto MediaDrmProxy::IsCryptoSchemeSupported(mozilla::jni::String::Param a0, mozilla::jni::String::Param a1) -> bool +{ + return mozilla::jni::Method<IsCryptoSchemeSupported_t>::Call(MediaDrmProxy::Context(), nullptr, a0, a1); +} + +constexpr char MediaDrmProxy::CloseSession_t::name[]; +constexpr char MediaDrmProxy::CloseSession_t::signature[]; + +auto MediaDrmProxy::CloseSession(int32_t a0, mozilla::jni::String::Param a1) const -> void +{ + return mozilla::jni::Method<CloseSession_t>::Call(MediaDrmProxy::mCtx, nullptr, a0, a1); +} + +constexpr char MediaDrmProxy::Create_t::name[]; +constexpr char MediaDrmProxy::Create_t::signature[]; + +auto MediaDrmProxy::Create(mozilla::jni::String::Param a0, mozilla::jni::Object::Param a1, bool a2) -> MediaDrmProxy::LocalRef +{ + return mozilla::jni::Method<Create_t>::Call(MediaDrmProxy::Context(), nullptr, a0, a1, a2); +} + +constexpr char MediaDrmProxy::CreateSession_t::name[]; +constexpr char MediaDrmProxy::CreateSession_t::signature[]; + +auto MediaDrmProxy::CreateSession(int32_t a0, int32_t a1, mozilla::jni::String::Param a2, mozilla::jni::ByteArray::Param a3) const -> void +{ + return mozilla::jni::Method<CreateSession_t>::Call(MediaDrmProxy::mCtx, nullptr, a0, a1, a2, a3); +} + +constexpr char MediaDrmProxy::Destroy_t::name[]; +constexpr char MediaDrmProxy::Destroy_t::signature[]; + +auto MediaDrmProxy::Destroy() const -> void +{ + return mozilla::jni::Method<Destroy_t>::Call(MediaDrmProxy::mCtx, nullptr); +} + +constexpr char MediaDrmProxy::IsSchemeSupported_t::name[]; +constexpr char MediaDrmProxy::IsSchemeSupported_t::signature[]; + +auto MediaDrmProxy::IsSchemeSupported(mozilla::jni::String::Param a0) -> bool +{ + return mozilla::jni::Method<IsSchemeSupported_t>::Call(MediaDrmProxy::Context(), nullptr, a0); +} + +constexpr char MediaDrmProxy::UpdateSession_t::name[]; +constexpr char MediaDrmProxy::UpdateSession_t::signature[]; + +auto MediaDrmProxy::UpdateSession(int32_t a0, mozilla::jni::String::Param a1, mozilla::jni::ByteArray::Param a2) const -> void +{ + return mozilla::jni::Method<UpdateSession_t>::Call(MediaDrmProxy::mCtx, nullptr, a0, a1, a2); +} + +const char16_t MediaDrmProxy::AAC[] = u"audio/mp4a-latm"; + +const char16_t MediaDrmProxy::AVC[] = u"video/avc"; + +const char16_t MediaDrmProxy::OPUS[] = u"audio/opus"; + +const char16_t MediaDrmProxy::VORBIS[] = u"audio/vorbis"; + +const char16_t MediaDrmProxy::VP8[] = u"video/x-vnd.on2.vp8"; + +const char16_t MediaDrmProxy::VP9[] = u"video/x-vnd.on2.vp9"; + +const char MediaDrmProxy::NativeMediaDrmProxyCallbacks::name[] = + "org/mozilla/gecko/media/MediaDrmProxy$NativeMediaDrmProxyCallbacks"; + +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::New_t::name[]; +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::New_t::signature[]; + +auto MediaDrmProxy::NativeMediaDrmProxyCallbacks::New() -> NativeMediaDrmProxyCallbacks::LocalRef +{ + return mozilla::jni::Constructor<New_t>::Call(NativeMediaDrmProxyCallbacks::Context(), nullptr); +} + +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnRejectPromise_t::name[]; +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnRejectPromise_t::signature[]; + +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionBatchedKeyChanged_t::name[]; +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionBatchedKeyChanged_t::signature[]; + +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionClosed_t::name[]; +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionClosed_t::signature[]; + +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionCreated_t::name[]; +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionCreated_t::signature[]; + +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionError_t::name[]; +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionError_t::signature[]; + +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionMessage_t::name[]; +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionMessage_t::signature[]; + +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionUpdated_t::name[]; +constexpr char MediaDrmProxy::NativeMediaDrmProxyCallbacks::OnSessionUpdated_t::signature[]; + +const char Sample::name[] = + "org/mozilla/gecko/media/Sample"; + +constexpr char Sample::WriteToByteBuffer_t::name[]; +constexpr char Sample::WriteToByteBuffer_t::signature[]; + +auto Sample::WriteToByteBuffer(mozilla::jni::ByteBuffer::Param a0) const -> void +{ + return mozilla::jni::Method<WriteToByteBuffer_t>::Call(Sample::mCtx, nullptr, a0); +} + +constexpr char Sample::Info_t::name[]; +constexpr char Sample::Info_t::signature[]; + +auto Sample::Info() const -> mozilla::jni::Object::LocalRef +{ + return mozilla::jni::Field<Info_t>::Get(Sample::mCtx, nullptr); +} + +auto Sample::Info(mozilla::jni::Object::Param a0) const -> void +{ + return mozilla::jni::Field<Info_t>::Set(Sample::mCtx, nullptr, a0); +} + +const char SessionKeyInfo::name[] = + "org/mozilla/gecko/media/SessionKeyInfo"; + +constexpr char SessionKeyInfo::New_t::name[]; +constexpr char SessionKeyInfo::New_t::signature[]; + +auto SessionKeyInfo::New(mozilla::jni::ByteArray::Param a0, int32_t a1) -> SessionKeyInfo::LocalRef +{ + return mozilla::jni::Constructor<New_t>::Call(SessionKeyInfo::Context(), nullptr, a0, a1); +} + +constexpr char SessionKeyInfo::KeyId_t::name[]; +constexpr char SessionKeyInfo::KeyId_t::signature[]; + +auto SessionKeyInfo::KeyId() const -> mozilla::jni::ByteArray::LocalRef +{ + return mozilla::jni::Field<KeyId_t>::Get(SessionKeyInfo::mCtx, nullptr); +} + +auto SessionKeyInfo::KeyId(mozilla::jni::ByteArray::Param a0) const -> void +{ + return mozilla::jni::Field<KeyId_t>::Set(SessionKeyInfo::mCtx, nullptr, a0); +} + +constexpr char SessionKeyInfo::Status_t::name[]; +constexpr char SessionKeyInfo::Status_t::signature[]; + +auto SessionKeyInfo::Status() const -> int32_t +{ + return mozilla::jni::Field<Status_t>::Get(SessionKeyInfo::mCtx, nullptr); +} + +auto SessionKeyInfo::Status(int32_t a0) const -> void +{ + return mozilla::jni::Field<Status_t>::Set(SessionKeyInfo::mCtx, nullptr, a0); +} + +const char Restrictions::name[] = + "org/mozilla/gecko/restrictions/Restrictions"; + +constexpr char Restrictions::IsAllowed_t::name[]; +constexpr char Restrictions::IsAllowed_t::signature[]; + +auto Restrictions::IsAllowed(int32_t a0, mozilla::jni::String::Param a1) -> bool +{ + return mozilla::jni::Method<IsAllowed_t>::Call(Restrictions::Context(), nullptr, a0, a1); +} + +constexpr char Restrictions::IsUserRestricted_t::name[]; +constexpr char Restrictions::IsUserRestricted_t::signature[]; + +auto Restrictions::IsUserRestricted() -> bool +{ + return mozilla::jni::Method<IsUserRestricted_t>::Call(Restrictions::Context(), nullptr); +} + +} /* java */ +} /* mozilla */ diff --git a/widget/android/fennec/FennecJNIWrappers.h b/widget/android/fennec/FennecJNIWrappers.h new file mode 100644 index 000000000..bb94cd142 --- /dev/null +++ b/widget/android/fennec/FennecJNIWrappers.h @@ -0,0 +1,1469 @@ +// GENERATED CODE +// Generated by the Java program at /build/annotationProcessors at compile time +// from annotations on Java methods. To update, change the annotations on the +// corresponding Java methods and rerun the build. Manually updating this file +// will cause your build to fail. + +#ifndef FennecJNIWrappers_h +#define FennecJNIWrappers_h + +#include "mozilla/jni/Refs.h" + +namespace mozilla { +namespace java { + +class ANRReporter : public mozilla::jni::ObjectBase<ANRReporter> +{ +public: + static const char name[]; + + explicit ANRReporter(const Context& ctx) : ObjectBase<ANRReporter>(ctx) {} + + struct GetNativeStack_t { + typedef ANRReporter Owner; + typedef mozilla::jni::String::LocalRef ReturnType; + typedef mozilla::jni::String::Param SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "getNativeStack"; + static constexpr char signature[] = + "()Ljava/lang/String;"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct ReleaseNativeStack_t { + typedef ANRReporter Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "releaseNativeStack"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct RequestNativeStack_t { + typedef ANRReporter Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args< + bool> Args; + static constexpr char name[] = "requestNativeStack"; + static constexpr char signature[] = + "(Z)Z"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + + template<class Impl> class Natives; +}; + +class DownloadsIntegration : public mozilla::jni::ObjectBase<DownloadsIntegration> +{ +public: + static const char name[]; + + explicit DownloadsIntegration(const Context& ctx) : ObjectBase<DownloadsIntegration>(ctx) {} + + struct GetTemporaryDownloadDirectory_t { + typedef DownloadsIntegration Owner; + typedef mozilla::jni::String::LocalRef ReturnType; + typedef mozilla::jni::String::Param SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "getTemporaryDownloadDirectory"; + static constexpr char signature[] = + "()Ljava/lang/String;"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto GetTemporaryDownloadDirectory() -> mozilla::jni::String::LocalRef; + + struct ScanMedia_t { + typedef DownloadsIntegration Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + mozilla::jni::String::Param> Args; + static constexpr char name[] = "scanMedia"; + static constexpr char signature[] = + "(Ljava/lang/String;Ljava/lang/String;)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto ScanMedia(mozilla::jni::String::Param, mozilla::jni::String::Param) -> void; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + +}; + +class GeckoJavaSampler : public mozilla::jni::ObjectBase<GeckoJavaSampler> +{ +public: + static const char name[]; + + explicit GeckoJavaSampler(const Context& ctx) : ObjectBase<GeckoJavaSampler>(ctx) {} + + struct GetFrameName_t { + typedef GeckoJavaSampler Owner; + typedef mozilla::jni::String::LocalRef ReturnType; + typedef mozilla::jni::String::Param SetterType; + typedef mozilla::jni::Args< + int32_t, + int32_t, + int32_t> Args; + static constexpr char name[] = "getFrameName"; + static constexpr char signature[] = + "(III)Ljava/lang/String;"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto GetFrameName(int32_t, int32_t, int32_t) -> mozilla::jni::String::LocalRef; + + struct GetProfilerTime_t { + typedef GeckoJavaSampler Owner; + typedef double ReturnType; + typedef double SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "getProfilerTime"; + static constexpr char signature[] = + "()D"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct GetSampleTime_t { + typedef GeckoJavaSampler Owner; + typedef double ReturnType; + typedef double SetterType; + typedef mozilla::jni::Args< + int32_t, + int32_t> Args; + static constexpr char name[] = "getSampleTime"; + static constexpr char signature[] = + "(II)D"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto GetSampleTime(int32_t, int32_t) -> double; + + struct GetThreadName_t { + typedef GeckoJavaSampler Owner; + typedef mozilla::jni::String::LocalRef ReturnType; + typedef mozilla::jni::String::Param SetterType; + typedef mozilla::jni::Args< + int32_t> Args; + static constexpr char name[] = "getThreadName"; + static constexpr char signature[] = + "(I)Ljava/lang/String;"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto GetThreadName(int32_t) -> mozilla::jni::String::LocalRef; + + struct Pause_t { + typedef GeckoJavaSampler Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "pause"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto Pause() -> void; + + struct Start_t { + typedef GeckoJavaSampler Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t, + int32_t> Args; + static constexpr char name[] = "start"; + static constexpr char signature[] = + "(II)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto Start(int32_t, int32_t) -> void; + + struct Stop_t { + typedef GeckoJavaSampler Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "stop"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto Stop() -> void; + + struct Unpause_t { + typedef GeckoJavaSampler Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "unpause"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto Unpause() -> void; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + + template<class Impl> class Natives; +}; + +class MemoryMonitor : public mozilla::jni::ObjectBase<MemoryMonitor> +{ +public: + static const char name[]; + + explicit MemoryMonitor(const Context& ctx) : ObjectBase<MemoryMonitor>(ctx) {} + + struct DispatchMemoryPressure_t { + typedef MemoryMonitor Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "dispatchMemoryPressure"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::UI; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::UI; + + template<class Impl> class Natives; +}; + +class PresentationMediaPlayerManager : public mozilla::jni::ObjectBase<PresentationMediaPlayerManager> +{ +public: + static const char name[]; + + explicit PresentationMediaPlayerManager(const Context& ctx) : ObjectBase<PresentationMediaPlayerManager>(ctx) {} + + struct AddPresentationSurface_t { + typedef PresentationMediaPlayerManager Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::Object::Param, + mozilla::jni::Object::Param> Args; + static constexpr char name[] = "addPresentationSurface"; + static constexpr char signature[] = + "(Lorg/mozilla/gecko/GeckoView;Landroid/view/Surface;)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::UI; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct InvalidateAndScheduleComposite_t { + typedef PresentationMediaPlayerManager Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::Object::Param> Args; + static constexpr char name[] = "invalidateAndScheduleComposite"; + static constexpr char signature[] = + "(Lorg/mozilla/gecko/GeckoView;)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::UI; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct RemovePresentationSurface_t { + typedef PresentationMediaPlayerManager Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "removePresentationSurface"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::UI; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::UI; + + template<class Impl> class Natives; +}; + +class ScreenManagerHelper : public mozilla::jni::ObjectBase<ScreenManagerHelper> +{ +public: + static const char name[]; + + explicit ScreenManagerHelper(const Context& ctx) : ObjectBase<ScreenManagerHelper>(ctx) {} + + struct AddDisplay_t { + typedef ScreenManagerHelper Owner; + typedef int32_t ReturnType; + typedef int32_t SetterType; + typedef mozilla::jni::Args< + int32_t, + int32_t, + int32_t, + float> Args; + static constexpr char name[] = "addDisplay"; + static constexpr char signature[] = + "(IIIF)I"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct RemoveDisplay_t { + typedef ScreenManagerHelper Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t> Args; + static constexpr char name[] = "removeDisplay"; + static constexpr char signature[] = + "(I)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + + template<class Impl> class Natives; +}; + +class Telemetry : public mozilla::jni::ObjectBase<Telemetry> +{ +public: + static const char name[]; + + explicit Telemetry(const Context& ctx) : ObjectBase<Telemetry>(ctx) {} + + struct AddHistogram_t { + typedef Telemetry Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + int32_t> Args; + static constexpr char name[] = "nativeAddHistogram"; + static constexpr char signature[] = + "(Ljava/lang/String;I)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct AddKeyedHistogram_t { + typedef Telemetry Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + mozilla::jni::String::Param, + int32_t> Args; + static constexpr char name[] = "nativeAddKeyedHistogram"; + static constexpr char signature[] = + "(Ljava/lang/String;Ljava/lang/String;I)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct AddUIEvent_t { + typedef Telemetry Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + mozilla::jni::String::Param, + int64_t, + mozilla::jni::String::Param> Args; + static constexpr char name[] = "nativeAddUiEvent"; + static constexpr char signature[] = + "(Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct StartUISession_t { + typedef Telemetry Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + int64_t> Args; + static constexpr char name[] = "nativeStartUiSession"; + static constexpr char signature[] = + "(Ljava/lang/String;J)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct StopUISession_t { + typedef Telemetry Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + mozilla::jni::String::Param, + int64_t> Args; + static constexpr char name[] = "nativeStopUiSession"; + static constexpr char signature[] = + "(Ljava/lang/String;Ljava/lang/String;J)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + + template<class Impl> class Natives; +}; + +class ThumbnailHelper : public mozilla::jni::ObjectBase<ThumbnailHelper> +{ +public: + static const char name[]; + + explicit ThumbnailHelper(const Context& ctx) : ObjectBase<ThumbnailHelper>(ctx) {} + + struct NotifyThumbnail_t { + typedef ThumbnailHelper Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteBuffer::Param, + mozilla::jni::Object::Param, + bool, + bool> Args; + static constexpr char name[] = "notifyThumbnail"; + static constexpr char signature[] = + "(Ljava/nio/ByteBuffer;Lorg/mozilla/gecko/Tab;ZZ)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto NotifyThumbnail(mozilla::jni::ByteBuffer::Param, mozilla::jni::Object::Param, bool, bool) -> void; + + struct RequestThumbnail_t { + typedef ThumbnailHelper Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteBuffer::Param, + mozilla::jni::Object::Param, + int32_t, + int32_t, + int32_t> Args; + static constexpr char name[] = "requestThumbnailLocked"; + static constexpr char signature[] = + "(Ljava/nio/ByteBuffer;Lorg/mozilla/gecko/Tab;III)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::PROXY; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + + template<class Impl> class Natives; +}; + +class ZoomedView : public mozilla::jni::ObjectBase<ZoomedView> +{ +public: + static const char name[]; + + explicit ZoomedView(const Context& ctx) : ObjectBase<ZoomedView>(ctx) {} + + struct RequestZoomedViewData_t { + typedef ZoomedView Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteBuffer::Param, + int32_t, + int32_t, + int32_t, + int32_t, + int32_t, + float> Args; + static constexpr char name[] = "requestZoomedViewData"; + static constexpr char signature[] = + "(Ljava/nio/ByteBuffer;IIIIIF)V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + + template<class Impl> class Natives; +}; + +class AudioFocusAgent : public mozilla::jni::ObjectBase<AudioFocusAgent> +{ +public: + static const char name[]; + + explicit AudioFocusAgent(const Context& ctx) : ObjectBase<AudioFocusAgent>(ctx) {} + + struct NotifyStartedPlaying_t { + typedef AudioFocusAgent Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "notifyStartedPlaying"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto NotifyStartedPlaying() -> void; + + struct NotifyStoppedPlaying_t { + typedef AudioFocusAgent Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "notifyStoppedPlaying"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto NotifyStoppedPlaying() -> void; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + +}; + +class CodecProxy : public mozilla::jni::ObjectBase<CodecProxy> +{ +public: + static const char name[]; + + explicit CodecProxy(const Context& ctx) : ObjectBase<CodecProxy>(ctx) {} + + class NativeCallbacks; + + struct Create_t { + typedef CodecProxy Owner; + typedef CodecProxy::LocalRef ReturnType; + typedef CodecProxy::Param SetterType; + typedef mozilla::jni::Args< + mozilla::jni::Object::Param, + mozilla::jni::Object::Param, + mozilla::jni::Object::Param> Args; + static constexpr char name[] = "create"; + static constexpr char signature[] = + "(Landroid/media/MediaFormat;Landroid/view/Surface;Lorg/mozilla/gecko/media/CodecProxy$Callbacks;)Lorg/mozilla/gecko/media/CodecProxy;"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto Create(mozilla::jni::Object::Param, mozilla::jni::Object::Param, mozilla::jni::Object::Param) -> CodecProxy::LocalRef; + + struct Flush_t { + typedef CodecProxy Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "flush"; + static constexpr char signature[] = + "()Z"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto Flush() const -> bool; + + struct Input_t { + typedef CodecProxy Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteBuffer::Param, + mozilla::jni::Object::Param, + mozilla::jni::Object::Param> Args; + static constexpr char name[] = "input"; + static constexpr char signature[] = + "(Ljava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;Landroid/media/MediaCodec$CryptoInfo;)Z"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto Input(mozilla::jni::ByteBuffer::Param, mozilla::jni::Object::Param, mozilla::jni::Object::Param) const -> bool; + + struct Release_t { + typedef CodecProxy Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "release"; + static constexpr char signature[] = + "()Z"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto Release() const -> bool; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + +}; + +class CodecProxy::NativeCallbacks : public mozilla::jni::ObjectBase<NativeCallbacks> +{ +public: + static const char name[]; + + explicit NativeCallbacks(const Context& ctx) : ObjectBase<NativeCallbacks>(ctx) {} + + struct New_t { + typedef NativeCallbacks Owner; + typedef NativeCallbacks::LocalRef ReturnType; + typedef NativeCallbacks::Param SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "<init>"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto New() -> NativeCallbacks::LocalRef; + + struct DisposeNative_t { + typedef NativeCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "disposeNative"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct OnError_t { + typedef NativeCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + bool> Args; + static constexpr char name[] = "onError"; + static constexpr char signature[] = + "(Z)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct OnInputExhausted_t { + typedef NativeCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "onInputExhausted"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct OnOutput_t { + typedef NativeCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::Object::Param> Args; + static constexpr char name[] = "onOutput"; + static constexpr char signature[] = + "(Lorg/mozilla/gecko/media/Sample;)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + struct OnOutputFormatChanged_t { + typedef NativeCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::Object::Param> Args; + static constexpr char name[] = "onOutputFormatChanged"; + static constexpr char signature[] = + "(Landroid/media/MediaFormat;)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + + template<class Impl> class Natives; +}; + +class MediaDrmProxy : public mozilla::jni::ObjectBase<MediaDrmProxy> +{ +public: + static const char name[]; + + explicit MediaDrmProxy(const Context& ctx) : ObjectBase<MediaDrmProxy>(ctx) {} + + class NativeMediaDrmProxyCallbacks; + + struct CanDecode_t { + typedef MediaDrmProxy Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param> Args; + static constexpr char name[] = "CanDecode"; + static constexpr char signature[] = + "(Ljava/lang/String;)Z"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto CanDecode(mozilla::jni::String::Param) -> bool; + + struct IsCryptoSchemeSupported_t { + typedef MediaDrmProxy Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + mozilla::jni::String::Param> Args; + static constexpr char name[] = "IsCryptoSchemeSupported"; + static constexpr char signature[] = + "(Ljava/lang/String;Ljava/lang/String;)Z"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto IsCryptoSchemeSupported(mozilla::jni::String::Param, mozilla::jni::String::Param) -> bool; + + struct CloseSession_t { + typedef MediaDrmProxy Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t, + mozilla::jni::String::Param> Args; + static constexpr char name[] = "closeSession"; + static constexpr char signature[] = + "(ILjava/lang/String;)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto CloseSession(int32_t, mozilla::jni::String::Param) const -> void; + + struct Create_t { + typedef MediaDrmProxy Owner; + typedef MediaDrmProxy::LocalRef ReturnType; + typedef MediaDrmProxy::Param SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param, + mozilla::jni::Object::Param, + bool> Args; + static constexpr char name[] = "create"; + static constexpr char signature[] = + "(Ljava/lang/String;Lorg/mozilla/gecko/media/MediaDrmProxy$Callbacks;Z)Lorg/mozilla/gecko/media/MediaDrmProxy;"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto Create(mozilla::jni::String::Param, mozilla::jni::Object::Param, bool) -> MediaDrmProxy::LocalRef; + + struct CreateSession_t { + typedef MediaDrmProxy Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t, + int32_t, + mozilla::jni::String::Param, + mozilla::jni::ByteArray::Param> Args; + static constexpr char name[] = "createSession"; + static constexpr char signature[] = + "(IILjava/lang/String;[B)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto CreateSession(int32_t, int32_t, mozilla::jni::String::Param, mozilla::jni::ByteArray::Param) const -> void; + + struct Destroy_t { + typedef MediaDrmProxy Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "destroy"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto Destroy() const -> void; + + struct IsSchemeSupported_t { + typedef MediaDrmProxy Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args< + mozilla::jni::String::Param> Args; + static constexpr char name[] = "isSchemeSupported"; + static constexpr char signature[] = + "(Ljava/lang/String;)Z"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto IsSchemeSupported(mozilla::jni::String::Param) -> bool; + + struct UpdateSession_t { + typedef MediaDrmProxy Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t, + mozilla::jni::String::Param, + mozilla::jni::ByteArray::Param> Args; + static constexpr char name[] = "updateSession"; + static constexpr char signature[] = + "(ILjava/lang/String;[B)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto UpdateSession(int32_t, mozilla::jni::String::Param, mozilla::jni::ByteArray::Param) const -> void; + + static const char16_t AAC[]; + + static const char16_t AVC[]; + + static const char16_t OPUS[]; + + static const char16_t VORBIS[]; + + static const char16_t VP8[]; + + static const char16_t VP9[]; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + +}; + +class MediaDrmProxy::NativeMediaDrmProxyCallbacks : public mozilla::jni::ObjectBase<NativeMediaDrmProxyCallbacks> +{ +public: + static const char name[]; + + explicit NativeMediaDrmProxyCallbacks(const Context& ctx) : ObjectBase<NativeMediaDrmProxyCallbacks>(ctx) {} + + struct New_t { + typedef NativeMediaDrmProxyCallbacks Owner; + typedef NativeMediaDrmProxyCallbacks::LocalRef ReturnType; + typedef NativeMediaDrmProxyCallbacks::Param SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "<init>"; + static constexpr char signature[] = + "()V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto New() -> NativeMediaDrmProxyCallbacks::LocalRef; + + struct OnRejectPromise_t { + typedef NativeMediaDrmProxyCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t, + mozilla::jni::String::Param> Args; + static constexpr char name[] = "onRejectPromise"; + static constexpr char signature[] = + "(ILjava/lang/String;)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct OnSessionBatchedKeyChanged_t { + typedef NativeMediaDrmProxyCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteArray::Param, + mozilla::jni::ObjectArray::Param> Args; + static constexpr char name[] = "onSessionBatchedKeyChanged"; + static constexpr char signature[] = + "([B[Lorg/mozilla/gecko/media/SessionKeyInfo;)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct OnSessionClosed_t { + typedef NativeMediaDrmProxyCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t, + mozilla::jni::ByteArray::Param> Args; + static constexpr char name[] = "onSessionClosed"; + static constexpr char signature[] = + "(I[B)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct OnSessionCreated_t { + typedef NativeMediaDrmProxyCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t, + int32_t, + mozilla::jni::ByteArray::Param, + mozilla::jni::ByteArray::Param> Args; + static constexpr char name[] = "onSessionCreated"; + static constexpr char signature[] = + "(II[B[B)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct OnSessionError_t { + typedef NativeMediaDrmProxyCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteArray::Param, + mozilla::jni::String::Param> Args; + static constexpr char name[] = "onSessionError"; + static constexpr char signature[] = + "([BLjava/lang/String;)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct OnSessionMessage_t { + typedef NativeMediaDrmProxyCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteArray::Param, + int32_t, + mozilla::jni::ByteArray::Param> Args; + static constexpr char name[] = "onSessionMessage"; + static constexpr char signature[] = + "([BI[B)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + struct OnSessionUpdated_t { + typedef NativeMediaDrmProxyCallbacks Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + int32_t, + mozilla::jni::ByteArray::Param> Args; + static constexpr char name[] = "onSessionUpdated"; + static constexpr char signature[] = + "(I[B)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::GECKO; + }; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + + template<class Impl> class Natives; +}; + +class Sample : public mozilla::jni::ObjectBase<Sample> +{ +public: + static const char name[]; + + explicit Sample(const Context& ctx) : ObjectBase<Sample>(ctx) {} + + struct WriteToByteBuffer_t { + typedef Sample Owner; + typedef void ReturnType; + typedef void SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteBuffer::Param> Args; + static constexpr char name[] = "writeToByteBuffer"; + static constexpr char signature[] = + "(Ljava/nio/ByteBuffer;)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto WriteToByteBuffer(mozilla::jni::ByteBuffer::Param) const -> void; + + struct Info_t { + typedef Sample Owner; + typedef mozilla::jni::Object::LocalRef ReturnType; + typedef mozilla::jni::Object::Param SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "info"; + static constexpr char signature[] = + "Landroid/media/MediaCodec$BufferInfo;"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto Info() const -> mozilla::jni::Object::LocalRef; + + auto Info(mozilla::jni::Object::Param) const -> void; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + +}; + +class SessionKeyInfo : public mozilla::jni::ObjectBase<SessionKeyInfo> +{ +public: + static const char name[]; + + explicit SessionKeyInfo(const Context& ctx) : ObjectBase<SessionKeyInfo>(ctx) {} + + struct New_t { + typedef SessionKeyInfo Owner; + typedef SessionKeyInfo::LocalRef ReturnType; + typedef SessionKeyInfo::Param SetterType; + typedef mozilla::jni::Args< + mozilla::jni::ByteArray::Param, + int32_t> Args; + static constexpr char name[] = "<init>"; + static constexpr char signature[] = + "([BI)V"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto New(mozilla::jni::ByteArray::Param, int32_t) -> SessionKeyInfo::LocalRef; + + struct KeyId_t { + typedef SessionKeyInfo Owner; + typedef mozilla::jni::ByteArray::LocalRef ReturnType; + typedef mozilla::jni::ByteArray::Param SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "keyId"; + static constexpr char signature[] = + "[B"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto KeyId() const -> mozilla::jni::ByteArray::LocalRef; + + auto KeyId(mozilla::jni::ByteArray::Param) const -> void; + + struct Status_t { + typedef SessionKeyInfo Owner; + typedef int32_t ReturnType; + typedef int32_t SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "status"; + static constexpr char signature[] = + "I"; + static const bool isStatic = false; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + auto Status() const -> int32_t; + + auto Status(int32_t) const -> void; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::ANY; + +}; + +class Restrictions : public mozilla::jni::ObjectBase<Restrictions> +{ +public: + static const char name[]; + + explicit Restrictions(const Context& ctx) : ObjectBase<Restrictions>(ctx) {} + + struct IsAllowed_t { + typedef Restrictions Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args< + int32_t, + mozilla::jni::String::Param> Args; + static constexpr char name[] = "isAllowed"; + static constexpr char signature[] = + "(ILjava/lang/String;)Z"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto IsAllowed(int32_t, mozilla::jni::String::Param) -> bool; + + struct IsUserRestricted_t { + typedef Restrictions Owner; + typedef bool ReturnType; + typedef bool SetterType; + typedef mozilla::jni::Args<> Args; + static constexpr char name[] = "isUserRestricted"; + static constexpr char signature[] = + "()Z"; + static const bool isStatic = true; + static const mozilla::jni::ExceptionMode exceptionMode = + mozilla::jni::ExceptionMode::ABORT; + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + static const mozilla::jni::DispatchTarget dispatchTarget = + mozilla::jni::DispatchTarget::CURRENT; + }; + + static auto IsUserRestricted() -> bool; + + static const mozilla::jni::CallingThread callingThread = + mozilla::jni::CallingThread::GECKO; + +}; + +} /* java */ +} /* mozilla */ +#endif // FennecJNIWrappers_h diff --git a/widget/android/fennec/MemoryMonitor.h b/widget/android/fennec/MemoryMonitor.h new file mode 100644 index 000000000..c87538424 --- /dev/null +++ b/widget/android/fennec/MemoryMonitor.h @@ -0,0 +1,27 @@ +/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MemoryMonitor_h +#define MemoryMonitor_h + +#include "FennecJNINatives.h" +#include "nsMemoryPressure.h" + +namespace mozilla { + +class MemoryMonitor final + : public java::MemoryMonitor::Natives<MemoryMonitor> +{ +public: + static void + DispatchMemoryPressure() + { + NS_DispatchMemoryPressure(MemoryPressureState::MemPressure_New); + } +}; + +} // namespace mozilla + +#endif // MemoryMonitor_h diff --git a/widget/android/fennec/Telemetry.h b/widget/android/fennec/Telemetry.h new file mode 100644 index 000000000..c72735496 --- /dev/null +++ b/widget/android/fennec/Telemetry.h @@ -0,0 +1,100 @@ +/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_widget_Telemetry_h__ +#define mozilla_widget_Telemetry_h__ + +#include "FennecJNINatives.h" +#include "nsAppShell.h" +#include "nsIAndroidBridge.h" + +#include "mozilla/Telemetry.h" + +namespace mozilla { +namespace widget { + +class Telemetry final + : public java::Telemetry::Natives<Telemetry> +{ + Telemetry() = delete; + + static already_AddRefed<nsIUITelemetryObserver> + GetObserver() + { + nsAppShell* const appShell = nsAppShell::Get(); + if (!appShell) { + return nullptr; + } + + nsCOMPtr<nsIAndroidBrowserApp> browserApp = appShell->GetBrowserApp(); + nsCOMPtr<nsIUITelemetryObserver> obs; + + if (!browserApp || NS_FAILED(browserApp->GetUITelemetryObserver( + getter_AddRefs(obs))) || !obs) { + return nullptr; + } + + return obs.forget(); + } + +public: + static void + AddHistogram(jni::String::Param aName, int32_t aValue) + { + MOZ_ASSERT(aName); + mozilla::Telemetry::Accumulate(aName->ToCString().get(), aValue); + } + + static void + AddKeyedHistogram(jni::String::Param aName, jni::String::Param aKey, + int32_t aValue) + { + MOZ_ASSERT(aName && aKey); + mozilla::Telemetry::Accumulate(aName->ToCString().get(), + aKey->ToCString(), aValue); + } + + static void + StartUISession(jni::String::Param aName, int64_t aTimestamp) + { + MOZ_ASSERT(aName); + nsCOMPtr<nsIUITelemetryObserver> obs = GetObserver(); + if (obs) { + obs->StartSession(aName->ToString().get(), aTimestamp); + } + } + + static void + StopUISession(jni::String::Param aName, jni::String::Param aReason, + int64_t aTimestamp) + { + MOZ_ASSERT(aName); + nsCOMPtr<nsIUITelemetryObserver> obs = GetObserver(); + if (obs) { + obs->StopSession(aName->ToString().get(), + aReason ? aReason->ToString().get() : nullptr, + aTimestamp); + } + } + + static void + AddUIEvent(jni::String::Param aAction, jni::String::Param aMethod, + int64_t aTimestamp, jni::String::Param aExtras) + { + MOZ_ASSERT(aAction); + nsCOMPtr<nsIUITelemetryObserver> obs = GetObserver(); + if (obs) { + obs->AddEvent(aAction->ToString().get(), + aMethod ? aMethod->ToString().get() : nullptr, + aTimestamp, + aExtras ? aExtras->ToString().get() : nullptr); + } + } +}; + +} // namespace widget +} // namespace mozilla + +#endif // mozilla_widget_Telemetry_h__ diff --git a/widget/android/fennec/ThumbnailHelper.h b/widget/android/fennec/ThumbnailHelper.h new file mode 100644 index 000000000..08fae787e --- /dev/null +++ b/widget/android/fennec/ThumbnailHelper.h @@ -0,0 +1,302 @@ +/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef ThumbnailHelper_h +#define ThumbnailHelper_h + +#include "AndroidBridge.h" +#include "FennecJNINatives.h" +#include "gfxPlatform.h" +#include "mozIDOMWindow.h" +#include "nsAppShell.h" +#include "nsCOMPtr.h" +#include "nsIChannel.h" +#include "nsIDOMWindowUtils.h" +#include "nsIDOMClientRect.h" +#include "nsIDocShell.h" +#include "nsIHttpChannel.h" +#include "nsIPresShell.h" +#include "nsIURI.h" +#include "nsPIDOMWindow.h" +#include "nsPresContext.h" + +#include "mozilla/Preferences.h" + +namespace mozilla { + +class ThumbnailHelper final + : public java::ThumbnailHelper::Natives<ThumbnailHelper> + , public java::ZoomedView::Natives<ThumbnailHelper> +{ + ThumbnailHelper() = delete; + + static already_AddRefed<mozIDOMWindowProxy> + GetWindowForTab(int32_t aTabId) + { + nsAppShell* const appShell = nsAppShell::Get(); + if (!appShell) { + return nullptr; + } + + nsCOMPtr<nsIAndroidBrowserApp> browserApp = appShell->GetBrowserApp(); + if (!browserApp) { + return nullptr; + } + + nsCOMPtr<mozIDOMWindowProxy> window; + nsCOMPtr<nsIBrowserTab> tab; + + if (NS_FAILED(browserApp->GetBrowserTab(aTabId, getter_AddRefs(tab))) || + !tab || + NS_FAILED(tab->GetWindow(getter_AddRefs(window))) || + !window) { + return nullptr; + } + + return window.forget(); + } + + // Decides if we should store thumbnails for a given docshell based on the + // presence of a Cache-Control: no-store header and the + // "browser.cache.disk_cache_ssl" pref. + static bool + ShouldStoreThumbnail(nsIDocShell* docShell) + { + nsCOMPtr<nsIChannel> channel; + if (NS_FAILED(docShell->GetCurrentDocumentChannel( + getter_AddRefs(channel))) || !channel) { + return false; + } + + nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(channel); + if (!httpChannel) { + // Allow storing non-HTTP thumbnails. + return true; + } + + // Don't store thumbnails for sites that didn't load or have + // Cache-Control: no-store. + uint32_t responseStatus = 0; + bool isNoStoreResponse = false; + + if (NS_FAILED(httpChannel->GetResponseStatus(&responseStatus)) || + (responseStatus / 100) != 2 || + NS_FAILED(httpChannel->IsNoStoreResponse(&isNoStoreResponse)) || + isNoStoreResponse) { + return false; + } + + // Deny storage if we're viewing a HTTPS page with a 'Cache-Control' + // header having a value that is not 'public', unless enabled by user. + nsCOMPtr<nsIURI> uri; + bool isHttps = false; + + if (NS_FAILED(channel->GetURI(getter_AddRefs(uri))) || + !uri || + NS_FAILED(uri->SchemeIs("https", &isHttps))) { + return false; + } + + if (!isHttps || + Preferences::GetBool("browser.cache.disk_cache_ssl", false)) { + // Allow storing non-HTTPS thumbnails, and HTTPS ones if enabled by + // user. + return true; + } + + nsAutoCString cacheControl; + if (NS_FAILED(httpChannel->GetResponseHeader( + NS_LITERAL_CSTRING("Cache-Control"), cacheControl))) { + return false; + } + + if (cacheControl.IsEmpty() || + cacheControl.LowerCaseEqualsLiteral("public")) { + // Allow no cache-control, or public cache-control. + return true; + } + return false; + } + + // Return a non-null nsIDocShell to indicate success. + static already_AddRefed<nsIDocShell> + GetThumbnailAndDocShell(mozIDOMWindowProxy* aWindow, + jni::ByteBuffer::Param aData, + int32_t aThumbWidth, int32_t aThumbHeight, + const CSSRect& aPageRect, float aZoomFactor) + { + nsCOMPtr<nsPIDOMWindowOuter> win = nsPIDOMWindowOuter::From(aWindow); + nsCOMPtr<nsIDocShell> docShell = win->GetDocShell(); + RefPtr<nsPresContext> presContext; + + if (!docShell || NS_FAILED(docShell->GetPresContext( + getter_AddRefs(presContext))) || !presContext) { + return nullptr; + } + + uint8_t* const data = static_cast<uint8_t*>(aData->Address()); + if (!data) { + return nullptr; + } + + const bool is24bit = !AndroidBridge::Bridge() || + AndroidBridge::Bridge()->GetScreenDepth() == 24; + const uint32_t stride = aThumbWidth * (is24bit ? 4 : 2); + + RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->CreateDrawTargetForData( + data, + IntSize(aThumbWidth, aThumbHeight), + stride, + is24bit ? SurfaceFormat::B8G8R8A8 + : SurfaceFormat::R5G6B5_UINT16); + + if (!dt || !dt->IsValid()) { + return nullptr; + } + + nsCOMPtr<nsIPresShell> presShell = presContext->PresShell(); + RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt); + MOZ_ASSERT(context); // checked the draw target above + + context->SetMatrix(context->CurrentMatrix().Scale( + aZoomFactor * float(aThumbWidth) / aPageRect.width, + aZoomFactor * float(aThumbHeight) / aPageRect.height)); + + const nsRect drawRect( + nsPresContext::CSSPixelsToAppUnits(aPageRect.x), + nsPresContext::CSSPixelsToAppUnits(aPageRect.y), + nsPresContext::CSSPixelsToAppUnits(aPageRect.width), + nsPresContext::CSSPixelsToAppUnits(aPageRect.height)); + const uint32_t renderDocFlags = + nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING | + nsIPresShell::RENDER_DOCUMENT_RELATIVE; + const nscolor bgColor = NS_RGB(255, 255, 255); + + if (NS_FAILED(presShell->RenderDocument( + drawRect, renderDocFlags, bgColor, context))) { + return nullptr; + } + + if (is24bit) { + gfxUtils::ConvertBGRAtoRGBA(data, stride * aThumbHeight); + } + + return docShell.forget(); + } + +public: + static void Init() + { + java::ThumbnailHelper::Natives<ThumbnailHelper>::Init(); + java::ZoomedView::Natives<ThumbnailHelper>::Init(); + } + + template<class Functor> + static void OnNativeCall(Functor&& aCall) + { + class IdleEvent : public nsAppShell::LambdaEvent<Functor> + { + using Base = nsAppShell::LambdaEvent<Functor>; + + public: + IdleEvent(Functor&& aCall) + : Base(Forward<Functor>(aCall)) + {} + + void Run() override + { + MessageLoop::current()->PostIdleTask( + NS_NewRunnableFunction(Move(Base::lambda))); + } + }; + + // Invoke RequestThumbnail on the main thread when the thread is idle. + nsAppShell::PostEvent(MakeUnique<IdleEvent>(Forward<Functor>(aCall))); + } + + static void + RequestThumbnail(jni::ByteBuffer::Param aData, jni::Object::Param aTab, + int32_t aTabId, int32_t aWidth, int32_t aHeight) + { + nsCOMPtr<mozIDOMWindowProxy> window = GetWindowForTab(aTabId); + if (!window || !aData) { + java::ThumbnailHelper::NotifyThumbnail( + aData, aTab, /* success */ false, /* store */ false); + return; + } + + // take a screenshot, as wide as possible, proportional to the destination size + nsCOMPtr<nsIDOMWindowUtils> utils = do_GetInterface(window); + nsCOMPtr<nsIDOMClientRect> rect; + float pageLeft = 0.0f, pageTop = 0.0f, pageWidth = 0.0f, pageHeight = 0.0f; + + if (!utils || + NS_FAILED(utils->GetRootBounds(getter_AddRefs(rect))) || + !rect || + NS_FAILED(rect->GetLeft(&pageLeft)) || + NS_FAILED(rect->GetTop(&pageTop)) || + NS_FAILED(rect->GetWidth(&pageWidth)) || + NS_FAILED(rect->GetHeight(&pageHeight)) || + int32_t(pageWidth) == 0 || int32_t(pageHeight) == 0) { + java::ThumbnailHelper::NotifyThumbnail( + aData, aTab, /* success */ false, /* store */ false); + return; + } + + const float aspectRatio = float(aWidth) / float(aHeight); + if (pageWidth / aspectRatio < pageHeight) { + pageHeight = pageWidth / aspectRatio; + } else { + pageWidth = pageHeight * aspectRatio; + } + + nsCOMPtr<nsIDocShell> docShell = GetThumbnailAndDocShell( + window, aData, aWidth, aHeight, + CSSRect(pageLeft, pageTop, pageWidth, pageHeight), + /* aZoomFactor */ 1.0f); + const bool success = !!docShell; + const bool store = success ? ShouldStoreThumbnail(docShell) : false; + + java::ThumbnailHelper::NotifyThumbnail(aData, aTab, success, store); + } + + static void + RequestZoomedViewData(jni::ByteBuffer::Param aData, int32_t aTabId, + int32_t aX, int32_t aY, + int32_t aWidth, int32_t aHeight, float aScale) + { + nsCOMPtr<mozIDOMWindowProxy> window = GetWindowForTab(aTabId); + if (!window || !aData) { + return; + } + + nsCOMPtr<nsPIDOMWindowOuter> win = nsPIDOMWindowOuter::From(window); + nsCOMPtr<nsIDocShell> docShell = win->GetDocShell(); + RefPtr<nsPresContext> presContext; + + if (!docShell || NS_FAILED(docShell->GetPresContext( + getter_AddRefs(presContext))) || !presContext) { + return; + } + + nsCOMPtr<nsIPresShell> presShell = presContext->PresShell(); + LayoutDeviceRect rect = LayoutDeviceRect(aX, aY, aWidth, aHeight); + const float resolution = presShell->GetCumulativeResolution(); + rect.Scale(1.0f / LayoutDeviceToLayerScale(resolution).scale); + + docShell = GetThumbnailAndDocShell( + window, aData, aWidth, aHeight, CSSRect::FromAppUnits( + rect.ToAppUnits(rect, presContext->AppUnitsPerDevPixel())), + aScale); + + if (docShell) { + java::LayerView::UpdateZoomedView(aData); + } + } +}; + +} // namespace mozilla + +#endif // ThumbnailHelper_h diff --git a/widget/android/fennec/moz.build b/widget/android/fennec/moz.build new file mode 100644 index 000000000..0d6a8e0cd --- /dev/null +++ b/widget/android/fennec/moz.build @@ -0,0 +1,21 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +EXPORTS += [ + 'FennecJNINatives.h', + 'FennecJNIWrappers.h', +] + +UNIFIED_SOURCES += [ + 'FennecJNIWrappers.cpp', +] + +FINAL_LIBRARY = 'xul' + +LOCAL_INCLUDES += [ + '/widget', + '/widget/android', +] |