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

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

Issue 2610063006: Create TaskAttributionTiming PerformanceEntry for attribution in PerformanceLongTaskTiming. Move cu… (Closed)
Patch Set: update layout test expectation Created 3 years, 11 months 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return entries; 126 return entries;
127 } 127 }
128 128
129 PerformanceEntryVector PerformanceBase::getEntriesByType( 129 PerformanceEntryVector PerformanceBase::getEntriesByType(
130 const String& entryType) { 130 const String& entryType) {
131 PerformanceEntryVector entries; 131 PerformanceEntryVector entries;
132 PerformanceEntry::EntryType type = 132 PerformanceEntry::EntryType type =
133 PerformanceEntry::toEntryTypeEnum(entryType); 133 PerformanceEntry::toEntryTypeEnum(entryType);
134 134
135 switch (type) { 135 switch (type) {
136 case PerformanceEntry::Invalid:
137 return entries;
138 case PerformanceEntry::LongTask:
139 // Unsupported for LongTask. Per the spec, Long task entries can only be
140 // accessed via Performance Observer. No separate buffer is maintained.
141 return entries;
142 case PerformanceEntry::Resource: 136 case PerformanceEntry::Resource:
143 for (const auto& resource : m_resourceTimingBuffer) 137 for (const auto& resource : m_resourceTimingBuffer)
144 entries.append(resource); 138 entries.append(resource);
145 break; 139 break;
146 case PerformanceEntry::Navigation: 140 case PerformanceEntry::Navigation:
147 if (m_navigationTiming) 141 if (m_navigationTiming)
148 entries.append(m_navigationTiming); 142 entries.append(m_navigationTiming);
149 break; 143 break;
150 case PerformanceEntry::Composite: 144 case PerformanceEntry::Composite:
151 case PerformanceEntry::Render: 145 case PerformanceEntry::Render:
152 for (const auto& frame : m_frameTimingBuffer) { 146 for (const auto& frame : m_frameTimingBuffer) {
153 if (type == frame->entryTypeEnum()) { 147 if (type == frame->entryTypeEnum()) {
154 entries.append(frame); 148 entries.append(frame);
155 } 149 }
156 } 150 }
157 break; 151 break;
158 case PerformanceEntry::Mark: 152 case PerformanceEntry::Mark:
159 if (m_userTiming) 153 if (m_userTiming)
160 entries.appendVector(m_userTiming->getMarks()); 154 entries.appendVector(m_userTiming->getMarks());
161 break; 155 break;
162 case PerformanceEntry::Measure: 156 case PerformanceEntry::Measure:
163 if (m_userTiming) 157 if (m_userTiming)
164 entries.appendVector(m_userTiming->getMeasures()); 158 entries.appendVector(m_userTiming->getMeasures());
165 break; 159 break;
160 // Unsupported for LongTask, TaskAttribution.
161 // Per the spec, these entries can only be accessed via
162 // Performance Observer. No separate buffer is maintained.
163 case PerformanceEntry::LongTask:
164 break;
165 case PerformanceEntry::TaskAttribution:
166 break;
167 case PerformanceEntry::Invalid:
168 break;
Yoav Weiss 2017/01/06 10:13:05 Hmm, this is according to spec: https://w3c.github
166 } 169 }
167 170
168 std::sort(entries.begin(), entries.end(), 171 std::sort(entries.begin(), entries.end(),
169 PerformanceEntry::startTimeCompareLessThan); 172 PerformanceEntry::startTimeCompareLessThan);
170 return entries; 173 return entries;
171 } 174 }
172 175
173 PerformanceEntryVector PerformanceBase::getEntriesByName( 176 PerformanceEntryVector PerformanceBase::getEntriesByName(
174 const String& name, 177 const String& name,
175 const String& entryType) { 178 const String& entryType) {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 dispatchEvent(Event::create(EventTypeNames::frametimingbufferfull)); 424 dispatchEvent(Event::create(EventTypeNames::frametimingbufferfull));
422 } 425 }
423 426
424 bool PerformanceBase::isFrameTimingBufferFull() { 427 bool PerformanceBase::isFrameTimingBufferFull() {
425 return m_frameTimingBuffer.size() >= m_frameTimingBufferSize; 428 return m_frameTimingBuffer.size() >= m_frameTimingBufferSize;
426 } 429 }
427 430
428 void PerformanceBase::addLongTaskTiming(double startTime, 431 void PerformanceBase::addLongTaskTiming(double startTime,
429 double endTime, 432 double endTime,
430 const String& name, 433 const String& name,
431 const String& culpritFrameSrc, 434 const String& frameSrc,
432 const String& culpritFrameId, 435 const String& frameId,
433 const String& culpritFrameName) { 436 const String& frameName) {
434 if (!hasObserverFor(PerformanceEntry::LongTask)) 437 if (!hasObserverFor(PerformanceEntry::LongTask))
435 return; 438 return;
436 PerformanceEntry* entry = PerformanceLongTaskTiming::create( 439 PerformanceEntry* entry = PerformanceLongTaskTiming::create(
437 monotonicTimeToDOMHighResTimeStamp(startTime), 440 monotonicTimeToDOMHighResTimeStamp(startTime),
438 monotonicTimeToDOMHighResTimeStamp(endTime), name, culpritFrameSrc, 441 monotonicTimeToDOMHighResTimeStamp(endTime), name, frameSrc, frameId,
439 culpritFrameId, culpritFrameName); 442 frameName);
440 notifyObserversOfEntry(*entry); 443 notifyObserversOfEntry(*entry);
441 } 444 }
442 445
443 void PerformanceBase::mark(const String& markName, 446 void PerformanceBase::mark(const String& markName,
444 ExceptionState& exceptionState) { 447 ExceptionState& exceptionState) {
445 if (!m_userTiming) 448 if (!m_userTiming)
446 m_userTiming = UserTiming::create(*this); 449 m_userTiming = UserTiming::create(*this);
447 if (PerformanceEntry* entry = m_userTiming->mark(markName, exceptionState)) 450 if (PerformanceEntry* entry = m_userTiming->mark(markName, exceptionState))
448 notifyObserversOfEntry(*entry); 451 notifyObserversOfEntry(*entry);
449 } 452 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 visitor->trace(m_resourceTimingBuffer); 575 visitor->trace(m_resourceTimingBuffer);
573 visitor->trace(m_navigationTiming); 576 visitor->trace(m_navigationTiming);
574 visitor->trace(m_userTiming); 577 visitor->trace(m_userTiming);
575 visitor->trace(m_observers); 578 visitor->trace(m_observers);
576 visitor->trace(m_activeObservers); 579 visitor->trace(m_activeObservers);
577 visitor->trace(m_suspendedObservers); 580 visitor->trace(m_suspendedObservers);
578 EventTargetWithInlineData::trace(visitor); 581 EventTargetWithInlineData::trace(visitor);
579 } 582 }
580 583
581 } // namespace blink 584 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/BUILD.gn ('k') | third_party/WebKit/Source/core/timing/PerformanceEntry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698