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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp

Issue 1829923004: Do not set m_decodeFailed in ImageFrameGenerator::decodeToYUV (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: back to PS1, add a new m_yuvDecodingFailed Created 4 years, 9 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 | « third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h ('k') | no next file » | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 componentSizes[2].set(size.width(), size.height()); 99 componentSizes[2].set(size.width(), size.height());
100 componentWidthBytes[2] = decoder->decodedYUVWidthBytes(2); 100 componentWidthBytes[2] = decoder->decodedYUVWidthBytes(2);
101 return true; 101 return true;
102 } 102 }
103 103
104 ImageFrameGenerator::ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<Sha redBuffer> data, bool allDataReceived, bool isMultiFrame) 104 ImageFrameGenerator::ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<Sha redBuffer> data, bool allDataReceived, bool isMultiFrame)
105 : m_fullSize(fullSize) 105 : m_fullSize(fullSize)
106 , m_data(adoptRef(new ThreadSafeDataTransport())) 106 , m_data(adoptRef(new ThreadSafeDataTransport()))
107 , m_isMultiFrame(isMultiFrame) 107 , m_isMultiFrame(isMultiFrame)
108 , m_decodeFailed(false) 108 , m_decodeFailed(false)
109 , m_yuvDecodingFailed(false)
109 , m_frameCount(0) 110 , m_frameCount(0)
110 , m_encodedData(nullptr) 111 , m_encodedData(nullptr)
111 { 112 {
112 setData(data.get(), allDataReceived); 113 setData(data.get(), allDataReceived);
113 } 114 }
114 115
115 ImageFrameGenerator::~ImageFrameGenerator() 116 ImageFrameGenerator::~ImageFrameGenerator()
116 { 117 {
117 if (m_encodedData) 118 if (m_encodedData)
118 m_encodedData->unref(); 119 m_encodedData->unref();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 decoder->setImagePlanes(imagePlanes.release()); 242 decoder->setImagePlanes(imagePlanes.release());
242 243
243 ASSERT(decoder->canDecodeToYUV()); 244 ASSERT(decoder->canDecodeToYUV());
244 245
245 if (decoder->decodeToYUV()) { 246 if (decoder->decodeToYUV()) {
246 setHasAlpha(0, false); // YUV is always opaque 247 setHasAlpha(0, false); // YUV is always opaque
247 return true; 248 return true;
248 } 249 }
249 250
250 ASSERT(decoder->failed()); 251 ASSERT(decoder->failed());
251 m_decodeFailed = true; 252 m_yuvDecodingFailed = true;
252 return false; 253 return false;
253 } 254 }
254 255
255 SkBitmap ImageFrameGenerator::tryToResumeDecode(size_t index, const SkISize& sca ledSize) 256 SkBitmap ImageFrameGenerator::tryToResumeDecode(size_t index, const SkISize& sca ledSize)
256 { 257 {
257 TRACE_EVENT1("blink", "ImageFrameGenerator::tryToResumeDecode", "frame index ", static_cast<int>(index)); 258 TRACE_EVENT1("blink", "ImageFrameGenerator::tryToResumeDecode", "frame index ", static_cast<int>(index));
258 259
259 ImageDecoder* decoder = 0; 260 ImageDecoder* decoder = 0;
260 const bool resumeDecoding = ImageDecodingStore::instance().lockDecoder(this, m_fullSize, &decoder); 261 const bool resumeDecoding = ImageDecodingStore::instance().lockDecoder(this, m_fullSize, &decoder);
261 ASSERT(!resumeDecoding || decoder); 262 ASSERT(!resumeDecoding || decoder);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 MutexLocker lock(m_alphaMutex); 389 MutexLocker lock(m_alphaMutex);
389 if (index < m_hasAlpha.size()) 390 if (index < m_hasAlpha.size())
390 return m_hasAlpha[index]; 391 return m_hasAlpha[index];
391 return true; 392 return true;
392 } 393 }
393 394
394 bool ImageFrameGenerator::getYUVComponentSizes(SkYUVSizeInfo* sizeInfo) 395 bool ImageFrameGenerator::getYUVComponentSizes(SkYUVSizeInfo* sizeInfo)
395 { 396 {
396 TRACE_EVENT2("blink", "ImageFrameGenerator::getYUVComponentSizes", "width", m_fullSize.width(), "height", m_fullSize.height()); 397 TRACE_EVENT2("blink", "ImageFrameGenerator::getYUVComponentSizes", "width", m_fullSize.width(), "height", m_fullSize.height());
397 398
399 if (m_yuvDecodingFailed)
400 return false;
401
398 SharedBuffer* data = 0; 402 SharedBuffer* data = 0;
399 bool allDataReceived = false; 403 bool allDataReceived = false;
400 m_data->data(&data, &allDataReceived); 404 m_data->data(&data, &allDataReceived);
401 405
402 // FIXME: YUV decoding does not currently support progressive decoding. 406 // FIXME: YUV decoding does not currently support progressive decoding.
403 if (!allDataReceived) 407 if (!allDataReceived)
404 return false; 408 return false;
405 409
406 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::Alp haPremultiplied, ImageDecoder::GammaAndColorProfileApplied); 410 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::Alp haPremultiplied, ImageDecoder::GammaAndColorProfileApplied);
407 if (!decoder) 411 if (!decoder)
408 return false; 412 return false;
409 413
410 // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. 414 // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding.
411 decoder->setData(data, allDataReceived); 415 decoder->setData(data, allDataReceived);
412 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); 416 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes);
413 decoder->setImagePlanes(dummyImagePlanes.release()); 417 decoder->setImagePlanes(dummyImagePlanes.release());
414 418
415 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fW idthBytes); 419 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fW idthBytes);
416 } 420 }
417 421
418 } // namespace blink 422 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698