OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/image_decoder.h" | 5 #include "chrome/browser/image_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/common/chrome_utility_messages.h" | 9 #include "chrome/common/chrome_utility_messages.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 base::Unretained(image_request))); | 92 base::Unretained(image_request))); |
93 return; | 93 return; |
94 } | 94 } |
95 | 95 |
96 last_request_ = base::TimeTicks::Now(); | 96 last_request_ = base::TimeTicks::Now(); |
97 base::AutoLock lock(map_lock_); | 97 base::AutoLock lock(map_lock_); |
98 image_request_id_map_.insert( | 98 image_request_id_map_.insert( |
99 std::make_pair(image_request_id_counter_, image_request)); | 99 std::make_pair(image_request_id_counter_, image_request)); |
100 | 100 |
101 switch (image_codec) { | 101 switch (image_codec) { |
| 102 #if defined(OS_CHROMEOS) |
102 case ROBUST_JPEG_CODEC: | 103 case ROBUST_JPEG_CODEC: |
103 utility_process_host_->Send(new ChromeUtilityMsg_RobustJPEGDecodeImage( | 104 utility_process_host_->Send(new ChromeUtilityMsg_RobustJPEGDecodeImage( |
104 image_data, image_request_id_counter_)); | 105 image_data, image_request_id_counter_)); |
105 break; | 106 break; |
| 107 #endif // defined(OS_CHROMEOS) |
106 case DEFAULT_CODEC: | 108 case DEFAULT_CODEC: |
107 utility_process_host_->Send(new ChromeUtilityMsg_DecodeImage( | 109 utility_process_host_->Send(new ChromeUtilityMsg_DecodeImage( |
108 image_data, shrink_to_fit, image_request_id_counter_)); | 110 image_data, shrink_to_fit, image_request_id_counter_)); |
109 break; | 111 break; |
110 } | 112 } |
111 | 113 |
112 ++image_request_id_counter_; | 114 ++image_request_id_counter_; |
113 } | 115 } |
114 | 116 |
115 void ImageDecoder::CancelImpl(ImageRequest* image_request) { | 117 void ImageDecoder::CancelImpl(ImageRequest* image_request) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 auto it = image_request_id_map_.find(request_id); | 191 auto it = image_request_id_map_.find(request_id); |
190 if (it != image_request_id_map_.end()) { | 192 if (it != image_request_id_map_.end()) { |
191 ImageRequest* image_request = it->second; | 193 ImageRequest* image_request = it->second; |
192 image_request->task_runner()->PostTask( | 194 image_request->task_runner()->PostTask( |
193 FROM_HERE, base::Bind(&ImageRequest::OnDecodeImageFailed, | 195 FROM_HERE, base::Bind(&ImageRequest::OnDecodeImageFailed, |
194 base::Unretained(image_request))); | 196 base::Unretained(image_request))); |
195 | 197 |
196 image_request_id_map_.erase(it); | 198 image_request_id_map_.erase(it); |
197 } | 199 } |
198 } | 200 } |
OLD | NEW |