Add a helper for forwarding event APZ info to TabParent. (bug 1109985 part 1, r=dvander)
☠☠ backed out by b2649ad7d86e ☠ ☠
authorKartikaya Gupta <kats@mozilla.com>
Mon, 15 Dec 2014 23:28:19 -0800
changeset 219904 2187c2cdeea9297104f2faf08689cc819aa4bc14
parent 219903 78a5cadec4fc9d91ae6c6ae2080531b7e06dd963
child 219905 c61753316ddb6325779d733e558abd49c6061a80
push id10419
push usercbook@mozilla.com
push dateTue, 16 Dec 2014 12:45:27 +0000
treeherderfx-team@ec87657146eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1109985
milestone37.0a1
Add a helper for forwarding event APZ info to TabParent. (bug 1109985 part 1, r=dvander)
gfx/layers/apz/util/InputAPZContext.cpp
gfx/layers/apz/util/InputAPZContext.h
gfx/layers/moz.build
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/util/InputAPZContext.cpp
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/. */
+
+#include "InputAPZContext.h"
+
+namespace mozilla {
+namespace layers {
+
+ScrollableLayerGuid InputAPZContext::sGuid;
+uint64_t InputAPZContext::sBlockId = 0;
+
+/*static*/ ScrollableLayerGuid
+InputAPZContext::GetTargetLayerGuid()
+{
+  return sGuid;
+}
+
+/*static*/ uint64_t
+InputAPZContext::GetInputBlockId()
+{
+  return sBlockId;
+}
+
+InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
+                                 const uint64_t& aBlockId)
+  : mOldGuid(sGuid)
+  , mOldBlockId(sBlockId)
+{
+  sGuid = aGuid;
+  sBlockId = aBlockId;
+}
+
+InputAPZContext::~InputAPZContext()
+{
+  sGuid = mOldGuid;
+  sBlockId = mOldBlockId;
+}
+
+}
+}
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/util/InputAPZContext.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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_layers_InputAPZContext_h
+#define mozilla_layers_InputAPZContext_h
+
+#include "FrameMetrics.h"
+
+namespace mozilla {
+namespace layers {
+
+// InputAPZContext is used to communicate the ScrollableLayerGuid and input
+// block ID from nsIWidget to RenderFrameParent. It is conceptually attached
+// to any WidgetInputEvent that has been processed by APZ directly from a
+// widget.
+class MOZ_STACK_CLASS InputAPZContext
+{
+private:
+  static ScrollableLayerGuid sGuid;
+  static uint64_t sBlockId;
+
+public:
+  static ScrollableLayerGuid GetTargetLayerGuid();
+  static uint64_t GetInputBlockId();
+
+  InputAPZContext(const ScrollableLayerGuid& aGuid,
+                    const uint64_t& aBlockId);
+  ~InputAPZContext();
+
+private:
+  ScrollableLayerGuid mOldGuid;
+  uint64_t mOldBlockId;
+};
+
+}
+}
+
+#endif /* mozilla_layers_InputAPZContext_h */
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -109,16 +109,17 @@ EXPORTS.mozilla.layers += [
     'apz/public/GeckoContentController.h',
     # exporting things from apz/src is temporary until we extract a
     # proper interface for the code there
     'apz/src/APZCTreeManager.h',
     'apz/testutil/APZTestData.h',
     'apz/util/ActiveElementManager.h',
     'apz/util/APZCCallbackHelper.h',
     'apz/util/ChromeProcessController.h',
+    'apz/util/InputAPZContext.h',
     'AtomicRefCountedWithFinalize.h',
     'AxisPhysicsModel.h',
     'AxisPhysicsMSDModel.h',
     'basic/BasicCompositor.h',
     'basic/MacIOSurfaceTextureHostBasic.h',
     'basic/TextureHostBasic.h',
     'client/CanvasClient.h',
     'client/CompositableClient.h',
@@ -241,16 +242,17 @@ UNIFIED_SOURCES += [
     'apz/src/InputBlockState.cpp',
     'apz/src/InputQueue.cpp',
     'apz/src/OverscrollHandoffState.cpp',
     'apz/src/TaskThrottler.cpp',
     'apz/testutil/APZTestData.cpp',
     'apz/util/ActiveElementManager.cpp',
     'apz/util/APZCCallbackHelper.cpp',
     'apz/util/ChromeProcessController.cpp',
+    'apz/util/InputAPZContext.cpp',
     'AxisPhysicsModel.cpp',
     'AxisPhysicsMSDModel.cpp',
     'basic/BasicCanvasLayer.cpp',
     'basic/BasicColorLayer.cpp',
     'basic/BasicCompositor.cpp',
     'basic/BasicContainerLayer.cpp',
     'basic/BasicImages.cpp',
     'basic/BasicLayerManager.cpp',