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

Side by Side Diff: sky/engine/wtf/text/StringImpl.cpp

Issue 691493004: Remove callOnMainThread (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/wtf/testing/RunAllTests.cpp ('k') | sky/viewer/platform/platform_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return !a->m_unnecessarilyWide && b->m_unnecessarilyWide; 177 return !a->m_unnecessarilyWide && b->m_unnecessarilyWide;
178 if (a->totalCharacters() != b->totalCharacters()) 178 if (a->totalCharacters() != b->totalCharacters())
179 return a->totalCharacters() < b->totalCharacters(); 179 return a->totalCharacters() < b->totalCharacters();
180 if (a->m_numberOfCopies != b->m_numberOfCopies) 180 if (a->m_numberOfCopies != b->m_numberOfCopies)
181 return a->m_numberOfCopies < b->m_numberOfCopies; 181 return a->m_numberOfCopies < b->m_numberOfCopies;
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()
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.fi nd(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);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 unsigned long long totalDataBytes = m_total8BitData + m_total16BitData * 2; 248 unsigned long long totalDataBytes = m_total8BitData + m_total16BitData * 2;
249 dataLogF("%8u Total %12llu chars %12llu bytes avg length % 6.1f\n", m_totalNumberStrings, totalNumberCharacters, totalDataBytes, averageLen gth); 249 dataLogF("%8u Total %12llu chars %12llu bytes avg length % 6.1f\n", m_totalNumberStrings, totalNumberCharacters, totalDataBytes, averageLen gth);
250 unsigned long long totalSavedBytes = m_total8BitData; 250 unsigned long long totalSavedBytes = m_total8BitData;
251 double percentSavings = totalSavedBytes ? ((double)totalSavedBytes * 100) / (double)(totalDataBytes + totalSavedBytes) : 0.0; 251 double percentSavings = totalSavedBytes ? ((double)totalSavedBytes * 100) / (double)(totalDataBytes + totalSavedBytes) : 0.0;
252 dataLogF(" Total savings %12llu bytes (%5.2f%%)\n", totalSavedBytes, percentSavings); 252 dataLogF(" Total savings %12llu bytes (%5.2f%%)\n", totalSavedBytes, percentSavings);
253 253
254 unsigned totalOverhead = m_totalNumberStrings * sizeof(StringImpl); 254 unsigned totalOverhead = m_totalNumberStrings * sizeof(StringImpl);
255 double overheadPercent = (double)totalOverhead / (double)totalDataBytes * 10 0; 255 double overheadPercent = (double)totalOverhead / (double)totalDataBytes * 10 0;
256 dataLogF(" StringImpl overheader: %8u (%5.2f%%)\n", totalOverhead, o verheadPercent); 256 dataLogF(" StringImpl overheader: %8u (%5.2f%%)\n", totalOverhead, o verheadPercent);
257 257
258 callOnMainThread(printLiveStringStats, 0); 258 printLiveStringStats();
259 } 259 }
260 #endif 260 #endif
261 261
262 void* StringImpl::operator new(size_t size) 262 void* StringImpl::operator new(size_t size)
263 { 263 {
264 ASSERT(size == sizeof(StringImpl)); 264 ASSERT(size == sizeof(StringImpl));
265 return partitionAllocGeneric(Partitions::getBufferPartition(), size); 265 return partitionAllocGeneric(Partitions::getBufferPartition(), size);
266 } 266 }
267 267
268 void StringImpl::operator delete(void* ptr) 268 void StringImpl::operator delete(void* ptr)
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 2099
2100 size_t StringImpl::sizeInBytes() const 2100 size_t StringImpl::sizeInBytes() const
2101 { 2101 {
2102 size_t size = length(); 2102 size_t size = length();
2103 if (!is8Bit()) 2103 if (!is8Bit())
2104 size *= 2; 2104 size *= 2;
2105 return size + sizeof(*this); 2105 return size + sizeof(*this);
2106 } 2106 }
2107 2107
2108 } // namespace WTF 2108 } // namespace WTF
OLDNEW
« no previous file with comments | « sky/engine/wtf/testing/RunAllTests.cpp ('k') | sky/viewer/platform/platform_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698