<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200967] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200967">200967</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-05-16 14:36:15 -0700 (Mon, 16 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>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):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformLoggingh">trunk/Source/WebCore/platform/Logging.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsBitmapImagecpp">trunk/Source/WebCore/platform/graphics/BitmapImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgGraphicsContextCGcpp">trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgImageDecoderCGcpp">trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200966 => 200967)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-05-16 Simon Fraser <simon.fraser@apple.com>
+
+ 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):
+
</ins><span class="cx"> 2016-05-12 Ada Chan <adachan@apple.com>
</span><span class="cx">
</span><span class="cx"> Don't execute JavaScript within HTMLMediaElement::stop()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformLoggingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Logging.h (200966 => 200967)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> M(Gamepad) \
</span><span class="cx"> M(History) \
</span><span class="cx"> M(IconDatabase) \
</span><ins>+ M(Images) \
</ins><span class="cx"> M(IndexedDB) \
</span><span class="cx"> M(Layout) \
</span><span class="cx"> M(Loading) \
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsBitmapImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (200966 => 200967)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "ImageBuffer.h"
</span><span class="cx"> #include "ImageObserver.h"
</span><span class="cx"> #include "IntRect.h"
</span><ins>+#include "Logging.h"
</ins><span class="cx"> #include "MIMETypeRegistry.h"
</span><span class="cx"> #include "TextStream.h"
</span><span class="cx"> #include "Timer.h"
</span><span class="lines">@@ -158,8 +159,10 @@
</span><span class="cx"> for (size_t i = 0; i < m_frames.size(); ++i)
</span><span class="cx"> allFrameBytes += m_frames[i].m_frameBytes;
</span><span class="cx">
</span><del>- if (allFrameBytes > largeAnimationCutoff)
</del><ins>+ if (allFrameBytes > largeAnimationCutoff) {
+ LOG(Images, "BitmapImage %p destroyDecodedDataIfNecessary destryingData: allFrameBytes=%u cutoff=%u", this, allFrameBytes, largeAnimationCutoff);
</ins><span class="cx"> destroyDecodedData(destroyAll);
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void BitmapImage::destroyMetadataAndNotify(unsigned frameBytesCleared, ClearedSource clearedSource)
</span><span class="lines">@@ -206,6 +209,8 @@
</span><span class="cx"> m_frames[index].m_hasAlpha = m_source.frameHasAlphaAtIndex(index);
</span><span class="cx"> m_frames[index].m_frameBytes = m_source.frameBytesAtIndex(index, subsamplingLevel);
</span><span class="cx">
</span><ins>+ 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);
+
</ins><span class="cx"> if (m_frames[index].m_image) {
</span><span class="cx"> int deltaBytes = safeCast<int>(m_frames[index].m_frameBytes);
</span><span class="cx"> m_decodedSize += deltaBytes;
</span><span class="lines">@@ -549,6 +554,11 @@
</span><span class="cx"> // See if we've also passed the time for frames after that to start, in
</span><span class="cx"> // case we need to skip some frames entirely. Remember not to advance
</span><span class="cx"> // to an incomplete frame.
</span><ins>+
+#if !LOG_DISABLED
+ size_t startCatchupFrameIndex = nextFrame;
+#endif
+
</ins><span class="cx"> for (size_t frameAfterNext = (nextFrame + 1) % frameCount(); frameIsCompleteAtIndex(frameAfterNext); frameAfterNext = (nextFrame + 1) % frameCount()) {
</span><span class="cx"> // Should we skip the next frame?
</span><span class="cx"> double frameAfterNextStartTime = m_desiredFrameStartTime + frameDurationAtIndex(nextFrame);
</span><span class="lines">@@ -560,12 +570,15 @@
</span><span class="cx"> if (!internalAdvanceAnimation(SkippingFramesToCatchUp)) {
</span><span class="cx"> m_animationFinishedWhenCatchingUp = true;
</span><span class="cx"> startTimer(0);
</span><ins>+ LOG(Images, "BitmapImage %p startAnimation catching up from frame %lu, ended", this, startCatchupFrameIndex);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> m_desiredFrameStartTime = frameAfterNextStartTime;
</span><span class="cx"> nextFrame = frameAfterNext;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ LOG(Images, "BitmapImage %p startAnimation catching up jumped from from frame %lu to %d", this, startCatchupFrameIndex, (int)nextFrame - 1);
+
</ins><span class="cx"> // Draw the next frame as soon as possible. Note that m_desiredFrameStartTime
</span><span class="cx"> // may be in the past, meaning the next time through this function we'll
</span><span class="cx"> // kick off the next advancement sooner than this frame's duration would suggest.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgGraphicsContextCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (200966 => 200967)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -34,12 +34,15 @@
</span><span class="cx"> #include "GraphicsContextPlatformPrivateCG.h"
</span><span class="cx"> #include "ImageBuffer.h"
</span><span class="cx"> #include "ImageOrientation.h"
</span><ins>+#include "Logging.h"
</ins><span class="cx"> #include "Path.h"
</span><span class="cx"> #include "Pattern.h"
</span><span class="cx"> #include "ShadowBlur.h"
</span><span class="cx"> #include "SubimageCacheWithTimer.h"
</span><ins>+#include "TextStream.h"
</ins><span class="cx"> #include "Timer.h"
</span><span class="cx"> #include "URL.h"
</span><ins>+#include <wtf/CurrentTime.h>
</ins><span class="cx"> #include <wtf/MathExtras.h>
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx">
</span><span class="lines">@@ -172,6 +175,9 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !LOG_DISABLED
+ double startTime = currentTime();
+#endif
</ins><span class="cx"> RetainPtr<CGImageRef> subImage(image);
</span><span class="cx">
</span><span class="cx"> float currHeight = orientation.usesWidthAsHeight() ? CGImageGetWidth(subImage.get()) : CGImageGetHeight(subImage.get());
</span><span class="lines">@@ -272,6 +278,8 @@
</span><span class="cx"> CGContextSetShouldAntialias(context, wasAntialiased);
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><ins>+
+ LOG_WITH_STREAM(Images, stream << "GraphicsContext::drawNativeImage " << image.get() << " size " << imageSize << " into " << destRect << " took " << 1000.0 * (currentTime() - startTime) << "ms");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void drawPatternCallback(void* info, CGContextRef context)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgImageDecoderCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp (200966 => 200967)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "ImageOrientation.h"
</span><span class="cx"> #include "IntPoint.h"
</span><span class="cx"> #include "IntSize.h"
</span><ins>+#include "Logging.h"
</ins><span class="cx"> #include "SharedBuffer.h"
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="lines">@@ -339,6 +340,8 @@
</span><span class="cx">
</span><span class="cx"> NativeImagePtr ImageDecoder::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel) const
</span><span class="cx"> {
</span><ins>+ LOG(Images, "ImageDecoder %p createFrameImageAtIndex %lu", this, index);
+
</ins><span class="cx"> RetainPtr<CGImageRef> image = adoptCF(CGImageSourceCreateImageAtIndex(m_nativeDecoder.get(), index, imageSourceOptions(subsamplingLevel).get()));
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre>
</div>
</div>
</body>
</html>