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

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

Issue 1920793005: Merge to M51: Cloud Print Proxy: Delete print jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
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 8aa85e2bf7c373f233f80913f0cfd3fc1eb53e70..4f4c3364f52e96d96c65ac23c360e716785082b4 100644
--- a/chrome/service/cloud_print/printer_job_handler.cc
+++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -249,7 +249,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;
@@ -258,7 +258,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;
@@ -784,17 +784,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()
@@ -819,4 +815,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