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 #ifndef PerformanceNavigationTiming_h | 5 #ifndef PerformanceNavigationTiming_h |
6 #define PerformanceNavigationTiming_h | 6 #define PerformanceNavigationTiming_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/dom/DOMHighResTimeStamp.h" | 9 #include "core/dom/DOMHighResTimeStamp.h" |
10 #include "core/loader/FrameLoaderTypes.h" | |
10 #include "core/timing/PerformanceResourceTiming.h" | 11 #include "core/timing/PerformanceResourceTiming.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
15 class Document; | |
16 class DocumentTiming; | |
17 class DocumentLoader; | |
18 class DocumentLoadTiming; | |
19 class LocalFrame; | |
20 class ExecutionContext; | |
21 class ResourceTimingInfo; | |
22 | |
14 class CORE_EXPORT PerformanceNavigationTiming final | 23 class CORE_EXPORT PerformanceNavigationTiming final |
15 : public PerformanceResourceTiming { | 24 : public PerformanceResourceTiming { |
16 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
26 friend class PerformanceNavigationTimingTest; | |
17 | 27 |
18 public: | 28 public: |
19 enum class NavigationType { Navigate, Reload, BackForward, Prerender }; | 29 PerformanceNavigationTiming(LocalFrame*, |
30 std::unique_ptr<ResourceTimingInfo>, | |
31 double timeOrigin); | |
20 | 32 |
21 PerformanceNavigationTiming(double timeOrigin, | 33 // Attributes inheritted from PerformanceEntry. |
22 double unloadEventStart, | 34 DOMHighResTimeStamp duration() const override; |
23 double unloadEventEnd, | |
24 double loadEventStart, | |
25 double loadEventEnd, | |
26 unsigned short redirectCount, | |
27 double domInteractive, | |
28 double domContentLoadedEventStart, | |
29 double domContentLoadedEventEnd, | |
30 double domComplete, | |
31 NavigationType, | |
32 double redirectStart, | |
33 double redirectEnd, | |
34 double fetchStart, | |
35 double responseEnd, | |
36 bool allowRedirectDetails, | |
37 bool hasSameOriginAsPreviousDocument, | |
38 ResourceLoadTiming*, | |
39 double lastRedirectEndTime, | |
40 double finishTime, | |
41 unsigned long long transferSize, | |
42 unsigned long long encodedBodyLength, | |
43 unsigned long long decodedBodyLength, | |
44 bool didReuseConnection); | |
45 | 35 |
36 // Attributes inherrited from PerformanceResourceTiming. | |
panicker
2017/02/03 23:53:52
Add link to relevant section in design doc, and al
sunjian
2017/02/10 18:32:46
Done.
| |
37 AtomicString initiatorType() const override; | |
38 DOMHighResTimeStamp workerStart() const override; | |
39 DOMHighResTimeStamp domainLookupStart() const override; | |
40 DOMHighResTimeStamp domainLookupEnd() const override; | |
41 DOMHighResTimeStamp connectStart() const override; | |
42 DOMHighResTimeStamp connectEnd() const override; | |
43 DOMHighResTimeStamp secureConnectionStart() const override; | |
44 DOMHighResTimeStamp requestStart() const override; | |
45 DOMHighResTimeStamp responseStart() const override; | |
46 unsigned long long transferSize() const override; | |
47 unsigned long long encodedBodySize() const override; | |
48 unsigned long long decodedBodySize() const override; | |
49 | |
50 // PerformanceNavigationTiming's unique attributes. | |
46 DOMHighResTimeStamp unloadEventStart() const; | 51 DOMHighResTimeStamp unloadEventStart() const; |
47 DOMHighResTimeStamp unloadEventEnd() const; | 52 DOMHighResTimeStamp unloadEventEnd() const; |
48 DOMHighResTimeStamp domInteractive() const; | 53 DOMHighResTimeStamp domInteractive() const; |
49 DOMHighResTimeStamp domContentLoadedEventStart() const; | 54 DOMHighResTimeStamp domContentLoadedEventStart() const; |
50 DOMHighResTimeStamp domContentLoadedEventEnd() const; | 55 DOMHighResTimeStamp domContentLoadedEventEnd() const; |
51 DOMHighResTimeStamp domComplete() const; | 56 DOMHighResTimeStamp domComplete() const; |
52 DOMHighResTimeStamp loadEventStart() const; | 57 DOMHighResTimeStamp loadEventStart() const; |
53 DOMHighResTimeStamp loadEventEnd() const; | 58 DOMHighResTimeStamp loadEventEnd() const; |
54 AtomicString type() const; | 59 AtomicString type() const; |
55 unsigned short redirectCount() const; | 60 unsigned short redirectCount() const; |
56 | 61 |
57 // PerformanceResourceTiming overrides: | 62 // PerformanceResourceTiming overrides: |
58 DOMHighResTimeStamp fetchStart() const override; | 63 DOMHighResTimeStamp fetchStart() const override; |
59 DOMHighResTimeStamp redirectStart() const override; | 64 DOMHighResTimeStamp redirectStart() const override; |
60 DOMHighResTimeStamp redirectEnd() const override; | 65 DOMHighResTimeStamp redirectEnd() const override; |
61 DOMHighResTimeStamp responseEnd() const override; | 66 DOMHighResTimeStamp responseEnd() const override; |
62 | 67 |
68 DECLARE_VIRTUAL_TRACE(); | |
69 | |
63 protected: | 70 protected: |
64 void buildJSONValue(V8ObjectBuilder&) const override; | 71 void buildJSONValue(V8ObjectBuilder&) const override; |
65 | 72 |
66 private: | 73 private: |
67 ~PerformanceNavigationTiming() override; | 74 ~PerformanceNavigationTiming() override; |
68 | 75 |
76 static AtomicString getNavigationType(NavigationType, const Document*); | |
77 | |
78 const DocumentTiming* documentTiming() const; | |
79 DocumentLoader* documentLoader() const; | |
80 DocumentLoadTiming* documentLoadTiming() const; | |
81 ExecutionContext* getExecutionContext() const; | |
82 | |
83 bool getAllowRedirectDetails() const; | |
84 | |
85 ResourceLoadTiming* resourceLoadTiming() const; | |
86 | |
69 double m_timeOrigin; | 87 double m_timeOrigin; |
70 double m_unloadEventStart; | 88 std::unique_ptr<ResourceTimingInfo> m_resourceTimingInfo; |
71 double m_unloadEventEnd; | 89 WeakMember<LocalFrame> m_frame; |
72 double m_loadEventStart; | |
73 double m_loadEventEnd; | |
74 unsigned short m_redirectCount; | |
75 double m_domInteractive; | |
76 double m_domContentLoadedEventStart; | |
77 double m_domContentLoadedEventEnd; | |
78 double m_domComplete; | |
79 NavigationType m_type; | |
80 double m_redirectStart; | |
81 double m_redirectEnd; | |
82 double m_fetchStart; | |
83 double m_responseEnd; | |
84 bool m_allowRedirectDetails; | |
85 bool m_hasSameOriginAsPreviousDocument; | |
86 }; | 90 }; |
87 } // namespace blink | 91 } // namespace blink |
88 | 92 |
89 #endif // PerformanceNavigationTiming_h | 93 #endif // PerformanceNavigationTiming_h |
OLD | NEW |