| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #ifndef PerformanceResourceTiming_h | 32 #ifndef PerformanceResourceTiming_h |
| 33 #define PerformanceResourceTiming_h | 33 #define PerformanceResourceTiming_h |
| 34 | 34 |
| 35 #include "core/dom/DOMHighResTimeStamp.h" | 35 #include "core/dom/DOMHighResTimeStamp.h" |
| 36 #include "core/timing/PerformanceEntry.h" | 36 #include "core/timing/PerformanceEntry.h" |
| 37 #include "core/timing/PerformanceServerTiming.h" |
| 37 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 38 #include "platform/wtf/Forward.h" | 39 #include "platform/wtf/Forward.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 class ResourceLoadTiming; | 43 class ResourceLoadTiming; |
| 43 class ResourceTimingInfo; | 44 class ResourceTimingInfo; |
| 44 | 45 |
| 45 class CORE_EXPORT PerformanceResourceTiming : public PerformanceEntry { | 46 class CORE_EXPORT PerformanceResourceTiming : public PerformanceEntry { |
| 46 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
| 47 friend class PerformanceResourceTimingTest; | 48 friend class PerformanceResourceTimingTest; |
| 48 | 49 |
| 49 public: | 50 public: |
| 50 ~PerformanceResourceTiming() override; | 51 ~PerformanceResourceTiming() override; |
| 51 static PerformanceResourceTiming* Create(const ResourceTimingInfo& info, | 52 static PerformanceResourceTiming* Create( |
| 52 double time_origin, | 53 const ResourceTimingInfo& info, |
| 53 double start_time, | 54 double time_origin, |
| 54 double last_redirect_end_time, | 55 double start_time, |
| 55 bool allow_timing_details, | 56 double last_redirect_end_time, |
| 56 bool allow_redirect_details) { | 57 bool allow_timing_details, |
| 58 bool allow_redirect_details, |
| 59 PerformanceServerTimingVector& serverTiming) { |
| 57 return new PerformanceResourceTiming( | 60 return new PerformanceResourceTiming( |
| 58 info, time_origin, start_time, last_redirect_end_time, | 61 info, time_origin, start_time, last_redirect_end_time, |
| 59 allow_timing_details, allow_redirect_details); | 62 allow_timing_details, allow_redirect_details, serverTiming); |
| 60 } | 63 } |
| 61 | 64 |
| 62 static PerformanceResourceTiming* Create(const ResourceTimingInfo& info, | 65 static PerformanceResourceTiming* Create( |
| 63 double time_origin, | 66 const ResourceTimingInfo& info, |
| 64 double start_time, | 67 double time_origin, |
| 65 bool allow_timing_details) { | 68 double start_time, |
| 69 bool allow_timing_details, |
| 70 PerformanceServerTimingVector& serverTiming) { |
| 66 return new PerformanceResourceTiming(info, time_origin, start_time, 0.0, | 71 return new PerformanceResourceTiming(info, time_origin, start_time, 0.0, |
| 67 allow_timing_details, false); | 72 allow_timing_details, false, |
| 73 serverTiming); |
| 68 } | 74 } |
| 69 // Related doc: https://goo.gl/uNecAj. | 75 // Related doc: https://goo.gl/uNecAj. |
| 70 virtual AtomicString initiatorType() const; | 76 virtual AtomicString initiatorType() const; |
| 71 AtomicString nextHopProtocol() const; | 77 AtomicString nextHopProtocol() const; |
| 72 DOMHighResTimeStamp workerStart() const; | 78 DOMHighResTimeStamp workerStart() const; |
| 73 virtual DOMHighResTimeStamp redirectStart() const; | 79 virtual DOMHighResTimeStamp redirectStart() const; |
| 74 virtual DOMHighResTimeStamp redirectEnd() const; | 80 virtual DOMHighResTimeStamp redirectEnd() const; |
| 75 virtual DOMHighResTimeStamp fetchStart() const; | 81 virtual DOMHighResTimeStamp fetchStart() const; |
| 76 DOMHighResTimeStamp domainLookupStart() const; | 82 DOMHighResTimeStamp domainLookupStart() const; |
| 77 DOMHighResTimeStamp domainLookupEnd() const; | 83 DOMHighResTimeStamp domainLookupEnd() const; |
| 78 DOMHighResTimeStamp connectStart() const; | 84 DOMHighResTimeStamp connectStart() const; |
| 79 DOMHighResTimeStamp connectEnd() const; | 85 DOMHighResTimeStamp connectEnd() const; |
| 80 DOMHighResTimeStamp secureConnectionStart() const; | 86 DOMHighResTimeStamp secureConnectionStart() const; |
| 81 DOMHighResTimeStamp requestStart() const; | 87 DOMHighResTimeStamp requestStart() const; |
| 82 DOMHighResTimeStamp responseStart() const; | 88 DOMHighResTimeStamp responseStart() const; |
| 83 virtual DOMHighResTimeStamp responseEnd() const; | 89 virtual DOMHighResTimeStamp responseEnd() const; |
| 84 unsigned long long transferSize() const; | 90 unsigned long long transferSize() const; |
| 85 unsigned long long encodedBodySize() const; | 91 unsigned long long encodedBodySize() const; |
| 86 unsigned long long decodedBodySize() const; | 92 unsigned long long decodedBodySize() const; |
| 93 PerformanceServerTimingVector serverTiming() const; |
| 94 |
| 95 DECLARE_VIRTUAL_TRACE(); |
| 87 | 96 |
| 88 protected: | 97 protected: |
| 89 void BuildJSONValue(V8ObjectBuilder&) const override; | 98 void BuildJSONValue(ScriptState*, V8ObjectBuilder&) const override; |
| 90 | 99 |
| 91 // This constructor is for PerformanceNavigationTiming. | 100 // This constructor is for PerformanceNavigationTiming. |
| 92 // Related doc: https://goo.gl/uNecAj. | 101 // Related doc: https://goo.gl/uNecAj. |
| 93 PerformanceResourceTiming(const String& name, | 102 PerformanceResourceTiming(const String& name, |
| 94 const String& entry_type, | 103 const String& entry_type, |
| 95 double start_time, | 104 double start_time, |
| 96 double duration); | 105 double duration, |
| 106 PerformanceServerTimingVector&); |
| 97 virtual AtomicString AlpnNegotiatedProtocol() const; | 107 virtual AtomicString AlpnNegotiatedProtocol() const; |
| 98 virtual AtomicString ConnectionInfo() const; | 108 virtual AtomicString ConnectionInfo() const; |
| 99 | 109 |
| 100 private: | 110 private: |
| 101 PerformanceResourceTiming(const ResourceTimingInfo&, | 111 PerformanceResourceTiming(const ResourceTimingInfo&, |
| 102 double time_origin, | 112 double time_origin, |
| 103 double start_time, | 113 double start_time, |
| 104 double last_redirect_end_time, | 114 double last_redirect_end_time, |
| 105 bool allow_timing_details, | 115 bool allow_timing_details, |
| 106 bool allow_redirect_details); | 116 bool allow_redirect_details, |
| 117 PerformanceServerTimingVector&); |
| 107 | 118 |
| 108 static AtomicString GetNextHopProtocol( | 119 static AtomicString GetNextHopProtocol( |
| 109 const AtomicString& alpn_negotiated_protocol, | 120 const AtomicString& alpn_negotiated_protocol, |
| 110 const AtomicString& connection_info); | 121 const AtomicString& connection_info); |
| 111 | 122 |
| 112 double WorkerReady() const; | 123 double WorkerReady() const; |
| 113 | 124 |
| 114 virtual ResourceLoadTiming* GetResourceLoadTiming() const; | 125 virtual ResourceLoadTiming* GetResourceLoadTiming() const; |
| 115 virtual bool AllowTimingDetails() const; | 126 virtual bool AllowTimingDetails() const; |
| 116 virtual bool DidReuseConnection() const; | 127 virtual bool DidReuseConnection() const; |
| 117 virtual unsigned long long GetTransferSize() const; | 128 virtual unsigned long long GetTransferSize() const; |
| 118 virtual unsigned long long GetEncodedBodySize() const; | 129 virtual unsigned long long GetEncodedBodySize() const; |
| 119 virtual unsigned long long GetDecodedBodySize() const; | 130 virtual unsigned long long GetDecodedBodySize() const; |
| 120 | 131 |
| 121 AtomicString initiator_type_; | 132 AtomicString initiator_type_; |
| 122 AtomicString alpn_negotiated_protocol_; | 133 AtomicString alpn_negotiated_protocol_; |
| 123 AtomicString connection_info_; | 134 AtomicString connection_info_; |
| 124 double time_origin_; | 135 double time_origin_; |
| 125 RefPtr<ResourceLoadTiming> timing_; | 136 RefPtr<ResourceLoadTiming> timing_; |
| 126 double last_redirect_end_time_; | 137 double last_redirect_end_time_; |
| 127 double finish_time_; | 138 double finish_time_; |
| 128 unsigned long long transfer_size_; | 139 unsigned long long transfer_size_; |
| 129 unsigned long long encoded_body_size_; | 140 unsigned long long encoded_body_size_; |
| 130 unsigned long long decoded_body_size_; | 141 unsigned long long decoded_body_size_; |
| 131 bool did_reuse_connection_; | 142 bool did_reuse_connection_; |
| 132 bool allow_timing_details_; | 143 bool allow_timing_details_; |
| 133 bool allow_redirect_details_; | 144 bool allow_redirect_details_; |
| 134 bool allow_negative_value_; | 145 bool allow_negative_value_; |
| 146 PerformanceServerTimingVector serverTiming_; |
| 135 }; | 147 }; |
| 136 | 148 |
| 137 } // namespace blink | 149 } // namespace blink |
| 138 | 150 |
| 139 #endif // PerformanceResourceTiming_h | 151 #endif // PerformanceResourceTiming_h |
| OLD | NEW |