| 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 "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/common/chrome_utility_messages.h" | 10 #include "chrome/common/chrome_utility_messages.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // investigation is needed to determine why the utility process | 118 // investigation is needed to determine why the utility process |
| 119 // is failing to start. See crbug.com/472272 | 119 // is failing to start. See crbug.com/472272 |
| 120 image_request->task_runner()->PostTask( | 120 image_request->task_runner()->PostTask( |
| 121 FROM_HERE, | 121 FROM_HERE, |
| 122 base::Bind(&ImageDecoder::RunOnDecodeImageFailed, this, request_id)); | 122 base::Bind(&ImageDecoder::RunOnDecodeImageFailed, this, request_id)); |
| 123 return; | 123 return; |
| 124 } | 124 } |
| 125 | 125 |
| 126 if (!batch_mode_timer_) { | 126 if (!batch_mode_timer_) { |
| 127 // Created here so it will call StopBatchMode() on the right thread. | 127 // Created here so it will call StopBatchMode() on the right thread. |
| 128 batch_mode_timer_.reset(new base::DelayTimer<ImageDecoder>( | 128 batch_mode_timer_.reset(new base::DelayTimer( |
| 129 FROM_HERE, | 129 FROM_HERE, base::TimeDelta::FromSeconds(kBatchModeTimeoutSeconds), this, |
| 130 base::TimeDelta::FromSeconds(kBatchModeTimeoutSeconds), | |
| 131 this, | |
| 132 &ImageDecoder::StopBatchMode)); | 130 &ImageDecoder::StopBatchMode)); |
| 133 } | 131 } |
| 134 batch_mode_timer_->Reset(); | 132 batch_mode_timer_->Reset(); |
| 135 | 133 |
| 136 switch (image_codec) { | 134 switch (image_codec) { |
| 137 #if defined(OS_CHROMEOS) | 135 #if defined(OS_CHROMEOS) |
| 138 case ROBUST_JPEG_CODEC: | 136 case ROBUST_JPEG_CODEC: |
| 139 utility_process_host_->Send(new ChromeUtilityMsg_RobustJPEGDecodeImage( | 137 utility_process_host_->Send(new ChromeUtilityMsg_RobustJPEGDecodeImage( |
| 140 image_data, request_id)); | 138 image_data, request_id)); |
| 141 break; | 139 break; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 auto it = image_request_id_map_.find(request_id); | 281 auto it = image_request_id_map_.find(request_id); |
| 284 if (it == image_request_id_map_.end()) | 282 if (it == image_request_id_map_.end()) |
| 285 return; | 283 return; |
| 286 image_request = it->second; | 284 image_request = it->second; |
| 287 image_request_id_map_.erase(it); | 285 image_request_id_map_.erase(it); |
| 288 } | 286 } |
| 289 | 287 |
| 290 DCHECK(image_request->task_runner()->RunsTasksOnCurrentThread()); | 288 DCHECK(image_request->task_runner()->RunsTasksOnCurrentThread()); |
| 291 image_request->OnDecodeImageFailed(); | 289 image_request->OnDecodeImageFailed(); |
| 292 } | 290 } |
| OLD | NEW |