| 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/paint/PaintTiming.h" | 5 #include "core/paint/PaintTiming.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" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 static const char kSupplementName[] = "PaintTiming"; | 14 static const char kSupplementName[] = "PaintTiming"; |
| 15 | 15 |
| 16 PaintTiming& PaintTiming::from(Document& document) | 16 PaintTiming& PaintTiming::from(Document& document) |
| 17 { | 17 { |
| 18 PaintTiming* timing = static_cast<PaintTiming*>(WillBeHeapSupplement<Documen
t>::from(document, kSupplementName)); | 18 PaintTiming* timing = static_cast<PaintTiming*>(HeapSupplement<Document>::fr
om(document, kSupplementName)); |
| 19 if (!timing) { | 19 if (!timing) { |
| 20 timing = new PaintTiming(document); | 20 timing = new PaintTiming(document); |
| 21 WillBeHeapSupplement<Document>::provideTo(document, kSupplementName, ado
ptPtrWillBeNoop(timing)); | 21 HeapSupplement<Document>::provideTo(document, kSupplementName, (timing))
; |
| 22 } | 22 } |
| 23 return *timing; | 23 return *timing; |
| 24 } | 24 } |
| 25 | 25 |
| 26 PaintTiming::PaintTiming(Document& document) | 26 PaintTiming::PaintTiming(Document& document) |
| 27 : m_document(document) | 27 : m_document(document) |
| 28 { | 28 { |
| 29 } | 29 } |
| 30 | 30 |
| 31 DEFINE_TRACE(PaintTiming) | 31 DEFINE_TRACE(PaintTiming) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void PaintTiming::markFirstContentfulPaint() | 82 void PaintTiming::markFirstContentfulPaint() |
| 83 { | 83 { |
| 84 if (m_firstContentfulPaint != 0.0) | 84 if (m_firstContentfulPaint != 0.0) |
| 85 return; | 85 return; |
| 86 m_firstContentfulPaint = monotonicallyIncreasingTime(); | 86 m_firstContentfulPaint = monotonicallyIncreasingTime(); |
| 87 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "firstContentfulPaint"
, m_firstContentfulPaint, "frame", frame()); | 87 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "firstContentfulPaint"
, m_firstContentfulPaint, "frame", frame()); |
| 88 notifyPaintTimingChanged(); | 88 notifyPaintTimingChanged(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace blink | 91 } // namespace blink |
| OLD | NEW |