tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PerformanceServerTiming.h (1523B)


      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_PerformanceServerTiming_h
      8 #define mozilla_dom_PerformanceServerTiming_h
      9 
     10 #include "nsCOMPtr.h"
     11 #include "nsDOMNavigationTiming.h"
     12 #include "nsString.h"
     13 #include "nsWrapperCache.h"
     14 
     15 class nsIServerTiming;
     16 class nsISupports;
     17 
     18 namespace mozilla::dom {
     19 
     20 class PerformanceServerTiming final : public nsISupports,
     21                                      public nsWrapperCache {
     22 public:
     23  PerformanceServerTiming(nsISupports* aParent, nsIServerTiming* aServerTiming)
     24      : mParent(aParent), mServerTiming(aServerTiming) {
     25    MOZ_ASSERT(mServerTiming);
     26  }
     27 
     28  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     29  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(PerformanceServerTiming)
     30 
     31  JSObject* WrapObject(JSContext* aCx,
     32                       JS::Handle<JSObject*> aGivenProto) override;
     33 
     34  nsISupports* GetParentObject() const { return mParent; }
     35 
     36  void GetName(nsAString& aName) const;
     37 
     38  DOMHighResTimeStamp Duration() const;
     39 
     40  void GetDescription(nsAString& aDescription) const;
     41 
     42 private:
     43  ~PerformanceServerTiming() = default;
     44 
     45  nsCOMPtr<nsISupports> mParent;
     46  nsCOMPtr<nsIServerTiming> mServerTiming;
     47 };
     48 
     49 }  // namespace mozilla::dom
     50 
     51 #endif  // mozilla_dom_PerformanceServerTiming_h