From 4e6ef25acf4b9fbd97fca51ea7f1814d9eec227b Mon Sep 17 00:00:00 2001 From: ssummar Date: Wed, 10 Nov 2021 12:57:43 +0000 Subject: [PATCH] Bug 1739367 - Replaces mozilla::Tuple with std::tuple in widget/ r=emilio,geckoview-reviewers,owlish Differential Revision: https://phabricator.services.mozilla.com/D130356 --- widget/PrintBackgroundTask.h | 3 +- widget/TouchResampler.cpp | 6 +- widget/android/WebExecutorSupport.cpp | 25 ++--- widget/android/jni/Natives.h | 16 +-- widget/android/nsWindow.cpp | 150 +++++++++++--------------- 5 files changed, 86 insertions(+), 114 deletions(-) diff --git a/widget/PrintBackgroundTask.h b/widget/PrintBackgroundTask.h index d8b4d8a4e58f..8b18c8a879f8 100644 --- a/widget/PrintBackgroundTask.h +++ b/widget/PrintBackgroundTask.h @@ -9,8 +9,9 @@ #include "mozilla/dom/Promise.h" #include "mozilla/ErrorResult.h" #include "mozilla/Telemetry.h" -#include + #include +#include // A helper to resolve a DOM Promise with the result of a const method, executed // in another thread. diff --git a/widget/TouchResampler.cpp b/widget/TouchResampler.cpp index 51974a440596..eeed30fe0e31 100644 --- a/widget/TouchResampler.cpp +++ b/widget/TouchResampler.cpp @@ -112,13 +112,11 @@ void TouchResampler::NotifyFrame(const TimeStamp& aTimeStamp) { uint64_t eventId; while (true) { MOZ_RELEASE_ASSERT(!mDeferredTouchMoveEvents.empty()); - std::tie(input, eventId) = std::move(mDeferredTouchMoveEvents.front()); mDeferredTouchMoveEvents.pop(); if (mDeferredTouchMoveEvents.empty() || input.mTimeStamp >= sampleTime) { break; } - // Flush this event to the outgoing queue without resampling. What ends up // on the screen will still be smooth because we will proceed to emit a // resampled event before the paint for this frame starts. @@ -215,9 +213,7 @@ void TouchResampler::PrependLeftoverHistoricalData(MultiTouchInput* aInput) { void TouchResampler::FlushDeferredTouchMoveEventsUnresampled() { while (!mDeferredTouchMoveEvents.empty()) { - MultiTouchInput input; - uint64_t eventId; - std::tie(input, eventId) = std::move(mDeferredTouchMoveEvents.front()); + auto [input, eventId] = std::move(mDeferredTouchMoveEvents.front()); mDeferredTouchMoveEvents.pop(); PrependLeftoverHistoricalData(&input); EmitEvent(std::move(input), eventId); diff --git a/widget/android/WebExecutorSupport.cpp b/widget/android/WebExecutorSupport.cpp index 99e7de95a0fb..966192fbfa49 100644 --- a/widget/android/WebExecutorSupport.cpp +++ b/widget/android/WebExecutorSupport.cpp @@ -5,34 +5,31 @@ #include +#include "GeckoViewStreamListener.h" +#include "InetAddress.h" // for java::sdk::InetAddress and java::sdk::UnknownHostException +#include "ReferrerInfo.h" #include "WebExecutorSupport.h" #include "nsIAsyncVerifyRedirectCallback.h" #include "nsIHttpChannel.h" #include "nsIHttpChannelInternal.h" #include "nsIHttpHeaderVisitor.h" -#include "nsINSSErrorsService.h" -#include "nsIUploadChannel2.h" -#include "nsIX509Cert.h" - #include "nsIDNSService.h" #include "nsIDNSListener.h" #include "nsIDNSRecord.h" +#include "nsINSSErrorsService.h" +#include "nsNetUtil.h" // for NS_NewURI, NS_NewChannel, NS_NewStreamLoader +#include "nsIPrivateBrowsingChannel.h" +#include "nsIUploadChannel2.h" +#include "nsIX509Cert.h" +#include "mozilla/Preferences.h" +#include "mozilla/net/CookieJarSettings.h" +#include "mozilla/net/DNS.h" // for NetAddr #include "mozilla/java/GeckoWebExecutorWrappers.h" #include "mozilla/java/WebMessageWrappers.h" #include "mozilla/java/WebRequestErrorWrappers.h" #include "mozilla/java/WebResponseWrappers.h" -#include "mozilla/net/DNS.h" // for NetAddr -#include "mozilla/net/CookieJarSettings.h" -#include "mozilla/Preferences.h" -#include "GeckoViewStreamListener.h" -#include "nsIPrivateBrowsingChannel.h" - -#include "nsNetUtil.h" // for NS_NewURI, NS_NewChannel, NS_NewStreamLoader - -#include "InetAddress.h" // for java::sdk::InetAddress and java::sdk::UnknownHostException -#include "ReferrerInfo.h" namespace mozilla { using namespace net; diff --git a/widget/android/jni/Natives.h b/widget/android/jni/Natives.h index fa8538cd5a30..c8df774fec35 100644 --- a/widget/android/jni/Natives.h +++ b/widget/android/jni/Natives.h @@ -8,13 +8,12 @@ #define mozilla_jni_Natives_h__ #include - +#include #include #include #include "mozilla/RefPtr.h" #include "mozilla/RWLock.h" -#include "mozilla/Tuple.h" #include "mozilla/TypeTraits.h" #include "mozilla/UniquePtr.h" #include "mozilla/Unused.h" @@ -1181,7 +1180,7 @@ class ProxyNativeCall { // Saved this arg. typename ThisArgClass::GlobalRef mThisArg; // Saved arguments. - mozilla::Tuple::Type...> mArgs; + std::tuple::Type...> mArgs; // We cannot use IsStatic and HasThisArg directly (without going through // extra hoops) because GCC complains about invalid overloads, so we use @@ -1190,13 +1189,13 @@ class ProxyNativeCall { template std::enable_if_t Call( const Class::LocalRef& cls, std::index_sequence) const { - (*mNativeCall)(cls, mozilla::Get(mArgs)...); + (*mNativeCall)(cls, std::get(mArgs)...); } template std::enable_if_t Call( const Class::LocalRef& cls, std::index_sequence) const { - (*mNativeCall)(mozilla::Get(mArgs)...); + (*mNativeCall)(std::get(mArgs)...); } template @@ -1205,7 +1204,7 @@ class ProxyNativeCall { std::index_sequence) const { auto impl = NativePtrTraits::Access(NativePtrTraits::Get(inst)); MOZ_CATCH_JNI_EXCEPTION(inst.Env()); - (impl->*mNativeCall)(inst, mozilla::Get(mArgs)...); + (impl->*mNativeCall)(inst, std::get(mArgs)...); } template @@ -1214,12 +1213,13 @@ class ProxyNativeCall { std::index_sequence) const { auto impl = NativePtrTraits::Access(NativePtrTraits::Get(inst)); MOZ_CATCH_JNI_EXCEPTION(inst.Env()); - (impl->*mNativeCall)(mozilla::Get(mArgs)...); + (impl->*mNativeCall)(std::get(mArgs)...); } template void Clear(JNIEnv* env, std::index_sequence) { - int dummy[] = {(ProxyArg::Clear(env, Get(mArgs)), 0)...}; + int dummy[] = { + (ProxyArg::Clear(env, std::get(mArgs)), 0)...}; mozilla::Unused << dummy; } diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index b4fd5a55eced..c2aca4b540f1 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -4,6 +4,7 @@ * 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/. */ +#include #include #include #include @@ -12,18 +13,56 @@ #include #include +#include "AndroidGraphics.h" +#include "AndroidBridge.h" +#include "AndroidBridgeUtilities.h" +#include "AndroidContentController.h" +#include "AndroidUiThread.h" +#include "AndroidView.h" +#include "gfxContext.h" +#include "GeckoEditableSupport.h" +#include "GeckoViewSupport.h" +#include "GLContext.h" +#include "GLContextProvider.h" +#include "JavaBuiltins.h" +#include "JavaExceptions.h" +#include "KeyEvent.h" +#include "Layers.h" +#include "MotionEvent.h" +#include "ScopedGLHelpers.h" +#include "ScreenHelperAndroid.h" +#include "TouchResampler.h" +#include "WidgetUtils.h" +#include "WindowRenderer.h" + +#include "nsAppShell.h" +#include "nsContentUtils.h" +#include "nsFocusManager.h" +#include "nsGkAtoms.h" +#include "nsGfxCIID.h" +#include "nsLayoutUtils.h" +#include "nsNetUtil.h" +#include "nsPrintfCString.h" +#include "nsString.h" +#include "nsTArray.h" +#include "nsThreadUtils.h" +#include "nsUserIdleService.h" +#include "nsViewManager.h" +#include "nsWidgetsCID.h" +#include "nsWindow.h" + +#include "nsIWidgetListener.h" +#include "nsIWindowWatcher.h" +#include "nsIAppWindow.h" + #include "mozilla/MiscEvents.h" #include "mozilla/MouseEvents.h" #include "mozilla/Preferences.h" #include "mozilla/StaticPrefs_android.h" #include "mozilla/StaticPrefs_ui.h" #include "mozilla/TouchEvents.h" -#include "mozilla/Unused.h" #include "mozilla/WeakPtr.h" #include "mozilla/WheelHandlingHelper.h" // for WheelDeltaAdjustmentStrategy - -#include "mozilla/Preferences.h" -#include "mozilla/Unused.h" #include "mozilla/a11y/SessionAccessibility.h" #include "mozilla/dom/BrowsingContext.h" #include "mozilla/dom/CanonicalBrowsingContext.h" @@ -34,65 +73,7 @@ #include "mozilla/gfx/DataSurfaceHelpers.h" #include "mozilla/gfx/Swizzle.h" #include "mozilla/gfx/Types.h" -#include "mozilla/layers/LayersTypes.h" -#include "mozilla/widget/AndroidVsync.h" -#include - -using mozilla::Unused; -using mozilla::dom::ContentChild; -using mozilla::dom::ContentParent; -using mozilla::gfx::DataSourceSurface; -using mozilla::gfx::IntSize; -using mozilla::gfx::Matrix; -using mozilla::gfx::SurfaceFormat; - -#include "nsWindow.h" - -#include "AndroidGraphics.h" -#include "JavaExceptions.h" - -#include "nsIWidgetListener.h" -#include "nsIWindowWatcher.h" -#include "nsIAppWindow.h" - -#include "nsAppShell.h" -#include "nsFocusManager.h" -#include "nsUserIdleService.h" -#include "nsLayoutUtils.h" -#include "nsNetUtil.h" -#include "nsViewManager.h" - -#include "WidgetUtils.h" -#include "nsContentUtils.h" - -#include "nsGfxCIID.h" -#include "nsGkAtoms.h" -#include "nsWidgetsCID.h" - -#include "gfxContext.h" - -#include "AndroidContentController.h" -#include "GLContext.h" -#include "GLContextProvider.h" -#include "Layers.h" -#include "WindowRenderer.h" -#include "ScopedGLHelpers.h" -#include "mozilla/layers/APZEventState.h" -#include "mozilla/layers/APZInputBridge.h" -#include "mozilla/layers/APZThreadUtils.h" -#include "mozilla/layers/CompositorOGL.h" -#include "mozilla/layers/IAPZCTreeManager.h" - -#include "nsTArray.h" - -#include "AndroidBridge.h" -#include "AndroidBridgeUtilities.h" -#include "AndroidUiThread.h" -#include "AndroidView.h" -#include "GeckoEditableSupport.h" -#include "GeckoViewSupport.h" -#include "KeyEvent.h" -#include "MotionEvent.h" +#include "mozilla/ipc/Shmem.h" #include "mozilla/java/EventDispatcherWrappers.h" #include "mozilla/java/GeckoAppShellWrappers.h" #include "mozilla/java/GeckoEditableChildWrappers.h" @@ -101,16 +82,17 @@ using mozilla::gfx::SurfaceFormat; #include "mozilla/java/GeckoSystemStateListenerWrappers.h" #include "mozilla/java/PanZoomControllerNatives.h" #include "mozilla/java/SessionAccessibilityWrappers.h" -#include "ScreenHelperAndroid.h" -#include "TouchResampler.h" - +#include "mozilla/layers/APZEventState.h" +#include "mozilla/layers/APZInputBridge.h" +#include "mozilla/layers/APZThreadUtils.h" +#include "mozilla/layers/CompositorBridgeChild.h" +#include "mozilla/layers/CompositorOGL.h" +#include "mozilla/layers/CompositorSession.h" +#include "mozilla/layers/LayersTypes.h" +#include "mozilla/layers/UiCompositorControllerChild.h" +#include "mozilla/layers/IAPZCTreeManager.h" #include "mozilla/ProfilerLabels.h" -#include "nsPrintfCString.h" -#include "nsString.h" - -#include "JavaBuiltins.h" - -#include "mozilla/ipc/Shmem.h" +#include "mozilla/widget/AndroidVsync.h" using namespace mozilla; using namespace mozilla::dom; @@ -118,13 +100,14 @@ using namespace mozilla::layers; using namespace mozilla::widget; using namespace mozilla::ipc; +using mozilla::dom::ContentChild; +using mozilla::dom::ContentParent; +using mozilla::gfx::DataSourceSurface; +using mozilla::gfx::IntSize; +using mozilla::gfx::Matrix; +using mozilla::gfx::SurfaceFormat; using mozilla::java::GeckoSession; -#include "mozilla/layers/CompositorBridgeChild.h" -#include "mozilla/layers/CompositorSession.h" -#include "mozilla/layers/UiCompositorControllerChild.h" -#include "nsThreadUtils.h" - // All the toplevel windows that have been created; these are in // stacking order, so the window at gTopLevelWindows[0] is the topmost // one. @@ -716,9 +699,7 @@ class NPZCSupport final MOZ_ASSERT(toolMinor.Length() == pointerCount); for (size_t i = startIndex; i < endIndex; i++) { - float orien; - ScreenSize radius; - std::tie(orien, radius) = ConvertOrientationAndRadius( + auto [orien, radius] = ConvertOrientationAndRadius( orientation[i], toolMajor[i], toolMinor[i]); ScreenIntPoint point(int32_t(floorf(x[i])), int32_t(floorf(y[i]))); @@ -728,12 +709,9 @@ class NPZCSupport final for (size_t historyIndex = 0; historyIndex < historySize; historyIndex++) { size_t historicalI = historyIndex * pointerCount + i; - float historicalAngle; - ScreenSize historicalRadius; - std::tie(historicalAngle, historicalRadius) = - ConvertOrientationAndRadius(historicalOrientation[historicalI], - historicalToolMajor[historicalI], - historicalToolMinor[historicalI]); + auto [historicalAngle, historicalRadius] = ConvertOrientationAndRadius( + historicalOrientation[historicalI], + historicalToolMajor[historicalI], historicalToolMinor[historicalI]); ScreenIntPoint historicalPoint( int32_t(floorf(historicalX[historicalI])), int32_t(floorf(historicalY[historicalI])));