/src/mozilla-central/netwerk/protocol/http/nsServerTiming.h
Line | Count | Source (jump to first uncovered line) |
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 | | { |
16 | | public: |
17 | | NS_DECL_THREADSAFE_ISUPPORTS |
18 | | NS_DECL_NSISERVERTIMING |
19 | | |
20 | 0 | nsServerTiming() = default; |
21 | | |
22 | | void SetName(const nsACString &aName) |
23 | 0 | { |
24 | 0 | mName = aName; |
25 | 0 | } |
26 | | |
27 | | void SetDuration(double aDuration) |
28 | 0 | { |
29 | 0 | mDuration = aDuration; |
30 | 0 | } |
31 | | |
32 | | void SetDescription(const nsACString &aDescription) |
33 | 0 | { |
34 | 0 | mDescription = aDescription; |
35 | 0 | } |
36 | | |
37 | | private: |
38 | 0 | virtual ~nsServerTiming() = default; |
39 | | |
40 | | nsCString mName; |
41 | | double mDuration; |
42 | | nsCString mDescription; |
43 | | }; |
44 | | |
45 | | namespace mozilla { |
46 | | namespace net { |
47 | | |
48 | | class ServerTimingParser |
49 | | { |
50 | | public: |
51 | | explicit ServerTimingParser(const nsCString &value) |
52 | | : mValue(value) |
53 | 0 | {} |
54 | | void Parse(); |
55 | | nsTArray<nsCOMPtr<nsIServerTiming>>&& TakeServerTimingHeaders(); |
56 | | |
57 | | private: |
58 | | nsCString mValue; |
59 | | nsTArray<nsCOMPtr<nsIServerTiming>> mServerTimingHeaders; |
60 | | }; |
61 | | |
62 | | } // namespace net |
63 | | } // namespace mozilla |
64 | | |
65 | | #endif |