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

Side by Side Diff: ios/web/public/image_fetcher/webp_decoder.mm

Issue 2663213002: Create the IOSImageDataFetcherWrapper (Closed)
Patch Set: Address comments Created 3 years, 10 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 | « ios/web/public/image_fetcher/webp_decoder.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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #import "ios/web/public/image_fetcher/webp_decoder.h" 5 #import "ios/web/public/image_fetcher/webp_decoder.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 : delegate_(delegate), state_(READING_FEATURES), has_alpha_(0) { 99 : delegate_(delegate), state_(READING_FEATURES), has_alpha_(0) {
100 DCHECK(delegate_.get()); 100 DCHECK(delegate_.get());
101 const bool rv = WebPInitDecoderConfig(&config_); 101 const bool rv = WebPInitDecoderConfig(&config_);
102 DCHECK(rv); 102 DCHECK(rv);
103 } 103 }
104 104
105 WebpDecoder::~WebpDecoder() { 105 WebpDecoder::~WebpDecoder() {
106 WebPFreeDecBuffer(&config_.output); 106 WebPFreeDecBuffer(&config_.output);
107 } 107 }
108 108
109 void WebpDecoder::OnDataReceived(const base::scoped_nsobject<NSData>& data) { 109 void WebpDecoder::OnDataReceived(NSData* data) {
110 DCHECK(data); 110 DCHECK(data);
111 switch (state_) { 111 switch (state_) {
112 case READING_FEATURES: 112 case READING_FEATURES:
113 DoReadFeatures(data); 113 DoReadFeatures(data);
114 break; 114 break;
115 case READING_DATA: 115 case READING_DATA:
116 DoReadData(data); 116 DoReadData(data);
117 break; 117 break;
118 case DONE: 118 case DONE:
119 DLOG(WARNING) << "Received WebP data but decoding is finished. Ignoring."; 119 DLOG(WARNING) << "Received WebP data but decoding is finished. Ignoring.";
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 UMA_HISTOGRAM_ENUMERATION("WebP.DecodedImageFormat", format, 247 UMA_HISTOGRAM_ENUMERATION("WebP.DecodedImageFormat", format,
248 DECODED_FORMAT_COUNT); 248 DECODED_FORMAT_COUNT);
249 delegate_->SetImageFeatures([result_data length], format); 249 delegate_->SetImageFeatures([result_data length], format);
250 delegate_->OnDataDecoded(result_data); 250 delegate_->OnDataDecoded(result_data);
251 output_buffer_.reset(); 251 output_buffer_.reset();
252 return true; 252 return true;
253 } 253 }
254 254
255 } // namespace webp_transcode 255 } // namespace webp_transcode
OLDNEW
« no previous file with comments | « ios/web/public/image_fetcher/webp_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698