Clean up APZCTM initialization on Android. (bug 1110540 part 3, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Mon, 15 Dec 2014 01:49:51 -0800
changeset 219725 70e6bd31ce14e4c2cee1b8e3d005396b06ee02e9
parent 219724 71b13c6e679a7436dfd3cd3ab6411f9358388f33
child 219726 ca218faa12dd1d08ae1d93bbc8fa4127a772394c
push id27967
push userryanvm@gmail.com
push dateMon, 15 Dec 2014 18:52:54 +0000
treeherdermozilla-central@5d6e0d038f95 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1110540
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Clean up APZCTM initialization on Android. (bug 1110540 part 3, r=kats)
widget/android/nsWindow.cpp
widget/android/nsWindow.h
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2491,26 +2491,34 @@ CompositorParent*
 nsWindow::NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight)
 {
     return new CompositorParent(this, true, aSurfaceWidth, aSurfaceHeight);
 }
 
 mozilla::layers::APZCTreeManager*
 nsWindow::GetAPZCTreeManager()
 {
+    return sApzcTreeManager;
+}
+
+void
+nsWindow::ConfigureAPZCTreeManager()
+{
+    nsBaseWidget::ConfigureAPZCTreeManager();
     if (!sApzcTreeManager) {
-        CompositorParent* compositor = sCompositorParent;
-        if (!compositor) {
-            return nullptr;
-        }
-        uint64_t rootLayerTreeId = compositor->RootLayerTreeId();
-        CompositorParent::SetControllerForLayerTree(rootLayerTreeId, mozilla::widget::android::APZCCallbackHandler::GetInstance());
-        sApzcTreeManager = CompositorParent::GetAPZCTreeManager(rootLayerTreeId);
+        sApzcTreeManager = mAPZC;
     }
-    return sApzcTreeManager;
+}
+
+already_AddRefed<GeckoContentController>
+nsWindow::CreateRootContentController()
+{
+    nsRefPtr<widget::android::APZCCallbackHandler> controller =
+        widget::android::APZCCallbackHandler::GetInstance();
+    return controller.forget();
 }
 
 uint64_t
 nsWindow::RootLayerTreeId()
 {
     MOZ_ASSERT(sCompositorParent);
     return sCompositorParent->RootLayerTreeId();
 }
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -169,16 +169,19 @@ public:
 protected:
     void BringToFront();
     nsWindow *FindTopLevel();
     bool IsTopLevel();
     void RemoveIMEComposition();
     void PostFlushIMEChanges();
     void FlushIMEChanges();
 
+    void ConfigureAPZCTreeManager() MOZ_OVERRIDE;
+    already_AddRefed<GeckoContentController> CreateRootContentController() MOZ_OVERRIDE;
+
     // Call this function when the users activity is the direct cause of an
     // event (like a keypress or mouse click).
     void UserActivity();
 
     bool mIsVisible;
     nsTArray<nsWindow*> mChildren;
     nsWindow* mParent;
     nsWindow* mFocus;