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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/png/PNGImageReader.cpp

Issue 2800193002: Add metrics for how often APNGs are used
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
4 * 4 *
5 * Portions are Copyright (C) 2001 mozilla.org 5 * Portions are Copyright (C) 2001 mozilla.org
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Stuart Parmenter <stuart@mozilla.com> 8 * Stuart Parmenter <stuart@mozilla.com>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 21 matching lines...) Expand all
32 * version of this file under the LGPL, indicate your decision by 32 * version of this file under the LGPL, indicate your decision by
33 * deletingthe provisions above and replace them with the notice and 33 * deletingthe provisions above and replace them with the notice and
34 * other provisions required by the MPL or the GPL, as the case may be. 34 * other provisions required by the MPL or the GPL, as the case may be.
35 * If you do not delete the provisions above, a recipient may use your 35 * If you do not delete the provisions above, a recipient may use your
36 * version of this file under any of the LGPL, the MPL or the GPL. 36 * version of this file under any of the LGPL, the MPL or the GPL.
37 */ 37 */
38 38
39 #include "platform/image-decoders/png/PNGImageReader.h" 39 #include "platform/image-decoders/png/PNGImageReader.h"
40 40
41 #include <memory> 41 #include <memory>
42 #include "platform/Histogram.h"
42 #include "platform/image-decoders/FastSharedBufferReader.h" 43 #include "platform/image-decoders/FastSharedBufferReader.h"
43 #include "platform/image-decoders/SegmentReader.h" 44 #include "platform/image-decoders/SegmentReader.h"
44 #include "platform/image-decoders/png/PNGImageDecoder.h" 45 #include "platform/image-decoders/png/PNGImageDecoder.h"
45 #include "wtf/PtrUtil.h" 46 #include "wtf/PtrUtil.h"
46 #include "zlib.h" 47 #include "zlib.h"
47 48
48 namespace { 49 namespace {
49 50
50 inline blink::PNGImageDecoder* imageDecoder(png_structp png) { 51 inline blink::PNGImageDecoder* imageDecoder(png_structp png) {
51 return static_cast<blink::PNGImageDecoder*>(png_get_progressive_ptr(png)); 52 return static_cast<blink::PNGImageDecoder*>(png_get_progressive_ptr(png));
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 529
529 if (isChunk(chunk, "IDAT")) { 530 if (isChunk(chunk, "IDAT")) {
530 // Done with header chunks. 531 // Done with header chunks.
531 m_idatOffset = m_readOffset; 532 m_idatOffset = m_readOffset;
532 m_fctlNeedsDatChunk = false; 533 m_fctlNeedsDatChunk = false;
533 if (m_ignoreAnimation) 534 if (m_ignoreAnimation)
534 m_isAnimated = false; 535 m_isAnimated = false;
535 if (!m_isAnimated || 1 == m_reportedFrameCount) 536 if (!m_isAnimated || 1 == m_reportedFrameCount)
536 m_decoder->setRepetitionCount(cAnimationNone); 537 m_decoder->setRepetitionCount(cAnimationNone);
537 m_decoder->headerAvailable(); 538 m_decoder->headerAvailable();
539 {
540 DEFINE_THREAD_SAFE_STATIC_LOCAL(
541 BooleanHistogram, apngHistogram,
542 new BooleanHistogram("Blink.DecodedImage.APNG"));
543 apngHistogram.count(m_isAnimated);
544 }
538 return true; 545 return true;
539 } 546 }
540 547
541 // Wait until the entire chunk is available for parsing simplicity. 548 // Wait until the entire chunk is available for parsing simplicity.
542 if (reader.size() < m_readOffset + length + 12) 549 if (reader.size() < m_readOffset + length + 12)
543 break; 550 break;
544 551
545 if (isChunk(chunk, "acTL")) { 552 if (isChunk(chunk, "acTL")) {
546 if (m_ignoreAnimation) 553 if (m_ignoreAnimation)
547 continue; 554 continue;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 break; 680 break;
674 default: 681 default:
675 return false; 682 return false;
676 } 683 }
677 684
678 m_fctlNeedsDatChunk = true; 685 m_fctlNeedsDatChunk = true;
679 return true; 686 return true;
680 } 687 }
681 688
682 } // namespace blink 689 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698