 Chromium Code Reviews
 Chromium Code Reviews Issue 2397753006:
  scheduler: Detect load RAIL mode  (Closed)
    
  
    Issue 2397753006:
  scheduler: Detect load RAIL mode  (Closed) 
  | Index: third_party/WebKit/Source/core/paint/PaintTiming.cpp | 
| diff --git a/third_party/WebKit/Source/core/paint/PaintTiming.cpp b/third_party/WebKit/Source/core/paint/PaintTiming.cpp | 
| index f87085b838c3eeaf5de00e7bed4e77de66bd05c9..d982e0c38b482887f75eab390d14695e21a4d6ec 100644 | 
| --- a/third_party/WebKit/Source/core/paint/PaintTiming.cpp | 
| +++ b/third_party/WebKit/Source/core/paint/PaintTiming.cpp | 
| @@ -5,8 +5,11 @@ | 
| #include "core/paint/PaintTiming.h" | 
| #include "core/dom/Document.h" | 
| +#include "core/frame/FrameView.h" | 
| +#include "core/frame/LocalFrame.h" | 
| #include "core/loader/DocumentLoader.h" | 
| #include "platform/tracing/TraceEvent.h" | 
| +#include "public/platform/WebFrameScheduler.h" | 
| namespace blink { | 
| @@ -65,6 +68,25 @@ void PaintTiming::markFirstImagePaint() { | 
| notifyPaintTimingChanged(); | 
| } | 
| +void PaintTiming::markFirstMeaningfulPaintCandidate() { | 
| + // The first meaningful paint candidate can be reported very early, even | 
| + // before the first contentful paint. To cut down on false positives, we only | 
| + // report the first meaningful paint candidate after the first contentful | 
| + // paint. | 
| 
kouhei (in TOK)
2016/11/30 01:30:20
I wonder if we can modify FMP to be always after F
 
kouhei (in TOK)
2016/11/30 01:36:52
Please ignore the comment above.
 | 
| + if (!m_firstContentfulPaint) | 
| + return; | 
| + // Ignore the first meaningful paint candidate as this generally is the first | 
| + // contentful paint itself. | 
| + if (!m_seenFirstMeaningfulPaintCandidate) { | 
| + m_seenFirstMeaningfulPaintCandidate = true; | 
| + return; | 
| + } | 
| + if (m_document->frame() && m_document->frame()->view() && | 
| + !m_document->frame()->view()->parent()) { | 
| + m_document->frame()->frameScheduler()->onFirstMeaningfulPaint(); | 
| + } | 
| +} | 
| + | 
| void PaintTiming::setFirstMeaningfulPaint(double stamp) { | 
| DCHECK_EQ(m_firstMeaningfulPaint, 0.0); | 
| m_firstMeaningfulPaint = stamp; |