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

Side by Side Diff: chrome/service/cloud_print/printer_job_handler.cc

Issue 2083363002: Remove calls to deprecated MessageLoop methods in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/service/cloud_print/printer_job_handler.h" 5 #include "chrome/service/cloud_print/printer_job_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/md5.h" 12 #include "base/md5.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
18 #include "base/values.h" 19 #include "base/values.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "chrome/common/cloud_print/cloud_print_constants.h" 21 #include "chrome/common/cloud_print/cloud_print_constants.h"
21 #include "chrome/common/cloud_print/cloud_print_helpers.h" 22 #include "chrome/common/cloud_print/cloud_print_helpers.h"
22 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
23 #include "chrome/service/cloud_print/cloud_print_service_helpers.h" 24 #include "chrome/service/cloud_print/cloud_print_service_helpers.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // and have them check for updates. 241 // and have them check for updates.
241 for (const auto& it : job_status_updater_list_) { 242 for (const auto& it : job_status_updater_list_) {
242 base::ThreadTaskRunnerHandle::Get()->PostTask( 243 base::ThreadTaskRunnerHandle::Get()->PostTask(
243 FROM_HERE, base::Bind(&JobStatusUpdater::UpdateStatus, it.get())); 244 FROM_HERE, base::Bind(&JobStatusUpdater::UpdateStatus, it.get()));
244 } 245 }
245 } 246 }
246 247
247 void PrinterJobHandler::OnJobSpoolSucceeded(const PlatformJobId& job_id) { 248 void PrinterJobHandler::OnJobSpoolSucceeded(const PlatformJobId& job_id) {
248 DCHECK(CurrentlyOnPrintThread()); 249 DCHECK(CurrentlyOnPrintThread());
249 job_spooler_->AddRef(); 250 job_spooler_->AddRef();
250 print_thread_.message_loop()->ReleaseSoon(FROM_HERE, job_spooler_.get()); 251 print_thread_.task_runner()->ReleaseSoon(FROM_HERE, job_spooler_.get());
251 job_spooler_ = NULL; 252 job_spooler_ = NULL;
252 job_handler_task_runner_->PostTask( 253 job_handler_task_runner_->PostTask(
253 FROM_HERE, base::Bind(&PrinterJobHandler::JobSpooled, this, job_id)); 254 FROM_HERE, base::Bind(&PrinterJobHandler::JobSpooled, this, job_id));
254 } 255 }
255 256
256 void PrinterJobHandler::OnJobSpoolFailed() { 257 void PrinterJobHandler::OnJobSpoolFailed() {
257 DCHECK(CurrentlyOnPrintThread()); 258 DCHECK(CurrentlyOnPrintThread());
258 job_spooler_->AddRef(); 259 job_spooler_->AddRef();
259 print_thread_.message_loop()->ReleaseSoon(FROM_HERE, job_spooler_.get()); 260 print_thread_.task_runner()->ReleaseSoon(FROM_HERE, job_spooler_.get());
260 job_spooler_ = NULL; 261 job_spooler_ = NULL;
261 VLOG(1) << "CP_CONNECTOR: Job failed (spool failed)"; 262 VLOG(1) << "CP_CONNECTOR: Job failed (spool failed)";
262 job_handler_task_runner_->PostTask( 263 job_handler_task_runner_->PostTask(
263 FROM_HERE, base::Bind(&PrinterJobHandler::JobFailed, this, JOB_FAILED)); 264 FROM_HERE, base::Bind(&PrinterJobHandler::JobFailed, this, JOB_FAILED));
264 } 265 }
265 266
266 // static 267 // static
267 void PrinterJobHandler::ReportsStats() { 268 void PrinterJobHandler::ReportsStats() {
268 base::subtle::Atomic32 started = 269 base::subtle::Atomic32 started =
269 base::subtle::NoBarrier_AtomicExchange(&g_total_jobs_started, 0); 270 base::subtle::NoBarrier_AtomicExchange(&g_total_jobs_started, 0);
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 this)) { 809 this)) {
809 OnJobSpoolFailed(); 810 OnJobSpoolFailed();
810 } 811 }
811 } 812 }
812 813
813 bool PrinterJobHandler::CurrentlyOnPrintThread() const { 814 bool PrinterJobHandler::CurrentlyOnPrintThread() const {
814 return base::MessageLoop::current() == print_thread_.message_loop(); 815 return base::MessageLoop::current() == print_thread_.message_loop();
815 } 816 }
816 817
817 } // namespace cloud_print 818 } // namespace cloud_print
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698