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

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

Issue 2617783002: Migrate WTF::Vector::append() to ::push_back() [part 12 of N] (Closed)
Patch Set: rebase 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 PerformanceTiming* PerformanceBase::timing() const { 107 PerformanceTiming* PerformanceBase::timing() const {
108 return nullptr; 108 return nullptr;
109 } 109 }
110 110
111 PerformanceEntryVector PerformanceBase::getEntries() const { 111 PerformanceEntryVector PerformanceBase::getEntries() const {
112 PerformanceEntryVector entries; 112 PerformanceEntryVector entries;
113 113
114 entries.appendVector(m_resourceTimingBuffer); 114 entries.appendVector(m_resourceTimingBuffer);
115 if (m_navigationTiming) 115 if (m_navigationTiming)
116 entries.append(m_navigationTiming); 116 entries.push_back(m_navigationTiming);
117 entries.appendVector(m_frameTimingBuffer); 117 entries.appendVector(m_frameTimingBuffer);
118 118
119 if (m_userTiming) { 119 if (m_userTiming) {
120 entries.appendVector(m_userTiming->getMarks()); 120 entries.appendVector(m_userTiming->getMarks());
121 entries.appendVector(m_userTiming->getMeasures()); 121 entries.appendVector(m_userTiming->getMeasures());
122 } 122 }
123 123
124 std::sort(entries.begin(), entries.end(), 124 std::sort(entries.begin(), entries.end(),
125 PerformanceEntry::startTimeCompareLessThan); 125 PerformanceEntry::startTimeCompareLessThan);
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::Resource: 136 case PerformanceEntry::Resource:
137 for (const auto& resource : m_resourceTimingBuffer) 137 for (const auto& resource : m_resourceTimingBuffer)
138 entries.append(resource); 138 entries.push_back(resource);
139 break; 139 break;
140 case PerformanceEntry::Navigation: 140 case PerformanceEntry::Navigation:
141 if (m_navigationTiming) 141 if (m_navigationTiming)
142 entries.append(m_navigationTiming); 142 entries.push_back(m_navigationTiming);
143 break; 143 break;
144 case PerformanceEntry::Composite: 144 case PerformanceEntry::Composite:
145 case PerformanceEntry::Render: 145 case PerformanceEntry::Render:
146 for (const auto& frame : m_frameTimingBuffer) { 146 for (const auto& frame : m_frameTimingBuffer) {
147 if (type == frame->entryTypeEnum()) { 147 if (type == frame->entryTypeEnum()) {
148 entries.append(frame); 148 entries.push_back(frame);
149 } 149 }
150 } 150 }
151 break; 151 break;
152 case PerformanceEntry::Mark: 152 case PerformanceEntry::Mark:
153 if (m_userTiming) 153 if (m_userTiming)
154 entries.appendVector(m_userTiming->getMarks()); 154 entries.appendVector(m_userTiming->getMarks());
155 break; 155 break;
156 case PerformanceEntry::Measure: 156 case PerformanceEntry::Measure:
157 if (m_userTiming) 157 if (m_userTiming)
158 entries.appendVector(m_userTiming->getMeasures()); 158 entries.appendVector(m_userTiming->getMeasures());
(...skipping 20 matching lines...) Expand all
179 PerformanceEntryVector entries; 179 PerformanceEntryVector entries;
180 PerformanceEntry::EntryType type = 180 PerformanceEntry::EntryType type =
181 PerformanceEntry::toEntryTypeEnum(entryType); 181 PerformanceEntry::toEntryTypeEnum(entryType);
182 182
183 if (!entryType.isNull() && type == PerformanceEntry::Invalid) 183 if (!entryType.isNull() && type == PerformanceEntry::Invalid)
184 return entries; 184 return entries;
185 185
186 if (entryType.isNull() || type == PerformanceEntry::Resource) { 186 if (entryType.isNull() || type == PerformanceEntry::Resource) {
187 for (const auto& resource : m_resourceTimingBuffer) { 187 for (const auto& resource : m_resourceTimingBuffer) {
188 if (resource->name() == name) 188 if (resource->name() == name)
189 entries.append(resource); 189 entries.push_back(resource);
190 } 190 }
191 } 191 }
192 192
193 if (entryType.isNull() || type == PerformanceEntry::Navigation) { 193 if (entryType.isNull() || type == PerformanceEntry::Navigation) {
194 if (m_navigationTiming && m_navigationTiming->name() == name) 194 if (m_navigationTiming && m_navigationTiming->name() == name)
195 entries.append(m_navigationTiming); 195 entries.push_back(m_navigationTiming);
196 } 196 }
197 197
198 if (entryType.isNull() || type == PerformanceEntry::Composite || 198 if (entryType.isNull() || type == PerformanceEntry::Composite ||
199 type == PerformanceEntry::Render) { 199 type == PerformanceEntry::Render) {
200 for (const auto& frame : m_frameTimingBuffer) { 200 for (const auto& frame : m_frameTimingBuffer) {
201 if (frame->name() == name && 201 if (frame->name() == name &&
202 (entryType.isNull() || entryType == frame->entryType())) 202 (entryType.isNull() || entryType == frame->entryType()))
203 entries.append(frame); 203 entries.push_back(frame);
204 } 204 }
205 } 205 }
206 206
207 if (m_userTiming) { 207 if (m_userTiming) {
208 if (entryType.isNull() || type == PerformanceEntry::Mark) 208 if (entryType.isNull() || type == PerformanceEntry::Mark)
209 entries.appendVector(m_userTiming->getMarks(name)); 209 entries.appendVector(m_userTiming->getMarks(name));
210 if (entryType.isNull() || type == PerformanceEntry::Measure) 210 if (entryType.isNull() || type == PerformanceEntry::Measure)
211 entries.appendVector(m_userTiming->getMeasures(name)); 211 entries.appendVector(m_userTiming->getMeasures(name));
212 } 212 }
213 213
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 documentLoadTiming.redirectStart(), documentLoadTiming.redirectEnd(), 397 documentLoadTiming.redirectStart(), documentLoadTiming.redirectEnd(),
398 documentLoadTiming.fetchStart(), documentLoadTiming.responseEnd(), 398 documentLoadTiming.fetchStart(), documentLoadTiming.responseEnd(),
399 allowRedirectDetails, 399 allowRedirectDetails,
400 documentLoadTiming.hasSameOriginAsPreviousDocument(), resourceLoadTiming, 400 documentLoadTiming.hasSameOriginAsPreviousDocument(), resourceLoadTiming,
401 lastRedirectEndTime, finishTime, transferSize, encodedBodyLength, 401 lastRedirectEndTime, finishTime, transferSize, encodedBodyLength,
402 decodedBodyLength, didReuseConnection); 402 decodedBodyLength, didReuseConnection);
403 notifyObserversOfEntry(*m_navigationTiming); 403 notifyObserversOfEntry(*m_navigationTiming);
404 } 404 }
405 405
406 void PerformanceBase::addResourceTimingBuffer(PerformanceEntry& entry) { 406 void PerformanceBase::addResourceTimingBuffer(PerformanceEntry& entry) {
407 m_resourceTimingBuffer.append(&entry); 407 m_resourceTimingBuffer.push_back(&entry);
408 408
409 if (isResourceTimingBufferFull()) { 409 if (isResourceTimingBufferFull()) {
410 dispatchEvent(Event::create(EventTypeNames::resourcetimingbufferfull)); 410 dispatchEvent(Event::create(EventTypeNames::resourcetimingbufferfull));
411 dispatchEvent( 411 dispatchEvent(
412 Event::create(EventTypeNames::webkitresourcetimingbufferfull)); 412 Event::create(EventTypeNames::webkitresourcetimingbufferfull));
413 } 413 }
414 } 414 }
415 415
416 bool PerformanceBase::isResourceTimingBufferFull() { 416 bool PerformanceBase::isResourceTimingBufferFull() {
417 return m_resourceTimingBuffer.size() >= m_resourceTimingBufferSize; 417 return m_resourceTimingBuffer.size() >= m_resourceTimingBufferSize;
418 } 418 }
419 419
420 void PerformanceBase::addFrameTimingBuffer(PerformanceEntry& entry) { 420 void PerformanceBase::addFrameTimingBuffer(PerformanceEntry& entry) {
421 m_frameTimingBuffer.append(&entry); 421 m_frameTimingBuffer.push_back(&entry);
422 422
423 if (isFrameTimingBufferFull()) 423 if (isFrameTimingBufferFull())
424 dispatchEvent(Event::create(EventTypeNames::frametimingbufferfull)); 424 dispatchEvent(Event::create(EventTypeNames::frametimingbufferfull));
425 } 425 }
426 426
427 bool PerformanceBase::isFrameTimingBufferFull() { 427 bool PerformanceBase::isFrameTimingBufferFull() {
428 return m_frameTimingBuffer.size() >= m_frameTimingBufferSize; 428 return m_frameTimingBuffer.size() >= m_frameTimingBufferSize;
429 } 429 }
430 430
431 void PerformanceBase::addLongTaskTiming(double startTime, 431 void PerformanceBase::addLongTaskTiming(double startTime,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 visitor->trace(m_resourceTimingBuffer); 575 visitor->trace(m_resourceTimingBuffer);
576 visitor->trace(m_navigationTiming); 576 visitor->trace(m_navigationTiming);
577 visitor->trace(m_userTiming); 577 visitor->trace(m_userTiming);
578 visitor->trace(m_observers); 578 visitor->trace(m_observers);
579 visitor->trace(m_activeObservers); 579 visitor->trace(m_activeObservers);
580 visitor->trace(m_suspendedObservers); 580 visitor->trace(m_suspendedObservers);
581 EventTargetWithInlineData::trace(visitor); 581 EventTargetWithInlineData::trace(visitor);
582 } 582 }
583 583
584 } // namespace blink 584 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698