Bug 1635001 - P2. Don't use MessageLoop threads with APZ. r=kats,geckoview-reviewers,snorp

It is unclear on why MessageLoop was ever used with this code.

Differential Revision: https://phabricator.services.mozilla.com/D73829
This commit is contained in:
Jean-Yves Avenard 2020-05-08 20:46:13 +00:00
Родитель 731fbf0e5b
Коммит 2df41aacc8
15 изменённых файлов: 89 добавлений и 92 удалений

Просмотреть файл

@ -132,7 +132,7 @@ bool GPUParent::Init(base::ProcessId aParentPid, const char* aParentBuildID,
#endif
CompositorThreadHolder::Start();
APZThreadUtils::SetControllerThread(MessageLoop::current());
APZThreadUtils::SetControllerThread(NS_GetCurrentThread());
apz::InitializeGlobalState();
LayerTreeOwnerTracker::Initialize();
CompositorBridgeParent::InitializeStatics();

Просмотреть файл

@ -111,7 +111,7 @@ class GeckoContentController {
*/
virtual void PostDelayedTask(already_AddRefed<Runnable> aRunnable,
int aDelayMs) {
APZThreadUtils::PostDelayedTask(std::move(aRunnable), aDelayMs);
APZThreadUtils::DelayedDispatch(std::move(aRunnable), aDelayMs);
}
/**

Просмотреть файл

@ -8,7 +8,6 @@
#define mozilla_layers_AsyncPanZoomAnimation_h_
#include "APZUtils.h"
#include "base/message_loop.h"
#include "mozilla/RefPtr.h"
#include "mozilla/TimeStamp.h"
#include "nsISupportsImpl.h"

Просмотреть файл

@ -33,8 +33,6 @@
#include "RecentEventsBuffer.h" // for RecentEventsBuffer
#include "SampledAPZCState.h"
#include "base/message_loop.h"
namespace mozilla {
namespace ipc {

Просмотреть файл

@ -26,7 +26,7 @@ class APZCBasicTester : public APZCTesterBase {
protected:
virtual void SetUp() {
APZThreadUtils::SetThreadAssertionsEnabled(false);
APZThreadUtils::SetControllerThread(MessageLoop::current());
APZThreadUtils::SetControllerThread(NS_GetCurrentThread());
tm = new TestAPZCTreeManager(mcc);
updater = new APZUpdater(tm, false);

Просмотреть файл

@ -23,7 +23,7 @@ class APZCTreeManagerTester : public APZCTesterBase {
virtual void SetUp() {
gfxPlatform::GetPlatform();
APZThreadUtils::SetThreadAssertionsEnabled(false);
APZThreadUtils::SetControllerThread(MessageLoop::current());
APZThreadUtils::SetControllerThread(NS_GetCurrentThread());
manager = new TestAPZCTreeManager(mcc);
updater = new APZUpdater(manager, false);

Просмотреть файл

@ -10,7 +10,7 @@ namespace mozilla {
namespace layers {
static bool sThreadAssertionsEnabled = true;
static MessageLoop* sControllerThread;
static nsISerialEventTarget* sControllerThread;
/*static*/
void APZThreadUtils::SetThreadAssertionsEnabled(bool aEnabled) {
@ -23,11 +23,11 @@ bool APZThreadUtils::GetThreadAssertionsEnabled() {
}
/*static*/
void APZThreadUtils::SetControllerThread(MessageLoop* aLoop) {
void APZThreadUtils::SetControllerThread(nsISerialEventTarget* aThread) {
// We must either be setting the initial controller thread, or removing it,
// or re-using an existing controller thread.
MOZ_ASSERT(!sControllerThread || !aLoop || sControllerThread == aLoop);
sControllerThread = aLoop;
MOZ_ASSERT(!sControllerThread || !aThread || sControllerThread == aThread);
sControllerThread = aThread;
}
/*static*/
@ -36,7 +36,7 @@ void APZThreadUtils::AssertOnControllerThread() {
return;
}
MOZ_ASSERT(sControllerThread == MessageLoop::current());
MOZ_ASSERT(sControllerThread->IsOnCurrentThread());
}
/*static*/
@ -49,25 +49,29 @@ void APZThreadUtils::RunOnControllerThread(RefPtr<Runnable>&& aTask) {
return;
}
if (sControllerThread == MessageLoop::current()) {
if (sControllerThread->IsOnCurrentThread()) {
task->Run();
} else {
sControllerThread->PostTask(task.forget());
sControllerThread->Dispatch(task.forget());
}
}
/*static*/
bool APZThreadUtils::IsControllerThread() {
return sControllerThread == MessageLoop::current();
return sControllerThread == NS_GetCurrentThread();
}
/*static*/
void APZThreadUtils::PostDelayedTask(already_AddRefed<Runnable> aRunnable,
void APZThreadUtils::DelayedDispatch(already_AddRefed<Runnable> aRunnable,
int aDelayMs) {
MOZ_ASSERT(sControllerThread && sControllerThread == MessageLoop::current());
MOZ_ASSERT(sControllerThread && sControllerThread->IsOnCurrentThread());
MOZ_ASSERT(!XRE_IsContentProcess(),
"ContentProcessController should only be used remotely.");
sControllerThread->PostDelayedTask(std::move(aRunnable), aDelayMs);
if (aDelayMs) {
sControllerThread->DelayedDispatch(std::move(aRunnable), aDelayMs);
} else {
sControllerThread->Dispatch(std::move(aRunnable));
}
}
NS_IMPL_ISUPPORTS(GenericNamedTimerCallbackBase, nsITimerCallback, nsINamed)

Просмотреть файл

@ -7,7 +7,6 @@
#ifndef mozilla_layers_APZThreadUtils_h
#define mozilla_layers_APZThreadUtils_h
#include "base/message_loop.h"
#include "nsINamed.h"
#include "nsITimer.h"
@ -30,7 +29,7 @@ class APZThreadUtils {
/**
* Set the controller thread.
*/
static void SetControllerThread(MessageLoop* aLoop);
static void SetControllerThread(nsISerialEventTarget* aThread);
/**
* This can be used to assert that the current thread is the
@ -56,7 +55,7 @@ class APZThreadUtils {
* in the future.
* This method must always be called on the controller thread.
*/
static void PostDelayedTask(already_AddRefed<Runnable> aRunnable,
static void DelayedDispatch(already_AddRefed<Runnable> aRunnable,
int aDelayMs);
};

Просмотреть файл

@ -9,8 +9,6 @@
#include "mozilla/EventStates.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_ui.h"
#include "base/message_loop.h"
#include "base/task.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Document.h"
@ -78,7 +76,7 @@ void ActiveElementManager::TriggerElementActivation() {
"layers::ActiveElementManager::SetActiveTask", this,
&ActiveElementManager::SetActiveTask, mTarget);
mSetActiveTask = task;
MessageLoop::current()->PostDelayedTask(
NS_GetCurrentThread()->DelayedDispatch(
task.forget(), StaticPrefs::ui_touch_activation_delay_ms());
AEM_LOG("Scheduling mSetActiveTask %p\n", mSetActiveTask.get());
}

Просмотреть файл

@ -7,7 +7,6 @@
#include "ChromeProcessController.h"
#include "MainThreadUtils.h" // for NS_IsMainThread()
#include "base/message_loop.h" // for MessageLoop
#include "mozilla/PresShell.h"
#include "mozilla/dom/Element.h"
#include "mozilla/layers/CompositorBridgeParent.h"
@ -34,13 +33,13 @@ ChromeProcessController::ChromeProcessController(
: mWidget(aWidget),
mAPZEventState(aAPZEventState),
mAPZCTreeManager(aAPZCTreeManager),
mUILoop(MessageLoop::current()) {
// Otherwise we're initializing mUILoop incorrectly.
mUIThread(NS_GetCurrentThread()) {
// Otherwise we're initializing mUIThread incorrectly.
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aAPZEventState);
MOZ_ASSERT(aAPZCTreeManager);
mUILoop->PostTask(
mUIThread->Dispatch(
NewRunnableMethod("layers::ChromeProcessController::InitializeRoot", this,
&ChromeProcessController::InitializeRoot));
}
@ -53,8 +52,8 @@ void ChromeProcessController::InitializeRoot() {
void ChromeProcessController::NotifyLayerTransforms(
const nsTArray<MatrixMessage>& aTransforms) {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(NewRunnableMethod<CopyableTArray<MatrixMessage>>(
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(NewRunnableMethod<CopyableTArray<MatrixMessage>>(
"layers::ChromeProcessController::NotifyLayerTransforms", this,
&ChromeProcessController::NotifyLayerTransforms, aTransforms));
return;
@ -82,14 +81,14 @@ void ChromeProcessController::DispatchToRepaintThread(
}
void ChromeProcessController::Destroy() {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(
NewRunnableMethod("layers::ChromeProcessController::Destroy", this,
&ChromeProcessController::Destroy));
return;
}
MOZ_ASSERT(MessageLoop::current() == mUILoop);
MOZ_ASSERT(mUIThread->IsOnCurrentThread());
mWidget = nullptr;
mAPZEventState = nullptr;
}
@ -128,7 +127,7 @@ dom::Document* ChromeProcessController::GetRootContentDocument(
void ChromeProcessController::HandleDoubleTap(
const mozilla::CSSPoint& aPoint, Modifiers aModifiers,
const ScrollableLayerGuid& aGuid) {
MOZ_ASSERT(MessageLoop::current() == mUILoop);
MOZ_ASSERT(mUIThread->IsOnCurrentThread());
RefPtr<dom::Document> document = GetRootContentDocument(aGuid.mScrollId);
if (!document.get()) {
@ -156,9 +155,9 @@ void ChromeProcessController::HandleTap(
uint64_t aInputBlockId) {
MOZ_LOG(sApzChromeLog, LogLevel::Debug,
("HandleTap called with %d\n", (int)aType));
if (MessageLoop::current() != mUILoop) {
if (!mUIThread->IsOnCurrentThread()) {
MOZ_LOG(sApzChromeLog, LogLevel::Debug, ("HandleTap redispatching\n"));
mUILoop->PostTask(
mUIThread->Dispatch(
NewRunnableMethod<TapType, mozilla::LayoutDevicePoint, Modifiers,
ScrollableLayerGuid, uint64_t>(
"layers::ChromeProcessController::HandleTap", this,
@ -216,8 +215,8 @@ void ChromeProcessController::HandleTap(
void ChromeProcessController::NotifyPinchGesture(
PinchGestureInput::PinchGestureType aType, const ScrollableLayerGuid& aGuid,
LayoutDeviceCoord aSpanChange, Modifiers aModifiers) {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(
NewRunnableMethod<PinchGestureInput::PinchGestureType,
ScrollableLayerGuid, LayoutDeviceCoord, Modifiers>(
"layers::ChromeProcessController::NotifyPinchGesture", this,
@ -234,8 +233,8 @@ void ChromeProcessController::NotifyPinchGesture(
void ChromeProcessController::NotifyAPZStateChange(
const ScrollableLayerGuid& aGuid, APZStateChange aChange, int aArg) {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(
NewRunnableMethod<ScrollableLayerGuid, APZStateChange, int>(
"layers::ChromeProcessController::NotifyAPZStateChange", this,
&ChromeProcessController::NotifyAPZStateChange, aGuid, aChange,
@ -252,11 +251,12 @@ void ChromeProcessController::NotifyAPZStateChange(
void ChromeProcessController::NotifyMozMouseScrollEvent(
const ScrollableLayerGuid::ViewID& aScrollId, const nsString& aEvent) {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(NewRunnableMethod<ScrollableLayerGuid::ViewID, nsString>(
"layers::ChromeProcessController::NotifyMozMouseScrollEvent", this,
&ChromeProcessController::NotifyMozMouseScrollEvent, aScrollId,
aEvent));
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(
NewRunnableMethod<ScrollableLayerGuid::ViewID, nsString>(
"layers::ChromeProcessController::NotifyMozMouseScrollEvent", this,
&ChromeProcessController::NotifyMozMouseScrollEvent, aScrollId,
aEvent));
return;
}
@ -272,9 +272,9 @@ void ChromeProcessController::NotifyFlushComplete() {
void ChromeProcessController::NotifyAsyncScrollbarDragInitiated(
uint64_t aDragBlockId, const ScrollableLayerGuid::ViewID& aScrollId,
ScrollDirection aDirection) {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(NewRunnableMethod<uint64_t, ScrollableLayerGuid::ViewID,
ScrollDirection>(
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(NewRunnableMethod<uint64_t, ScrollableLayerGuid::ViewID,
ScrollDirection>(
"layers::ChromeProcessController::NotifyAsyncScrollbarDragInitiated",
this, &ChromeProcessController::NotifyAsyncScrollbarDragInitiated,
aDragBlockId, aScrollId, aDirection));
@ -287,8 +287,8 @@ void ChromeProcessController::NotifyAsyncScrollbarDragInitiated(
void ChromeProcessController::NotifyAsyncScrollbarDragRejected(
const ScrollableLayerGuid::ViewID& aScrollId) {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(NewRunnableMethod<ScrollableLayerGuid::ViewID>(
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(NewRunnableMethod<ScrollableLayerGuid::ViewID>(
"layers::ChromeProcessController::NotifyAsyncScrollbarDragRejected",
this, &ChromeProcessController::NotifyAsyncScrollbarDragRejected,
aScrollId));
@ -300,8 +300,8 @@ void ChromeProcessController::NotifyAsyncScrollbarDragRejected(
void ChromeProcessController::NotifyAsyncAutoscrollRejected(
const ScrollableLayerGuid::ViewID& aScrollId) {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(NewRunnableMethod<ScrollableLayerGuid::ViewID>(
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(NewRunnableMethod<ScrollableLayerGuid::ViewID>(
"layers::ChromeProcessController::NotifyAsyncAutoscrollRejected", this,
&ChromeProcessController::NotifyAsyncAutoscrollRejected, aScrollId));
return;
@ -312,8 +312,8 @@ void ChromeProcessController::NotifyAsyncAutoscrollRejected(
void ChromeProcessController::CancelAutoscroll(
const ScrollableLayerGuid& aGuid) {
if (MessageLoop::current() != mUILoop) {
mUILoop->PostTask(NewRunnableMethod<ScrollableLayerGuid>(
if (!mUIThread->IsOnCurrentThread()) {
mUIThread->Dispatch(NewRunnableMethod<ScrollableLayerGuid>(
"layers::ChromeProcessController::CancelAutoscroll", this,
&ChromeProcessController::CancelAutoscroll, aGuid));
return;

Просмотреть файл

@ -13,9 +13,8 @@
#include "mozilla/layers/MatrixMessage.h"
class nsIDOMWindowUtils;
class nsISerialEventTarget;
class nsIWidget;
class MessageLoop;
namespace mozilla {
class PresShell;
@ -81,7 +80,7 @@ class ChromeProcessController : public mozilla::layers::GeckoContentController {
nsCOMPtr<nsIWidget> mWidget;
RefPtr<APZEventState> mAPZEventState;
RefPtr<IAPZCTreeManager> mAPZCTreeManager;
MessageLoop* mUILoop;
nsCOMPtr<nsISerialEventTarget> mUIThread;
void InitializeRoot();
PresShell* GetPresShell() const;

Просмотреть файл

@ -6,8 +6,6 @@
#include "mozilla/layers/RemoteContentController.h"
#include "base/message_loop.h"
#include "base/task.h"
#include "MainThreadUtils.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/layers/APZCCallbackHelper.h"
@ -29,18 +27,19 @@ namespace layers {
using namespace mozilla::gfx;
RemoteContentController::RemoteContentController()
: mCompositorThread(MessageLoop::current()), mCanSend(true) {}
: mCompositorThread(NS_GetCurrentThread()), mCanSend(true) {
MOZ_ASSERT(CompositorThread()->IsOnCurrentThread());
}
RemoteContentController::~RemoteContentController() = default;
void RemoteContentController::NotifyLayerTransforms(
const nsTArray<MatrixMessage>& aTransforms) {
if (MessageLoop::current() != mCompositorThread) {
if (!mCompositorThread->IsOnCurrentThread()) {
// We have to send messages from the compositor thread
mCompositorThread->PostTask(
NewRunnableMethod<CopyableTArray<MatrixMessage>>(
"layers::RemoteContentController::NotifyLayerTransforms", this,
&RemoteContentController::NotifyLayerTransforms, aTransforms));
mCompositorThread->Dispatch(NewRunnableMethod<CopyableTArray<MatrixMessage>>(
"layers::RemoteContentController::NotifyLayerTransforms", this,
&RemoteContentController::NotifyLayerTransforms, aTransforms));
return;
}
@ -78,7 +77,7 @@ void RemoteContentController::HandleTapOnCompositorThread(
TapType aTapType, LayoutDevicePoint aPoint, Modifiers aModifiers,
ScrollableLayerGuid aGuid, uint64_t aInputBlockId) {
MOZ_ASSERT(XRE_IsGPUProcess());
MOZ_ASSERT(MessageLoop::current() == mCompositorThread);
MOZ_ASSERT(mCompositorThread->IsOnCurrentThread());
// The raw pointer to APZCTreeManagerParent is ok here because we are on the
// compositor thread.
@ -99,12 +98,12 @@ void RemoteContentController::HandleTap(TapType aTapType,
APZThreadUtils::AssertOnControllerThread();
if (XRE_GetProcessType() == GeckoProcessType_GPU) {
if (MessageLoop::current() == mCompositorThread) {
if (mCompositorThread->IsOnCurrentThread()) {
HandleTapOnCompositorThread(aTapType, aPoint, aModifiers, aGuid,
aInputBlockId);
} else {
// We have to send messages from the compositor thread
mCompositorThread->PostTask(
mCompositorThread->Dispatch(
NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers,
ScrollableLayerGuid, uint64_t>(
"layers::RemoteContentController::HandleTapOnCompositorThread",
@ -144,7 +143,7 @@ void RemoteContentController::HandleTap(TapType aTapType,
void RemoteContentController::NotifyPinchGestureOnCompositorThread(
PinchGestureInput::PinchGestureType aType, const ScrollableLayerGuid& aGuid,
LayoutDeviceCoord aSpanChange, Modifiers aModifiers) {
MOZ_ASSERT(MessageLoop::current() == mCompositorThread);
MOZ_ASSERT(mCompositorThread->IsOnCurrentThread());
// The raw pointer to APZCTreeManagerParent is ok here because we are on the
// compositor thread.
@ -167,11 +166,11 @@ void RemoteContentController::NotifyPinchGesture(
// If we're in the GPU process, try to find a handle to the parent process
// and send it there.
if (XRE_IsGPUProcess()) {
if (MessageLoop::current() == mCompositorThread) {
if (mCompositorThread->IsOnCurrentThread()) {
NotifyPinchGestureOnCompositorThread(aType, aGuid, aSpanChange,
aModifiers);
} else {
mCompositorThread->PostTask(
mCompositorThread->Dispatch(
NewRunnableMethod<PinchGestureInput::PinchGestureType,
ScrollableLayerGuid, LayoutDeviceCoord, Modifiers>(
"layers::RemoteContentController::"
@ -198,19 +197,19 @@ void RemoteContentController::NotifyPinchGesture(
}
bool RemoteContentController::IsRepaintThread() {
return MessageLoop::current() == mCompositorThread;
return mCompositorThread->IsOnCurrentThread();
}
void RemoteContentController::DispatchToRepaintThread(
already_AddRefed<Runnable> aTask) {
mCompositorThread->PostTask(std::move(aTask));
mCompositorThread->Dispatch(std::move(aTask));
}
void RemoteContentController::NotifyAPZStateChange(
const ScrollableLayerGuid& aGuid, APZStateChange aChange, int aArg) {
if (MessageLoop::current() != mCompositorThread) {
if (!mCompositorThread->IsOnCurrentThread()) {
// We have to send messages from the compositor thread
mCompositorThread->PostTask(
mCompositorThread->Dispatch(
NewRunnableMethod<ScrollableLayerGuid, APZStateChange, int>(
"layers::RemoteContentController::NotifyAPZStateChange", this,
&RemoteContentController::NotifyAPZStateChange, aGuid, aChange,
@ -225,8 +224,8 @@ void RemoteContentController::NotifyAPZStateChange(
void RemoteContentController::UpdateOverscrollVelocity(float aX, float aY,
bool aIsRootContent) {
if (MessageLoop::current() != mCompositorThread) {
mCompositorThread->PostTask(NewRunnableMethod<float, float, bool>(
if (!mCompositorThread->IsOnCurrentThread()) {
mCompositorThread->Dispatch(NewRunnableMethod<float, float, bool>(
"layers::RemoteContentController::UpdateOverscrollVelocity", this,
&RemoteContentController::UpdateOverscrollVelocity, aX, aY,
aIsRootContent));
@ -239,8 +238,8 @@ void RemoteContentController::UpdateOverscrollVelocity(float aX, float aY,
void RemoteContentController::UpdateOverscrollOffset(float aX, float aY,
bool aIsRootContent) {
if (MessageLoop::current() != mCompositorThread) {
mCompositorThread->PostTask(NewRunnableMethod<float, float, bool>(
if (!mCompositorThread->IsOnCurrentThread()) {
mCompositorThread->Dispatch(NewRunnableMethod<float, float, bool>(
"layers::RemoteContentController::UpdateOverscrollOffset", this,
&RemoteContentController::UpdateOverscrollOffset, aX, aY,
aIsRootContent));
@ -253,9 +252,9 @@ void RemoteContentController::UpdateOverscrollOffset(float aX, float aY,
void RemoteContentController::NotifyMozMouseScrollEvent(
const ScrollableLayerGuid::ViewID& aScrollId, const nsString& aEvent) {
if (MessageLoop::current() != mCompositorThread) {
if (!mCompositorThread->IsOnCurrentThread()) {
// We have to send messages from the compositor thread
mCompositorThread->PostTask(
mCompositorThread->Dispatch(
NewRunnableMethod<ScrollableLayerGuid::ViewID, nsString>(
"layers::RemoteContentController::NotifyMozMouseScrollEvent", this,
&RemoteContentController::NotifyMozMouseScrollEvent, aScrollId,
@ -279,9 +278,9 @@ void RemoteContentController::NotifyFlushComplete() {
void RemoteContentController::NotifyAsyncScrollbarDragInitiated(
uint64_t aDragBlockId, const ScrollableLayerGuid::ViewID& aScrollId,
ScrollDirection aDirection) {
if (MessageLoop::current() != mCompositorThread) {
if (!mCompositorThread->IsOnCurrentThread()) {
// We have to send messages from the compositor thread
mCompositorThread->PostTask(NewRunnableMethod<uint64_t,
mCompositorThread->Dispatch(NewRunnableMethod<uint64_t,
ScrollableLayerGuid::ViewID,
ScrollDirection>(
"layers::RemoteContentController::NotifyAsyncScrollbarDragInitiated",
@ -298,9 +297,9 @@ void RemoteContentController::NotifyAsyncScrollbarDragInitiated(
void RemoteContentController::NotifyAsyncScrollbarDragRejected(
const ScrollableLayerGuid::ViewID& aScrollId) {
if (MessageLoop::current() != mCompositorThread) {
if (!mCompositorThread->IsOnCurrentThread()) {
// We have to send messages from the compositor thread
mCompositorThread->PostTask(NewRunnableMethod<ScrollableLayerGuid::ViewID>(
mCompositorThread->Dispatch(NewRunnableMethod<ScrollableLayerGuid::ViewID>(
"layers::RemoteContentController::NotifyAsyncScrollbarDragRejected",
this, &RemoteContentController::NotifyAsyncScrollbarDragRejected,
aScrollId));
@ -314,9 +313,9 @@ void RemoteContentController::NotifyAsyncScrollbarDragRejected(
void RemoteContentController::NotifyAsyncAutoscrollRejected(
const ScrollableLayerGuid::ViewID& aScrollId) {
if (MessageLoop::current() != mCompositorThread) {
if (!mCompositorThread->IsOnCurrentThread()) {
// We have to send messages from the compositor thread
mCompositorThread->PostTask(NewRunnableMethod<ScrollableLayerGuid::ViewID>(
mCompositorThread->Dispatch(NewRunnableMethod<ScrollableLayerGuid::ViewID>(
"layers::RemoteContentController::NotifyAsyncAutoscrollRejected", this,
&RemoteContentController::NotifyAsyncAutoscrollRejected, aScrollId));
return;
@ -354,8 +353,8 @@ void RemoteContentController::CancelAutoscrollCrossProcess(
const ScrollableLayerGuid& aGuid) {
MOZ_ASSERT(XRE_IsGPUProcess());
if (MessageLoop::current() != mCompositorThread) {
mCompositorThread->PostTask(NewRunnableMethod<ScrollableLayerGuid>(
if (!mCompositorThread->IsOnCurrentThread()) {
mCompositorThread->Dispatch(NewRunnableMethod<ScrollableLayerGuid>(
"layers::RemoteContentController::CancelAutoscrollCrossProcess", this,
&RemoteContentController::CancelAutoscrollCrossProcess, aGuid));
return;

Просмотреть файл

@ -88,7 +88,7 @@ class RemoteContentController : public GeckoContentController,
bool IsRemote() override;
private:
MessageLoop* mCompositorThread;
nsCOMPtr<nsISerialEventTarget> mCompositorThread;
bool mCanSend;
void HandleTapOnMainThread(TapType aType, LayoutDevicePoint aPoint,

Просмотреть файл

@ -2291,7 +2291,8 @@ bool nsWindow::NeedsPaint() {
}
void nsWindow::ConfigureAPZControllerThread() {
APZThreadUtils::SetControllerThread(mozilla::GetAndroidUiThreadMessageLoop());
nsCOMPtr<nsISerialEventTarget> thread = mozilla::GetAndroidUiThread();
APZThreadUtils::SetControllerThread(thread);
}
already_AddRefed<GeckoContentController>

Просмотреть файл

@ -907,7 +907,7 @@ void nsBaseWidget::ConfigureAPZCTreeManager() {
void nsBaseWidget::ConfigureAPZControllerThread() {
// By default the controller thread is the main thread.
APZThreadUtils::SetControllerThread(MessageLoop::current());
APZThreadUtils::SetControllerThread(NS_GetCurrentThread());
}
void nsBaseWidget::SetConfirmedTargetAPZC(