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

Unified Diff: Source/core/style/StyleImage.h

Issue 1308953009: Move Image ownership out of CSSValue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/style/StyleGeneratedImage.cpp ('k') | Source/core/style/StylePendingImage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/style/StyleImage.h
diff --git a/Source/core/style/StyleImage.h b/Source/core/style/StyleImage.h
index 5457c38eb03bc13dc9c2e3d76d0fcd72e56676e1..771f380cbddd2a0b9e331f8f0a1afe727ff44e7a 100644
--- a/Source/core/style/StyleImage.h
+++ b/Source/core/style/StyleImage.h
@@ -26,6 +26,7 @@
#include "core/CoreExport.h"
#include "core/css/CSSValue.h"
+#include "core/fetch/ImageResource.h"
#include "platform/geometry/IntSize.h"
#include "platform/geometry/LayoutSize.h"
#include "platform/graphics/Image.h"
@@ -35,7 +36,6 @@
namespace blink {
-class ImageResource;
class CSSValue;
class LayoutObject;
@@ -43,7 +43,7 @@ typedef void* WrappedImagePtr;
class CORE_EXPORT StyleImage : public RefCountedWillBeGarbageCollectedFinalized<StyleImage> {
public:
- virtual ~StyleImage() { }
+ virtual ~StyleImage() { printf("%p: StyleImage freed\n", this); }
bool operator==(const StyleImage& other) const
{
@@ -90,6 +90,22 @@ protected:
bool m_isImageResourceSet:1;
};
+class CSSStyleImageMap {
+public:
+ typedef WillBeHeapHashMap<CSSValue*, RefPtrWillBeRawPtr<StyleImage>> StyleImageMap;
+ typedef WillBeHeapHashMap<CSSValue*, ResourcePtr<ImageResource>> ImageResourceMap;
+ typedef WillBeHeapHashMap<CSSValue*, RefPtr<Image>> ImageMap;
+
+ StyleImageMap::AddResult getStyleImageEntry(CSSValue* value) { return m_styleImages.add(value, nullptr); }
+ ImageResourceMap::AddResult getImageResourceEntry(CSSValue* value) { return m_imageResources.add(value, nullptr); }
+ ImageMap::AddResult getImageEntry(CSSValue* value) { return m_images.add(value, nullptr); }
+
+private:
+ StyleImageMap m_styleImages;
+ ImageResourceMap m_imageResources;
+ ImageMap m_images;
+};
+
#define DEFINE_STYLE_IMAGE_TYPE_CASTS(thisType, function) \
DEFINE_TYPE_CASTS(thisType, StyleImage, styleImage, styleImage->function, styleImage.function); \
inline thisType* to##thisType(const RefPtrWillBeMember<StyleImage>& styleImage) { return to##thisType(styleImage.get()); } \
« no previous file with comments | « Source/core/style/StyleGeneratedImage.cpp ('k') | Source/core/style/StylePendingImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698