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

Side by Side Diff: chrome/browser/image_decoder.cc

Issue 1112403005: [chrome/browser] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nit Created 5 years, 7 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
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 image_request_id_map_.erase(it++); 153 image_request_id_map_.erase(it++);
154 } else { 154 } else {
155 ++it; 155 ++it;
156 } 156 }
157 } 157 }
158 } 158 }
159 159
160 void ImageDecoder::StartBatchMode() { 160 void ImageDecoder::StartBatchMode() {
161 DCHECK_CURRENTLY_ON(BrowserThread::IO); 161 DCHECK_CURRENTLY_ON(BrowserThread::IO);
162 utility_process_host_ = 162 utility_process_host_ =
163 UtilityProcessHost::Create(this, base::MessageLoopProxy::current().get()) 163 UtilityProcessHost::Create(
164 ->AsWeakPtr(); 164 this, base::ThreadTaskRunnerHandle::Get().get())->AsWeakPtr();
165 utility_process_host_->SetName(l10n_util::GetStringUTF16( 165 utility_process_host_->SetName(l10n_util::GetStringUTF16(
166 IDS_UTILITY_PROCESS_IMAGE_DECODER_NAME)); 166 IDS_UTILITY_PROCESS_IMAGE_DECODER_NAME));
167 if (!utility_process_host_->StartBatchMode()) { 167 if (!utility_process_host_->StartBatchMode()) {
168 utility_process_host_.reset(); 168 utility_process_host_.reset();
169 return; 169 return;
170 } 170 }
171 } 171 }
172 172
173 void ImageDecoder::StopBatchMode() { 173 void ImageDecoder::StopBatchMode() {
174 DCHECK_CURRENTLY_ON(BrowserThread::IO); 174 DCHECK_CURRENTLY_ON(BrowserThread::IO);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 auto it = image_request_id_map_.find(request_id); 276 auto it = image_request_id_map_.find(request_id);
277 if (it == image_request_id_map_.end()) 277 if (it == image_request_id_map_.end())
278 return; 278 return;
279 image_request = it->second; 279 image_request = it->second;
280 image_request_id_map_.erase(it); 280 image_request_id_map_.erase(it);
281 } 281 }
282 282
283 DCHECK(image_request->task_runner()->RunsTasksOnCurrentThread()); 283 DCHECK(image_request->task_runner()->RunsTasksOnCurrentThread());
284 image_request->OnDecodeImageFailed(); 284 image_request->OnDecodeImageFailed();
285 } 285 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698