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

Side by Side Diff: chrome/utility/image_decoder_impl.cc

Issue 2080083002: Revert of Deletes mojo::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « chrome/utility/image_decoder_impl.h ('k') | components/arc/bluetooth/arc_bluetooth_bridge.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/utility/image_decoder_impl.h" 5 #include "chrome/utility/image_decoder_impl.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 23 matching lines...) Expand all
34 : max_message_size_(kMaxMessageSize), binding_(this, std::move(request)) { 34 : max_message_size_(kMaxMessageSize), binding_(this, std::move(request)) {
35 } 35 }
36 36
37 ImageDecoderImpl::~ImageDecoderImpl() { 37 ImageDecoderImpl::~ImageDecoderImpl() {
38 } 38 }
39 39
40 void ImageDecoderImpl::DecodeImage( 40 void ImageDecoderImpl::DecodeImage(
41 mojo::Array<uint8_t> encoded_data, 41 mojo::Array<uint8_t> encoded_data,
42 mojom::ImageCodec codec, 42 mojom::ImageCodec codec,
43 bool shrink_to_fit, 43 bool shrink_to_fit,
44 const DecodeImageCallback& callback) { 44 const mojo::Callback<void(const SkBitmap&)>& callback) {
45 if (encoded_data.size() == 0) { 45 if (encoded_data.size() == 0) {
46 callback.Run(SkBitmap()); 46 callback.Run(SkBitmap());
47 return; 47 return;
48 } 48 }
49 49
50 SkBitmap decoded_image; 50 SkBitmap decoded_image;
51 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
52 if (codec == mojom::ImageCodec::ROBUST_JPEG) { 52 if (codec == mojom::ImageCodec::ROBUST_JPEG) {
53 // Our robust jpeg decoding is using IJG libjpeg. 53 // Our robust jpeg decoding is using IJG libjpeg.
54 if (encoded_data.size()) { 54 if (encoded_data.size()) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 decoded_image, skia::ImageOperations::RESIZE_LANCZOS3, 93 decoded_image, skia::ImageOperations::RESIZE_LANCZOS3,
94 decoded_image.width() >> halves, decoded_image.height() >> halves); 94 decoded_image.width() >> halves, decoded_image.height() >> halves);
95 } else { 95 } else {
96 decoded_image.reset(); 96 decoded_image.reset();
97 } 97 }
98 } 98 }
99 } 99 }
100 100
101 callback.Run(decoded_image); 101 callback.Run(decoded_image);
102 } 102 }
OLDNEW
« no previous file with comments | « chrome/utility/image_decoder_impl.h ('k') | components/arc/bluetooth/arc_bluetooth_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698