Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #include "config.h" | |
| 32 | |
| 33 #include "core/timing/PerformanceObserverEntryList.h" | |
| 34 | |
| 35 #include "core/timing/PerformanceEntry.h" | |
| 36 | |
| 37 #include "wtf/StdLibExtras.h" | |
| 38 | |
| 39 namespace blink { | |
| 40 | |
| 41 PerformanceObserverEntryList::PerformanceObserverEntryList(const PerformanceEntr yVector& entryVector) | |
| 42 : m_performanceEntries(entryVector) | |
| 43 { | |
| 44 } | |
| 45 | |
| 46 PerformanceObserverEntryList::~PerformanceObserverEntryList() | |
| 47 { | |
| 48 } | |
| 49 | |
| 50 | |
| 51 PerformanceEntryVector PerformanceObserverEntryList::getEntries() const | |
| 52 { | |
| 53 PerformanceEntryVector entries; | |
| 54 | |
| 55 entries.appendVector(m_performanceEntries); | |
| 56 | |
| 57 std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompare LessThan); | |
| 58 return entries; | |
| 59 } | |
| 60 | |
| 61 PerformanceEntryVector PerformanceObserverEntryList::getEntriesByType(const Stri ng& entryType) | |
| 62 { | |
| 63 PerformanceEntryVector entries; | |
| 64 | |
| 65 for (const auto& entry : m_performanceEntries) { | |
| 66 if (entryType.isNull() || equalIgnoringCase(entryType, entry->entryType( ))) { | |
|
esprehn
2015/07/18 22:24:16
This method shouldn't accept null at all, doing ge
MikeB
2015/07/20 23:06:50
Done.
| |
| 67 entries.append(entry); | |
| 68 } | |
| 69 } | |
| 70 | |
| 71 std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompare LessThan); | |
| 72 return entries; | |
| 73 } | |
| 74 | |
| 75 PerformanceEntryVector PerformanceObserverEntryList::getEntriesByName(const Stri ng& name, const String& entryType) | |
| 76 { | |
| 77 PerformanceEntryVector entries; | |
| 78 | |
| 79 for (const auto& entry : m_performanceEntries) { | |
| 80 if (entry->name() == name && (entryType.isNull() || equalIgnoringCase(en tryType, entry->entryType()))) { | |
|
esprehn
2015/07/18 22:24:16
ditto, you and to use AtomicStrings here as well.
MikeB
2015/07/20 23:06:50
Performance and PerformanceEntry use String at the
| |
| 81 entries.append(entry); | |
| 82 } | |
| 83 } | |
| 84 | |
| 85 std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompare LessThan); | |
| 86 return entries; | |
| 87 } | |
| 88 | |
| 89 DEFINE_TRACE(PerformanceObserverEntryList) | |
| 90 { | |
| 91 visitor->trace(m_performanceEntries); | |
| 92 } | |
| 93 | |
| 94 } // namespace blink | |
| OLD | NEW |