OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/dom/DocumentParserTiming.h" | 5 #include "core/dom/DocumentParserTiming.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/loader/DocumentLoader.h" | 8 #include "core/loader/DocumentLoader.h" |
9 #include "platform/TraceEvent.h" | 9 #include "platform/TraceEvent.h" |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 double duration, bool scriptInsertedViaDocumentWrite) | 49 double duration, bool scriptInsertedViaDocumentWrite) |
50 { | 50 { |
51 if (m_parserDetached || m_parserStart == 0.0 || m_parserStop > 0.0) | 51 if (m_parserDetached || m_parserStart == 0.0 || m_parserStop > 0.0) |
52 return; | 52 return; |
53 m_parserBlockedOnScriptLoadDuration += duration; | 53 m_parserBlockedOnScriptLoadDuration += duration; |
54 if (scriptInsertedViaDocumentWrite) | 54 if (scriptInsertedViaDocumentWrite) |
55 m_parserBlockedOnScriptLoadFromDocumentWriteDuration += duration; | 55 m_parserBlockedOnScriptLoadFromDocumentWriteDuration += duration; |
56 notifyDocumentParserTimingChanged(); | 56 notifyDocumentParserTimingChanged(); |
57 } | 57 } |
58 | 58 |
| 59 void DocumentParserTiming::recordParserBlockedOnScriptExecutionDuration( |
| 60 double duration, bool scriptInsertedViaDocumentWrite) |
| 61 { |
| 62 if (m_parserDetached || m_parserStart == 0.0 || m_parserStop > 0.0) |
| 63 return; |
| 64 m_parserBlockedOnScriptExecutionDuration += duration; |
| 65 if (scriptInsertedViaDocumentWrite) |
| 66 m_parserBlockedOnScriptExecutionFromDocumentWriteDuration += duration; |
| 67 notifyDocumentParserTimingChanged(); |
| 68 } |
| 69 |
59 DEFINE_TRACE(DocumentParserTiming) | 70 DEFINE_TRACE(DocumentParserTiming) |
60 { | 71 { |
61 visitor->trace(m_document); | 72 visitor->trace(m_document); |
62 Supplement<Document>::trace(visitor); | 73 Supplement<Document>::trace(visitor); |
63 } | 74 } |
64 | 75 |
65 DocumentParserTiming::DocumentParserTiming(Document& document) | 76 DocumentParserTiming::DocumentParserTiming(Document& document) |
66 : m_document(document) | 77 : m_document(document) |
67 { | 78 { |
68 } | 79 } |
69 | 80 |
70 void DocumentParserTiming::notifyDocumentParserTimingChanged() | 81 void DocumentParserTiming::notifyDocumentParserTimingChanged() |
71 { | 82 { |
72 if (m_document->loader()) | 83 if (m_document->loader()) |
73 m_document->loader()->didChangePerformanceTiming(); | 84 m_document->loader()->didChangePerformanceTiming(); |
74 } | 85 } |
75 | 86 |
76 } // namespace blink | 87 } // namespace blink |
OLD | NEW |