Bug 1445662 - Assert that IAPZCTreeManager's helper methods are always on the controller thread. r=rhunt

These two functions (UpdateWheelTransaction and ProcessUnhandledEvent)
are only ever called on the concrete APZCTreeManager when the APZ code
is living in the GPU process. This is because the calls are made by the
IAPZCTreeManager implementation which lives in the UI process, and
remoted over PAPZCTreeManager. So the assertion is safe, and will help
us guard against inadvertent breakage when we try making a different
thread the controller thread in the GPU process.

In addition, the WillHandleInput function can be called in the GPU
process on the compositor thread, but we will allow it to be called on
the main thread as well. In that case we need to ensure we don't try
running EventStateManager pref-reading code in the GPU process, and
instead preserve the current behaviour of just returning true.

MozReview-Commit-ID: JFBX3NSXywn

--HG--
extra : rebase_source : 6718944034ec7b7223581e562aa59e9e79b54b53
This commit is contained in:
Kartikaya Gupta 2018-03-14 16:57:41 -04:00
Родитель 354719495e
Коммит 43bc6e764c
1 изменённых файлов: 5 добавлений и 1 удалений

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

@ -1064,7 +1064,7 @@ template<typename PanGestureOrScrollWheelInput>
static bool
WillHandleInput(const PanGestureOrScrollWheelInput& aPanInput)
{
if (!NS_IsMainThread()) {
if (!XRE_IsParentProcess() || !NS_IsMainThread()) {
return true;
}
@ -1795,6 +1795,8 @@ void
APZCTreeManager::UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint,
EventMessage aEventMessage)
{
APZThreadUtils::AssertOnControllerThread();
WheelBlockState* txn = mInputQueue->GetActiveWheelTransaction();
if (!txn) {
return;
@ -1840,6 +1842,8 @@ APZCTreeManager::ProcessUnhandledEvent(LayoutDeviceIntPoint* aRefPoint,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutFocusSequenceNumber)
{
APZThreadUtils::AssertOnControllerThread();
// Transform the aRefPoint.
// If the event hits an overscrolled APZC, instruct the caller to ignore it.
CompositorHitTestInfo hitResult = CompositorHitTestInfo::eInvisibleToHitTest;