tor-browser

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

nsServerTiming.h (1326B)


      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 nsServerTiming_h__
      8 #define nsServerTiming_h__
      9 
     10 #include "nsITimedChannel.h"
     11 #include "nsString.h"
     12 #include "nsTArray.h"
     13 
     14 class nsServerTiming final : public nsIServerTiming {
     15 public:
     16  NS_DECL_THREADSAFE_ISUPPORTS
     17  NS_DECL_NSISERVERTIMING
     18 
     19  nsServerTiming() = default;
     20 
     21  void SetName(const nsACString& aName) { mName = aName; }
     22 
     23  void SetDuration(double aDuration) { mDuration = aDuration; }
     24 
     25  void SetDescription(const nsACString& aDescription) {
     26    mDescription = aDescription;
     27  }
     28 
     29 private:
     30  virtual ~nsServerTiming() = default;
     31 
     32  nsCString mName;
     33  double mDuration = 0;
     34  nsCString mDescription;
     35 };
     36 
     37 namespace mozilla {
     38 namespace net {
     39 
     40 class ServerTimingParser {
     41 public:
     42  explicit ServerTimingParser(const nsCString& value) : mValue(value) {}
     43  void Parse();
     44  nsTArray<nsCOMPtr<nsIServerTiming>>&& TakeServerTimingHeaders();
     45 
     46 private:
     47  nsCString mValue;
     48  nsTArray<nsCOMPtr<nsIServerTiming>> mServerTimingHeaders;
     49 };
     50 
     51 }  // namespace net
     52 }  // namespace mozilla
     53 
     54 #endif