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

Unified Diff: chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc

Issue 1112573002: [chrome/browser/extensions] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Review Comments Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
diff --git a/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc b/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
index 9c77870764b610705a63016e726baa5e1ba0341b..5dc5b11c622a1330cc1e50f2cfe3b17606084ba0 100644
--- a/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
+++ b/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
@@ -4,6 +4,7 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
+#include "base/thread_task_runner_handle.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.h"
#include "chrome/common/extensions/chrome_utility_extensions_messages.h"
@@ -14,7 +15,7 @@
using content::BrowserThread;
ImageWriterUtilityClient::ImageWriterUtilityClient()
- : message_loop_proxy_(base::MessageLoopProxy::current()) {}
+ : thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
ImageWriterUtilityClient::~ImageWriterUtilityClient() {}
void ImageWriterUtilityClient::Write(const ProgressCallback& progress_callback,
@@ -32,7 +33,7 @@ void ImageWriterUtilityClient::Write(const ProgressCallback& progress_callback,
if (!Send(new ChromeUtilityMsg_ImageWriter_Write(source, target))) {
DLOG(ERROR) << "Unable to send Write message to Utility Process.";
- message_loop_proxy_->PostTask(
+ thread_task_runner_->PostTask(
FROM_HERE, base::Bind(error_callback_, "IPC communication failed"));
}
}
@@ -52,7 +53,7 @@ void ImageWriterUtilityClient::Verify(const ProgressCallback& progress_callback,
if (!Send(new ChromeUtilityMsg_ImageWriter_Verify(source, target))) {
DLOG(ERROR) << "Unable to send Verify message to Utility Process.";
- message_loop_proxy_->PostTask(
+ thread_task_runner_->PostTask(
FROM_HERE, base::Bind(error_callback_, "IPC communication failed"));
}
}
@@ -62,7 +63,7 @@ void ImageWriterUtilityClient::Cancel(const CancelCallback& cancel_callback) {
if (!utility_process_host_) {
// If we haven't connected, there is nothing to cancel.
- message_loop_proxy_->PostTask(FROM_HERE, cancel_callback);
+ thread_task_runner_->PostTask(FROM_HERE, cancel_callback);
return;
}
@@ -105,12 +106,12 @@ void ImageWriterUtilityClient::StartHost() {
}
void ImageWriterUtilityClient::OnProcessCrashed(int exit_code) {
- message_loop_proxy_->PostTask(
+ thread_task_runner_->PostTask(
FROM_HERE, base::Bind(error_callback_, "Utility process crashed."));
}
void ImageWriterUtilityClient::OnProcessLaunchFailed() {
- message_loop_proxy_->PostTask(
+ thread_task_runner_->PostTask(
FROM_HERE, base::Bind(error_callback_, "Process launch failed."));
}
@@ -136,26 +137,26 @@ bool ImageWriterUtilityClient::Send(IPC::Message* msg) {
void ImageWriterUtilityClient::OnWriteImageSucceeded() {
if (!success_callback_.is_null()) {
- message_loop_proxy_->PostTask(FROM_HERE, success_callback_);
+ thread_task_runner_->PostTask(FROM_HERE, success_callback_);
}
}
void ImageWriterUtilityClient::OnWriteImageCancelled() {
if (!cancel_callback_.is_null()) {
- message_loop_proxy_->PostTask(FROM_HERE, cancel_callback_);
+ thread_task_runner_->PostTask(FROM_HERE, cancel_callback_);
}
}
void ImageWriterUtilityClient::OnWriteImageFailed(const std::string& message) {
if (!error_callback_.is_null()) {
- message_loop_proxy_->PostTask(FROM_HERE,
+ thread_task_runner_->PostTask(FROM_HERE,
base::Bind(error_callback_, message));
}
}
void ImageWriterUtilityClient::OnWriteImageProgress(int64 progress) {
if (!progress_callback_.is_null()) {
- message_loop_proxy_->PostTask(FROM_HERE,
+ thread_task_runner_->PostTask(FROM_HERE,
base::Bind(progress_callback_, progress));
}
}

Powered by Google App Engine
This is Rietveld 408576698