Chromium Code Reviews| 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 class ResourceLoadTiming; | |
| 23 | |
| 14 class CORE_EXPORT PerformanceNavigationTiming final | 24 class CORE_EXPORT PerformanceNavigationTiming final |
| 15 : public PerformanceResourceTiming { | 25 : public PerformanceResourceTiming { |
| 16 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
| 27 friend class PerformanceNavigationTimingTest; | |
| 17 | 28 |
| 18 public: | 29 public: |
| 19 enum class NavigationType { Navigate, Reload, BackForward, Prerender }; | 30 PerformanceNavigationTiming(LocalFrame*, |
| 31 ResourceTimingInfo*, | |
| 32 double timeOrigin); | |
| 20 | 33 |
| 21 PerformanceNavigationTiming(double timeOrigin, | 34 // Attributes inheritted from PerformanceEntry. |
| 22 const String& requestedUrl, | 35 DOMHighResTimeStamp duration() const override; |
| 23 double unloadEventStart, | |
| 24 double unloadEventEnd, | |
| 25 double loadEventStart, | |
| 26 double loadEventEnd, | |
| 27 unsigned short redirectCount, | |
| 28 double domInteractive, | |
| 29 double domContentLoadedEventStart, | |
| 30 double domContentLoadedEventEnd, | |
| 31 double domComplete, | |
| 32 NavigationType, | |
| 33 double redirectStart, | |
| 34 double redirectEnd, | |
| 35 double fetchStart, | |
| 36 double responseEnd, | |
| 37 bool allowRedirectDetails, | |
| 38 bool hasSameOriginAsPreviousDocument, | |
| 39 ResourceLoadTiming*, | |
| 40 double lastRedirectEndTime, | |
| 41 double finishTime, | |
| 42 unsigned long long transferSize, | |
| 43 unsigned long long encodedBodyLength, | |
| 44 unsigned long long decodedBodyLength, | |
| 45 bool didReuseConnection); | |
| 46 | 36 |
| 37 AtomicString initiatorType() const override; | |
| 38 | |
| 39 // PerformanceNavigationTiming's unique attributes. | |
| 47 DOMHighResTimeStamp unloadEventStart() const; | 40 DOMHighResTimeStamp unloadEventStart() const; |
| 48 DOMHighResTimeStamp unloadEventEnd() const; | 41 DOMHighResTimeStamp unloadEventEnd() const; |
| 49 DOMHighResTimeStamp domInteractive() const; | 42 DOMHighResTimeStamp domInteractive() const; |
| 50 DOMHighResTimeStamp domContentLoadedEventStart() const; | 43 DOMHighResTimeStamp domContentLoadedEventStart() const; |
| 51 DOMHighResTimeStamp domContentLoadedEventEnd() const; | 44 DOMHighResTimeStamp domContentLoadedEventEnd() const; |
| 52 DOMHighResTimeStamp domComplete() const; | 45 DOMHighResTimeStamp domComplete() const; |
| 53 DOMHighResTimeStamp loadEventStart() const; | 46 DOMHighResTimeStamp loadEventStart() const; |
| 54 DOMHighResTimeStamp loadEventEnd() const; | 47 DOMHighResTimeStamp loadEventEnd() const; |
| 55 AtomicString type() const; | 48 AtomicString type() const; |
| 56 unsigned short redirectCount() const; | 49 unsigned short redirectCount() const; |
| 57 | 50 |
| 58 // PerformanceResourceTiming overrides: | 51 // PerformanceResourceTiming overrides: |
| 59 DOMHighResTimeStamp fetchStart() const override; | 52 DOMHighResTimeStamp fetchStart() const override; |
| 60 DOMHighResTimeStamp redirectStart() const override; | 53 DOMHighResTimeStamp redirectStart() const override; |
| 61 DOMHighResTimeStamp redirectEnd() const override; | 54 DOMHighResTimeStamp redirectEnd() const override; |
| 62 DOMHighResTimeStamp responseEnd() const override; | 55 DOMHighResTimeStamp responseEnd() const override; |
| 63 | 56 |
| 57 DECLARE_VIRTUAL_TRACE(); | |
| 58 | |
| 64 protected: | 59 protected: |
| 65 void buildJSONValue(V8ObjectBuilder&) const override; | 60 void buildJSONValue(V8ObjectBuilder&) const override; |
| 66 | 61 |
| 67 private: | 62 private: |
| 68 ~PerformanceNavigationTiming() override; | 63 ~PerformanceNavigationTiming() override; |
| 69 | 64 |
| 65 static AtomicString getNavigationType(NavigationType, const Document*); | |
| 66 const DocumentTiming* documentTiming() const; | |
| 67 DocumentLoader* documentLoader() const; | |
| 68 DocumentLoadTiming* documentLoadTiming() const; | |
| 69 | |
| 70 virtual ResourceLoadTiming* resourceLoadTiming() const; | |
| 71 virtual bool allowTimingDetails() const; | |
| 72 virtual bool didReuseConnection() const; | |
| 73 virtual unsigned long long getTransferSize() const; | |
| 74 virtual unsigned long long getEncodedBodySize() const; | |
| 75 virtual unsigned long long getDecodedBodySize() const; | |
| 76 | |
| 77 bool getAllowRedirectDetails() const; | |
| 78 | |
| 70 double m_timeOrigin; | 79 double m_timeOrigin; |
| 71 double m_unloadEventStart; | 80 RefPtr<ResourceTimingInfo> m_resourceTimingInfo; |
| 72 double m_unloadEventEnd; | 81 WeakMember<LocalFrame> m_frame; |
|
haraken
2017/03/14 20:10:40
I guess this should just be a Member.
Is there an
sunjian
2017/03/14 23:59:53
I guess i wasn't taking who outlives whom into con
| |
| 73 double m_loadEventStart; | |
| 74 double m_loadEventEnd; | |
| 75 unsigned short m_redirectCount; | |
| 76 double m_domInteractive; | |
| 77 double m_domContentLoadedEventStart; | |
| 78 double m_domContentLoadedEventEnd; | |
| 79 double m_domComplete; | |
| 80 NavigationType m_type; | |
| 81 double m_redirectStart; | |
| 82 double m_redirectEnd; | |
| 83 double m_fetchStart; | |
| 84 double m_responseEnd; | |
| 85 bool m_allowRedirectDetails; | |
| 86 bool m_hasSameOriginAsPreviousDocument; | |
| 87 }; | 82 }; |
| 88 } // namespace blink | 83 } // namespace blink |
| 89 | 84 |
| 90 #endif // PerformanceNavigationTiming_h | 85 #endif // PerformanceNavigationTiming_h |
| OLD | NEW |