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

Unified Diff: chrome/service/cloud_print/printer_job_handler.cc

Issue 1907083002: Cloud Print Proxy: Delete print jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « chrome/service/cloud_print/printer_job_handler.h ('k') | chrome/service/service_utility_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/printer_job_handler.cc
diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc
index bbddff5801f5f9fdae4ce17b2f7fdbdc4d559c2b..66be390085cb49f9c2e85d13c28d18ee577005d7 100644
--- a/chrome/service/cloud_print/printer_job_handler.cc
+++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -246,7 +246,7 @@ void PrinterJobHandler::OnJobChanged() {
}
void PrinterJobHandler::OnJobSpoolSucceeded(const PlatformJobId& job_id) {
- DCHECK(base::MessageLoop::current() == print_thread_.message_loop());
+ DCHECK(CurrentlyOnPrintThread());
job_spooler_->AddRef();
print_thread_.message_loop()->ReleaseSoon(FROM_HERE, job_spooler_.get());
job_spooler_ = NULL;
@@ -255,7 +255,7 @@ void PrinterJobHandler::OnJobSpoolSucceeded(const PlatformJobId& job_id) {
}
void PrinterJobHandler::OnJobSpoolFailed() {
- DCHECK(base::MessageLoop::current() == print_thread_.message_loop());
+ DCHECK(CurrentlyOnPrintThread());
job_spooler_->AddRef();
print_thread_.message_loop()->ReleaseSoon(FROM_HERE, job_spooler_.get());
job_spooler_ = NULL;
@@ -780,17 +780,13 @@ void PrinterJobHandler::OnReceivePrinterCaps(
}
}
-// The following methods are called on |print_thread_|. It is not safe to
-// access any members other than |job_handler_task_runner_|,
-// |job_spooler_| and |print_system_|.
void PrinterJobHandler::DoPrint(const JobDetails& job_details,
const std::string& printer_name) {
+ DCHECK(CurrentlyOnPrintThread());
job_spooler_ = print_system_->CreateJobSpooler();
UMA_HISTOGRAM_LONG_TIMES("CloudPrint.PrepareTime",
base::Time::Now() - job_start_time_);
DCHECK(job_spooler_.get());
- if (!job_spooler_.get())
- return;
base::string16 document_name =
job_details.job_title_.empty()
@@ -815,4 +811,8 @@ void PrinterJobHandler::DoPrint(const JobDetails& job_details,
}
}
+bool PrinterJobHandler::CurrentlyOnPrintThread() const {
+ return base::MessageLoop::current() == print_thread_.message_loop();
+}
+
} // namespace cloud_print
« no previous file with comments | « chrome/service/cloud_print/printer_job_handler.h ('k') | chrome/service/service_utility_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698