Bug 1739367 - Replaces mozilla::Tuple with std::tuple in widget/ r=emilio,geckoview-reviewers,owlish

Differential Revision: https://phabricator.services.mozilla.com/D130356
This commit is contained in:
ssummar 2021-11-10 12:57:43 +00:00
parent bd406d8841
commit 4e6ef25acf
5 changed files with 86 additions and 114 deletions

View File

@ -9,8 +9,9 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Telemetry.h"
#include <utility>
#include <tuple>
#include <utility>
// A helper to resolve a DOM Promise with the result of a const method, executed
// in another thread.

View File

@ -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);

View File

@ -5,34 +5,31 @@
#include <algorithm>
#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;

View File

@ -8,13 +8,12 @@
#define mozilla_jni_Natives_h__
#include <jni.h>
#include <tuple>
#include <type_traits>
#include <utility>
#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<typename ProxyArg<Args>::Type...> mArgs;
std::tuple<typename ProxyArg<Args>::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 <bool Static, bool ThisArg, size_t... Indices>
std::enable_if_t<Static && ThisArg, void> Call(
const Class::LocalRef& cls, std::index_sequence<Indices...>) const {
(*mNativeCall)(cls, mozilla::Get<Indices>(mArgs)...);
(*mNativeCall)(cls, std::get<Indices>(mArgs)...);
}
template <bool Static, bool ThisArg, size_t... Indices>
std::enable_if_t<Static && !ThisArg, void> Call(
const Class::LocalRef& cls, std::index_sequence<Indices...>) const {
(*mNativeCall)(mozilla::Get<Indices>(mArgs)...);
(*mNativeCall)(std::get<Indices>(mArgs)...);
}
template <bool Static, bool ThisArg, size_t... Indices>
@ -1205,7 +1204,7 @@ class ProxyNativeCall {
std::index_sequence<Indices...>) const {
auto impl = NativePtrTraits<Impl>::Access(NativePtrTraits<Impl>::Get(inst));
MOZ_CATCH_JNI_EXCEPTION(inst.Env());
(impl->*mNativeCall)(inst, mozilla::Get<Indices>(mArgs)...);
(impl->*mNativeCall)(inst, std::get<Indices>(mArgs)...);
}
template <bool Static, bool ThisArg, size_t... Indices>
@ -1214,12 +1213,13 @@ class ProxyNativeCall {
std::index_sequence<Indices...>) const {
auto impl = NativePtrTraits<Impl>::Access(NativePtrTraits<Impl>::Get(inst));
MOZ_CATCH_JNI_EXCEPTION(inst.Env());
(impl->*mNativeCall)(mozilla::Get<Indices>(mArgs)...);
(impl->*mNativeCall)(std::get<Indices>(mArgs)...);
}
template <size_t... Indices>
void Clear(JNIEnv* env, std::index_sequence<Indices...>) {
int dummy[] = {(ProxyArg<Args>::Clear(env, Get<Indices>(mArgs)), 0)...};
int dummy[] = {
(ProxyArg<Args>::Clear(env, std::get<Indices>(mArgs)), 0)...};
mozilla::Unused << dummy;
}

View File

@ -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 <algorithm>
#include <android/log.h>
#include <android/native_window.h>
#include <android/native_window_jni.h>
@ -12,18 +13,56 @@
#include <type_traits>
#include <unistd.h>
#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 <algorithm>
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])));