Commit c0549db1 authored by Wan-Teh Chang's avatar Wan-Teh Chang Committed by Commit Bot

Use std::make_unique<T> instead of new T.

Change-Id: I7572d81f261f1f7277ec1d1fc8bf9d089174f411
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134784Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756489}
parent 3e55ff96
...@@ -130,24 +130,24 @@ std::unique_ptr<ImageDecoder> ImageDecoder::Create( ...@@ -130,24 +130,24 @@ std::unique_ptr<ImageDecoder> ImageDecoder::Create(
std::unique_ptr<ImageDecoder> decoder; std::unique_ptr<ImageDecoder> decoder;
if (MatchesJPEGSignature(contents)) { if (MatchesJPEGSignature(contents)) {
decoder.reset(new JPEGImageDecoder(alpha_option, color_behavior, decoder = std::make_unique<JPEGImageDecoder>(
max_decoded_bytes, allow_decode_to_yuv)); alpha_option, color_behavior, max_decoded_bytes, allow_decode_to_yuv);
} else if (MatchesPNGSignature(contents)) { } else if (MatchesPNGSignature(contents)) {
decoder.reset(new PNGImageDecoder(alpha_option, decoder = std::make_unique<PNGImageDecoder>(
high_bit_depth_decoding_option, alpha_option, high_bit_depth_decoding_option, color_behavior,
color_behavior, max_decoded_bytes)); max_decoded_bytes);
} else if (MatchesGIFSignature(contents)) { } else if (MatchesGIFSignature(contents)) {
decoder.reset( decoder = std::make_unique<GIFImageDecoder>(alpha_option, color_behavior,
new GIFImageDecoder(alpha_option, color_behavior, max_decoded_bytes)); max_decoded_bytes);
} else if (MatchesWebPSignature(contents)) { } else if (MatchesWebPSignature(contents)) {
decoder.reset( decoder = std::make_unique<WEBPImageDecoder>(alpha_option, color_behavior,
new WEBPImageDecoder(alpha_option, color_behavior, max_decoded_bytes)); max_decoded_bytes);
} else if (MatchesICOSignature(contents) || MatchesCURSignature(contents)) { } else if (MatchesICOSignature(contents) || MatchesCURSignature(contents)) {
decoder.reset( decoder = std::make_unique<ICOImageDecoder>(alpha_option, color_behavior,
new ICOImageDecoder(alpha_option, color_behavior, max_decoded_bytes)); max_decoded_bytes);
} else if (MatchesBMPSignature(contents)) { } else if (MatchesBMPSignature(contents)) {
decoder.reset( decoder = std::make_unique<BMPImageDecoder>(alpha_option, color_behavior,
new BMPImageDecoder(alpha_option, color_behavior, max_decoded_bytes)); max_decoded_bytes);
} }
if (decoder) if (decoder)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment