| Index: chrome/service/cloud_print/print_system_win.cc
|
| diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc
|
| index 550a56338d413eeea337d36bc99f12082470858d..58b52311057e020f24f30abf7865f266b4dd6cef 100644
|
| --- a/chrome/service/cloud_print/print_system_win.cc
|
| +++ b/chrome/service/cloud_print/print_system_win.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/json/json_writer.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "base/thread_task_runner_handle.h"
|
| #include "base/win/object_watcher.h"
|
| #include "base/win/scoped_bstr.h"
|
| #include "base/win/scoped_comptr.h"
|
| @@ -410,26 +411,24 @@ class JobSpoolerWin : public PrintSystem::JobSpooler {
|
| int dc_width = GetDeviceCaps(printer_dc_.Get(), PHYSICALWIDTH);
|
| int dc_height = GetDeviceCaps(printer_dc_.Get(), PHYSICALHEIGHT);
|
| gfx::Rect render_area(0, 0, dc_width, dc_height);
|
| - g_service_process->io_thread()->message_loop_proxy()->PostTask(
|
| + g_service_process->io_thread()->task_runner()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&JobSpoolerWin::Core::RenderPDFPagesInSandbox,
|
| - this,
|
| - print_data_file_path_,
|
| - render_area,
|
| - printer_dpi,
|
| - base::MessageLoopProxy::current()));
|
| + base::Bind(&JobSpoolerWin::Core::RenderPDFPagesInSandbox, this,
|
| + print_data_file_path_, render_area, printer_dpi,
|
| + base::ThreadTaskRunnerHandle::Get()));
|
| }
|
|
|
| // Called on the service process IO thread.
|
| - void RenderPDFPagesInSandbox(const base::FilePath& pdf_path,
|
| - const gfx::Rect& render_area,
|
| - int render_dpi,
|
| - const scoped_refptr<base::MessageLoopProxy>&
|
| - client_message_loop_proxy) {
|
| - DCHECK(g_service_process->io_thread()->message_loop_proxy()->
|
| - BelongsToCurrentThread());
|
| + void RenderPDFPagesInSandbox(
|
| + const base::FilePath& pdf_path,
|
| + const gfx::Rect& render_area,
|
| + int render_dpi,
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& client_task_runner) {
|
| + DCHECK(g_service_process->io_thread()
|
| + ->task_runner()
|
| + ->BelongsToCurrentThread());
|
| scoped_ptr<ServiceUtilityProcessHost> utility_host(
|
| - new ServiceUtilityProcessHost(this, client_message_loop_proxy.get()));
|
| + new ServiceUtilityProcessHost(this, client_task_runner.get()));
|
| // TODO(gene): For now we disabling autorotation for CloudPrinting.
|
| // Landscape/Portrait setting is passed in the print ticket and
|
| // server is generating portrait PDF always.
|
| @@ -441,7 +440,7 @@ class JobSpoolerWin : public PrintSystem::JobSpooler {
|
| // The object will self-destruct when the child process dies.
|
| utility_host.release();
|
| } else {
|
| - client_message_loop_proxy->PostTask(
|
| + client_task_runner->PostTask(
|
| FROM_HERE, base::Bind(&Core::PrintJobDone, this, false));
|
| }
|
| }
|
| @@ -555,53 +554,51 @@ class PrinterCapsHandler : public ServiceUtilityProcessHost::Client {
|
| }
|
|
|
| void StartGetPrinterCapsAndDefaults() {
|
| - g_service_process->io_thread()->message_loop_proxy()->PostTask(
|
| + g_service_process->io_thread()->task_runner()->PostTask(
|
| FROM_HERE,
|
| base::Bind(&PrinterCapsHandler::GetPrinterCapsAndDefaultsImpl, this,
|
| - base::MessageLoopProxy::current()));
|
| + base::ThreadTaskRunnerHandle::Get()));
|
| }
|
|
|
| void StartGetPrinterSemanticCapsAndDefaults() {
|
| - g_service_process->io_thread()->message_loop_proxy()->PostTask(
|
| + g_service_process->io_thread()->task_runner()->PostTask(
|
| FROM_HERE,
|
| base::Bind(&PrinterCapsHandler::GetPrinterSemanticCapsAndDefaultsImpl,
|
| - this, base::MessageLoopProxy::current()));
|
| + this, base::ThreadTaskRunnerHandle::Get()));
|
| }
|
|
|
| private:
|
| ~PrinterCapsHandler() override {}
|
|
|
| void GetPrinterCapsAndDefaultsImpl(
|
| - const scoped_refptr<base::MessageLoopProxy>&
|
| - client_message_loop_proxy) {
|
| - DCHECK(g_service_process->io_thread()->message_loop_proxy()->
|
| - BelongsToCurrentThread());
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& client_task_runner) {
|
| + DCHECK(g_service_process->io_thread()
|
| + ->task_runner()
|
| + ->BelongsToCurrentThread());
|
| scoped_ptr<ServiceUtilityProcessHost> utility_host(
|
| - new ServiceUtilityProcessHost(this, client_message_loop_proxy.get()));
|
| + new ServiceUtilityProcessHost(this, client_task_runner.get()));
|
| if (utility_host->StartGetPrinterCapsAndDefaults(printer_name_)) {
|
| // The object will self-destruct when the child process dies.
|
| utility_host.release();
|
| } else {
|
| - client_message_loop_proxy->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&PrinterCapsHandler::OnChildDied, this));
|
| + client_task_runner->PostTask(
|
| + FROM_HERE, base::Bind(&PrinterCapsHandler::OnChildDied, this));
|
| }
|
| }
|
|
|
| void GetPrinterSemanticCapsAndDefaultsImpl(
|
| - const scoped_refptr<base::MessageLoopProxy>&
|
| - client_message_loop_proxy) {
|
| - DCHECK(g_service_process->io_thread()->message_loop_proxy()->
|
| - BelongsToCurrentThread());
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& client_task_runner) {
|
| + DCHECK(g_service_process->io_thread()
|
| + ->task_runner()
|
| + ->BelongsToCurrentThread());
|
| scoped_ptr<ServiceUtilityProcessHost> utility_host(
|
| - new ServiceUtilityProcessHost(this, client_message_loop_proxy.get()));
|
| + new ServiceUtilityProcessHost(this, client_task_runner.get()));
|
| if (utility_host->StartGetPrinterSemanticCapsAndDefaults(printer_name_)) {
|
| // The object will self-destruct when the child process dies.
|
| utility_host.release();
|
| } else {
|
| - client_message_loop_proxy->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&PrinterCapsHandler::OnChildDied, this));
|
| + client_task_runner->PostTask(
|
| + FROM_HERE, base::Bind(&PrinterCapsHandler::OnChildDied, this));
|
| }
|
| }
|
|
|
|
|