Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / performance / PerformanceServerTiming.h
blob27b85d29fd4270b74a09515af9e945bae66172ea
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/. */
7 #ifndef mozilla_dom_PerformanceServerTiming_h
8 #define mozilla_dom_PerformanceServerTiming_h
10 #include "mozilla/Attributes.h"
11 #include "nsCOMPtr.h"
12 #include "nsDOMNavigationTiming.h"
13 #include "nsWrapperCache.h"
14 #include "nsString.h"
16 class nsIServerTiming;
17 class nsISupports;
19 namespace mozilla::dom {
21 class PerformanceServerTiming final : public nsISupports,
22 public nsWrapperCache {
23 public:
24 PerformanceServerTiming(nsISupports* aParent, nsIServerTiming* aServerTiming)
25 : mParent(aParent), mServerTiming(aServerTiming) {
26 MOZ_ASSERT(mServerTiming);
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(PerformanceServerTiming)
32 JSObject* WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) override;
35 nsISupports* GetParentObject() const { return mParent; }
37 void GetName(nsAString& aName) const;
39 DOMHighResTimeStamp Duration() const;
41 void GetDescription(nsAString& aDescription) const;
43 private:
44 ~PerformanceServerTiming() = default;
46 nsCOMPtr<nsISupports> mParent;
47 nsCOMPtr<nsIServerTiming> mServerTiming;
50 } // namespace mozilla::dom
52 #endif // mozilla_dom_PerformanceServerTiming_h