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" |
| 10 #include "platform/wtf/text/WTFString.h" |
9 | 11 |
10 namespace blink { | 12 namespace blink { |
11 | 13 |
12 class CORE_EXPORT PerformanceServerTiming : public PerformanceEntry { | 14 class ResourceTimingInfo; |
| 15 class PerformanceServerTiming; |
| 16 |
| 17 using PerformanceServerTimingVector = |
| 18 HeapVector<Member<PerformanceServerTiming>>; |
| 19 |
| 20 class CORE_EXPORT PerformanceServerTiming final |
| 21 : public GarbageCollectedFinalized<PerformanceServerTiming>, |
| 22 public ScriptWrappable { |
13 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
14 | 24 |
15 public: | 25 public: |
16 ~PerformanceServerTiming() override; | 26 enum class ShouldAllowTimingDetails { |
| 27 Yes, |
| 28 No, |
| 29 }; |
17 | 30 |
18 static PerformanceServerTiming* create(const String& name, | 31 PerformanceServerTiming(const String& metric, |
19 const String& metric, | 32 double value, |
20 double duration, | 33 const String& description, |
21 const String& description) { | 34 ShouldAllowTimingDetails); |
22 return new PerformanceServerTiming(name, metric, duration, description); | 35 ~PerformanceServerTiming(); |
23 } | |
24 | 36 |
25 String metric() const; | 37 String metric() const; |
| 38 double value() const; |
26 String description() const; | 39 String description() const; |
27 | 40 |
28 protected: | 41 static PerformanceServerTimingVector ParseServerTiming( |
29 void BuildJSONValue(V8ObjectBuilder&) const override; | 42 const ResourceTimingInfo&, |
| 43 ShouldAllowTimingDetails); |
| 44 |
| 45 ScriptValue toJSONForBinding(ScriptState*) const; |
| 46 |
| 47 DEFINE_INLINE_VIRTUAL_TRACE() {} |
30 | 48 |
31 private: | 49 private: |
32 PerformanceServerTiming(const String& name, | |
33 const String& metric, | |
34 double duration, | |
35 const String& description); | |
36 | |
37 const String metric_; | 50 const String metric_; |
| 51 double value_; |
38 const String description_; | 52 const String description_; |
| 53 ShouldAllowTimingDetails shouldAllowTimingDetails_; |
39 }; | 54 }; |
40 | 55 |
41 } // namespace blink | 56 } // namespace blink |
42 | 57 |
43 #endif // PerformanceServerTiming_h | 58 #endif // PerformanceServerTiming_h |
OLD | NEW |