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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSValuePool.h

Issue 2671933002: Migrate WTF::HashMap::add() to ::insert() (Closed)
Patch Set: rebase, add TODOs 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) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 CSSPrimitiveValue* setNumberCacheValue(int intValue, 94 CSSPrimitiveValue* setNumberCacheValue(int intValue,
95 CSSPrimitiveValue* cssValue) { 95 CSSPrimitiveValue* cssValue) {
96 return m_numberValueCache[intValue] = cssValue; 96 return m_numberValueCache[intValue] = cssValue;
97 } 97 }
98 98
99 // Hash map caches. 99 // Hash map caches.
100 ColorValueCache::AddResult getColorCacheEntry(RGBA32 rgbValue) { 100 ColorValueCache::AddResult getColorCacheEntry(RGBA32 rgbValue) {
101 // Just wipe out the cache and start rebuilding if it gets too big. 101 // Just wipe out the cache and start rebuilding if it gets too big.
102 if (m_colorValueCache.size() > maximumColorCacheSize) 102 if (m_colorValueCache.size() > maximumColorCacheSize)
103 m_colorValueCache.clear(); 103 m_colorValueCache.clear();
104 return m_colorValueCache.add(rgbValue, nullptr); 104 return m_colorValueCache.insert(rgbValue, nullptr);
105 } 105 }
106 FontFamilyValueCache::AddResult getFontFamilyCacheEntry( 106 FontFamilyValueCache::AddResult getFontFamilyCacheEntry(
107 const String& familyName) { 107 const String& familyName) {
108 return m_fontFamilyValueCache.add(familyName, nullptr); 108 return m_fontFamilyValueCache.insert(familyName, nullptr);
109 } 109 }
110 FontFaceValueCache::AddResult getFontFaceCacheEntry( 110 FontFaceValueCache::AddResult getFontFaceCacheEntry(
111 const AtomicString& string) { 111 const AtomicString& string) {
112 // Just wipe out the cache and start rebuilding if it gets too big. 112 // Just wipe out the cache and start rebuilding if it gets too big.
113 if (m_fontFaceValueCache.size() > maximumFontFaceCacheSize) 113 if (m_fontFaceValueCache.size() > maximumFontFaceCacheSize)
114 m_fontFaceValueCache.clear(); 114 m_fontFaceValueCache.clear();
115 return m_fontFaceValueCache.add(string, nullptr); 115 return m_fontFaceValueCache.insert(string, nullptr);
116 } 116 }
117 117
118 DECLARE_TRACE(); 118 DECLARE_TRACE();
119 119
120 private: 120 private:
121 CSSValuePool(); 121 CSSValuePool();
122 122
123 // Cached individual values. 123 // Cached individual values.
124 Member<CSSInheritedValue> m_inheritedValue; 124 Member<CSSInheritedValue> m_inheritedValue;
125 Member<CSSInitialValue> m_initialValue; 125 Member<CSSInitialValue> m_initialValue;
(...skipping 18 matching lines...) Expand all
144 FontFamilyValueCache m_fontFamilyValueCache; 144 FontFamilyValueCache m_fontFamilyValueCache;
145 145
146 friend CORE_EXPORT CSSValuePool& cssValuePool(); 146 friend CORE_EXPORT CSSValuePool& cssValuePool();
147 }; 147 };
148 148
149 CORE_EXPORT CSSValuePool& cssValuePool(); 149 CORE_EXPORT CSSValuePool& cssValuePool();
150 150
151 } // namespace blink 151 } // namespace blink
152 152
153 #endif 153 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp ('k') | third_party/WebKit/Source/core/css/FontFaceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698