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

Side by Side Diff: Source/core/css/CSSValue.cpp

Issue 13973026: remove memoryinstrumentation Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove the rest part of MemoryInstrumentation Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSValue.h ('k') | Source/core/css/CSSValueList.h » ('j') | 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) 2011 Andreas Kling (kling@webkit.org) 2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org)
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "CSSReflectValue.h" 46 #include "CSSReflectValue.h"
47 #include "CSSTimingFunctionValue.h" 47 #include "CSSTimingFunctionValue.h"
48 #include "CSSUnicodeRangeValue.h" 48 #include "CSSUnicodeRangeValue.h"
49 #include "CSSValueList.h" 49 #include "CSSValueList.h"
50 #include "CSSVariableValue.h" 50 #include "CSSVariableValue.h"
51 #include "FontValue.h" 51 #include "FontValue.h"
52 #include "FontFeatureValue.h" 52 #include "FontFeatureValue.h"
53 #include "ShadowValue.h" 53 #include "ShadowValue.h"
54 #include "SVGColor.h" 54 #include "SVGColor.h"
55 #include "SVGPaint.h" 55 #include "SVGPaint.h"
56 #include "WebCoreMemoryInstrumentation.h"
57 #include "WebKitCSSArrayFunctionValue.h" 56 #include "WebKitCSSArrayFunctionValue.h"
58 #include "WebKitCSSFilterValue.h" 57 #include "WebKitCSSFilterValue.h"
59 #include "WebKitCSSMixFunctionValue.h" 58 #include "WebKitCSSMixFunctionValue.h"
60 #include "WebKitCSSShaderValue.h" 59 #include "WebKitCSSShaderValue.h"
61 #include "WebKitCSSTransformValue.h" 60 #include "WebKitCSSTransformValue.h"
62 61
63 #if ENABLE(SVG) 62 #if ENABLE(SVG)
64 #include "WebKitCSSSVGDocumentValue.h" 63 #include "WebKitCSSSVGDocumentValue.h"
65 #endif 64 #endif
66 65
67 namespace WebCore { 66 namespace WebCore {
68 67
69 struct SameSizeAsCSSValue : public RefCounted<SameSizeAsCSSValue> { 68 struct SameSizeAsCSSValue : public RefCounted<SameSizeAsCSSValue> {
70 uint32_t bitfields; 69 uint32_t bitfields;
71 }; 70 };
72 71
73 COMPILE_ASSERT(sizeof(CSSValue) == sizeof(SameSizeAsCSSValue), CSS_value_should_ stay_small); 72 COMPILE_ASSERT(sizeof(CSSValue) == sizeof(SameSizeAsCSSValue), CSS_value_should_ stay_small);
74 73
75 class TextCloneCSSValue : public CSSValue { 74 class TextCloneCSSValue : public CSSValue {
76 public: 75 public:
77 static PassRefPtr<TextCloneCSSValue> create(ClassType classType, const Strin g& text) { return adoptRef(new TextCloneCSSValue(classType, text)); } 76 static PassRefPtr<TextCloneCSSValue> create(ClassType classType, const Strin g& text) { return adoptRef(new TextCloneCSSValue(classType, text)); }
78 77
79 String cssText() const { return m_cssText; } 78 String cssText() const { return m_cssText; }
80 79
81 void reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
82 {
83 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
84 info.addMember(m_cssText, "cssText");
85 }
86
87 private: 80 private:
88 TextCloneCSSValue(ClassType classType, const String& text) 81 TextCloneCSSValue(ClassType classType, const String& text)
89 : CSSValue(classType, /*isCSSOMSafe*/ true) 82 : CSSValue(classType, /*isCSSOMSafe*/ true)
90 , m_cssText(text) 83 , m_cssText(text)
91 { 84 {
92 m_isTextClone = true; 85 m_isTextClone = true;
93 } 86 }
94 87
95 String m_cssText; 88 String m_cssText;
96 }; 89 };
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return static_cast<const CSSImageValue*>(this)->hasFailedOrCanceledSubre sources(); 134 return static_cast<const CSSImageValue*>(this)->hasFailedOrCanceledSubre sources();
142 if (classType() == CrossfadeClass) 135 if (classType() == CrossfadeClass)
143 return static_cast<const CSSCrossfadeValue*>(this)->hasFailedOrCanceledS ubresources(); 136 return static_cast<const CSSCrossfadeValue*>(this)->hasFailedOrCanceledS ubresources();
144 #if ENABLE(CSS_IMAGE_SET) 137 #if ENABLE(CSS_IMAGE_SET)
145 if (classType() == ImageSetClass) 138 if (classType() == ImageSetClass)
146 return static_cast<const CSSImageSetValue*>(this)->hasFailedOrCanceledSu bresources(); 139 return static_cast<const CSSImageSetValue*>(this)->hasFailedOrCanceledSu bresources();
147 #endif 140 #endif
148 return false; 141 return false;
149 } 142 }
150 143
151 void CSSValue::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
152 {
153 if (m_isTextClone) {
154 ASSERT(isCSSOMSafe());
155 static_cast<const TextCloneCSSValue*>(this)->reportDescendantMemoryUsage (memoryObjectInfo);
156 return;
157 }
158
159 ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());
160 switch (classType()) {
161 case PrimitiveClass:
162 static_cast<const CSSPrimitiveValue*>(this)->reportDescendantMemoryUsage (memoryObjectInfo);
163 return;
164 case ImageClass:
165 static_cast<const CSSImageValue*>(this)->reportDescendantMemoryUsage(mem oryObjectInfo);
166 return;
167 case CursorImageClass:
168 static_cast<const CSSCursorImageValue*>(this)->reportDescendantMemoryUsa ge(memoryObjectInfo);
169 return;
170 case CanvasClass:
171 static_cast<const CSSCanvasValue*>(this)->reportDescendantMemoryUsage(me moryObjectInfo);
172 return;
173 case CrossfadeClass:
174 static_cast<const CSSCrossfadeValue*>(this)->reportDescendantMemoryUsage (memoryObjectInfo);
175 return;
176 case LinearGradientClass:
177 static_cast<const CSSLinearGradientValue*>(this)->reportDescendantMemory Usage(memoryObjectInfo);
178 return;
179 case RadialGradientClass:
180 static_cast<const CSSRadialGradientValue*>(this)->reportDescendantMemory Usage(memoryObjectInfo);
181 return;
182 case CubicBezierTimingFunctionClass:
183 static_cast<const CSSCubicBezierTimingFunctionValue*>(this)->reportDesce ndantMemoryUsage(memoryObjectInfo);
184 return;
185 case LinearTimingFunctionClass:
186 static_cast<const CSSLinearTimingFunctionValue*>(this)->reportDescendant MemoryUsage(memoryObjectInfo);
187 return;
188 case StepsTimingFunctionClass:
189 static_cast<const CSSStepsTimingFunctionValue*>(this)->reportDescendantM emoryUsage(memoryObjectInfo);
190 return;
191 case AspectRatioClass:
192 static_cast<const CSSAspectRatioValue*>(this)->reportDescendantMemoryUsa ge(memoryObjectInfo);
193 return;
194 case BorderImageSliceClass:
195 static_cast<const CSSBorderImageSliceValue*>(this)->reportDescendantMemo ryUsage(memoryObjectInfo);
196 return;
197 case FontFeatureClass:
198 static_cast<const FontFeatureValue*>(this)->reportDescendantMemoryUsage( memoryObjectInfo);
199 return;
200 case FontClass:
201 static_cast<const FontValue*>(this)->reportDescendantMemoryUsage(memoryO bjectInfo);
202 return;
203 case FontFaceSrcClass:
204 static_cast<const CSSFontFaceSrcValue*>(this)->reportDescendantMemoryUsa ge(memoryObjectInfo);
205 return;
206 case FunctionClass:
207 static_cast<const CSSFunctionValue*>(this)->reportDescendantMemoryUsage( memoryObjectInfo);
208 return;
209 case InheritedClass:
210 static_cast<const CSSInheritedValue*>(this)->reportDescendantMemoryUsage (memoryObjectInfo);
211 return;
212 case InitialClass:
213 static_cast<const CSSInitialValue*>(this)->reportDescendantMemoryUsage(m emoryObjectInfo);
214 return;
215 case ReflectClass:
216 static_cast<const CSSReflectValue*>(this)->reportDescendantMemoryUsage(m emoryObjectInfo);
217 return;
218 case ShadowClass:
219 static_cast<const ShadowValue*>(this)->reportDescendantMemoryUsage(memor yObjectInfo);
220 return;
221 case UnicodeRangeClass:
222 static_cast<const CSSUnicodeRangeValue*>(this)->reportDescendantMemoryUs age(memoryObjectInfo);
223 return;
224 case LineBoxContainClass:
225 static_cast<const CSSLineBoxContainValue*>(this)->reportDescendantMemory Usage(memoryObjectInfo);
226 return;
227 case CalculationClass:
228 static_cast<const CSSCalcValue*>(this)->reportDescendantMemoryUsage(memo ryObjectInfo);
229 return;
230 case WebKitCSSArrayFunctionValueClass:
231 static_cast<const WebKitCSSArrayFunctionValue*>(this)->reportDescendantM emoryUsage(memoryObjectInfo);
232 return;
233 case WebKitCSSMixFunctionValueClass:
234 static_cast<const WebKitCSSMixFunctionValue*>(this)->reportDescendantMem oryUsage(memoryObjectInfo);
235 return;
236 case WebKitCSSShaderClass:
237 static_cast<const WebKitCSSShaderValue*>(this)->reportDescendantMemoryUs age(memoryObjectInfo);
238 return;
239 case VariableClass:
240 static_cast<const CSSVariableValue*>(this)->reportDescendantMemoryUsage( memoryObjectInfo);
241 return;
242 #if ENABLE(SVG)
243 case SVGColorClass:
244 static_cast<const SVGColor*>(this)->reportDescendantMemoryUsage(memoryOb jectInfo);
245 return;
246 case SVGPaintClass:
247 static_cast<const SVGPaint*>(this)->reportDescendantMemoryUsage(memoryOb jectInfo);
248 return;
249 case WebKitCSSSVGDocumentClass:
250 static_cast<const WebKitCSSSVGDocumentValue*>(this)->reportDescendantMem oryUsage(memoryObjectInfo);
251 return;
252 #endif
253 case ValueListClass:
254 static_cast<const CSSValueList*>(this)->reportDescendantMemoryUsage(memo ryObjectInfo);
255 return;
256 #if ENABLE(CSS_IMAGE_SET)
257 case ImageSetClass:
258 static_cast<const CSSImageSetValue*>(this)->reportDescendantMemoryUsage( memoryObjectInfo);
259 return;
260 #endif
261 case WebKitCSSFilterClass:
262 static_cast<const WebKitCSSFilterValue*>(this)->reportDescendantMemoryUs age(memoryObjectInfo);
263 return;
264 case WebKitCSSTransformClass:
265 static_cast<const WebKitCSSTransformValue*>(this)->reportDescendantMemor yUsage(memoryObjectInfo);
266 return;
267 }
268 ASSERT_NOT_REACHED();
269 }
270
271 template<class ChildClassType> 144 template<class ChildClassType>
272 inline static bool compareCSSValues(const CSSValue& first, const CSSValue& secon d) 145 inline static bool compareCSSValues(const CSSValue& first, const CSSValue& secon d)
273 { 146 {
274 return static_cast<const ChildClassType&>(first).equals(static_cast<const Ch ildClassType&>(second)); 147 return static_cast<const ChildClassType&>(first).equals(static_cast<const Ch ildClassType&>(second));
275 } 148 }
276 149
277 bool CSSValue::equals(const CSSValue& other) const 150 bool CSSValue::equals(const CSSValue& other) const
278 { 151 {
279 if (m_isTextClone) { 152 if (m_isTextClone) {
280 ASSERT(isCSSOMSafe()); 153 ASSERT(isCSSOMSafe());
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 case SVGPaintClass: 489 case SVGPaintClass:
617 return static_cast<const SVGPaint*>(this)->cloneForCSSOM(); 490 return static_cast<const SVGPaint*>(this)->cloneForCSSOM();
618 #endif 491 #endif
619 default: 492 default:
620 ASSERT(!isSubtypeExposedToCSSOM()); 493 ASSERT(!isSubtypeExposedToCSSOM());
621 return TextCloneCSSValue::create(classType(), cssText()); 494 return TextCloneCSSValue::create(classType(), cssText());
622 } 495 }
623 } 496 }
624 497
625 } 498 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSValue.h ('k') | Source/core/css/CSSValueList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698