LCOV - code coverage report
Current view: top level - gfx/layers/ipc - APZCTreeManagerParent.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 8 116 6.9 %
Date: 2017-07-14 16:53:18 Functions: 2 24 8.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=99: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "mozilla/layers/APZCTreeManagerParent.h"
       8             : 
       9             : #include "mozilla/layers/APZCTreeManager.h"
      10             : #include "mozilla/layers/APZThreadUtils.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace layers {
      14             : 
      15           1 : APZCTreeManagerParent::APZCTreeManagerParent(uint64_t aLayersId, RefPtr<APZCTreeManager> aAPZCTreeManager)
      16             :   : mLayersId(aLayersId)
      17           1 :   , mTreeManager(aAPZCTreeManager)
      18             : {
      19           1 :   MOZ_ASSERT(aAPZCTreeManager != nullptr);
      20           1 : }
      21             : 
      22           0 : APZCTreeManagerParent::~APZCTreeManagerParent()
      23             : {
      24           0 : }
      25             : 
      26             : void
      27           0 : APZCTreeManagerParent::ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager)
      28             : {
      29           0 :   MOZ_ASSERT(aAPZCTreeManager != nullptr);
      30           0 :   mTreeManager = aAPZCTreeManager;
      31           0 : }
      32             : 
      33             : mozilla::ipc::IPCResult
      34           0 : APZCTreeManagerParent::RecvReceiveMultiTouchInputEvent(
      35             :     const MultiTouchInput& aEvent,
      36             :     nsEventStatus* aOutStatus,
      37             :     MultiTouchInput* aOutEvent,
      38             :     ScrollableLayerGuid* aOutTargetGuid,
      39             :     uint64_t* aOutInputBlockId)
      40             : {
      41           0 :   MultiTouchInput event = aEvent;
      42             : 
      43           0 :   *aOutStatus = mTreeManager->ReceiveInputEvent(
      44             :     event,
      45             :     aOutTargetGuid,
      46           0 :     aOutInputBlockId);
      47           0 :   *aOutEvent = event;
      48             : 
      49           0 :   return IPC_OK();
      50             : }
      51             : 
      52             : mozilla::ipc::IPCResult
      53           0 : APZCTreeManagerParent::RecvReceiveMouseInputEvent(
      54             :     const MouseInput& aEvent,
      55             :     nsEventStatus* aOutStatus,
      56             :     MouseInput* aOutEvent,
      57             :     ScrollableLayerGuid* aOutTargetGuid,
      58             :     uint64_t* aOutInputBlockId)
      59             : {
      60           0 :   MouseInput event = aEvent;
      61             : 
      62           0 :   *aOutStatus = mTreeManager->ReceiveInputEvent(
      63             :     event,
      64             :     aOutTargetGuid,
      65           0 :     aOutInputBlockId);
      66           0 :   *aOutEvent = event;
      67             : 
      68           0 :   return IPC_OK();
      69             : }
      70             : 
      71             : mozilla::ipc::IPCResult
      72           0 : APZCTreeManagerParent::RecvReceivePanGestureInputEvent(
      73             :     const PanGestureInput& aEvent,
      74             :     nsEventStatus* aOutStatus,
      75             :     PanGestureInput* aOutEvent,
      76             :     ScrollableLayerGuid* aOutTargetGuid,
      77             :     uint64_t* aOutInputBlockId)
      78             : {
      79           0 :   PanGestureInput event = aEvent;
      80             : 
      81           0 :   *aOutStatus = mTreeManager->ReceiveInputEvent(
      82             :     event,
      83             :     aOutTargetGuid,
      84           0 :     aOutInputBlockId);
      85           0 :   *aOutEvent = event;
      86             : 
      87           0 :   return IPC_OK();
      88             : }
      89             : 
      90             : mozilla::ipc::IPCResult
      91           0 : APZCTreeManagerParent::RecvReceivePinchGestureInputEvent(
      92             :     const PinchGestureInput& aEvent,
      93             :     nsEventStatus* aOutStatus,
      94             :     PinchGestureInput* aOutEvent,
      95             :     ScrollableLayerGuid* aOutTargetGuid,
      96             :     uint64_t* aOutInputBlockId)
      97             : {
      98           0 :   PinchGestureInput event = aEvent;
      99             : 
     100           0 :   *aOutStatus = mTreeManager->ReceiveInputEvent(
     101             :     event,
     102             :     aOutTargetGuid,
     103           0 :     aOutInputBlockId);
     104           0 :   *aOutEvent = event;
     105             : 
     106           0 :   return IPC_OK();
     107             : }
     108             : 
     109             : mozilla::ipc::IPCResult
     110           0 : APZCTreeManagerParent::RecvReceiveTapGestureInputEvent(
     111             :     const TapGestureInput& aEvent,
     112             :     nsEventStatus* aOutStatus,
     113             :     TapGestureInput* aOutEvent,
     114             :     ScrollableLayerGuid* aOutTargetGuid,
     115             :     uint64_t* aOutInputBlockId)
     116             : {
     117           0 :   TapGestureInput event = aEvent;
     118             : 
     119           0 :   *aOutStatus = mTreeManager->ReceiveInputEvent(
     120             :     event,
     121             :     aOutTargetGuid,
     122           0 :     aOutInputBlockId);
     123           0 :   *aOutEvent = event;
     124             : 
     125           0 :   return IPC_OK();
     126             : }
     127             : 
     128             : mozilla::ipc::IPCResult
     129           0 : APZCTreeManagerParent::RecvReceiveScrollWheelInputEvent(
     130             :     const ScrollWheelInput& aEvent,
     131             :     nsEventStatus* aOutStatus,
     132             :     ScrollWheelInput* aOutEvent,
     133             :     ScrollableLayerGuid* aOutTargetGuid,
     134             :     uint64_t* aOutInputBlockId)
     135             : {
     136           0 :   ScrollWheelInput event = aEvent;
     137             : 
     138           0 :   *aOutStatus = mTreeManager->ReceiveInputEvent(
     139             :     event,
     140             :     aOutTargetGuid,
     141           0 :     aOutInputBlockId);
     142           0 :   *aOutEvent = event;
     143             : 
     144           0 :   return IPC_OK();
     145             : }
     146             : 
     147             : mozilla::ipc::IPCResult
     148           0 : APZCTreeManagerParent::RecvReceiveKeyboardInputEvent(
     149             :         const KeyboardInput& aEvent,
     150             :         nsEventStatus* aOutStatus,
     151             :         KeyboardInput* aOutEvent,
     152             :         ScrollableLayerGuid* aOutTargetGuid,
     153             :         uint64_t* aOutInputBlockId)
     154             : {
     155           0 :   KeyboardInput event = aEvent;
     156             : 
     157           0 :   *aOutStatus = mTreeManager->ReceiveInputEvent(
     158             :     event,
     159             :     aOutTargetGuid,
     160           0 :     aOutInputBlockId);
     161           0 :   *aOutEvent = event;
     162             : 
     163           0 :   return IPC_OK();
     164             : }
     165             : 
     166             : mozilla::ipc::IPCResult
     167           0 : APZCTreeManagerParent::RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap)
     168             : {
     169           0 :   mTreeManager->SetKeyboardMap(aKeyboardMap);
     170             : 
     171           0 :   return IPC_OK();
     172             : }
     173             : 
     174             : mozilla::ipc::IPCResult
     175           0 : APZCTreeManagerParent::RecvZoomToRect(
     176             :     const ScrollableLayerGuid& aGuid,
     177             :     const CSSRect& aRect,
     178             :     const uint32_t& aFlags)
     179             : {
     180           0 :   if (aGuid.mLayersId != mLayersId) {
     181             :     // Guard against bad data from hijacked child processes
     182           0 :     NS_ERROR("Unexpected layers id in RecvZoomToRect; dropping message...");
     183           0 :     return IPC_FAIL_NO_REASON(this);
     184             :   }
     185             : 
     186           0 :   mTreeManager->ZoomToRect(aGuid, aRect, aFlags);
     187           0 :   return IPC_OK();
     188             : }
     189             : 
     190             : mozilla::ipc::IPCResult
     191           0 : APZCTreeManagerParent::RecvContentReceivedInputBlock(
     192             :     const uint64_t& aInputBlockId,
     193             :     const bool& aPreventDefault)
     194             : {
     195           0 :   APZThreadUtils::RunOnControllerThread(NewRunnableMethod<uint64_t, bool>(
     196             :     "layers::IAPZCTreeManager::ContentReceivedInputBlock",
     197             :     mTreeManager,
     198             :     &IAPZCTreeManager::ContentReceivedInputBlock,
     199             :     aInputBlockId,
     200           0 :     aPreventDefault));
     201             : 
     202           0 :   return IPC_OK();
     203             : }
     204             : 
     205             : mozilla::ipc::IPCResult
     206           0 : APZCTreeManagerParent::RecvSetTargetAPZC(
     207             :     const uint64_t& aInputBlockId,
     208             :     nsTArray<ScrollableLayerGuid>&& aTargets)
     209             : {
     210           0 :   for (size_t i = 0; i < aTargets.Length(); i++) {
     211           0 :     if (aTargets[i].mLayersId != mLayersId) {
     212             :       // Guard against bad data from hijacked child processes
     213           0 :       NS_ERROR("Unexpected layers id in RecvSetTargetAPZC; dropping message...");
     214           0 :       return IPC_FAIL_NO_REASON(this);
     215             :     }
     216             :   }
     217           0 :   APZThreadUtils::RunOnControllerThread(
     218             :     NewRunnableMethod<uint64_t,
     219           0 :                       StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>(
     220             :       "layers::IAPZCTreeManager::SetTargetAPZC",
     221             :       mTreeManager,
     222             :       &IAPZCTreeManager::SetTargetAPZC,
     223             :       aInputBlockId,
     224           0 :       aTargets));
     225             : 
     226           0 :   return IPC_OK();
     227             : }
     228             : 
     229             : mozilla::ipc::IPCResult
     230           1 : APZCTreeManagerParent::RecvUpdateZoomConstraints(
     231             :     const ScrollableLayerGuid& aGuid,
     232             :     const MaybeZoomConstraints& aConstraints)
     233             : {
     234           1 :   if (aGuid.mLayersId != mLayersId) {
     235             :     // Guard against bad data from hijacked child processes
     236           0 :     NS_ERROR("Unexpected layers id in RecvUpdateZoomConstraints; dropping message...");
     237           0 :     return IPC_FAIL_NO_REASON(this);
     238             :   }
     239             : 
     240           1 :   mTreeManager->UpdateZoomConstraints(aGuid, aConstraints);
     241           1 :   return IPC_OK();
     242             : }
     243             : 
     244             : mozilla::ipc::IPCResult
     245           0 : APZCTreeManagerParent::RecvCancelAnimation(const ScrollableLayerGuid& aGuid)
     246             : {
     247           0 :   if (aGuid.mLayersId != mLayersId) {
     248             :     // Guard against bad data from hijacked child processes
     249           0 :     NS_ERROR("Unexpected layers id in RecvCancelAnimation; dropping message...");
     250           0 :     return IPC_FAIL_NO_REASON(this);
     251             :   }
     252             : 
     253           0 :   mTreeManager->CancelAnimation(aGuid);
     254           0 :   return IPC_OK();
     255             : }
     256             : 
     257             : mozilla::ipc::IPCResult
     258           0 : APZCTreeManagerParent::RecvSetDPI(const float& aDpiValue)
     259             : {
     260           0 :   mTreeManager->SetDPI(aDpiValue);
     261           0 :   return IPC_OK();
     262             : }
     263             : 
     264             : mozilla::ipc::IPCResult
     265           0 : APZCTreeManagerParent::RecvSetAllowedTouchBehavior(
     266             :     const uint64_t& aInputBlockId,
     267             :     nsTArray<TouchBehaviorFlags>&& aValues)
     268             : {
     269           0 :   APZThreadUtils::RunOnControllerThread(
     270             :     NewRunnableMethod<uint64_t,
     271           0 :                       StoreCopyPassByRRef<nsTArray<TouchBehaviorFlags>>>(
     272             :       "layers::IAPZCTreeManager::SetAllowedTouchBehavior",
     273             :       mTreeManager,
     274             :       &IAPZCTreeManager::SetAllowedTouchBehavior,
     275             :       aInputBlockId,
     276           0 :       Move(aValues)));
     277             : 
     278           0 :   return IPC_OK();
     279             : }
     280             : 
     281             : mozilla::ipc::IPCResult
     282           0 : APZCTreeManagerParent::RecvStartScrollbarDrag(
     283             :     const ScrollableLayerGuid& aGuid,
     284             :     const AsyncDragMetrics& aDragMetrics)
     285             : {
     286           0 :   if (aGuid.mLayersId != mLayersId) {
     287             :     // Guard against bad data from hijacked child processes
     288           0 :     NS_ERROR("Unexpected layers id in RecvStartScrollbarDrag; dropping message...");
     289           0 :     return IPC_FAIL_NO_REASON(this);
     290             :   }
     291             : 
     292           0 :   APZThreadUtils::RunOnControllerThread(
     293           0 :     NewRunnableMethod<ScrollableLayerGuid, AsyncDragMetrics>(
     294             :       "layers::IAPZCTreeManager::StartScrollbarDrag",
     295             :       mTreeManager,
     296             :       &IAPZCTreeManager::StartScrollbarDrag,
     297             :       aGuid,
     298           0 :       aDragMetrics));
     299             : 
     300           0 :   return IPC_OK();
     301             : }
     302             : 
     303             : mozilla::ipc::IPCResult
     304           0 : APZCTreeManagerParent::RecvSetLongTapEnabled(const bool& aTapGestureEnabled)
     305             : {
     306           0 :   mTreeManager->SetLongTapEnabled(aTapGestureEnabled);
     307           0 :   return IPC_OK();
     308             : }
     309             : 
     310             : mozilla::ipc::IPCResult
     311           0 : APZCTreeManagerParent::RecvProcessTouchVelocity(
     312             :   const uint32_t& aTimestampMs,
     313             :   const float& aSpeedY)
     314             : {
     315           0 :   mTreeManager->ProcessTouchVelocity(aTimestampMs, aSpeedY);
     316           0 :   return IPC_OK();
     317             : }
     318             : 
     319             : mozilla::ipc::IPCResult
     320           0 : APZCTreeManagerParent::RecvUpdateWheelTransaction(
     321             :         const LayoutDeviceIntPoint& aRefPoint,
     322             :         const EventMessage& aEventMessage)
     323             : {
     324           0 :   mTreeManager->UpdateWheelTransaction(aRefPoint, aEventMessage);
     325           0 :   return IPC_OK();
     326             : }
     327             : 
     328             : mozilla::ipc::IPCResult
     329           0 : APZCTreeManagerParent::RecvProcessUnhandledEvent(
     330             :         const LayoutDeviceIntPoint& aRefPoint,
     331             :         LayoutDeviceIntPoint* aOutRefPoint,
     332             :         ScrollableLayerGuid*  aOutTargetGuid,
     333             :         uint64_t*             aOutFocusSequenceNumber)
     334             : {
     335           0 :   LayoutDeviceIntPoint refPoint = aRefPoint;
     336           0 :   mTreeManager->ProcessUnhandledEvent(&refPoint, aOutTargetGuid, aOutFocusSequenceNumber);
     337           0 :   *aOutRefPoint = refPoint;
     338             : 
     339           0 :   return IPC_OK();
     340             : }
     341             : 
     342             : } // namespace layers
     343             : } // namespace mozilla

Generated by: LCOV version 1.13