Line data Source code
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/Attributes.h"
11 : #include "mozilla/dom/Performance.h"
12 : #include "nsDOMNavigationTiming.h"
13 : #include "nsWrapperCache.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : // Script "performance.navigation" object
19 : class PerformanceNavigation final : public nsWrapperCache
20 : {
21 : public:
22 : explicit PerformanceNavigation(Performance* aPerformance);
23 :
24 0 : NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PerformanceNavigation)
25 7 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PerformanceNavigation)
26 :
27 0 : nsDOMNavigationTiming* GetDOMTiming() const
28 : {
29 0 : return mPerformance->GetDOMTiming();
30 : }
31 :
32 0 : PerformanceTiming* GetPerformanceTiming() const
33 : {
34 0 : return mPerformance->Timing();
35 : }
36 :
37 0 : Performance* GetParentObject() const
38 : {
39 0 : return mPerformance;
40 : }
41 :
42 : virtual JSObject* WrapObject(JSContext *cx,
43 : JS::Handle<JSObject*> aGivenProto) override;
44 :
45 : // PerformanceNavigation WebIDL methods
46 0 : uint16_t Type() const
47 : {
48 0 : return GetDOMTiming()->GetType();
49 : }
50 :
51 : uint16_t RedirectCount() const;
52 :
53 : private:
54 : ~PerformanceNavigation();
55 : RefPtr<Performance> mPerformance;
56 : };
57 :
58 : } // namespace dom
59 : } // namespace mozilla
60 :
61 : #endif // mozilla_dom_PerformanceNavigation_h
|