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 #include "wtf/RawPtr.h" | 10 #include "wtf/RawPtr.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 m_parserStop = monotonicallyIncreasingTime(); | 39 m_parserStop = monotonicallyIncreasingTime(); |
40 notifyDocumentParserTimingChanged(); | 40 notifyDocumentParserTimingChanged(); |
41 } | 41 } |
42 | 42 |
43 void DocumentParserTiming::markParserDetached() | 43 void DocumentParserTiming::markParserDetached() |
44 { | 44 { |
45 ASSERT(m_parserStart > 0.0); | 45 ASSERT(m_parserStart > 0.0); |
46 m_parserDetached = true; | 46 m_parserDetached = true; |
47 } | 47 } |
48 | 48 |
49 void DocumentParserTiming::recordParserBlockedOnScriptLoadDuration(double durati
on) | 49 void DocumentParserTiming::recordParserBlockedOnScriptLoadDuration( |
| 50 double duration, bool scriptInsertedViaDocumentWrite) |
50 { | 51 { |
51 if (m_parserDetached || m_parserStart == 0.0 || m_parserStop > 0.0) | 52 if (m_parserDetached || m_parserStart == 0.0 || m_parserStop > 0.0) |
52 return; | 53 return; |
53 m_parserBlockedOnScriptLoadDuration += duration; | 54 m_parserBlockedOnScriptLoadDuration += duration; |
| 55 if (scriptInsertedViaDocumentWrite) |
| 56 m_parserBlockedOnScriptLoadFromDocumentWriteDuration += duration; |
54 notifyDocumentParserTimingChanged(); | 57 notifyDocumentParserTimingChanged(); |
55 } | 58 } |
56 | 59 |
57 DEFINE_TRACE(DocumentParserTiming) | 60 DEFINE_TRACE(DocumentParserTiming) |
58 { | 61 { |
59 visitor->trace(m_document); | 62 visitor->trace(m_document); |
60 } | 63 } |
61 | 64 |
62 DocumentParserTiming::DocumentParserTiming(Document& document) | 65 DocumentParserTiming::DocumentParserTiming(Document& document) |
63 : m_document(document) | 66 : m_document(document) |
64 { | 67 { |
65 } | 68 } |
66 | 69 |
67 void DocumentParserTiming::notifyDocumentParserTimingChanged() | 70 void DocumentParserTiming::notifyDocumentParserTimingChanged() |
68 { | 71 { |
69 if (m_document->loader()) | 72 if (m_document->loader()) |
70 m_document->loader()->didChangePerformanceTiming(); | 73 m_document->loader()->didChangePerformanceTiming(); |
71 } | 74 } |
72 | 75 |
73 } // namespace blink | 76 } // namespace blink |
OLD | NEW |