Diff
Modified: trunk/Source/WebCore/ChangeLog (126973 => 126974)
--- trunk/Source/WebCore/ChangeLog 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/ChangeLog 2012-08-29 09:28:48 UTC (rev 126974)
@@ -1,3 +1,52 @@
+2012-08-24 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: NMI: Instrument WebCore part of the Image class hierarchy
+ https://bugs.webkit.org/show_bug.cgi?id=94959
+
+ Drive by fix: remove unused GeneratedImage.cpp
+
+ Reviewed by Yury Semikhatsky.
+
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::reportMemoryUsage):
+ (WebCore):
+ * html/HTMLImageElement.h:
+ (HTMLImageElement):
+ * loader/cache/CachedImage.cpp:
+ (WebCore::CachedImage::reportMemoryUsage):
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::reportMemoryUsage):
+ (WebCore):
+ * platform/graphics/BitmapImage.h:
+ (FrameData):
+ (BitmapImage):
+ * platform/graphics/CrossfadeGeneratedImage.cpp:
+ (WebCore::CrossfadeGeneratedImage::reportMemoryUsage):
+ (WebCore):
+ * platform/graphics/CrossfadeGeneratedImage.h:
+ (WebCore):
+ (CrossfadeGeneratedImage):
+ * platform/graphics/GeneratedImage.cpp: Removed.
+ * platform/graphics/GeneratedImage.h:
+ (GeneratedImage):
+ * platform/graphics/GeneratorGeneratedImage.cpp:
+ (WebCore::GeneratedImage::reportMemoryUsage):
+ (WebCore):
+ (WebCore::GeneratorGeneratedImage::reportMemoryUsage):
+ * platform/graphics/GeneratorGeneratedImage.h:
+ (GeneratorGeneratedImage):
+ * platform/graphics/Image.cpp:
+ (WebCore::Image::reportMemoryUsage):
+ (WebCore):
+ * platform/graphics/Image.h:
+ (WebCore):
+ (Image):
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::reportMemoryUsage):
+ (WebCore):
+ * svg/graphics/SVGImage.h:
+ (SVGImage):
+
2012-08-29 Dominic Mazzoni <[email protected]>
AX: Canvas should have a distinct role
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (126973 => 126974)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2012-08-29 09:28:48 UTC (rev 126974)
@@ -421,4 +421,12 @@
return toImageInnerElement(userAgentShadowRoot()->firstChild());
}
+void HTMLImageElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
+ HTMLElement::reportMemoryUsage(memoryObjectInfo);
+ info.addMember(m_imageLoader);
+ info.addInstrumentedMember(m_form);
}
+
+}
Modified: trunk/Source/WebCore/html/HTMLImageElement.h (126973 => 126974)
--- trunk/Source/WebCore/html/HTMLImageElement.h 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/html/HTMLImageElement.h 2012-08-29 09:28:48 UTC (rev 126974)
@@ -89,6 +89,8 @@
virtual bool canContainRangeEndPoint() const { return false; }
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
protected:
HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (126973 => 126974)
--- trunk/Source/WebCore/loader/cache/CachedImage.cpp 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp 2012-08-29 09:28:48 UTC (rev 126974)
@@ -478,11 +478,7 @@
{
MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceImage);
CachedResource::reportMemoryUsage(memoryObjectInfo);
- if (m_image) {
- if (m_image->data())
- info.addRawBuffer(m_image->data(), m_image->data()->size());
- info.addRawBuffer(m_image.get(), decodedSize());
- }
+ info.addInstrumentedMember(m_image);
#if ENABLE(SVG)
info.addMember(m_svgImageCache);
#endif
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2012-08-29 09:28:48 UTC (rev 126974)
@@ -31,6 +31,7 @@
#include "ImageObserver.h"
#include "IntRect.h"
#include "MIMETypeRegistry.h"
+#include "MemoryInstrumentation.h"
#include "PlatformString.h"
#include "Timer.h"
#include <wtf/CurrentTime.h>
@@ -571,4 +572,16 @@
return m_solidColor;
}
+void BitmapImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceImage);
+ Image::reportMemoryUsage(memoryObjectInfo);
+ info.addMember(m_source);
+ info.addMember(m_frameTimer);
+ info.addVector(m_frames);
+ int size = frameBytes(m_size);
+ for (unsigned i = 0; i < m_frameCount; ++i)
+ info.addRawBuffer(m_frames[i].m_frame, size);
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.h 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h 2012-08-29 09:28:48 UTC (rev 126974)
@@ -87,6 +87,7 @@
// Clear the cached image data on the frame, and (optionally) the metadata.
// Returns whether there was cached image data to clear.
bool clear(bool clearMetadata);
+ void reportMemoryUsage(MemoryObjectInfo*) const;
NativeImagePtr m_frame;
ImageOrientation m_orientation;
@@ -180,6 +181,8 @@
virtual bool notSolidColor();
#endif
+ void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
private:
void updateSize() const;
Modified: trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp 2012-08-29 09:28:48 UTC (rev 126974)
@@ -29,6 +29,7 @@
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
+#include "MemoryInstrumentation.h"
using namespace std;
@@ -107,4 +108,12 @@
imageBuffer->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, dstRect);
}
+void CrossfadeGeneratedImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
+ GeneratedImage::reportMemoryUsage(memoryObjectInfo);
+ info.addInstrumentedMember(m_fromImage);
+ info.addInstrumentedMember(m_toImage);
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h 2012-08-29 09:28:48 UTC (rev 126974)
@@ -35,6 +35,7 @@
namespace WebCore {
class CSSCrossfadeValue;
+class MemoryObjectInfo;
class CrossfadeGeneratedImage : public GeneratedImage {
public:
@@ -50,6 +51,8 @@
virtual IntSize size() const { return m_crossfadeSize; }
+ void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
protected:
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect);
Deleted: trunk/Source/WebCore/platform/graphics/GeneratedImage.cpp (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/GeneratedImage.cpp 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/GeneratedImage.cpp 2012-08-29 09:28:48 UTC (rev 126974)
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GeneratedImage.h"
-
-#include "FloatRect.h"
-#include "GraphicsContext.h"
-#include "ImageBuffer.h"
-#include "Length.h"
-
-namespace WebCore {
-
-void GeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
-{
- GraphicsContextStateSaver stateSaver(*context);
- context->setCompositeOperation(compositeOp);
- context->clip(dstRect);
- context->translate(dstRect.x(), dstRect.y());
- if (dstRect.size() != srcRect.size())
- context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()));
- context->translate(-srcRect.x(), -srcRect.y());
- context->fillRect(FloatRect(FloatPoint(), m_size), *m_generator.get());
-}
-
-void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
- const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
-{
- // Allow the generator to provide visually-equivalent tiling parameters for better performance.
- IntSize adjustedSize = m_size;
- FloatRect adjustedSrcRect = srcRect;
- m_generator->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect);
-
- // Create a BitmapImage and call drawPattern on it.
- OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(adjustedSize);
- if (!imageBuffer)
- return;
-
- // Fill with the gradient.
- GraphicsContext* graphicsContext = imageBuffer->context();
- graphicsContext->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_generator.get());
-
- // Tile the image buffer into the context.
- imageBuffer->drawPattern(context, adjustedSrcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect);
-}
-
-void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
-{
- Image::computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
- intrinsicRatio = FloatSize();
-}
-
-}
Modified: trunk/Source/WebCore/platform/graphics/GeneratedImage.h (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/GeneratedImage.h 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/GeneratedImage.h 2012-08-29 09:28:48 UTC (rev 126974)
@@ -50,6 +50,8 @@
virtual void destroyDecodedData(bool /*destroyAll*/ = true) { }
virtual unsigned decodedSize() const { return 0; }
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
protected:
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0;
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
Modified: trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp 2012-08-29 09:28:48 UTC (rev 126974)
@@ -85,10 +85,25 @@
intrinsicRatio = FloatSize();
}
+void GeneratedImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceImage);
+ Image::reportMemoryUsage(memoryObjectInfo);
+}
+
void GeneratorGeneratedImage::invalidateCacheTimerFired(DeferrableOneShotTimer<GeneratorGeneratedImage>*)
{
m_cachedImageBuffer.clear();
m_cachedAdjustedSize = IntSize();
}
+void GeneratorGeneratedImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
+ GeneratedImage::reportMemoryUsage(memoryObjectInfo);
+ info.addMember(m_generator);
+ info.addMember(m_cachedImageBuffer);
+ info.addMember(m_cacheTimer);
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.h 2012-08-29 09:28:48 UTC (rev 126974)
@@ -31,6 +31,7 @@
#include "Image.h"
#include "ImageBuffer.h"
#include "IntSize.h"
+#include "MemoryInstrumentation.h"
#include "Timer.h"
#include <wtf/RefPtr.h>
@@ -50,6 +51,8 @@
m_cacheTimer.stop();
}
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
protected:
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
Modified: trunk/Source/WebCore/platform/graphics/Image.cpp (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/Image.cpp 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/Image.cpp 2012-08-29 09:28:48 UTC (rev 126974)
@@ -30,9 +30,11 @@
#include "AffineTransform.h"
#include "BitmapImage.h"
#include "GraphicsContext.h"
+#include "ImageObserver.h"
#include "IntRect.h"
#include "Length.h"
#include "MIMETypeRegistry.h"
+#include "MemoryInstrumentation.h"
#include "SharedBuffer.h"
#include <math.h>
#include <wtf/MainThread.h>
@@ -196,4 +198,11 @@
intrinsicHeight = Length(intrinsicRatio.height(), Fixed);
}
+void Image::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceImage);
+ info.addInstrumentedMember(m_data);
+ info.addMember(m_imageObserver);
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/Image.h (126973 => 126974)
--- trunk/Source/WebCore/platform/graphics/Image.h 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/platform/graphics/Image.h 2012-08-29 09:28:48 UTC (rev 126974)
@@ -64,6 +64,7 @@
class FloatRect;
class FloatSize;
class GraphicsContext;
+class MemoryObjectInfo;
class SharedBuffer;
struct Length;
@@ -168,6 +169,8 @@
virtual bool notSolidColor() { return true; }
#endif
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const;
+
protected:
Image(ImageObserver* = 0);
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (126973 => 126974)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2012-08-29 09:28:48 UTC (rev 126974)
@@ -355,6 +355,15 @@
return "svg";
}
+void SVGImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceImage);
+ Image::reportMemoryUsage(memoryObjectInfo);
+ info.addMember(m_chromeClient);
+ info.addMember(m_page);
+ info.addInstrumentedMember(m_frameCache);
}
+}
+
#endif // ENABLE(SVG)
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.h (126973 => 126974)
--- trunk/Source/WebCore/svg/graphics/SVGImage.h 2012-08-29 08:21:53 UTC (rev 126973)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.h 2012-08-29 09:28:48 UTC (rev 126974)
@@ -61,6 +61,8 @@
virtual bool hasRelativeWidth() const;
virtual bool hasRelativeHeight() const;
+ virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+
private:
friend class SVGImageChromeClient;
virtual ~SVGImage();