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

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

Issue 2753953002: Revert of Un-DCHECK-guard ThreadRestrictionVerifier for strings. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.h ('k') | no next file » | 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 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 using namespace std; 53 using namespace std;
54 54
55 namespace WTF { 55 namespace WTF {
56 56
57 using namespace Unicode; 57 using namespace Unicode;
58 58
59 // As of Jan 2017, StringImpl needs 2 * sizeof(int) + 29 bits of data, and 59 // As of Jan 2017, StringImpl needs 2 * sizeof(int) + 29 bits of data, and
60 // sizeof(ThreadRestrictionVerifier) is 16 bytes. Thus, in DCHECK mode the 60 // sizeof(ThreadRestrictionVerifier) is 16 bytes. Thus, in DCHECK mode the
61 // class may be padded to 32 bytes. 61 // class may be padded to 32 bytes.
62 // TODO(meade): Revert this by 17 Mar 17. 62 #if DCHECK_IS_ON()
63 // This is for investigating crbug.com/694520
64 // #if DCHECK_IS_ON()
65 static_assert(sizeof(StringImpl) <= 8 * sizeof(int), 63 static_assert(sizeof(StringImpl) <= 8 * sizeof(int),
66 "StringImpl should stay small"); 64 "StringImpl should stay small");
67 // #else 65 #else
68 // static_assert(sizeof(StringImpl) <= 3 * sizeof(int), 66 static_assert(sizeof(StringImpl) <= 3 * sizeof(int),
69 // "StringImpl should stay small"); 67 "StringImpl should stay small");
70 // #endif 68 #endif
71 69
72 #ifdef STRING_STATS 70 #ifdef STRING_STATS
73 71
74 static Mutex& statsMutex() { 72 static Mutex& statsMutex() {
75 DEFINE_STATIC_LOCAL(Mutex, mutex, ()); 73 DEFINE_STATIC_LOCAL(Mutex, mutex, ());
76 return mutex; 74 return mutex;
77 } 75 }
78 76
79 static HashSet<void*>& liveStrings() { 77 static HashSet<void*>& liveStrings() {
80 // Notice that we can't use HashSet<StringImpl*> because then HashSet would 78 // Notice that we can't use HashSet<StringImpl*> because then HashSet would
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 return true; 327 return true;
330 // AtomicStrings are not safe to send between threads as ~StringImpl() 328 // AtomicStrings are not safe to send between threads as ~StringImpl()
331 // will try to remove them from the wrong AtomicStringTable. 329 // will try to remove them from the wrong AtomicStringTable.
332 if (isAtomic()) 330 if (isAtomic())
333 return false; 331 return false;
334 if (hasOneRef()) 332 if (hasOneRef())
335 return true; 333 return true;
336 return false; 334 return false;
337 } 335 }
338 336
339 // TODO(meade): Revert this by 17 Mar 17. 337 #if DCHECK_IS_ON()
340 // This is for investigating crbug.com/694520
341 // #if DCHECK_IS_ON()
342 std::string StringImpl::asciiForDebugging() const { 338 std::string StringImpl::asciiForDebugging() const {
343 CString ascii = String(isolatedCopy()->substring(0, 128)).ascii(); 339 CString ascii = String(isolatedCopy()->substring(0, 128)).ascii();
344 return std::string(ascii.data(), ascii.length()); 340 return std::string(ascii.data(), ascii.length());
345 } 341 }
346 // #endif 342 #endif
347 343
348 PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, 344 PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length,
349 LChar*& data) { 345 LChar*& data) {
350 if (!length) { 346 if (!length) {
351 data = 0; 347 data = 0;
352 return empty; 348 return empty;
353 } 349 }
354 350
355 // Allocate a single buffer large enough to contain the StringImpl 351 // Allocate a single buffer large enough to contain the StringImpl
356 // struct as well as the data which it contains. This removes one 352 // struct as well as the data which it contains. This removes one
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { 2235 } else if (localeIdMatchesLang(localeIdentifier, "lt")) {
2240 // TODO(rob.buis) implement upper-casing rules for lt 2236 // TODO(rob.buis) implement upper-casing rules for lt
2241 // like in StringImpl::upper(locale). 2237 // like in StringImpl::upper(locale).
2242 } 2238 }
2243 } 2239 }
2244 2240
2245 return toUpper(c); 2241 return toUpper(c);
2246 } 2242 }
2247 2243
2248 } // namespace WTF 2244 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698