SharedSurfacesMemoryReport.h (1709B)
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_GFX_SHAREDSURFACESMEMORYREPORT_H 8 #define MOZILLA_GFX_SHAREDSURFACESMEMORYREPORT_H 9 10 #include <cstdint> // for uint32_t 11 #include <unordered_map> 12 #include "base/process.h" 13 #include "ipc/IPCMessageUtils.h" 14 #include "ipc/IPCMessageUtilsSpecializations.h" 15 #include "mozilla/ParamTraits_TiedFields.h" 16 #include "mozilla/gfx/Point.h" // for IntSize 17 18 namespace mozilla { 19 namespace layers { 20 21 class SharedSurfacesMemoryReport final { 22 public: 23 class SurfaceEntry final { 24 public: 25 base::ProcessId mCreatorPid; 26 gfx::IntSize mSize; 27 int32_t mStride; 28 uint32_t mConsumers; 29 bool mCreatorRef; 30 PaddingField<bool, 3> _padding; 31 32 auto MutTiedFields() { 33 return std::tie(mCreatorPid, mSize, mStride, mConsumers, mCreatorRef, 34 _padding); 35 } 36 }; 37 38 auto MutTiedFields() { return std::tie(mSurfaces); } 39 40 std::unordered_map<uint64_t, SurfaceEntry> mSurfaces; 41 }; 42 43 } // namespace layers 44 } // namespace mozilla 45 46 namespace IPC { 47 48 template <> 49 struct ParamTraits<mozilla::layers::SharedSurfacesMemoryReport> 50 : public ParamTraits_TiedFields< 51 mozilla::layers::SharedSurfacesMemoryReport> {}; 52 53 template <> 54 struct ParamTraits<mozilla::layers::SharedSurfacesMemoryReport::SurfaceEntry> 55 : public ParamTraits_TiedFields< 56 mozilla::layers::SharedSurfacesMemoryReport::SurfaceEntry> {}; 57 58 } // namespace IPC 59 60 #endif