OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PerformanceServerTiming_h | 5 #ifndef PerformanceServerTiming_h |
6 #define PerformanceServerTiming_h | 6 #define PerformanceServerTiming_h |
7 | 7 |
8 #include "core/timing/PerformanceEntry.h" | 8 #include "bindings/core/v8/V8ObjectBuilder.h" |
| 9 #include "platform/bindings/ScriptWrappable.h" |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 class CORE_EXPORT PerformanceServerTiming : public PerformanceEntry { | 13 class PerformanceServerTiming; |
| 14 |
| 15 using PerformanceServerTimingVector = |
| 16 HeapVector<Member<PerformanceServerTiming>>; |
| 17 |
| 18 class CORE_EXPORT PerformanceServerTiming final |
| 19 : public GarbageCollectedFinalized<PerformanceServerTiming>, |
| 20 public ScriptWrappable { |
13 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
14 | 22 |
15 public: | 23 public: |
16 ~PerformanceServerTiming() override; | 24 PerformanceServerTiming(const String& metric, |
17 | 25 double value, |
18 static PerformanceServerTiming* create(const String& name, | 26 const String& description, |
19 const String& metric, | 27 bool allow_timing_details); |
20 double duration, | 28 ~PerformanceServerTiming(); |
21 const String& description) { | |
22 return new PerformanceServerTiming(name, metric, duration, description); | |
23 } | |
24 | 29 |
25 String metric() const; | 30 String metric() const; |
| 31 double value() const; |
26 String description() const; | 32 String description() const; |
27 | 33 |
| 34 enum class ShouldAllowTimingDetails { |
| 35 Yes, |
| 36 No, |
| 37 }; |
| 38 |
| 39 static PerformanceServerTimingVector ParseServerTiming( |
| 40 const ResourceTimingInfo&, |
| 41 ShouldAllowTimingDetails); |
| 42 |
| 43 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 44 |
28 protected: | 45 protected: |
29 void BuildJSONValue(V8ObjectBuilder&) const override; | 46 void BuildJSONValue(V8ObjectBuilder&) const; |
30 | 47 |
31 private: | 48 private: |
32 PerformanceServerTiming(const String& name, | |
33 const String& metric, | |
34 double duration, | |
35 const String& description); | |
36 | |
37 const String metric_; | 49 const String metric_; |
| 50 double value_; |
38 const String description_; | 51 const String description_; |
| 52 bool allow_timing_details_; |
39 }; | 53 }; |
40 | 54 |
41 } // namespace blink | 55 } // namespace blink |
42 | 56 |
43 #endif // PerformanceServerTiming_h | 57 #endif // PerformanceServerTiming_h |
OLD | NEW |