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

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

Issue 2108163003: Fix dead-lock issue attempting to decode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@componentBuild
Patch Set: Created 4 years, 5 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 | 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 DecodingImageGenerator::~DecodingImageGenerator() 49 DecodingImageGenerator::~DecodingImageGenerator()
50 { 50 {
51 } 51 }
52 52
53 SkData* DecodingImageGenerator::onRefEncodedData(GrContext* ctx) 53 SkData* DecodingImageGenerator::onRefEncodedData(GrContext* ctx)
54 { 54 {
55 TRACE_EVENT0("blink", "DecodingImageGenerator::refEncodedData"); 55 TRACE_EVENT0("blink", "DecodingImageGenerator::refEncodedData");
56 56
57 return m_allDataReceived ? m_data->getAsSkData().leakRef() : nullptr; 57 // The GPU only wants the data if it has all been received, since the GPU
58 // only wants a complete texture. getAsSkData() may require copying, so
59 // skip it and just return nullptr to avoid a slowdown. (See
60 // crbug.com/568016 for details about such a slowdown.)
f(malita) 2016/06/29 17:38:37 It seems a bit fragile to tweak this implementatio
reed1 2016/06/29 17:57:45 agreed, seems fragile. Can you imagine other ways
scroggo_chromium 2016/06/29 19:21:21 Tracking with a bug: skbug.com/5485
scroggo_chromium 2016/06/29 19:21:21 Agreed. Added a TODO.
61 if (ctx && !m_allDataReceived)
62 return nullptr;
63
64 // Other clients are serializers, which want the data even if it requires
65 // copying, and even if the data is incomplete. (Otherwise they would
66 // potentially need to decode the partial image in order to re-encode it.)
67 return m_data->getAsSkData().leakRef();
58 } 68 }
59 69
60 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor table[], int* tableCount) 70 bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor table[], int* tableCount)
61 { 71 {
62 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "frame index", st atic_cast<int>(m_frameIndex)); 72 TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "frame index", st atic_cast<int>(m_frameIndex));
63 73
64 // Implementation doesn't support scaling yet so make sure we're not given a different size. 74 // Implementation doesn't support scaling yet so make sure we're not given a different size.
65 if (info.width() != getInfo().width() || info.height() != getInfo().height() ) 75 if (info.width() != getInfo().width() || info.height() != getInfo().height() )
66 return false; 76 return false;
67 77
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t()); 136 const SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.heigh t());
127 137
128 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), false); 138 RefPtr<ImageFrameGenerator> frame = ImageFrameGenerator::create(SkISize::Mak e(size.width(), size.height()), false);
129 if (!frame) 139 if (!frame)
130 return 0; 140 return 0;
131 141
132 return new DecodingImageGenerator(frame, info, segmentReader.release(), true , 0); 142 return new DecodingImageGenerator(frame, info, segmentReader.release(), true , 0);
133 } 143 }
134 144
135 } // namespace blink 145 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698