summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 21:13:53 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 21:13:53 +0000
commit1624b397f565f5f281122e404c11e33d84f949e3 (patch)
treeac05d6660615abaaab78e5d7148ae180767e5ba4
parentebaf09fc99d68821c265297499a64246222bf64d (diff)
downloadchromium_src-1624b397f565f5f281122e404c11e33d84f949e3.zip
chromium_src-1624b397f565f5f281122e404c11e33d84f949e3.tar.gz
chromium_src-1624b397f565f5f281122e404c11e33d84f949e3.tar.bz2
base::Bind: Convert chrome/service.
BUG=none TEST=none R=csilv@chromium.org Review URL: http://codereview.chromium.org/8553002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110163 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/service/cloud_print/cloud_print_proxy_backend.cc70
-rw-r--r--chrome/service/cloud_print/job_status_updater.cc3
-rw-r--r--chrome/service/cloud_print/print_system_cups.cc55
-rw-r--r--chrome/service/cloud_print/print_system_win.cc24
-rw-r--r--chrome/service/cloud_print/printer_job_handler.cc57
-rw-r--r--chrome/service/gaia/service_gaia_authenticator.cc4
-rw-r--r--chrome/service/service_utility_process_host.cc24
7 files changed, 103 insertions, 134 deletions
diff --git a/chrome/service/cloud_print/cloud_print_proxy_backend.cc b/chrome/service/cloud_print/cloud_print_proxy_backend.cc
index a0a5d80..b452d9c 100644
--- a/chrome/service/cloud_print/cloud_print_proxy_backend.cc
+++ b/chrome/service/cloud_print/cloud_print_proxy_backend.cc
@@ -7,6 +7,7 @@
#include <map>
#include <vector>
+#include "base/bind.h"
#include "base/file_util.h"
#include "base/rand_util.h"
#include "base/values.h"
@@ -174,15 +175,11 @@ bool CloudPrintProxyBackend::InitializeWithLsid(
const std::string& last_user_email) {
if (!core_thread_.Start())
return false;
- core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(
- core_.get(),
- &CloudPrintProxyBackend::Core::DoInitializeWithLsid,
- lsid,
- proxy_id,
- last_robot_refresh_token,
- last_robot_email,
- last_user_email));
+ core_thread_.message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&CloudPrintProxyBackend::Core::DoInitializeWithLsid,
+ core_.get(), lsid, proxy_id, last_robot_refresh_token,
+ last_robot_email, last_user_email));
return true;
}
@@ -191,10 +188,10 @@ bool CloudPrintProxyBackend::InitializeWithToken(
const std::string& proxy_id) {
if (!core_thread_.Start())
return false;
- core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(
- core_.get(), &CloudPrintProxyBackend::Core::DoInitializeWithToken,
- cloud_print_token, proxy_id));
+ core_thread_.message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&CloudPrintProxyBackend::Core::DoInitializeWithToken,
+ core_.get(), cloud_print_token, proxy_id));
return true;
}
@@ -204,13 +201,11 @@ bool CloudPrintProxyBackend::InitializeWithRobotToken(
const std::string& proxy_id) {
if (!core_thread_.Start())
return false;
- core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(
- core_.get(),
- &CloudPrintProxyBackend::Core::DoInitializeWithRobotToken,
- robot_oauth_refresh_token,
- robot_email,
- proxy_id));
+ core_thread_.message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&CloudPrintProxyBackend::Core::DoInitializeWithRobotToken,
+ core_.get(), robot_oauth_refresh_token, robot_email,
+ proxy_id));
return true;
}
@@ -220,20 +215,17 @@ bool CloudPrintProxyBackend::InitializeWithRobotAuthCode(
const std::string& proxy_id) {
if (!core_thread_.Start())
return false;
- core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(
- core_.get(),
- &CloudPrintProxyBackend::Core::DoInitializeWithRobotAuthCode,
- robot_oauth_auth_code,
- robot_email,
- proxy_id));
+ core_thread_.message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&CloudPrintProxyBackend::Core::DoInitializeWithRobotAuthCode,
+ core_.get(), robot_oauth_auth_code, robot_email, proxy_id));
return true;
}
void CloudPrintProxyBackend::Shutdown() {
- core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(core_.get(),
- &CloudPrintProxyBackend::Core::DoShutdown));
+ core_thread_.message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&CloudPrintProxyBackend::Core::DoShutdown, core_.get()));
core_thread_.Stop();
core_ = NULL; // Releases reference to core_.
}
@@ -308,11 +300,9 @@ void CloudPrintProxyBackend::Core::OnAuthenticationComplete(
token_store->SetToken(access_token);
// Let the frontend know that we have authenticated.
backend_->frontend_loop_->PostTask(
- FROM_HERE, NewRunnableMethod(this,
- &Core::NotifyAuthenticated,
- robot_oauth_refresh_token,
- robot_email,
- user_email));
+ FROM_HERE,
+ base::Bind(&Core::NotifyAuthenticated, this, robot_oauth_refresh_token,
+ robot_email, user_email));
if (first_time) {
InitNotifications(robot_email, access_token);
} else {
@@ -327,9 +317,7 @@ void CloudPrintProxyBackend::Core::OnAuthenticationComplete(
if (!connector_->Start()) {
// Let the frontend know that we do not have a print system.
backend_->frontend_loop_->PostTask(
- FROM_HERE,
- NewRunnableMethod(this,
- &Core::NotifyPrintSystemUnavailable));
+ FROM_HERE, base::Bind(&Core::NotifyPrintSystemUnavailable, this));
}
}
}
@@ -337,8 +325,8 @@ void CloudPrintProxyBackend::Core::OnAuthenticationComplete(
void CloudPrintProxyBackend::Core::OnInvalidCredentials() {
DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
VLOG(1) << "CP_CONNECTOR: Auth Error";
- backend_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &Core::NotifyAuthenticationFailed));
+ backend_->frontend_loop_->PostTask(
+ FROM_HERE, base::Bind(&Core::NotifyAuthenticationFailed, this));
}
void CloudPrintProxyBackend::Core::OnAuthFailed() {
@@ -415,7 +403,7 @@ void CloudPrintProxyBackend::Core::ScheduleJobPoll() {
kMaxJobPollIntervalSecs);
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- NewRunnableMethod(this, &CloudPrintProxyBackend::Core::PollForJobs),
+ base::Bind(&CloudPrintProxyBackend::Core::PollForJobs, this),
interval_in_seconds * 1000);
job_poll_scheduled_ = true;
}
diff --git a/chrome/service/cloud_print/job_status_updater.cc b/chrome/service/cloud_print/job_status_updater.cc
index c2d7fc1..0c4e76a 100644
--- a/chrome/service/cloud_print/job_status_updater.cc
+++ b/chrome/service/cloud_print/job_status_updater.cc
@@ -4,6 +4,7 @@
#include "chrome/service/cloud_print/job_status_updater.h"
+#include "base/bind.h"
#include "base/json/json_reader.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -84,7 +85,7 @@ CloudPrintURLFetcher::ResponseAction JobStatusUpdater::HandleJSONData(
bool succeeded) {
if (last_job_details_.status == cloud_print::PRINT_JOB_STATUS_COMPLETED) {
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &JobStatusUpdater::Stop));
+ FROM_HERE, base::Bind(&JobStatusUpdater::Stop, this));
}
return CloudPrintURLFetcher::STOP_PROCESSING;
}
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc
index 54ee38f..528da8a 100644
--- a/chrome/service/cloud_print/print_system_cups.cc
+++ b/chrome/service/cloud_print/print_system_cups.cc
@@ -13,6 +13,7 @@
#include <list>
#include <map>
+#include "base/bind.h"
#include "base/file_path.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
@@ -50,7 +51,7 @@ static const int kDefaultIPPServerPort = 631;
// Time interval to check for printer's updates.
const int kCheckForPrinterUpdatesMs = 5*60*1000;
-// Job update timeput
+// Job update timeout
const int kJobUpdateTimeoutMs = 5000;
// Job id for dry run (it should not affect CUPS job ids, since 0 job-id is
@@ -185,8 +186,9 @@ class PrintServerWatcherCUPS
PrintSystem::PrintServerWatcher::Delegate* delegate) {
delegate_ = delegate;
printers_hash_ = GetPrintersHash();
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- NewRunnableMethod(this, &PrintServerWatcherCUPS::CheckForUpdates),
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&PrintServerWatcherCUPS::CheckForUpdates, this),
print_system_->GetUpdateTimeoutMs());
return true;
}
@@ -204,8 +206,9 @@ class PrintServerWatcherCUPS
printers_hash_ = new_hash;
delegate_->OnPrinterAdded();
}
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- NewRunnableMethod(this, &PrintServerWatcherCUPS::CheckForUpdates),
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&PrintServerWatcherCUPS::CheckForUpdates, this),
print_system_->GetUpdateTimeoutMs());
}
private:
@@ -254,13 +257,15 @@ class PrinterWatcherCUPS
delegate_ = delegate;
settings_hash_ = GetSettingsHash();
// Schedule next job status update.
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- NewRunnableMethod(this, &PrinterWatcherCUPS::JobStatusUpdate),
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&PrinterWatcherCUPS::JobStatusUpdate, this),
kJobUpdateTimeoutMs);
// Schedule next printer check.
// TODO(gene): Randomize time for the next printer update.
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- NewRunnableMethod(this, &PrinterWatcherCUPS::PrinterUpdate),
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&PrinterWatcherCUPS::PrinterUpdate, this),
print_system_->GetUpdateTimeoutMs());
return true;
}
@@ -281,8 +286,9 @@ class PrinterWatcherCUPS
// jobs for this printer and check their status. If printer has no
// outstanding jobs, OnJobChanged() will do nothing.
delegate_->OnJobChanged();
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- NewRunnableMethod(this, &PrinterWatcherCUPS::JobStatusUpdate),
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&PrinterWatcherCUPS::JobStatusUpdate, this),
kJobUpdateTimeoutMs);
}
@@ -302,8 +308,9 @@ class PrinterWatcherCUPS
VLOG(1) << "CP_CUPS: Printer update detected for: " << printer_name_;
}
}
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- NewRunnableMethod(this, &PrinterWatcherCUPS::PrinterUpdate),
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&PrinterWatcherCUPS::PrinterUpdate, this),
print_system_->GetUpdateTimeoutMs());
}
private:
@@ -358,12 +365,9 @@ class JobSpoolerCUPS : public PrintSystem::JobSpooler {
int job_id = print_system_->SpoolPrintJob(
print_ticket, print_data_file_path, print_data_mime_type,
printer_name, job_title, tags, &dry_run);
- MessageLoop::current()->PostTask(FROM_HERE,
- NewRunnableFunction(
- &JobSpoolerCUPS::NotifyDelegate,
- delegate,
- job_id,
- dry_run));
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&JobSpoolerCUPS::NotifyDelegate, delegate, job_id, dry_run));
return true;
}
@@ -457,9 +461,9 @@ void PrintSystemCUPS::UpdatePrinters() {
}
// Schedule next update.
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- NewRunnableMethod(this, &PrintSystemCUPS::UpdatePrinters),
- GetUpdateTimeoutMs());
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&PrintSystemCUPS::UpdatePrinters, this), GetUpdateTimeoutMs());
}
PrintSystem::PrintSystemResult PrintSystemCUPS::EnumeratePrinters(
@@ -484,11 +488,8 @@ void PrintSystemCUPS::GetPrinterCapsAndDefaults(
bool succeeded = GetPrinterCapsAndDefaults(printer_name, &printer_info);
MessageLoop::current()->PostTask(
FROM_HERE,
- NewRunnableFunction(&PrintSystemCUPS::RunCapsCallback,
- callback,
- succeeded,
- printer_name,
- printer_info));
+ base::Bind(&PrintSystemCUPS::RunCapsCallback, callback, succeeded,
+ printer_name, printer_info));
}
bool PrintSystemCUPS::IsValidPrinter(const std::string& printer_name) {
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc
index ce52f99..e61fda2 100644
--- a/chrome/service/cloud_print/print_system_win.cc
+++ b/chrome/service/cloud_print/print_system_win.cc
@@ -8,6 +8,7 @@
#include <winspool.h>
#include <xpsprint.h>
+#include "base/bind.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/memory/scoped_ptr.h"
@@ -532,14 +533,9 @@ class PrintSystemWin : public PrintSystem {
gfx::Rect render_area(0, 0, dc_width, dc_height);
g_service_process->io_thread()->message_loop_proxy()->PostTask(
FROM_HERE,
- NewRunnableMethod(
- this,
- &JobSpoolerWin::Core::RenderPDFPagesInSandbox,
- print_data_file_path_,
- render_area,
- printer_dpi,
- page_ranges,
- base::MessageLoopProxy::current()));
+ base::Bind(&JobSpoolerWin::Core::RenderPDFPagesInSandbox, this,
+ print_data_file_path_, render_area, printer_dpi,
+ page_ranges, base::MessageLoopProxy::current()));
}
// Called on the service process IO thread.
void RenderPDFPagesInSandbox(
@@ -659,10 +655,8 @@ class PrintSystemWin : public PrintSystem {
virtual void Start() {
g_service_process->io_thread()->message_loop_proxy()->PostTask(
FROM_HERE,
- NewRunnableMethod(
- this,
- &PrinterCapsHandler::GetPrinterCapsAndDefaultsImpl,
- base::MessageLoopProxy::current()));
+ base::Bind(&PrinterCapsHandler::GetPrinterCapsAndDefaultsImpl, this,
+ base::MessageLoopProxy::current()));
}
virtual void OnChildDied() {
@@ -699,10 +693,8 @@ class PrintSystemWin : public PrintSystem {
} else {
client_message_loop_proxy->PostTask(
FROM_HERE,
- NewRunnableMethod(
- this,
- &PrinterCapsHandler::OnGetPrinterCapsAndDefaultsFailed,
- printer_name_));
+ base::Bind(&PrinterCapsHandler::OnGetPrinterCapsAndDefaultsFailed,
+ this, printer_name_));
}
}
diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc
index 36fd51a..5a231c8 100644
--- a/chrome/service/cloud_print/printer_job_handler.cc
+++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -4,6 +4,7 @@
#include "chrome/service/cloud_print/printer_job_handler.h"
+#include "base/bind.h"
#include "base/file_util.h"
#include "base/json/json_reader.h"
#include "base/md5.h"
@@ -128,7 +129,7 @@ void PrinterJobHandler::Stop() {
Reset();
if (HavePendingTasks()) {
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Start));
+ FROM_HERE, base::Bind(&PrinterJobHandler::Start, this));
}
}
@@ -141,7 +142,7 @@ void PrinterJobHandler::CheckForJobs(const std::string& reason) {
job_check_pending_ = true;
if (!task_in_progress_) {
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Start));
+ FROM_HERE, base::Bind(&PrinterJobHandler::Start, this));
}
}
@@ -259,7 +260,7 @@ void PrinterJobHandler::OnReceivePrinterCaps(
} else {
// We are done here. Go to the Stop state
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Stop));
+ FROM_HERE, base::Bind(&PrinterJobHandler::Stop, this));
}
}
@@ -277,8 +278,7 @@ CloudPrintURLFetcher::ResponseAction PrinterJobHandler::HandleRawResponse(
response_code == RC_UNSUPPORTED_MEDIA_TYPE) {
MessageLoop::current()->PostTask(
FROM_HERE,
- NewRunnableMethod(this, &PrinterJobHandler::JobFailed,
- JOB_DOWNLOAD_FAILED));
+ base::Bind(&PrinterJobHandler::JobFailed, this, JOB_DOWNLOAD_FAILED));
return CloudPrintURLFetcher::STOP_PROCESSING;
}
return CloudPrintURLFetcher::CONTINUE_PROCESSING;
@@ -309,8 +309,7 @@ void PrinterJobHandler::OnRequestGiveUp() {
// In that case, we should make job as error and should not try it later.
MessageLoop::current()->PostTask(
FROM_HERE,
- NewRunnableMethod(this, &PrinterJobHandler::JobFailed,
- JOB_DOWNLOAD_FAILED));
+ base::Bind(&PrinterJobHandler::JobFailed, this, JOB_DOWNLOAD_FAILED));
}
CloudPrintURLFetcher::ResponseAction PrinterJobHandler::OnRequestAuthError() {
@@ -352,7 +351,7 @@ void PrinterJobHandler::OnPrinterChanged() {
printer_update_pending_ = true;
if (!task_in_progress_) {
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Start));
+ FROM_HERE, base::Bind(&PrinterJobHandler::Start, this));
}
}
@@ -362,8 +361,7 @@ void PrinterJobHandler::OnJobChanged() {
for (JobStatusUpdaterList::iterator index = job_status_updater_list_.begin();
index != job_status_updater_list_.end(); index++) {
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(index->get(),
- &JobStatusUpdater::UpdateStatus));
+ FROM_HERE, base::Bind(&JobStatusUpdater::UpdateStatus, index->get()));
}
}
@@ -378,7 +376,7 @@ PrinterJobHandler::HandlePrinterUpdateResponse(
<< printer_info_cloud_.printer_id;
// We are done here. Go to the Stop state
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Stop));
+ FROM_HERE, base::Bind(&PrinterJobHandler::Stop, this));
return CloudPrintURLFetcher::STOP_PROCESSING;
}
@@ -427,7 +425,7 @@ PrinterJobHandler::HandleJobMetadataResponse(
// If no jobs are available, go to the Stop state.
if (!job_available)
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Stop));
+ FROM_HERE, base::Bind(&PrinterJobHandler::Stop, this));
return CloudPrintURLFetcher::STOP_PROCESSING;
}
@@ -460,7 +458,7 @@ PrinterJobHandler::HandlePrintDataResponse(const content::URLFetcher* source,
const std::string& data) {
VLOG(1) << "CP_CONNECTOR: Handle print data response, id: "
<< printer_info_cloud_.printer_id;
- Task* next_task = NULL;
+ base::Closure next_task;
if (file_util::CreateTemporaryFile(&job_details_.print_data_file_path_)) {
int ret = file_util::WriteFile(job_details_.print_data_file_path_,
data.c_str(),
@@ -469,14 +467,14 @@ PrinterJobHandler::HandlePrintDataResponse(const content::URLFetcher* source,
&job_details_.print_data_mime_type_);
DCHECK(ret == static_cast<int>(data.length()));
if (ret == static_cast<int>(data.length())) {
- next_task = NewRunnableMethod(this, &PrinterJobHandler::StartPrinting);
+ next_task = base::Bind(&PrinterJobHandler::StartPrinting, this);
}
}
// If there was no task allocated above, then there was an error in
// saving the print data, bail out here.
- if (!next_task) {
- next_task = NewRunnableMethod(this, &PrinterJobHandler::JobFailed,
- JOB_DOWNLOAD_FAILED);
+ if (next_task.is_null()) {
+ next_task = base::Bind(&PrinterJobHandler::JobFailed, this,
+ JOB_DOWNLOAD_FAILED);
}
MessageLoop::current()->PostTask(FROM_HERE, next_task);
return CloudPrintURLFetcher::STOP_PROCESSING;
@@ -498,14 +496,14 @@ PrinterJobHandler::HandleSuccessStatusUpdateResponse(
print_system_.get(), this));
job_status_updater_list_.push_back(job_status_updater);
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(job_status_updater.get(),
- &JobStatusUpdater::UpdateStatus));
+ FROM_HERE, base::Bind(&JobStatusUpdater::UpdateStatus,
+ job_status_updater.get()));
if (succeeded) {
// Since we just printed successfully, we want to look for more jobs.
CheckForJobs(kJobFetchReasonQueryMore);
}
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Stop));
+ FROM_HERE, base::Bind(&PrinterJobHandler::Stop, this));
return CloudPrintURLFetcher::STOP_PROCESSING;
}
@@ -518,7 +516,7 @@ PrinterJobHandler::HandleFailureStatusUpdateResponse(
VLOG(1) << "CP_CONNECTOR: Handle failure status update response, id: "
<< printer_info_cloud_.printer_id;
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::Stop));
+ FROM_HERE, base::Bind(&PrinterJobHandler::Stop, this));
return CloudPrintURLFetcher::STOP_PROCESSING;
}
// End Response handlers
@@ -533,9 +531,8 @@ void PrinterJobHandler::StartPrinting() {
JobFailed(PRINT_FAILED);
} else {
print_thread_.message_loop()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &PrinterJobHandler::DoPrint,
- job_details_,
- printer_info_.printer_name));
+ FROM_HERE, base::Bind(&PrinterJobHandler::DoPrint, this, job_details_,
+ printer_info_.printer_name));
}
}
}
@@ -640,17 +637,13 @@ void PrinterJobHandler::OnJobSpoolSucceeded(
const cloud_print::PlatformJobId& job_id) {
DCHECK(MessageLoop::current() == print_thread_.message_loop());
job_spooler_ = NULL;
- job_handler_message_loop_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &PrinterJobHandler::JobSpooled,
- job_id));
+ job_handler_message_loop_proxy_->PostTask(
+ FROM_HERE, base::Bind(&PrinterJobHandler::JobSpooled, this, job_id));
}
void PrinterJobHandler::OnJobSpoolFailed() {
DCHECK(MessageLoop::current() == print_thread_.message_loop());
job_spooler_ = NULL;
- job_handler_message_loop_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &PrinterJobHandler::JobFailed,
- PRINT_FAILED));
+ job_handler_message_loop_proxy_->PostTask(
+ FROM_HERE, base::Bind(&PrinterJobHandler::JobFailed, this, PRINT_FAILED));
}
diff --git a/chrome/service/gaia/service_gaia_authenticator.cc b/chrome/service/gaia/service_gaia_authenticator.cc
index 5967729..a77f224 100644
--- a/chrome/service/gaia/service_gaia_authenticator.cc
+++ b/chrome/service/gaia/service_gaia_authenticator.cc
@@ -4,6 +4,7 @@
#include "chrome/service/gaia/service_gaia_authenticator.h"
+#include "base/bind.h"
#include "base/message_loop_proxy.h"
#include "chrome/service/net/service_url_request_context.h"
#include "chrome/service/service_process.h"
@@ -31,8 +32,7 @@ bool ServiceGaiaAuthenticator::Post(const GURL& url,
DCHECK(io_message_loop_proxy_);
io_message_loop_proxy_->PostTask(
FROM_HERE,
- NewRunnableMethod(this, &ServiceGaiaAuthenticator::DoPost, url,
- post_body));
+ base::Bind(&ServiceGaiaAuthenticator::DoPost, this, url, post_body));
// TODO(sanjeevr): Waiting here until the network request completes is not
// desirable. We need to change Post to be asynchronous.
// Block until network request completes. See OnURLFetchComplete.
diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc
index 387356c..9b359c3 100644
--- a/chrome/service/service_utility_process_host.cc
+++ b/chrome/service/service_utility_process_host.cc
@@ -4,6 +4,7 @@
#include "chrome/service/service_utility_process_host.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/message_loop.h"
@@ -133,8 +134,7 @@ void ServiceUtilityProcessHost::OnChildDied() {
// If we are yet to receive a reply then notify the client that the
// child died.
client_message_loop_proxy_->PostTask(
- FROM_HERE,
- NewRunnableMethod(client_.get(), &Client::OnChildDied));
+ FROM_HERE, base::Bind(&Client::OnChildDied, client_.get()));
}
// The base class implementation will delete |this|.
ServiceChildProcessHost::OnChildDied();
@@ -183,10 +183,8 @@ void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileSucceeded(
scratch_metafile_dir_->Take();
client_message_loop_proxy_->PostTask(
FROM_HERE,
- NewRunnableMethod(client_.get(),
- &Client::MetafileAvailable,
- metafile_path_,
- highest_rendered_page_number));
+ base::Bind(&Client::MetafileAvailable, client_.get(), metafile_path_,
+ highest_rendered_page_number));
}
void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileFailed() {
@@ -194,8 +192,7 @@ void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileFailed() {
waiting_for_reply_ = false;
client_message_loop_proxy_->PostTask(
FROM_HERE,
- NewRunnableMethod(client_.get(),
- &Client::OnRenderPDFPagesToMetafileFailed));
+ base::Bind(&Client::OnRenderPDFPagesToMetafileFailed, client_.get()));
}
void ServiceUtilityProcessHost::OnGetPrinterCapsAndDefaultsSucceeded(
@@ -205,10 +202,8 @@ void ServiceUtilityProcessHost::OnGetPrinterCapsAndDefaultsSucceeded(
waiting_for_reply_ = false;
client_message_loop_proxy_->PostTask(
FROM_HERE,
- NewRunnableMethod(client_.get(),
- &Client::OnGetPrinterCapsAndDefaultsSucceeded,
- printer_name,
- caps_and_defaults));
+ base::Bind(&Client::OnGetPrinterCapsAndDefaultsSucceeded, client_.get(),
+ printer_name, caps_and_defaults));
}
void ServiceUtilityProcessHost::OnGetPrinterCapsAndDefaultsFailed(
@@ -217,9 +212,8 @@ void ServiceUtilityProcessHost::OnGetPrinterCapsAndDefaultsFailed(
waiting_for_reply_ = false;
client_message_loop_proxy_->PostTask(
FROM_HERE,
- NewRunnableMethod(client_.get(),
- &Client::OnGetPrinterCapsAndDefaultsFailed,
- printer_name));
+ base::Bind(&Client::OnGetPrinterCapsAndDefaultsFailed, client_.get(),
+ printer_name));
}
void ServiceUtilityProcessHost::Client::MetafileAvailable(