Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 "resource", | 50 "resource", |
| 51 PerformanceBase::MonotonicTimeToDOMHighResTimeStamp( | 51 PerformanceBase::MonotonicTimeToDOMHighResTimeStamp( |
| 52 time_origin, | 52 time_origin, |
| 53 start_time, | 53 start_time, |
| 54 info.NegativeAllowed()), | 54 info.NegativeAllowed()), |
| 55 PerformanceBase::MonotonicTimeToDOMHighResTimeStamp( | 55 PerformanceBase::MonotonicTimeToDOMHighResTimeStamp( |
| 56 time_origin, | 56 time_origin, |
| 57 info.LoadFinishTime(), | 57 info.LoadFinishTime(), |
| 58 info.NegativeAllowed())), | 58 info.NegativeAllowed())), |
| 59 initiator_type_(info.InitiatorType()), | 59 initiator_type_(info.InitiatorType()), |
| 60 alpn_negotiated_protocol_(info.FinalResponse().AlpnNegotiatedProtocol()), | |
| 61 connection_info_(info.FinalResponse().ConnectionInfoString()), | |
| 60 time_origin_(time_origin), | 62 time_origin_(time_origin), |
| 61 timing_(info.FinalResponse().GetResourceLoadTiming()), | 63 timing_(info.FinalResponse().GetResourceLoadTiming()), |
| 62 last_redirect_end_time_(last_redirect_end_time), | 64 last_redirect_end_time_(last_redirect_end_time), |
| 63 finish_time_(info.LoadFinishTime()), | 65 finish_time_(info.LoadFinishTime()), |
| 64 transfer_size_(info.TransferSize()), | 66 transfer_size_(info.TransferSize()), |
| 65 encoded_body_size_(info.FinalResponse().EncodedBodyLength()), | 67 encoded_body_size_(info.FinalResponse().EncodedBodyLength()), |
| 66 decoded_body_size_(info.FinalResponse().DecodedBodyLength()), | 68 decoded_body_size_(info.FinalResponse().DecodedBodyLength()), |
| 67 did_reuse_connection_(info.FinalResponse().ConnectionReused()), | 69 did_reuse_connection_(info.FinalResponse().ConnectionReused()), |
| 68 allow_timing_details_(allow_timing_details), | 70 allow_timing_details_(allow_timing_details), |
| 69 allow_redirect_details_(allow_redirect_details), | 71 allow_redirect_details_(allow_redirect_details), |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 99 } | 101 } |
| 100 | 102 |
| 101 unsigned long long PerformanceResourceTiming::GetDecodedBodySize() const { | 103 unsigned long long PerformanceResourceTiming::GetDecodedBodySize() const { |
| 102 return decoded_body_size_; | 104 return decoded_body_size_; |
| 103 } | 105 } |
| 104 | 106 |
| 105 AtomicString PerformanceResourceTiming::initiatorType() const { | 107 AtomicString PerformanceResourceTiming::initiatorType() const { |
| 106 return initiator_type_; | 108 return initiator_type_; |
| 107 } | 109 } |
| 108 | 110 |
| 111 AtomicString PerformanceResourceTiming::AlpnNegotiatedProtocol() const { | |
| 112 return alpn_negotiated_protocol_; | |
| 113 } | |
| 114 | |
| 115 AtomicString PerformanceResourceTiming::ConnectionInfo() const { | |
| 116 return connection_info_; | |
| 117 } | |
| 118 | |
| 119 AtomicString PerformanceResourceTiming::GetNextHopProtocol( | |
| 120 const AtomicString& alpn_negotiated_protocol, | |
| 121 const AtomicString& connection_info) { | |
| 122 // Fallback to connection_info when alpn_negotiated_protocol is unknown. | |
| 123 AtomicString returnedProtocol = alpn_negotiated_protocol == "unknown" | |
|
Yoav Weiss
2017/06/10 05:31:33
Nit: Can you add parenthesis around the condition?
shaseley
2017/06/13 23:14:17
Done.
| |
| 124 ? connection_info | |
| 125 : alpn_negotiated_protocol; | |
| 126 // Fallback to "http/1.1" when connection_info is also unknown. | |
| 127 returnedProtocol = | |
| 128 returnedProtocol == "unknown" ? "http/1.1" : returnedProtocol; | |
|
Yoav Weiss
2017/06/10 05:31:33
Nit: Can you add parenthesis around the condition?
shaseley
2017/06/13 23:14:17
Done.
| |
| 129 | |
| 130 if (returnedProtocol.Contains("quic")) | |
| 131 returnedProtocol = "hq"; | |
|
Yoav Weiss
2017/06/10 05:31:33
Can you add a comment linking to the place this is
kinuko
2017/06/12 00:48:23
Where is it also defined this should return http/1
panicker
2017/06/13 22:09:47
"hq" is based on ietf working group discussion - I
kinuko
2017/06/14 00:00:06
Should we file a github issue for spec discussion
panicker
2017/06/14 19:46:47
SGTM, let's reference this issue: https://github.c
shaseley
2017/06/15 00:11:01
Per the Github issue thread, the latest patchset f
| |
| 132 | |
| 133 return returnedProtocol; | |
| 134 } | |
| 135 | |
| 136 AtomicString PerformanceResourceTiming::nextHopProtocol() const { | |
| 137 return PerformanceResourceTiming::GetNextHopProtocol(AlpnNegotiatedProtocol(), | |
| 138 ConnectionInfo()); | |
| 139 } | |
| 140 | |
| 109 DOMHighResTimeStamp PerformanceResourceTiming::workerStart() const { | 141 DOMHighResTimeStamp PerformanceResourceTiming::workerStart() const { |
| 110 ResourceLoadTiming* timing = GetResourceLoadTiming(); | 142 ResourceLoadTiming* timing = GetResourceLoadTiming(); |
| 111 if (!timing || timing->WorkerStart() == 0.0) | 143 if (!timing || timing->WorkerStart() == 0.0) |
| 112 return 0.0; | 144 return 0.0; |
| 113 | 145 |
| 114 return PerformanceBase::MonotonicTimeToDOMHighResTimeStamp( | 146 return PerformanceBase::MonotonicTimeToDOMHighResTimeStamp( |
| 115 time_origin_, timing->WorkerStart(), allow_negative_value_); | 147 time_origin_, timing->WorkerStart(), allow_negative_value_); |
| 116 } | 148 } |
| 117 | 149 |
| 118 DOMHighResTimeStamp PerformanceResourceTiming::WorkerReady() const { | 150 DOMHighResTimeStamp PerformanceResourceTiming::WorkerReady() const { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 unsigned long long PerformanceResourceTiming::decodedBodySize() const { | 302 unsigned long long PerformanceResourceTiming::decodedBodySize() const { |
| 271 if (!AllowTimingDetails()) | 303 if (!AllowTimingDetails()) |
| 272 return 0; | 304 return 0; |
| 273 | 305 |
| 274 return GetDecodedBodySize(); | 306 return GetDecodedBodySize(); |
| 275 } | 307 } |
| 276 | 308 |
| 277 void PerformanceResourceTiming::BuildJSONValue(V8ObjectBuilder& builder) const { | 309 void PerformanceResourceTiming::BuildJSONValue(V8ObjectBuilder& builder) const { |
| 278 PerformanceEntry::BuildJSONValue(builder); | 310 PerformanceEntry::BuildJSONValue(builder); |
| 279 builder.AddString("initiatorType", initiatorType()); | 311 builder.AddString("initiatorType", initiatorType()); |
| 312 builder.AddString("nextHopProtocol", nextHopProtocol()); | |
| 280 builder.AddNumber("workerStart", workerStart()); | 313 builder.AddNumber("workerStart", workerStart()); |
| 281 builder.AddNumber("redirectStart", redirectStart()); | 314 builder.AddNumber("redirectStart", redirectStart()); |
| 282 builder.AddNumber("redirectEnd", redirectEnd()); | 315 builder.AddNumber("redirectEnd", redirectEnd()); |
| 283 builder.AddNumber("fetchStart", fetchStart()); | 316 builder.AddNumber("fetchStart", fetchStart()); |
| 284 builder.AddNumber("domainLookupStart", domainLookupStart()); | 317 builder.AddNumber("domainLookupStart", domainLookupStart()); |
| 285 builder.AddNumber("domainLookupEnd", domainLookupEnd()); | 318 builder.AddNumber("domainLookupEnd", domainLookupEnd()); |
| 286 builder.AddNumber("connectStart", connectStart()); | 319 builder.AddNumber("connectStart", connectStart()); |
| 287 builder.AddNumber("connectEnd", connectEnd()); | 320 builder.AddNumber("connectEnd", connectEnd()); |
| 288 builder.AddNumber("secureConnectionStart", secureConnectionStart()); | 321 builder.AddNumber("secureConnectionStart", secureConnectionStart()); |
| 289 builder.AddNumber("requestStart", requestStart()); | 322 builder.AddNumber("requestStart", requestStart()); |
| 290 builder.AddNumber("responseStart", responseStart()); | 323 builder.AddNumber("responseStart", responseStart()); |
| 291 builder.AddNumber("responseEnd", responseEnd()); | 324 builder.AddNumber("responseEnd", responseEnd()); |
| 292 builder.AddNumber("transferSize", transferSize()); | 325 builder.AddNumber("transferSize", transferSize()); |
| 293 builder.AddNumber("encodedBodySize", encodedBodySize()); | 326 builder.AddNumber("encodedBodySize", encodedBodySize()); |
| 294 builder.AddNumber("decodedBodySize", decodedBodySize()); | 327 builder.AddNumber("decodedBodySize", decodedBodySize()); |
| 295 } | 328 } |
| 296 | 329 |
| 297 } // namespace blink | 330 } // namespace blink |
| OLD | NEW |