NativeLayerRootRemoteMacParent.h (2462B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef mozilla_layers_NativeLayerRootRemoteMacParent_h 7 #define mozilla_layers_NativeLayerRootRemoteMacParent_h 8 9 #include "mozilla/layers/NativeLayerCA.h" 10 #include "mozilla/layers/NativeLayerRemoteParent.h" 11 12 namespace mozilla { 13 namespace layers { 14 15 // NativeLayerRootRemoteMacParent is a macOS-specific receiver class for 16 // NativeLayerRootRemoteMacChild. It interprets the incoming messages and 17 // sends them on to the "real" NativeLayerRoot object in the parent 18 // process. 19 class NativeLayerRootRemoteMacParent final : public NativeLayerRemoteParent { 20 public: 21 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(NativeLayerRootRemoteMacParent, 22 override) 23 24 explicit NativeLayerRootRemoteMacParent( 25 RefPtr<NativeLayerRootCA> aRealNativeLayerRoot); 26 27 mozilla::ipc::IPCResult RecvCommitNativeLayerCommands( 28 nsTArray<NativeLayerCommand>&& aCommands) override; 29 30 mozilla::ipc::IPCResult RecvRequestReadback(IntSize aSize, 31 Shmem* const aPixels) override; 32 33 mozilla::ipc::IPCResult RecvFlush() override; 34 35 protected: 36 ~NativeLayerRootRemoteMacParent() = default; 37 38 void HandleCreateLayer(uint64_t aID, IntSize aSize, bool aOpaque); 39 void HandleCreateLayerForExternalTexture(uint64_t aID, bool aOpaque); 40 void HandleCreateLayerForColor(uint64_t aID, DeviceColor aColor); 41 void HandleLayerDestroyed(uint64_t aID); 42 void HandleSetLayers(const nsTArray<uint64_t>& aIDs); 43 void HandleLayerInfo(uint64_t aID, IntPoint aPosition, IntRect aDisplayRect, 44 Maybe<IntRect> aClipRect, 45 Maybe<RoundedRect> aRoundedClipRect, 46 Matrix4x4 aTransform, int8_t aSamplingFilter, 47 bool aSurfaceIsFlipped); 48 void HandleChangedSurface(uint64_t aID, IOSurfacePort aSurfacePort, 49 bool aIsDRM, bool aIsHDR, IntSize aSize); 50 51 RefPtr<NativeLayerRootCA> mRealNativeLayerRoot; 52 UniquePtr<NativeLayerRootSnapshotter> mSnapshotter; 53 nsTHashMap<uint64_t, RefPtr<NativeLayer>> mKnownLayers; 54 }; 55 56 } // namespace layers 57 } // namespace mozilla 58 59 #endif // mozilla_layers_NativeLayerRootRemoteMacParent_h