Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Mon, 15 Dec 2014 01:47:15 -0800
changeset 219723 3fd3bc9d9cd2f3a742df615483435c99c8391eec
parent 219722 212f295a955d32d0f6b58a12f4309808c26e26a9
child 219724 71b13c6e679a7436dfd3cd3ab6411f9358388f33
push id10400
push userryanvm@gmail.com
push dateMon, 15 Dec 2014 18:54:54 +0000
treeherderfx-team@5d6e0d038f95 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1110540
milestone37.0a1
Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/gonk/nsWindow.cpp
widget/gonk/nsWindow.h
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/windows/winrt/MetroWidget.cpp
widget/windows/winrt/MetroWidget.h
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -468,17 +468,16 @@ public:
 
   void WillPaintWindow();
   bool PaintWindow(nsIntRegion aRegion);
 
 #ifdef ACCESSIBILITY
   already_AddRefed<mozilla::a11y::Accessible> GetDocumentAccessible();
 #endif
 
-  virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);
   virtual void CreateCompositor();
   virtual void PrepareWindowEffects() MOZ_OVERRIDE;
   virtual void CleanupWindowEffects() MOZ_OVERRIDE;
   virtual bool PreRender(LayerManagerComposite* aManager) MOZ_OVERRIDE;
   virtual void PostRender(LayerManagerComposite* aManager) MOZ_OVERRIDE;
   virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) MOZ_OVERRIDE;
 
   virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries);
@@ -523,17 +522,17 @@ public:
   NSRect            DevPixelsToCocoaPoints(const nsIntRect& aRect) const {
     return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
   }
 
   mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() MOZ_OVERRIDE;
   void EndRemoteDrawing() MOZ_OVERRIDE;
   void CleanupRemoteDrawing() MOZ_OVERRIDE;
 
-  APZCTreeManager* APZCTM() { return mAPZCTreeManager; }
+  APZCTreeManager* APZCTM() { return mAPZC ; }
 
 protected:
   virtual ~nsChildView();
 
   void              ReportMoveEvent();
   void              ReportSizeEvent();
 
   // override to create different kinds of child views. Autoreleases, so
@@ -544,16 +543,19 @@ protected:
   virtual already_AddRefed<nsIWidget>
   AllocateChildPopupWidget()
   {
     static NS_DEFINE_IID(kCPopUpCID, NS_POPUP_CID);
     nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
     return widget.forget();
   }
 
+  void ConfigureAPZCTreeManager() MOZ_OVERRIDE;
+  already_AddRefed<GeckoContentController> CreateRootContentController() MOZ_OVERRIDE;
+
   void DoRemoteComposition(const nsIntRect& aRenderRect);
 
   // Overlay drawing functions for OpenGL drawing
   void DrawWindowOverlay(mozilla::layers::GLManager* aManager, nsIntRect aRect);
   void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
   void MaybeDrawRoundedCorners(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
   void MaybeDrawTitlebar(mozilla::layers::GLManager* aManager, const nsIntRect& aRect);
 
@@ -624,18 +626,16 @@ protected:
   bool                  mVisible;
   bool                  mDrawing;
   bool                  mIsDispatchPaint; // Is a paint event being dispatched
 
   // Used in OMTC BasicLayers mode. Presents the BasicCompositor result
   // surface to the screen using an OpenGL context.
   nsAutoPtr<GLPresenter> mGLPresenter;
 
-  nsRefPtr<APZCTreeManager> mAPZCTreeManager;
-
   mozilla::UniquePtr<mozilla::VibrancyManager> mVibrancyManager;
 
   static uint32_t sLastInputEventCount;
 
   void ReleaseTitlebarCGContext();
 };
 
 #endif // nsChildView_h_
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -470,17 +470,17 @@ nsChildView::~nsChildView()
     kid = kid->GetPrevSibling();
     childView->ResetParent();
   }
 
   NS_WARN_IF_FALSE(mOnDestroyCalled, "nsChildView object destroyed without calling Destroy()");
 
   DestroyCompositor();
 
-  if (mAPZCTreeManager) {
+  if (mAPZC) {
     gNumberOfWidgetsNeedingEventThread--;
     if (gNumberOfWidgetsNeedingEventThread == 0) {
       [EventThreadRunner stop];
     }
   }
 
   // An nsChildView object that was in use can be destroyed without Destroy()
   // ever being called on it.  So we also need to do a quick, safe cleanup
@@ -1879,35 +1879,32 @@ void
 nsChildView::CreateCompositor()
 {
   nsBaseWidget::CreateCompositor();
   if (mCompositorChild) {
     [(ChildView *)mView setUsingOMTCompositor:true];
   }
 }
 
-CompositorParent*
-nsChildView::NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight)
-{
-  CompositorParent *compositor = nsBaseWidget::NewCompositorParent(aSurfaceWidth, aSurfaceHeight);
-
-  if (gfxPrefs::AsyncPanZoomEnabled()) {
-    uint64_t rootLayerTreeId = compositor->RootLayerTreeId();
-    nsRefPtr<APZCTMController> controller = new APZCTMController();
-    CompositorParent::SetControllerForLayerTree(rootLayerTreeId, controller);
-    mAPZCTreeManager = CompositorParent::GetAPZCTreeManager(rootLayerTreeId);
-    mAPZCTreeManager->SetDPI(GetDPI());
-
-    if (gNumberOfWidgetsNeedingEventThread == 0) {
-      [EventThreadRunner start];
-    }
-    gNumberOfWidgetsNeedingEventThread++;
-  }
-
-  return compositor;
+already_AddRefed<GeckoContentController>
+nsChildView::CreateRootContentController()
+{
+  nsRefPtr<APZCTMController> controller = new APZCTMController();
+  return controller.forget();
+}
+
+void
+nsChildView::ConfigureAPZCTreeManager()
+{
+  nsBaseWidget::ConfigureAPZCTreeManager();
+
+  if (gNumberOfWidgetsNeedingEventThread == 0) {
+    [EventThreadRunner start];
+  }
+  gNumberOfWidgetsNeedingEventThread++;
 }
 
 nsIntRect
 nsChildView::RectContainingTitlebarControls()
 {
   // Start with a thin strip at the top of the window for the highlight line.
   NSRect rect = NSMakeRect(0, 0, [mView bounds].size.width,
                            [(ChildView*)mView cornerRadius]);
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -605,25 +605,29 @@ nsWindow::GetLayerManager(PLayerTransact
 
     if (!topWindow) {
         LOGW(" -- no topwindow\n");
         return nullptr;
     }
 
     CreateCompositor();
     if (mCompositorParent) {
-        uint64_t rootLayerTreeId = mCompositorParent->RootLayerTreeId();
-        CompositorParent::SetControllerForLayerTree(rootLayerTreeId, new ParentProcessController());
-        CompositorParent::GetAPZCTreeManager(rootLayerTreeId)->SetDPI(GetDPI());
         HwcComposer2D::GetInstance()->SetCompositorParent(mCompositorParent);
     }
     MOZ_ASSERT(mLayerManager);
     return mLayerManager;
 }
 
+already_AddRefed<GeckoContentController>
+nsWindow::CreateRootContentController()
+{
+    nsRefPtr<ParentProcessController> controller = new ParentProcessController();
+    return controller.forget();
+}
+
 void
 nsWindow::BringToTop()
 {
     if (!sTopWindows.IsEmpty()) {
         if (nsIWidgetListener* listener = sTopWindows[0]->GetWidgetListener())
             listener->WindowDeactivated();
     }
 
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -116,16 +116,20 @@ public:
     virtual uint32_t GetGLFrameBufferFormat() MOZ_OVERRIDE;
 
     virtual nsIntRect GetNaturalBounds() MOZ_OVERRIDE;
     virtual bool NeedsPaint();
 
     virtual Composer2D* GetComposer2D() MOZ_OVERRIDE;
 
 protected:
+    // nsBaseWidget
+    already_AddRefed<GeckoContentController> CreateRootContentController() MOZ_OVERRIDE;
+
+protected:
     nsWindow* mParent;
     bool mVisible;
     InputContext mInputContext;
     nsCOMPtr<nsIIdleServiceInternal> mIdleService;
     // If we're using a BasicCompositor, these fields are temporarily
     // set during frame composition.  They wrap the hardware
     // framebuffer.
     mozilla::RefPtr<mozilla::gfx::DrawTarget> mFramebufferTarget;
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -38,16 +38,17 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/unused.h"
 #include "nsContentUtils.h"
 #include "gfxPrefs.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/MouseEvents.h"
 #include "GLConsts.h"
 #include "mozilla/unused.h"
+#include "mozilla/layers/APZCTreeManager.h"
 
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
 
 #ifdef DEBUG
 #include "nsIObserver.h"
 
@@ -906,16 +907,36 @@ CompositorParent* nsBaseWidget::NewCompo
 
 void nsBaseWidget::CreateCompositor()
 {
   nsIntRect rect;
   GetBounds(rect);
   CreateCompositor(rect.width, rect.height);
 }
 
+already_AddRefed<GeckoContentController>
+nsBaseWidget::CreateRootContentController()
+{
+  return nullptr;
+}
+
+void nsBaseWidget::ConfigureAPZCTreeManager()
+{
+  uint64_t rootLayerTreeId = mCompositorParent->RootLayerTreeId();
+  mAPZC = CompositorParent::GetAPZCTreeManager(rootLayerTreeId);
+  MOZ_ASSERT(mAPZC);
+
+  mAPZC->SetDPI(GetDPI());
+
+  nsRefPtr<GeckoContentController> controller = CreateRootContentController();
+  if (controller) {
+    CompositorParent::SetControllerForLayerTree(rootLayerTreeId, controller);
+  }
+}
+
 void
 nsBaseWidget::GetPreferredCompositorBackends(nsTArray<LayersBackend>& aHints)
 {
   if (mUseLayersAcceleration) {
     aHints.AppendElement(LayersBackend::LAYERS_OPENGL);
   }
 
   aHints.AppendElement(LayersBackend::LAYERS_BASIC);
@@ -940,16 +961,20 @@ void nsBaseWidget::CreateCompositor(int 
 
   mCompositorParent = NewCompositorParent(aWidth, aHeight);
   MessageChannel *parentChannel = mCompositorParent->GetIPCChannel();
   nsRefPtr<ClientLayerManager> lm = new ClientLayerManager(this);
   MessageLoop *childMessageLoop = CompositorParent::CompositorLoop();
   mCompositorChild = new CompositorChild(lm);
   mCompositorChild->Open(parentChannel, childMessageLoop, ipc::ChildSide);
 
+  if (gfxPrefs::AsyncPanZoomEnabled()) {
+    ConfigureAPZCTreeManager();
+  }
+
   TextureFactoryIdentifier textureFactoryIdentifier;
   PLayerTransactionChild* shadowManager = nullptr;
   nsTArray<LayersBackend> backendHints;
   GetPreferredCompositorBackends(backendHints);
 
 #if !defined(MOZ_X11) && !defined(XP_WIN)
   if (!mRequireOffMainThreadCompositing &&
       !Preferences::GetBool("layers.offmainthreadcomposition.force-basic", false)) {
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -29,16 +29,18 @@ namespace a11y {
 class Accessible;
 }
 #endif
 
 namespace layers {
 class BasicLayerManager;
 class CompositorChild;
 class CompositorParent;
+class APZCTreeManager;
+class GeckoContentController;
 }
 }
 
 namespace base {
 class Thread;
 }
 
 // Windows specific constant indicating the maximum number of touch points the
@@ -77,16 +79,18 @@ class nsBaseWidget : public nsIWidget
   friend class nsAutoRollup;
 
 protected:
   typedef base::Thread Thread;
   typedef mozilla::layers::BasicLayerManager BasicLayerManager;
   typedef mozilla::layers::BufferMode BufferMode;
   typedef mozilla::layers::CompositorChild CompositorChild;
   typedef mozilla::layers::CompositorParent CompositorParent;
+  typedef mozilla::layers::APZCTreeManager APZCTreeManager;
+  typedef mozilla::layers::GeckoContentController GeckoContentController;
   typedef mozilla::ScreenRotation ScreenRotation;
 
   virtual ~nsBaseWidget();
 
 public:
   nsBaseWidget();
 
   NS_DECL_ISUPPORTS
@@ -295,16 +299,19 @@ protected:
                                           const nsAString &aIconSuffix,
                                           nsIFile **aResult);
   virtual void            OnDestroy();
   virtual void            BaseCreate(nsIWidget *aParent,
                                      const nsIntRect &aRect,
                                      nsDeviceContext *aContext,
                                      nsWidgetInitData *aInitData);
 
+  virtual void ConfigureAPZCTreeManager();
+  virtual already_AddRefed<GeckoContentController> CreateRootContentController();
+
   const nsIntRegion RegionFromArray(const nsTArray<nsIntRect>& aRects);
   void ArrayFromRegion(const nsIntRegion& aRegion, nsTArray<nsIntRect>& aRects);
 
   virtual nsIContent* GetLastRollup()
   {
     return mLastRollup;
   }
 
@@ -402,16 +409,17 @@ protected:
 
   nsIWidgetListener* mWidgetListener;
   nsIWidgetListener* mAttachedWidgetListener;
   nsDeviceContext* mContext;
   nsRefPtr<LayerManager> mLayerManager;
   nsRefPtr<LayerManager> mBasicLayerManager;
   nsRefPtr<CompositorChild> mCompositorChild;
   nsRefPtr<CompositorParent> mCompositorParent;
+  nsRefPtr<APZCTreeManager> mAPZC;
   nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
   nsCursor          mCursor;
   bool              mUpdateCursor;
   nsBorderStyle     mBorderStyle;
   bool              mUseLayersAcceleration;
   bool              mForceLayersAcceleration;
   bool              mTemporarilyUseBasicLayerManager;
   // Windows with out-of-process tabs always require OMTC. This flag designates
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -181,17 +181,17 @@
 #include "npapi.h"
 
 #include <d3d11.h>
 
 #if !defined(SM_CONVERTIBLESLATEMODE)
 #define SM_CONVERTIBLESLATEMODE 0x2003
 #endif
 
-#include "mozilla/layers/CompositorParent.h"
+#include "mozilla/layers/APZCTreeManager.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 using namespace mozilla::widget;
 
 namespace mozilla {
@@ -7661,29 +7661,16 @@ void nsWindow::PickerClosed()
   if (!mPickerDisplayCount)
     return;
   mPickerDisplayCount--;
   if (!mPickerDisplayCount && mDestroyCalled) {
     Destroy();
   }
 }
 
-CompositorParent* nsWindow::NewCompositorParent(int aSurfaceWidth,
-                                                int aSurfaceHeight)
-{
-  CompositorParent *compositor = new CompositorParent(this, false, aSurfaceWidth, aSurfaceHeight);
-
-  if (gfxPrefs::AsyncPanZoomEnabled()) {
-    mAPZC = CompositorParent::GetAPZCTreeManager(compositor->RootLayerTreeId());
-    APZCTreeManager::SetDPI(GetDPI());
-  }
-
-  return compositor;
-}
-
 /**************************************************************
  **************************************************************
  **
  ** BLOCK: ChildWindow impl.
  **
  ** Child window overrides.
  **
  **************************************************************
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -37,17 +37,16 @@
 #ifdef ACCESSIBILITY
 #include "oleacc.h"
 #include "mozilla/a11y/Accessible.h"
 #endif
 
 #include "nsUXThemeData.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIIdleServiceInternal.h"
-#include "mozilla/layers/APZCTreeManager.h"
 
 /**
  * Forward class definitions
  */
 
 class nsNativeDragTarget;
 class nsIRollupListener;
 class nsIFile;
@@ -69,34 +68,32 @@ struct MSGResult;
 class nsWindow : public nsWindowBase
 {
   typedef mozilla::TimeStamp TimeStamp;
   typedef mozilla::TimeDuration TimeDuration;
   typedef mozilla::widget::WindowHook WindowHook;
   typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
   typedef mozilla::widget::NativeKey NativeKey;
   typedef mozilla::widget::MSGResult MSGResult;
-  typedef mozilla::layers::APZCTreeManager APZCTreeManager;
 
 public:
   nsWindow();
 
   NS_DECL_ISUPPORTS_INHERITED
 
   friend class nsWindowGfx;
 
   // nsWindowBase
   virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
                          nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE;
   virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
   virtual bool DispatchKeyboardEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
   virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
   virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE;
   virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return mIsTopWidgetWindow; }
-  virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) MOZ_OVERRIDE;
 
   // nsIWidget interface
   NS_IMETHOD              Create(nsIWidget *aParent,
                                  nsNativeWidget aNativeParent,
                                  const nsIntRect &aRect,
                                  nsDeviceContext *aContext,
                                  nsWidgetInitData *aInitData = nullptr);
   NS_IMETHOD              Destroy();
@@ -588,18 +585,16 @@ protected:
 
   // For converting native event times to timestamps we record the time of the
   // first received event in each time scale.
   static DWORD     sFirstEventTime;
   static TimeStamp sFirstEventTimeStamp;
 
   static bool sNeedsToInitMouseWheelSettings;
   static void InitMouseWheelScrollData();
-
-  nsRefPtr<APZCTreeManager> mAPZC;
 };
 
 /**
  * A child window is a window with different style.
  */
 class ChildWindow : public nsWindow {
 
 public:
--- a/widget/windows/winrt/MetroWidget.cpp
+++ b/widget/windows/winrt/MetroWidget.cpp
@@ -1027,40 +1027,37 @@ MetroWidget::ShouldUseAPZC()
 }
 
 void
 MetroWidget::SetWidgetListener(nsIWidgetListener* aWidgetListener)
 {
   mWidgetListener = aWidgetListener;
 }
 
-CompositorParent* MetroWidget::NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight)
+void
+MetroWidget::ConfigureAPZCTreeManager()
 {
-  CompositorParent *compositor = nsBaseWidget::NewCompositorParent(aSurfaceWidth, aSurfaceHeight);
-
-  if (ShouldUseAPZC()) {
-    mRootLayerTreeId = compositor->RootLayerTreeId();
-
-    mController = new APZController();
-
-    CompositorParent::SetControllerForLayerTree(mRootLayerTreeId, mController);
+  nsBaseWidget::ConfigureAPZCTreeManager();
 
-    APZController::sAPZC = CompositorParent::GetAPZCTreeManager(compositor->RootLayerTreeId());
-    APZController::sAPZC->SetDPI(GetDPI());
+  nsresult rv;
+  nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
+  if (NS_SUCCEEDED(rv)) {
+    observerService->AddObserver(this, "apzc-scroll-offset-changed", false);
+    observerService->AddObserver(this, "apzc-zoom-to-rect", false);
+    observerService->AddObserver(this, "apzc-disable-zoom", false);
+  }
+}
 
-    nsresult rv;
-    nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
-    if (NS_SUCCEEDED(rv)) {
-      observerService->AddObserver(this, "apzc-scroll-offset-changed", false);
-      observerService->AddObserver(this, "apzc-zoom-to-rect", false);
-      observerService->AddObserver(this, "apzc-disable-zoom", false);
-    }
-  }
+already_AddRefed<GeckoContentController>
+MetroWidget::CreateRootContentController()
+{
+  MOZ_ASSERT(!mController);
 
-  return compositor;
+  mController = new APZController();
+  return mController;
 }
 
 MetroWidget::TouchBehaviorFlags
 MetroWidget::ContentGetAllowedTouchBehavior(const nsIntPoint& aPoint)
 {
   return ContentHelper::GetAllowedTouchBehavior(this, aPoint);
 }
 
--- a/widget/windows/winrt/MetroWidget.h
+++ b/widget/windows/winrt/MetroWidget.h
@@ -84,17 +84,16 @@ public:
   virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return true; }
   virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE { return nullptr; }
   // InitEvent assumes physical coordinates and is used by shared win32 code. Do
   // not hand winrt event coordinates to this routine.
   virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
                          nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE;
 
   // nsBaseWidget
-  virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);
   virtual void SetWidgetListener(nsIWidgetListener* aWidgetListener);
 
   // nsIWidget interface
   NS_IMETHOD    Create(nsIWidget *aParent,
                        nsNativeWidget aNativeParent,
                        const nsIntRect &aRect,
                        nsDeviceContext *aContext,
                        nsWidgetInitData *aInitData = nullptr);
@@ -241,16 +240,20 @@ protected:
     ~OleInitializeWrapper() {
       if (SUCCEEDED(hr)) {
         ::OleFlushClipboard();
         ::OleUninitialize();
       }
     }
   };
 
+  // nsBaseWidget
+  void ConfigureAPZCTreeManager() MOZ_OVERRIDE;
+  already_AddRefed<GeckoContentController> NewRootContentController() MOZ_OVERRIDE;
+
   void SetSubclass();
   void RemoveSubclass();
   nsIWidgetListener* GetPaintListener();
 
   // Async event dispatching
   void DispatchAsyncScrollEvent(DispatchMsg* aEvent);
   void DeliverNextScrollEvent();
   void DeliverNextKeyboardEvent();