OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "core/timing/PerformanceNavigationTiming.h" | 5 #include "core/timing/PerformanceNavigationTiming.h" |
6 | 6 |
7 #include "bindings/core/v8/V8ObjectBuilder.h" | 7 #include "bindings/core/v8/V8ObjectBuilder.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/DocumentTiming.h" | 9 #include "core/dom/DocumentTiming.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
11 #include "core/loader/DocumentLoadTiming.h" | 11 #include "core/loader/DocumentLoadTiming.h" |
12 #include "core/loader/DocumentLoader.h" | 12 #include "core/loader/DocumentLoader.h" |
13 #include "core/timing/PerformanceBase.h" | 13 #include "core/timing/PerformanceBase.h" |
14 #include "platform/loader/fetch/ResourceTimingInfo.h" | 14 #include "platform/loader/fetch/ResourceTimingInfo.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 PerformanceNavigationTiming::PerformanceNavigationTiming( | 18 PerformanceNavigationTiming::PerformanceNavigationTiming( |
19 LocalFrame* frame, | 19 LocalFrame* frame, |
20 ResourceTimingInfo* info, | 20 ResourceTimingInfo* info, |
21 double time_origin) | 21 double time_origin, |
| 22 PerformanceServerTimingVector& serverTiming) |
22 : PerformanceResourceTiming(info ? info->InitialURL().GetString() : "", | 23 : PerformanceResourceTiming(info ? info->InitialURL().GetString() : "", |
23 "navigation", | 24 "navigation", |
24 0.0, | 25 0.0, |
25 0.0), | 26 0.0, |
| 27 serverTiming), |
26 ContextClient(frame), | 28 ContextClient(frame), |
27 time_origin_(time_origin), | 29 time_origin_(time_origin), |
28 resource_timing_info_(info) { | 30 resource_timing_info_(info) { |
29 DCHECK(frame); | 31 DCHECK(frame); |
30 DCHECK(info); | 32 DCHECK(info); |
31 } | 33 } |
32 | 34 |
33 PerformanceNavigationTiming::~PerformanceNavigationTiming() {} | 35 PerformanceNavigationTiming::~PerformanceNavigationTiming() {} |
34 | 36 |
35 DEFINE_TRACE(PerformanceNavigationTiming) { | 37 DEFINE_TRACE(PerformanceNavigationTiming) { |
36 ContextClient::Trace(visitor); | 38 ContextClient::Trace(visitor); |
37 PerformanceEntry::Trace(visitor); | 39 PerformanceResourceTiming::Trace(visitor); |
38 } | 40 } |
39 | 41 |
40 DocumentLoadTiming* PerformanceNavigationTiming::GetDocumentLoadTiming() const { | 42 DocumentLoadTiming* PerformanceNavigationTiming::GetDocumentLoadTiming() const { |
41 DocumentLoader* loader = GetDocumentLoader(); | 43 DocumentLoader* loader = GetDocumentLoader(); |
42 if (!loader) | 44 if (!loader) |
43 return nullptr; | 45 return nullptr; |
44 | 46 |
45 return &loader->GetTiming(); | 47 return &loader->GetTiming(); |
46 } | 48 } |
47 | 49 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return PerformanceBase::MonotonicTimeToDOMHighResTimeStamp( | 259 return PerformanceBase::MonotonicTimeToDOMHighResTimeStamp( |
258 time_origin_, timing->ResponseEnd(), false /* allow_negative_value */); | 260 time_origin_, timing->ResponseEnd(), false /* allow_negative_value */); |
259 } | 261 } |
260 | 262 |
261 // Overriding PerformanceEntry's attributes. | 263 // Overriding PerformanceEntry's attributes. |
262 DOMHighResTimeStamp PerformanceNavigationTiming::duration() const { | 264 DOMHighResTimeStamp PerformanceNavigationTiming::duration() const { |
263 return loadEventEnd(); | 265 return loadEventEnd(); |
264 } | 266 } |
265 | 267 |
266 void PerformanceNavigationTiming::BuildJSONValue( | 268 void PerformanceNavigationTiming::BuildJSONValue( |
| 269 ScriptState* script_state, |
267 V8ObjectBuilder& builder) const { | 270 V8ObjectBuilder& builder) const { |
268 PerformanceResourceTiming::BuildJSONValue(builder); | 271 PerformanceResourceTiming::BuildJSONValue(script_state, builder); |
269 builder.AddNumber("unloadEventStart", unloadEventStart()); | 272 builder.AddNumber("unloadEventStart", unloadEventStart()); |
270 builder.AddNumber("unloadEventEnd", unloadEventEnd()); | 273 builder.AddNumber("unloadEventEnd", unloadEventEnd()); |
271 builder.AddNumber("domInteractive", domInteractive()); | 274 builder.AddNumber("domInteractive", domInteractive()); |
272 builder.AddNumber("domContentLoadedEventStart", domContentLoadedEventStart()); | 275 builder.AddNumber("domContentLoadedEventStart", domContentLoadedEventStart()); |
273 builder.AddNumber("domContentLoadedEventEnd", domContentLoadedEventEnd()); | 276 builder.AddNumber("domContentLoadedEventEnd", domContentLoadedEventEnd()); |
274 builder.AddNumber("domComplete", domComplete()); | 277 builder.AddNumber("domComplete", domComplete()); |
275 builder.AddNumber("loadEventStart", loadEventStart()); | 278 builder.AddNumber("loadEventStart", loadEventStart()); |
276 builder.AddNumber("loadEventEnd", loadEventEnd()); | 279 builder.AddNumber("loadEventEnd", loadEventEnd()); |
277 builder.AddString("type", type()); | 280 builder.AddString("type", type()); |
278 builder.AddNumber("redirectCount", redirectCount()); | 281 builder.AddNumber("redirectCount", redirectCount()); |
279 } | 282 } |
280 } | 283 } |
OLD | NEW |