FrameUniformityData.h (1417B)
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_FrameUniformityData_h_ 8 #define mozilla_layers_FrameUniformityData_h_ 9 10 #include "ipc/IPCMessageUtils.h" 11 #include "js/TypeDecls.h" 12 #include "ipc/IPCMessageUtilsSpecializations.h" 13 #include "nsTArray.h" 14 15 namespace mozilla { 16 namespace layers { 17 18 class FrameUniformityData { 19 friend struct IPC::ParamTraits<FrameUniformityData>; 20 21 public: 22 bool ToJS(JS::MutableHandle<JS::Value> aOutValue, JSContext* aContext); 23 // Contains the calculated frame uniformities 24 std::map<uintptr_t, float> mUniformities; 25 }; 26 27 } // namespace layers 28 } // namespace mozilla 29 30 namespace IPC { 31 template <> 32 struct ParamTraits<mozilla::layers::FrameUniformityData> { 33 typedef mozilla::layers::FrameUniformityData paramType; 34 35 static void Write(MessageWriter* aWriter, const paramType& aParam) { 36 WriteParam(aWriter, aParam.mUniformities); 37 } 38 39 static bool Read(MessageReader* aReader, paramType* aResult) { 40 return ParamTraitsStd<std::map<uintptr_t, float>>::Read( 41 aReader, &aResult->mUniformities); 42 } 43 }; 44 45 } // namespace IPC 46 47 #endif // mozilla_layers_FrameUniformityData_h_