| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) | 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 if (a->m_length != b->m_length) | 182 if (a->m_length != b->m_length) |
| 183 return a->m_length < b->m_length; | 183 return a->m_length < b->m_length; |
| 184 return a->m_numberOfAtomicCopies < b->m_numberOfAtomicCopies; | 184 return a->m_numberOfAtomicCopies < b->m_numberOfAtomicCopies; |
| 185 } | 185 } |
| 186 | 186 |
| 187 static void printLiveStringStats(void*) | 187 static void printLiveStringStats(void*) |
| 188 { | 188 { |
| 189 MutexLocker locker(statsMutex()); | 189 MutexLocker locker(statsMutex()); |
| 190 HashSet<void*>& strings = liveStrings(); | 190 HashSet<void*>& strings = liveStrings(); |
| 191 | 191 |
| 192 HashMap<StringImpl*, RefPtr<PerStringStats> > stats; | 192 HashMap<StringImpl*, RefPtr<PerStringStats>> stats; |
| 193 for (HashSet<void*>::iterator iter = strings.begin(); iter != strings.end();
++iter) { | 193 for (HashSet<void*>::iterator iter = strings.begin(); iter != strings.end();
++iter) { |
| 194 StringImpl* string = static_cast<StringImpl*>(*iter); | 194 StringImpl* string = static_cast<StringImpl*>(*iter); |
| 195 HashMap<StringImpl*, RefPtr<PerStringStats> >::iterator entry = stats.fi
nd(string); | 195 HashMap<StringImpl*, RefPtr<PerStringStats>>::iterator entry = stats.fin
d(string); |
| 196 RefPtr<PerStringStats> value = entry == stats.end() ? RefPtr<PerStringSt
ats>(PerStringStats::create()) : entry->value; | 196 RefPtr<PerStringStats> value = entry == stats.end() ? RefPtr<PerStringSt
ats>(PerStringStats::create()) : entry->value; |
| 197 value->add(string); | 197 value->add(string); |
| 198 stats.set(string, value.release()); | 198 stats.set(string, value.release()); |
| 199 } | 199 } |
| 200 | 200 |
| 201 Vector<RefPtr<PerStringStats> > all; | 201 Vector<RefPtr<PerStringStats>> all; |
| 202 for (HashMap<StringImpl*, RefPtr<PerStringStats> >::iterator iter = stats.be
gin(); iter != stats.end(); ++iter) | 202 for (HashMap<StringImpl*, RefPtr<PerStringStats>>::iterator iter = stats.beg
in(); iter != stats.end(); ++iter) |
| 203 all.append(iter->value); | 203 all.append(iter->value); |
| 204 | 204 |
| 205 std::sort(all.begin(), all.end()); | 205 std::sort(all.begin(), all.end()); |
| 206 std::reverse(all.begin(), all.end()); | 206 std::reverse(all.begin(), all.end()); |
| 207 for (size_t i = 0; i < 20 && i < all.size(); ++i) | 207 for (size_t i = 0; i < 20 && i < all.size(); ++i) |
| 208 all[i]->print(); | 208 all[i]->print(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 StringStats StringImpl::m_stringStats; | 211 StringStats StringImpl::m_stringStats; |
| 212 | 212 |
| (...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 | 2086 |
| 2087 size_t StringImpl::sizeInBytes() const | 2087 size_t StringImpl::sizeInBytes() const |
| 2088 { | 2088 { |
| 2089 size_t size = length(); | 2089 size_t size = length(); |
| 2090 if (!is8Bit()) | 2090 if (!is8Bit()) |
| 2091 size *= 2; | 2091 size *= 2; |
| 2092 return size + sizeof(*this); | 2092 return size + sizeof(*this); |
| 2093 } | 2093 } |
| 2094 | 2094 |
| 2095 } // namespace WTF | 2095 } // namespace WTF |
| OLD | NEW |