PerformanceMeasure.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_dom_performancemeasure_h___ 8 #define mozilla_dom_performancemeasure_h___ 9 10 #include "mozilla/dom/PerformanceEntry.h" 11 12 namespace mozilla::dom { 13 14 // http://www.w3.org/TR/user-timing/#performancemeasure 15 class PerformanceMeasure final : public PerformanceEntry { 16 public: 17 NS_DECL_ISUPPORTS_INHERITED 18 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMeasure, 19 PerformanceEntry); 20 21 PerformanceMeasure(nsISupports* aParent, const nsAString& aName, 22 DOMHighResTimeStamp aStartTime, 23 DOMHighResTimeStamp aEndTime, 24 const JS::Handle<JS::Value>& aDetail); 25 26 virtual JSObject* WrapObject(JSContext* aCx, 27 JS::Handle<JSObject*> aGivenProto) override; 28 29 virtual DOMHighResTimeStamp StartTime() const override { return mStartTime; } 30 31 virtual DOMHighResTimeStamp Duration() const override { return mDuration; } 32 33 void GetDetail(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval); 34 35 size_t SizeOfIncludingThis( 36 mozilla::MallocSizeOf aMallocSizeOf) const override; 37 38 protected: 39 virtual ~PerformanceMeasure(); 40 DOMHighResTimeStamp mStartTime; 41 DOMHighResTimeStamp mDuration; 42 43 private: 44 JS::Heap<JS::Value> mDetail; 45 }; 46 47 } // namespace mozilla::dom 48 49 #endif /* mozilla_dom_performancemeasure_h___ */