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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp

Issue 2940593002: Optimize yuv decoding fail check and remove the usage of unwanted variable.
Patch Set: Remove image plane creation check Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
index 5ed0c32cb845f5c8a4052e7b3207a22688b238b1..761752e8f913c21f008ba9524569e5c915e6a6e6 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
@@ -95,7 +95,7 @@ class ExternalMemoryAllocator final : public SkBitmap::Allocator {
size_t row_bytes_;
};
-static bool UpdateYUVComponentSizes(ImageDecoder* decoder,
+static void UpdateYUVComponentSizes(ImageDecoder* decoder,
SkISize component_sizes[3],
size_t component_width_bytes[3]) {
if (!decoder->CanDecodeToYUV())
@@ -106,8 +106,6 @@ static bool UpdateYUVComponentSizes(ImageDecoder* decoder,
component_sizes[yuv_index].set(size.Width(), size.Height());
component_width_bytes[yuv_index] = decoder->DecodedYUVWidthBytes(yuv_index);
}
-
- return true;
}
ImageFrameGenerator::ImageFrameGenerator(const SkISize& full_size,
@@ -117,7 +115,6 @@ ImageFrameGenerator::ImageFrameGenerator(const SkISize& full_size,
decoder_color_behavior_(color_behavior),
is_multi_frame_(is_multi_frame),
decode_failed_(false),
- yuv_decoding_failed_(false),
frame_count_(0) {}
ImageFrameGenerator::~ImageFrameGenerator() {
@@ -201,7 +198,6 @@ bool ImageFrameGenerator::DecodeToYUV(SegmentReader* data,
}
DCHECK(decoder->Failed());
- yuv_decoding_failed_ = true;
return false;
}
@@ -382,9 +378,6 @@ bool ImageFrameGenerator::GetYUVComponentSizes(SegmentReader* data,
TRACE_EVENT2("blink", "ImageFrameGenerator::getYUVComponentSizes", "width",
full_size_.width(), "height", full_size_.height());
- if (yuv_decoding_failed_)
- return false;
-
std::unique_ptr<ImageDecoder> decoder = ImageDecoder::Create(
data, true, ImageDecoder::kAlphaPremultiplied, decoder_color_behavior_);
if (!decoder)
@@ -396,8 +389,10 @@ bool ImageFrameGenerator::GetYUVComponentSizes(SegmentReader* data,
WTF::WrapUnique(new ImagePlanes);
decoder->SetImagePlanes(std::move(dummy_image_planes));
- return UpdateYUVComponentSizes(decoder.get(), size_info->fSizes,
- size_info->fWidthBytes);
+ UpdateYUVComponentSizes(decoder.get(), size_info->fSizes,
+ size_info->fWidthBytes);
+
+ return true;
}
} // namespace blink
« 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