Bug 1321644 - part 1, Remove android specific message loop code from APZThreadUtils.cpp r=botond
☠☠ backed out by f0840950a19b ☠ ☠
authorRandall Barker <rbarker@mozilla.com>
Wed, 30 Nov 2016 15:00:45 -0800
changeset 327042 c25bce77b775a551e55f80faaa9b721f6bdbbac9
parent 327041 15b92bb6d8107bbc60c1932e340b4a954ed8a8d2
child 327043 60ba1893ecf3690dcee0be7872d3de2ca26c557e
push id85087
push userrbarker@mozilla.com
push dateFri, 23 Dec 2016 00:22:27 +0000
treeherdermozilla-inbound@60ba1893ecf3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1321644
milestone53.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
Bug 1321644 - part 1, Remove android specific message loop code from APZThreadUtils.cpp r=botond
gfx/layers/apz/util/APZThreadUtils.cpp
widget/android/AndroidContentController.cpp
widget/android/AndroidContentController.h
--- a/gfx/layers/apz/util/APZThreadUtils.cpp
+++ b/gfx/layers/apz/util/APZThreadUtils.cpp
@@ -1,19 +1,16 @@
 /* -*- 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 "mozilla/layers/APZThreadUtils.h"
 
 #include "mozilla/layers/Compositor.h"
-#ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
-#endif
 
 namespace mozilla {
 namespace layers {
 
 static bool sThreadAssertionsEnabled = true;
 static MessageLoop* sControllerThread;
 
 /*static*/ void
@@ -52,45 +49,31 @@ APZThreadUtils::AssertOnCompositorThread
   }
 }
 
 /*static*/ void
 APZThreadUtils::RunOnControllerThread(already_AddRefed<Runnable> aTask)
 {
   RefPtr<Runnable> task = aTask;
 
-#ifdef MOZ_WIDGET_ANDROID
-  // This is needed while nsWindow::ConfigureAPZControllerThread is not propper
-  // implemented.
-  if (AndroidBridge::IsJavaUiThread()) {
-    task->Run();
-  } else {
-    AndroidBridge::Bridge()->PostTaskToUiThread(task.forget(), 0);
-  }
-#else
   if (!sControllerThread) {
     // Could happen on startup
     NS_WARNING("Dropping task posted to controller thread");
     return;
   }
 
   if (sControllerThread == MessageLoop::current()) {
     task->Run();
   } else {
     sControllerThread->PostTask(task.forget());
   }
-#endif
 }
 
 /*static*/ bool
 APZThreadUtils::IsControllerThread()
 {
-#ifdef MOZ_WIDGET_ANDROID
-  return AndroidBridge::IsJavaUiThread();
-#else
   return sControllerThread == MessageLoop::current();
-#endif
 }
 
 NS_IMPL_ISUPPORTS(GenericTimerCallbackBase, nsITimerCallback)
 
 } // namespace layers
 } // namespace mozilla
--- a/widget/android/AndroidContentController.cpp
+++ b/widget/android/AndroidContentController.cpp
@@ -21,34 +21,16 @@ namespace widget {
 void
 AndroidContentController::Destroy()
 {
     mAndroidWindow = nullptr;
     ChromeProcessController::Destroy();
 }
 
 void
-AndroidContentController::NotifyDefaultPrevented(IAPZCTreeManager* aManager,
-                                                 uint64_t aInputBlockId,
-                                                 bool aDefaultPrevented)
-{
-    if (!AndroidBridge::IsJavaUiThread()) {
-        // The notification must reach the APZ on the Java UI thread (aka the
-        // APZ "controller" thread) but we get it from the Gecko thread, so we
-        // have to throw it onto the other thread.
-        AndroidBridge::Bridge()->PostTaskToUiThread(NewRunnableMethod<uint64_t, bool>(
-            aManager, &IAPZCTreeManager::ContentReceivedInputBlock,
-            aInputBlockId, aDefaultPrevented), 0);
-        return;
-    }
-
-    aManager->ContentReceivedInputBlock(aInputBlockId, aDefaultPrevented);
-}
-
-void
 AndroidContentController::DispatchSingleTapToObservers(const LayoutDevicePoint& aPoint,
                                                        const ScrollableLayerGuid& aGuid) const
 {
     nsIContent* content = nsLayoutUtils::FindContentFor(aGuid.mScrollId);
     nsPresContext* context = content
         ? mozilla::layers::APZCCallbackHelper::GetPresContextForContent(content)
         : nullptr;
 
@@ -97,21 +79,16 @@ AndroidContentController::HandleTap(TapT
         (aType == TapType::eSingleTap || aType == TapType::eSecondTap)) {
         DispatchSingleTapToObservers(aPoint, aGuid);
     }
 
     ChromeProcessController::HandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId);
 }
 
 void
-AndroidContentController::PostDelayedTask(already_AddRefed<Runnable> aTask, int aDelayMs)
-{
-    AndroidBridge::Bridge()->PostTaskToUiThread(Move(aTask), aDelayMs);
-}
-void
 AndroidContentController::UpdateOverscrollVelocity(const float aX, const float aY, const bool aIsRootContent)
 {
   if (aIsRootContent && mAndroidWindow) {
     mAndroidWindow->UpdateOverscrollVelocity(aX, aY);
   }
 }
 
 void
--- a/widget/android/AndroidContentController.h
+++ b/widget/android/AndroidContentController.h
@@ -31,26 +31,22 @@ public:
       : mozilla::layers::ChromeProcessController(aWindow, aAPZEventState, aAPZCTreeManager)
       , mAndroidWindow(aWindow)
     {}
 
     // ChromeProcessController methods
     virtual void Destroy() override;
     void HandleTap(TapType aType, const LayoutDevicePoint& aPoint, Modifiers aModifiers,
                    const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) override;
-    void PostDelayedTask(already_AddRefed<Runnable> aTask, int aDelayMs) override;
     void UpdateOverscrollVelocity(const float aX, const float aY, const bool aIsRootContent) override;
     void UpdateOverscrollOffset(const float aX, const float aY, const bool aIsRootContent) override;
     void SetScrollingRootContent(const bool isRootContent) override;
     void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
                               APZStateChange aChange,
                               int aArg) override;
-
-    static void NotifyDefaultPrevented(mozilla::layers::IAPZCTreeManager* aManager,
-                                       uint64_t aInputBlockId, bool aDefaultPrevented);
 private:
     nsWindow* mAndroidWindow;
 
     void DispatchSingleTapToObservers(const LayoutDevicePoint& aPoint,
                                       const ScrollableLayerGuid& aGuid) const;
 };
 
 } // namespace widget