OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "CSSImageGeneratorValue.h" | 27 #include "CSSImageGeneratorValue.h" |
28 | 28 |
29 #include "CSSCanvasValue.h" | 29 #include "CSSCanvasValue.h" |
30 #include "CSSCrossfadeValue.h" | 30 #include "CSSCrossfadeValue.h" |
31 #include "CSSGradientValue.h" | 31 #include "CSSGradientValue.h" |
32 #include "Image.h" | 32 #include "Image.h" |
33 #include "RenderObject.h" | 33 #include "RenderObject.h" |
34 #include "WebCoreMemoryInstrumentation.h" | |
35 #include <wtf/MemoryInstrumentationHashCountedSet.h> | |
36 #include <wtf/MemoryInstrumentationHashMap.h> | |
37 #include <wtf/text/WTFString.h> | 34 #include <wtf/text/WTFString.h> |
38 | 35 |
39 | |
40 namespace WTF { | |
41 | |
42 template<> struct SequenceMemoryInstrumentationTraits<const WebCore::RenderObjec
t*> { | |
43 template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&)
{ } | |
44 }; | |
45 | |
46 } | |
47 | |
48 namespace WebCore { | 36 namespace WebCore { |
49 | 37 |
50 CSSImageGeneratorValue::CSSImageGeneratorValue(ClassType classType) | 38 CSSImageGeneratorValue::CSSImageGeneratorValue(ClassType classType) |
51 : CSSValue(classType) | 39 : CSSValue(classType) |
52 { | 40 { |
53 } | 41 } |
54 | 42 |
55 CSSImageGeneratorValue::~CSSImageGeneratorValue() | 43 CSSImageGeneratorValue::~CSSImageGeneratorValue() |
56 { | 44 { |
57 } | 45 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 101 |
114 // Look up the image in our cache. | 102 // Look up the image in our cache. |
115 return m_images.get(size).get(); | 103 return m_images.get(size).get(); |
116 } | 104 } |
117 | 105 |
118 void CSSImageGeneratorValue::putImage(const IntSize& size, PassRefPtr<Image> ima
ge) | 106 void CSSImageGeneratorValue::putImage(const IntSize& size, PassRefPtr<Image> ima
ge) |
119 { | 107 { |
120 m_images.add(size, image); | 108 m_images.add(size, image); |
121 } | 109 } |
122 | 110 |
123 void CSSImageGeneratorValue::reportBaseClassMemoryUsage(MemoryObjectInfo* memory
ObjectInfo) const | |
124 { | |
125 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
126 info.addMember(m_sizes, "sizes"); | |
127 info.addMember(m_clients, "clients"); | |
128 info.addMember(m_images, "images"); | |
129 } | |
130 | |
131 PassRefPtr<Image> CSSImageGeneratorValue::image(RenderObject* renderer, const In
tSize& size) | 111 PassRefPtr<Image> CSSImageGeneratorValue::image(RenderObject* renderer, const In
tSize& size) |
132 { | 112 { |
133 switch (classType()) { | 113 switch (classType()) { |
134 case CanvasClass: | 114 case CanvasClass: |
135 return static_cast<CSSCanvasValue*>(this)->image(renderer, size); | 115 return static_cast<CSSCanvasValue*>(this)->image(renderer, size); |
136 case CrossfadeClass: | 116 case CrossfadeClass: |
137 return static_cast<CSSCrossfadeValue*>(this)->image(renderer, size); | 117 return static_cast<CSSCrossfadeValue*>(this)->image(renderer, size); |
138 case LinearGradientClass: | 118 case LinearGradientClass: |
139 return static_cast<CSSLinearGradientValue*>(this)->image(renderer, size)
; | 119 return static_cast<CSSLinearGradientValue*>(this)->image(renderer, size)
; |
140 case RadialGradientClass: | 120 case RadialGradientClass: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 break; | 207 break; |
228 case RadialGradientClass: | 208 case RadialGradientClass: |
229 static_cast<CSSRadialGradientValue*>(this)->loadSubimages(cachedResource
Loader); | 209 static_cast<CSSRadialGradientValue*>(this)->loadSubimages(cachedResource
Loader); |
230 break; | 210 break; |
231 default: | 211 default: |
232 ASSERT_NOT_REACHED(); | 212 ASSERT_NOT_REACHED(); |
233 } | 213 } |
234 } | 214 } |
235 | 215 |
236 } // namespace WebCore | 216 } // namespace WebCore |
OLD | NEW |