Diff
Modified: trunk/Source/WebCore/ChangeLog (200966 => 200967)
--- trunk/Source/WebCore/ChangeLog 2016-05-16 20:52:33 UTC (rev 200966)
+++ trunk/Source/WebCore/ChangeLog 2016-05-16 21:36:15 UTC (rev 200967)
@@ -1,3 +1,23 @@
+2016-05-16 Simon Fraser <[email protected]>
+
+ Add a WebCore logging channel for images
+ https://bugs.webkit.org/show_bug.cgi?id=157752
+
+ Reviewed by Zalan Bujtas.
+
+ Create an Images log channel, and log various things related to decoding and drawing
+ images.
+
+ * platform/Logging.h:
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
+ (WebCore::BitmapImage::cacheFrame):
+ (WebCore::BitmapImage::startAnimation):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::drawNativeImage):
+ * platform/graphics/cg/ImageDecoderCG.cpp:
+ (WebCore::ImageDecoder::createFrameImageAtIndex):
+
2016-05-12 Ada Chan <[email protected]>
Don't execute _javascript_ within HTMLMediaElement::stop()
Modified: trunk/Source/WebCore/platform/Logging.h (200966 => 200967)
--- trunk/Source/WebCore/platform/Logging.h 2016-05-16 20:52:33 UTC (rev 200966)
+++ trunk/Source/WebCore/platform/Logging.h 2016-05-16 21:36:15 UTC (rev 200967)
@@ -59,6 +59,7 @@
M(Gamepad) \
M(History) \
M(IconDatabase) \
+ M(Images) \
M(IndexedDB) \
M(Layout) \
M(Loading) \
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (200966 => 200967)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2016-05-16 20:52:33 UTC (rev 200966)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2016-05-16 21:36:15 UTC (rev 200967)
@@ -32,6 +32,7 @@
#include "ImageBuffer.h"
#include "ImageObserver.h"
#include "IntRect.h"
+#include "Logging.h"
#include "MIMETypeRegistry.h"
#include "TextStream.h"
#include "Timer.h"
@@ -158,8 +159,10 @@
for (size_t i = 0; i < m_frames.size(); ++i)
allFrameBytes += m_frames[i].m_frameBytes;
- if (allFrameBytes > largeAnimationCutoff)
+ if (allFrameBytes > largeAnimationCutoff) {
+ LOG(Images, "BitmapImage %p destroyDecodedDataIfNecessary destryingData: allFrameBytes=%u cutoff=%u", this, allFrameBytes, largeAnimationCutoff);
destroyDecodedData(destroyAll);
+ }
}
void BitmapImage::destroyMetadataAndNotify(unsigned frameBytesCleared, ClearedSource clearedSource)
@@ -206,6 +209,8 @@
m_frames[index].m_hasAlpha = m_source.frameHasAlphaAtIndex(index);
m_frames[index].m_frameBytes = m_source.frameBytesAtIndex(index, subsamplingLevel);
+ LOG(Images, "BitmapImage %p cacheFrame %lu (%s%u bytes, complete %d)", this, index, frameCaching == CacheMetadataOnly ? "metadata only, " : "", m_frames[index].m_frameBytes, m_frames[index].m_isComplete);
+
if (m_frames[index].m_image) {
int deltaBytes = safeCast<int>(m_frames[index].m_frameBytes);
m_decodedSize += deltaBytes;
@@ -549,6 +554,11 @@
// See if we've also passed the time for frames after that to start, in
// case we need to skip some frames entirely. Remember not to advance
// to an incomplete frame.
+
+#if !LOG_DISABLED
+ size_t startCatchupFrameIndex = nextFrame;
+#endif
+
for (size_t frameAfterNext = (nextFrame + 1) % frameCount(); frameIsCompleteAtIndex(frameAfterNext); frameAfterNext = (nextFrame + 1) % frameCount()) {
// Should we skip the next frame?
double frameAfterNextStartTime = m_desiredFrameStartTime + frameDurationAtIndex(nextFrame);
@@ -560,12 +570,15 @@
if (!internalAdvanceAnimation(SkippingFramesToCatchUp)) {
m_animationFinishedWhenCatchingUp = true;
startTimer(0);
+ LOG(Images, "BitmapImage %p startAnimation catching up from frame %lu, ended", this, startCatchupFrameIndex);
return;
}
m_desiredFrameStartTime = frameAfterNextStartTime;
nextFrame = frameAfterNext;
}
+ LOG(Images, "BitmapImage %p startAnimation catching up jumped from from frame %lu to %d", this, startCatchupFrameIndex, (int)nextFrame - 1);
+
// Draw the next frame as soon as possible. Note that m_desiredFrameStartTime
// may be in the past, meaning the next time through this function we'll
// kick off the next advancement sooner than this frame's duration would suggest.
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (200966 => 200967)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2016-05-16 20:52:33 UTC (rev 200966)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2016-05-16 21:36:15 UTC (rev 200967)
@@ -34,12 +34,15 @@
#include "GraphicsContextPlatformPrivateCG.h"
#include "ImageBuffer.h"
#include "ImageOrientation.h"
+#include "Logging.h"
#include "Path.h"
#include "Pattern.h"
#include "ShadowBlur.h"
#include "SubimageCacheWithTimer.h"
+#include "TextStream.h"
#include "Timer.h"
#include "URL.h"
+#include <wtf/CurrentTime.h>
#include <wtf/MathExtras.h>
#include <wtf/RetainPtr.h>
@@ -172,6 +175,9 @@
return;
}
+#if !LOG_DISABLED
+ double startTime = currentTime();
+#endif
RetainPtr<CGImageRef> subImage(image);
float currHeight = orientation.usesWidthAsHeight() ? CGImageGetWidth(subImage.get()) : CGImageGetHeight(subImage.get());
@@ -272,6 +278,8 @@
CGContextSetShouldAntialias(context, wasAntialiased);
#endif
}
+
+ LOG_WITH_STREAM(Images, stream << "GraphicsContext::drawNativeImage " << image.get() << " size " << imageSize << " into " << destRect << " took " << 1000.0 * (currentTime() - startTime) << "ms");
}
static void drawPatternCallback(void* info, CGContextRef context)
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp (200966 => 200967)
--- trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp 2016-05-16 20:52:33 UTC (rev 200966)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp 2016-05-16 21:36:15 UTC (rev 200967)
@@ -31,6 +31,7 @@
#include "ImageOrientation.h"
#include "IntPoint.h"
#include "IntSize.h"
+#include "Logging.h"
#include "SharedBuffer.h"
#include <wtf/NeverDestroyed.h>
@@ -339,6 +340,8 @@
NativeImagePtr ImageDecoder::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel) const
{
+ LOG(Images, "ImageDecoder %p createFrameImageAtIndex %lu", this, index);
+
RetainPtr<CGImageRef> image = adoptCF(CGImageSourceCreateImageAtIndex(m_nativeDecoder.get(), index, imageSourceOptions(subsamplingLevel).get()));
#if PLATFORM(IOS)