Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceBase.cpp

Issue 2528513003: first-paint and first-contentful paint (Closed)
Patch Set: updated layout tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 PerformanceEntryVector PerformanceBase::getEntriesByType( 97 PerformanceEntryVector PerformanceBase::getEntriesByType(
98 const String& entryType) { 98 const String& entryType) {
99 PerformanceEntryVector entries; 99 PerformanceEntryVector entries;
100 PerformanceEntry::EntryType type = 100 PerformanceEntry::EntryType type =
101 PerformanceEntry::toEntryTypeEnum(entryType); 101 PerformanceEntry::toEntryTypeEnum(entryType);
102 102
103 switch (type) { 103 switch (type) {
104 case PerformanceEntry::Invalid: 104 case PerformanceEntry::Invalid:
105 return entries; 105 return entries;
106 case PerformanceEntry::Paint:
panicker 2016/12/05 20:51:23 Nit: add another comment here instead of adding to
sunjian 2016/12/07 21:55:44 Done.
106 case PerformanceEntry::LongTask: 107 case PerformanceEntry::LongTask:
107 // Unsupported for LongTask. Per the spec, Long task entries can only be 108 // Unsupported for LongTask or Paint. Per the spec, Long task entries and
108 // accessed via Performance Observer. No separate buffer is maintained. 109 // Paint entries can only be accessed via Performance Observer.
110 // No separate buffer is maintained.
109 return entries; 111 return entries;
110 case PerformanceEntry::Resource: 112 case PerformanceEntry::Resource:
111 for (const auto& resource : m_resourceTimingBuffer) 113 for (const auto& resource : m_resourceTimingBuffer)
112 entries.append(resource); 114 entries.append(resource);
113 break; 115 break;
114 case PerformanceEntry::Navigation: 116 case PerformanceEntry::Navigation:
115 if (m_navigationTiming) 117 if (m_navigationTiming)
116 entries.append(m_navigationTiming); 118 entries.append(m_navigationTiming);
117 break; 119 break;
118 case PerformanceEntry::Composite: 120 case PerformanceEntry::Composite:
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 documentLoader->getNavigationType(), documentLoadTiming.redirectStart(), 350 documentLoader->getNavigationType(), documentLoadTiming.redirectStart(),
349 documentLoadTiming.redirectEnd(), documentLoadTiming.fetchStart(), 351 documentLoadTiming.redirectEnd(), documentLoadTiming.fetchStart(),
350 documentLoadTiming.responseEnd(), 352 documentLoadTiming.responseEnd(),
351 documentLoadTiming.hasCrossOriginRedirect(), 353 documentLoadTiming.hasCrossOriginRedirect(),
352 documentLoadTiming.hasSameOriginAsPreviousDocument(), resourceLoadTiming, 354 documentLoadTiming.hasSameOriginAsPreviousDocument(), resourceLoadTiming,
353 lastRedirectEndTime, finishTime, transferSize, encodedBodyLength, 355 lastRedirectEndTime, finishTime, transferSize, encodedBodyLength,
354 decodedBodyLength, didReuseConnection); 356 decodedBodyLength, didReuseConnection);
355 notifyObserversOfEntry(*m_navigationTiming); 357 notifyObserversOfEntry(*m_navigationTiming);
356 } 358 }
357 359
360 void PerformanceBase::addPaintTiming(PerformancePaintTiming::PaintType type,
361 double startTime) {
362 if (!RuntimeEnabledFeatures::performancePaintTimingEnabled())
363 return;
364 PerformanceEntry* entry = new PerformancePaintTiming(
365 type, monotonicTimeToDOMHighResTimeStamp(startTime));
366 notifyObserversOfEntry(*entry);
367 }
368
358 void PerformanceBase::addResourceTimingBuffer(PerformanceEntry& entry) { 369 void PerformanceBase::addResourceTimingBuffer(PerformanceEntry& entry) {
359 m_resourceTimingBuffer.append(&entry); 370 m_resourceTimingBuffer.append(&entry);
360 371
361 if (isResourceTimingBufferFull()) { 372 if (isResourceTimingBufferFull()) {
362 dispatchEvent(Event::create(EventTypeNames::resourcetimingbufferfull)); 373 dispatchEvent(Event::create(EventTypeNames::resourcetimingbufferfull));
363 dispatchEvent( 374 dispatchEvent(
364 Event::create(EventTypeNames::webkitresourcetimingbufferfull)); 375 Event::create(EventTypeNames::webkitresourcetimingbufferfull));
365 } 376 }
366 } 377 }
367 378
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 visitor->trace(m_resourceTimingBuffer); 543 visitor->trace(m_resourceTimingBuffer);
533 visitor->trace(m_navigationTiming); 544 visitor->trace(m_navigationTiming);
534 visitor->trace(m_userTiming); 545 visitor->trace(m_userTiming);
535 visitor->trace(m_observers); 546 visitor->trace(m_observers);
536 visitor->trace(m_activeObservers); 547 visitor->trace(m_activeObservers);
537 visitor->trace(m_suspendedObservers); 548 visitor->trace(m_suspendedObservers);
538 EventTargetWithInlineData::trace(visitor); 549 EventTargetWithInlineData::trace(visitor);
539 } 550 }
540 551
541 } // namespace blink 552 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698