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

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

Issue 2103373002: Don't lazy allocate the AtomicStringTable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "wtf/text/AtomicStringTable.h"
6
7 namespace WTF {
8
9 AtomicStringTable::AtomicStringTable()
10 {
11 for (StringImpl* string : StringImpl::allStaticStrings().values())
12 addStringImpl(string);
13 }
14
15 AtomicStringTable::~AtomicStringTable()
16 {
17 for (StringImpl* string : m_table) {
18 if (!string->isStatic()) {
19 DCHECK(string->isAtomic());
20 string->setIsAtomic(false);
21 }
22 }
23 }
24
25 StringImpl* AtomicStringTable::addStringImpl(StringImpl* string)
26 {
27 if (!string->length())
28 return StringImpl::empty();
29
30 StringImpl* result = *m_table.add(string).storedValue;
31
32 if (!result->isAtomic())
33 result->setIsAtomic(true);
34
35 DCHECK(!string->isStatic() || result->isStatic());
36 return result;
37 }
38
39 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/AtomicStringTable.h ('k') | third_party/WebKit/Source/wtf/wtf.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698