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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSImageGeneratorValue.cpp

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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (m_clients.isEmpty()) { 44 if (m_clients.isEmpty()) {
45 ASSERT(!m_keepAlive); 45 ASSERT(!m_keepAlive);
46 m_keepAlive = this; 46 m_keepAlive = this;
47 } 47 }
48 48
49 if (!size.isEmpty()) 49 if (!size.isEmpty())
50 m_sizes.add(size); 50 m_sizes.add(size);
51 51
52 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); 52 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject);
53 if (it == m_clients.end()) { 53 if (it == m_clients.end()) {
54 m_clients.add(layoutObject, SizeAndCount(size, 1)); 54 m_clients.insert(layoutObject, SizeAndCount(size, 1));
55 } else { 55 } else {
56 SizeAndCount& sizeCount = it->value; 56 SizeAndCount& sizeCount = it->value;
57 ++sizeCount.count; 57 ++sizeCount.count;
58 } 58 }
59 } 59 }
60 60
61 CSSImageGeneratorValue* CSSImageGeneratorValue::valueWithURLsMadeAbsolute() { 61 CSSImageGeneratorValue* CSSImageGeneratorValue::valueWithURLsMadeAbsolute() {
62 if (isCrossfadeValue()) 62 if (isCrossfadeValue())
63 return toCSSCrossfadeValue(this)->valueWithURLsMadeAbsolute(); 63 return toCSSCrossfadeValue(this)->valueWithURLsMadeAbsolute();
64 return this; 64 return this;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Don't generate an image for empty sizes. 102 // Don't generate an image for empty sizes.
103 if (size.isEmpty()) 103 if (size.isEmpty())
104 return nullptr; 104 return nullptr;
105 105
106 // Look up the image in our cache. 106 // Look up the image in our cache.
107 return m_images.get(size); 107 return m_images.get(size);
108 } 108 }
109 109
110 void CSSImageGeneratorValue::putImage(const IntSize& size, 110 void CSSImageGeneratorValue::putImage(const IntSize& size,
111 PassRefPtr<Image> image) { 111 PassRefPtr<Image> image) {
112 m_images.add(size, std::move(image)); 112 m_images.insert(size, std::move(image));
113 } 113 }
114 114
115 PassRefPtr<Image> CSSImageGeneratorValue::image( 115 PassRefPtr<Image> CSSImageGeneratorValue::image(
116 const LayoutObject& layoutObject, 116 const LayoutObject& layoutObject,
117 const IntSize& size, 117 const IntSize& size,
118 float zoom) { 118 float zoom) {
119 switch (getClassType()) { 119 switch (getClassType()) {
120 case CrossfadeClass: 120 case CrossfadeClass:
121 return toCSSCrossfadeValue(this)->image(layoutObject, size); 121 return toCSSCrossfadeValue(this)->image(layoutObject, size);
122 case LinearGradientClass: 122 case LinearGradientClass:
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 break; 211 break;
212 case RadialGradientClass: 212 case RadialGradientClass:
213 toCSSRadialGradientValue(this)->loadSubimages(document); 213 toCSSRadialGradientValue(this)->loadSubimages(document);
214 break; 214 break;
215 default: 215 default:
216 ASSERT_NOT_REACHED(); 216 ASSERT_NOT_REACHED();
217 } 217 }
218 } 218 }
219 219
220 } // namespace blink 220 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp ('k') | third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698