PerformanceNavigation.h (1538B)
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_PerformanceNavigation_h 8 #define mozilla_dom_PerformanceNavigation_h 9 10 #include "mozilla/dom/Performance.h" 11 #include "nsDOMNavigationTiming.h" 12 #include "nsWrapperCache.h" 13 14 namespace mozilla::dom { 15 16 // Script "performance.navigation" object 17 class PerformanceNavigation final : public nsWrapperCache { 18 public: 19 explicit PerformanceNavigation(Performance* aPerformance); 20 21 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PerformanceNavigation) 22 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(PerformanceNavigation) 23 24 nsDOMNavigationTiming* GetDOMTiming() const { 25 return mPerformance->GetDOMTiming(); 26 } 27 28 PerformanceTiming* GetPerformanceTiming() const { 29 return mPerformance->Timing(); 30 } 31 32 Performance* GetParentObject() const { return mPerformance; } 33 34 virtual JSObject* WrapObject(JSContext* cx, 35 JS::Handle<JSObject*> aGivenProto) override; 36 37 // PerformanceNavigation WebIDL methods 38 uint16_t Type() const { return GetDOMTiming()->GetType(); } 39 40 uint16_t RedirectCount() const; 41 42 private: 43 ~PerformanceNavigation(); 44 RefPtr<Performance> mPerformance; 45 }; 46 47 } // namespace mozilla::dom 48 49 #endif // mozilla_dom_PerformanceNavigation_h