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

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringImpl.h

Issue 2655853003: Replace StringImpl::empty{16Bit}() with a static member (Closed)
Patch Set: annotate race Created 3 years, 10 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights 3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2009 Google Inc. All rights reserved. 5 * Copyright (C) 2009 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 : m_refCount(1), 198 : m_refCount(1),
199 m_length(length), 199 m_length(length),
200 m_hash(hash), 200 m_hash(hash),
201 m_containsOnlyASCII(!length), 201 m_containsOnlyASCII(!length),
202 m_needsASCIICheck(static_cast<bool>(length)), 202 m_needsASCIICheck(static_cast<bool>(length)),
203 m_isAtomic(false), 203 m_isAtomic(false),
204 m_is8Bit(true), 204 m_is8Bit(true),
205 m_isStatic(true) {} 205 m_isStatic(true) {}
206 206
207 public: 207 public:
208 static StringImpl* empty;
209 static StringImpl* empty16Bit;
210
208 ~StringImpl(); 211 ~StringImpl();
209 212
213 static void initStatics();
214
210 static StringImpl* createStatic(const char* string, 215 static StringImpl* createStatic(const char* string,
211 unsigned length, 216 unsigned length,
212 unsigned hash); 217 unsigned hash);
213 static void reserveStaticStringsCapacityForSize(unsigned size); 218 static void reserveStaticStringsCapacityForSize(unsigned size);
214 static void freezeStaticStrings(); 219 static void freezeStaticStrings();
215 static const StaticStringsTable& allStaticStrings(); 220 static const StaticStringsTable& allStaticStrings();
216 static unsigned highestStaticStringLength() { 221 static unsigned highestStaticStringLength() {
217 return m_highestStaticStringLength; 222 return m_highestStaticStringLength;
218 } 223 }
219 224
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 322
318 ALWAYS_INLINE void deref() const { 323 ALWAYS_INLINE void deref() const {
319 #if DCHECK_IS_ON() 324 #if DCHECK_IS_ON()
320 DCHECK(isStatic() || m_verifier.onDeref(m_refCount)) 325 DCHECK(isStatic() || m_verifier.onDeref(m_refCount))
321 << asciiForDebugging() << " " << currentThread(); 326 << asciiForDebugging() << " " << currentThread();
322 #endif 327 #endif
323 if (!--m_refCount) 328 if (!--m_refCount)
324 destroyIfNotStatic(); 329 destroyIfNotStatic();
325 } 330 }
326 331
327 static StringImpl* empty();
328 static StringImpl* empty16Bit();
329
330 // FIXME: Does this really belong in StringImpl? 332 // FIXME: Does this really belong in StringImpl?
331 template <typename T> 333 template <typename T>
332 static void copyChars(T* destination, 334 static void copyChars(T* destination,
333 const T* source, 335 const T* source,
334 unsigned numCharacters) { 336 unsigned numCharacters) {
335 memcpy(destination, source, numCharacters * sizeof(T)); 337 memcpy(destination, source, numCharacters * sizeof(T));
336 } 338 }
337 339
338 ALWAYS_INLINE static void copyChars(UChar* destination, 340 ALWAYS_INLINE static void copyChars(UChar* destination,
339 const LChar* source, 341 const LChar* source,
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 using WTF::TextCaseASCIIInsensitive; 887 using WTF::TextCaseASCIIInsensitive;
886 using WTF::TextCaseUnicodeInsensitive; 888 using WTF::TextCaseUnicodeInsensitive;
887 using WTF::TextCaseSensitive; 889 using WTF::TextCaseSensitive;
888 using WTF::TextCaseSensitivity; 890 using WTF::TextCaseSensitivity;
889 using WTF::equal; 891 using WTF::equal;
890 using WTF::equalNonNull; 892 using WTF::equalNonNull;
891 using WTF::lengthOfNullTerminatedString; 893 using WTF::lengthOfNullTerminatedString;
892 using WTF::reverseFind; 894 using WTF::reverseFind;
893 895
894 #endif 896 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/AtomicStringTable.cpp ('k') | third_party/WebKit/Source/wtf/text/StringImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698