APZChild.h (2775B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 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 #ifndef mozilla_layers_APZChild_h 8 #define mozilla_layers_APZChild_h 9 10 #include "mozilla/ipc/ProtocolUtils.h" 11 #include "mozilla/layers/PAPZChild.h" 12 #include "mozilla/layers/APZTaskRunnable.h" 13 14 namespace mozilla { 15 namespace layers { 16 17 class GeckoContentController; 18 19 /** 20 * APZChild implements PAPZChild and is used to remote a GeckoContentController 21 * that lives in a different process than where APZ lives. 22 */ 23 class APZChild final : public PAPZChild { 24 public: 25 using APZStateChange = GeckoContentController_APZStateChange; 26 27 explicit APZChild(RefPtr<GeckoContentController> aController); 28 virtual ~APZChild(); 29 30 mozilla::ipc::IPCResult RecvLayerTransforms( 31 nsTArray<MatrixMessage>&& aTransforms); 32 33 mozilla::ipc::IPCResult RecvRequestContentRepaint( 34 const RepaintRequest& aRequest); 35 36 mozilla::ipc::IPCResult RecvUpdateOverscrollVelocity( 37 const ScrollableLayerGuid& aGuid, const float& aX, const float& aY, 38 const bool& aIsRootContent); 39 40 mozilla::ipc::IPCResult RecvUpdateOverscrollOffset( 41 const ScrollableLayerGuid& aGuid, const float& aX, const float& aY, 42 const bool& aIsRootContent); 43 44 mozilla::ipc::IPCResult RecvHideDynamicToolbar(); 45 46 mozilla::ipc::IPCResult RecvNotifyMozMouseScrollEvent(const ViewID& aScrollId, 47 const nsString& aEvent); 48 49 mozilla::ipc::IPCResult RecvNotifyAPZStateChange( 50 const ScrollableLayerGuid& aGuid, const APZStateChange& aChange, 51 const int& aArg, Maybe<uint64_t> aInputBlockId); 52 53 mozilla::ipc::IPCResult RecvNotifyFlushComplete(); 54 55 mozilla::ipc::IPCResult RecvNotifyAsyncScrollbarDragInitiated( 56 const uint64_t& aDragBlockId, const ViewID& aScrollId, 57 const ScrollDirection& aDirection); 58 mozilla::ipc::IPCResult RecvNotifyAsyncScrollbarDragRejected( 59 const ViewID& aScrollId); 60 61 mozilla::ipc::IPCResult RecvNotifyAsyncAutoscrollRejected( 62 const ViewID& aScrollId); 63 64 mozilla::ipc::IPCResult RecvDestroy(); 65 66 private: 67 void EnsureAPZTaskRunnable() { 68 if (!mAPZTaskRunnable) { 69 mAPZTaskRunnable = new APZTaskRunnable(mController); 70 } 71 } 72 73 RefPtr<GeckoContentController> mController; 74 // A runnable invoked in a nsRefreshDriver's tick to update multiple 75 // RepaintRequests and notify a "apz-repaints-flushed" at the same time. 76 RefPtr<APZTaskRunnable> mAPZTaskRunnable; 77 }; 78 79 } // namespace layers 80 } // namespace mozilla 81 82 #endif // mozilla_layers_APZChild_h