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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * 3 *
4 * Portions are Copyright (C) 2001-6 mozilla.org 4 * Portions are Copyright (C) 2001-6 mozilla.org
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Stuart Parmenter <stuart@mozilla.com> 7 * Stuart Parmenter <stuart@mozilla.com>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 21 matching lines...) Expand all
32 * deletingthe provisions above and replace them with the notice and 32 * deletingthe provisions above and replace them with the notice and
33 * other provisions required by the MPL or the GPL, as the case may be. 33 * other provisions required by the MPL or the GPL, as the case may be.
34 * If you do not delete the provisions above, a recipient may use your 34 * If you do not delete the provisions above, a recipient may use your
35 * version of this file under any of the LGPL, the MPL or the GPL. 35 * version of this file under any of the LGPL, the MPL or the GPL.
36 */ 36 */
37 37
38 #include "platform/image-decoders/jpeg/JPEGImageDecoder.h" 38 #include "platform/image-decoders/jpeg/JPEGImageDecoder.h"
39 39
40 #include "platform/Histogram.h" 40 #include "platform/Histogram.h"
41 #include "platform/PlatformInstrumentation.h" 41 #include "platform/PlatformInstrumentation.h"
42 #include "wtf/PtrUtil.h"
42 #include "wtf/Threading.h" 43 #include "wtf/Threading.h"
44 #include <memory>
43 45
44 extern "C" { 46 extern "C" {
45 #include <stdio.h> // jpeglib.h needs stdio FILE. 47 #include <stdio.h> // jpeglib.h needs stdio FILE.
46 #include "jpeglib.h" 48 #include "jpeglib.h"
47 #if USE(ICCJPEG) 49 #if USE(ICCJPEG)
48 #include "iccjpeg.h" 50 #include "iccjpeg.h"
49 #endif 51 #endif
50 #if USE(QCMSLIB) 52 #if USE(QCMSLIB)
51 #include "qcms.h" 53 #include "qcms.h"
52 #endif 54 #endif
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 { 788 {
787 if (!hasImagePlanes()) 789 if (!hasImagePlanes())
788 return false; 790 return false;
789 791
790 PlatformInstrumentation::willDecodeImage("JPEG"); 792 PlatformInstrumentation::willDecodeImage("JPEG");
791 decode(false); 793 decode(false);
792 PlatformInstrumentation::didDecodeImage(); 794 PlatformInstrumentation::didDecodeImage();
793 return !failed(); 795 return !failed();
794 } 796 }
795 797
796 void JPEGImageDecoder::setImagePlanes(PassOwnPtr<ImagePlanes> imagePlanes) 798 void JPEGImageDecoder::setImagePlanes(std::unique_ptr<ImagePlanes> imagePlanes)
797 { 799 {
798 m_imagePlanes = std::move(imagePlanes); 800 m_imagePlanes = std::move(imagePlanes);
799 } 801 }
800 802
801 template <J_COLOR_SPACE colorSpace> void setPixel(ImageFrame& buffer, ImageFrame ::PixelData* pixel, JSAMPARRAY samples, int column) 803 template <J_COLOR_SPACE colorSpace> void setPixel(ImageFrame& buffer, ImageFrame ::PixelData* pixel, JSAMPARRAY samples, int column)
802 { 804 {
803 ASSERT_NOT_REACHED(); 805 ASSERT_NOT_REACHED();
804 } 806 }
805 807
806 template <> void setPixel<JCS_RGB>(ImageFrame& buffer, ImageFrame::PixelData* pi xel, JSAMPARRAY samples, int column) 808 template <> void setPixel<JCS_RGB>(ImageFrame& buffer, ImageFrame::PixelData* pi xel, JSAMPARRAY samples, int column)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 983
982 return decoder->frameIsCompleteAtIndex(0); 984 return decoder->frameIsCompleteAtIndex(0);
983 } 985 }
984 986
985 void JPEGImageDecoder::decode(bool onlySize) 987 void JPEGImageDecoder::decode(bool onlySize)
986 { 988 {
987 if (failed()) 989 if (failed())
988 return; 990 return;
989 991
990 if (!m_reader) { 992 if (!m_reader) {
991 m_reader = adoptPtr(new JPEGImageReader(this)); 993 m_reader = wrapUnique(new JPEGImageReader(this));
992 m_reader->setData(m_data.get()); 994 m_reader->setData(m_data.get());
993 } 995 }
994 996
995 // If we couldn't decode the image but have received all the data, decoding 997 // If we couldn't decode the image but have received all the data, decoding
996 // has failed. 998 // has failed.
997 if (!m_reader->decode(onlySize) && isAllDataReceived()) 999 if (!m_reader->decode(onlySize) && isAllDataReceived())
998 setFailed(); 1000 setFailed();
999 1001
1000 // If decoding is done or failed, we don't need the JPEGImageReader anymore. 1002 // If decoding is done or failed, we don't need the JPEGImageReader anymore.
1001 if (isComplete(this, onlySize) || failed()) 1003 if (isComplete(this, onlySize) || failed())
1002 m_reader.reset(); 1004 m_reader.reset();
1003 } 1005 }
1004 1006
1005 } // namespace blink 1007 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698