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 DocumentParserTiming_h | 5 #ifndef DocumentParserTiming_h |
6 #define DocumentParserTiming_h | 6 #define DocumentParserTiming_h |
7 | 7 |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void markParserDetached(); | 44 void markParserDetached(); |
45 | 45 |
46 // Record a duration of time that the parser yielded due to loading a | 46 // Record a duration of time that the parser yielded due to loading a |
47 // script, in seconds. scriptInsertedViaDocumentWrite indicates whether the | 47 // script, in seconds. scriptInsertedViaDocumentWrite indicates whether the |
48 // script causing blocking was inserted via document.write. This may be | 48 // script causing blocking was inserted via document.write. This may be |
49 // called multiple times, once for each time the parser yields on a script | 49 // called multiple times, once for each time the parser yields on a script |
50 // load. | 50 // load. |
51 void recordParserBlockedOnScriptLoadDuration( | 51 void recordParserBlockedOnScriptLoadDuration( |
52 double duration, bool scriptInsertedViaDocumentWrite); | 52 double duration, bool scriptInsertedViaDocumentWrite); |
53 | 53 |
| 54 // Record a duration of time that the parser spent executing a script, in |
| 55 // seconds. scriptInsertedViaDocumentWrite indicates whether the script |
| 56 // being executed was inserted via document.write. This may be called |
| 57 // multiple times, once for each time the parser executes a script. |
| 58 void recordParserBlockedOnScriptExecutionDuration( |
| 59 double duration, bool scriptInsertedViaDocumentWrite); |
| 60 |
54 // The getters below return monotonically-increasing seconds, or zero if the | 61 // The getters below return monotonically-increasing seconds, or zero if the |
55 // given parser event has not yet occurred. See the comments for | 62 // given parser event has not yet occurred. See the comments for |
56 // monotonicallyIncreasingTime in wtf/CurrentTime.h for additional details. | 63 // monotonicallyIncreasingTime in wtf/CurrentTime.h for additional details. |
57 | 64 |
58 double parserStart() const { return m_parserStart; } | 65 double parserStart() const { return m_parserStart; } |
59 double parserStop() const { return m_parserStop; } | 66 double parserStop() const { return m_parserStop; } |
60 | 67 |
61 // Returns the sum of all blocking script load durations reported via | 68 // Returns the sum of all blocking script load durations reported via |
62 // recordParseBlockedOnScriptLoadDuration. | 69 // recordParseBlockedOnScriptLoadDuration. |
63 double parserBlockedOnScriptLoadDuration() const { return m_parserBlockedOnS
criptLoadDuration; } | 70 double parserBlockedOnScriptLoadDuration() const { return m_parserBlockedOnS
criptLoadDuration; } |
64 | 71 |
65 // Returns the sum of all blocking script load durations due to | 72 // Returns the sum of all blocking script load durations due to |
66 // document.write reported via recordParseBlockedOnScriptLoadDuration. Note | 73 // document.write reported via recordParseBlockedOnScriptLoadDuration. Note |
67 // that some uncommon cases are not currently covered by this method. See | 74 // that some uncommon cases are not currently covered by this method. See |
68 // crbug/600711 for details. | 75 // crbug/600711 for details. |
69 double parserBlockedOnScriptLoadFromDocumentWriteDuration() const { return m
_parserBlockedOnScriptLoadFromDocumentWriteDuration; } | 76 double parserBlockedOnScriptLoadFromDocumentWriteDuration() const { return m
_parserBlockedOnScriptLoadFromDocumentWriteDuration; } |
70 | 77 |
| 78 // Returns the sum of all script execution durations reported via |
| 79 // recordParseBlockedOnScriptExecutionDuration. |
| 80 double parserBlockedOnScriptExecutionDuration() const { return m_parserBlock
edOnScriptExecutionDuration; } |
| 81 |
| 82 // Returns the sum of all script execution durations due to |
| 83 // document.write reported via recordParseBlockedOnScriptExecutionDuration.
Note |
| 84 // that some uncommon cases are not currently covered by this method. See |
| 85 // crbug/600711 for details. |
| 86 double parserBlockedOnScriptExecutionFromDocumentWriteDuration() const { ret
urn m_parserBlockedOnScriptExecutionFromDocumentWriteDuration; } |
| 87 |
71 DECLARE_VIRTUAL_TRACE(); | 88 DECLARE_VIRTUAL_TRACE(); |
72 | 89 |
73 private: | 90 private: |
74 explicit DocumentParserTiming(Document&); | 91 explicit DocumentParserTiming(Document&); |
75 void notifyDocumentParserTimingChanged(); | 92 void notifyDocumentParserTimingChanged(); |
76 | 93 |
77 double m_parserStart = 0.0; | 94 double m_parserStart = 0.0; |
78 double m_parserStop = 0.0; | 95 double m_parserStop = 0.0; |
79 double m_parserBlockedOnScriptLoadDuration = 0.0; | 96 double m_parserBlockedOnScriptLoadDuration = 0.0; |
80 double m_parserBlockedOnScriptLoadFromDocumentWriteDuration = 0.0; | 97 double m_parserBlockedOnScriptLoadFromDocumentWriteDuration = 0.0; |
| 98 double m_parserBlockedOnScriptExecutionDuration = 0.0; |
| 99 double m_parserBlockedOnScriptExecutionFromDocumentWriteDuration = 0.0; |
81 bool m_parserDetached = false; | 100 bool m_parserDetached = false; |
82 | 101 |
83 Member<Document> m_document; | 102 Member<Document> m_document; |
84 }; | 103 }; |
85 | 104 |
86 } // namespace blink | 105 } // namespace blink |
87 | 106 |
88 #endif | 107 #endif |
OLD | NEW |