Chromium Code Reviews| Index: chrome/browser/chromeos/printing/cups_print_job_manager_impl.h |
| diff --git a/chrome/browser/chromeos/printing/cups_print_job_manager_impl.h b/chrome/browser/chromeos/printing/cups_print_job_manager_impl.h |
| index afd64c901063fbc04acce7ef4e7731903616b7f5..b062ea7fa3f7c234c60d0037786c6178afc56b6a 100644 |
| --- a/chrome/browser/chromeos/printing/cups_print_job_manager_impl.h |
| +++ b/chrome/browser/chromeos/printing/cups_print_job_manager_impl.h |
| @@ -12,6 +12,7 @@ |
| #include <vector> |
| #include "base/memory/weak_ptr.h" |
| +#include "base/synchronization/lock.h" |
| #include "chrome/browser/chromeos/printing/cups_print_job.h" |
| #include "chrome/browser/chromeos/printing/cups_print_job_manager.h" |
| #include "chrome/browser/chromeos/printing/printers_manager.h" |
| @@ -23,6 +24,11 @@ class Profile; |
| namespace chromeos { |
| +struct QueryResult { |
| + bool success; |
| + std::vector<::printing::QueueStatus> queues; |
| +}; |
| + |
| class CupsPrintJobManagerImpl : public CupsPrintJobManager, |
| public content::NotificationObserver { |
| public: |
| @@ -52,11 +58,14 @@ class CupsPrintJobManagerImpl : public CupsPrintJobManager, |
| // Schedule a query of CUPS for print job status with a delay of |delay|. |
| void ScheduleQuery(const base::TimeDelta& delay); |
| - // Query CUPS for print job status. |
| - void QueryCups(); |
| + // Schedule the CUPS query off the UI thread. |
| + void PostQuery(); |
| // Process jobs from CUPS and perform notifications. |
| - void UpdateJobs(const std::vector<::printing::CupsJob>& jobs); |
| + void UpdateJobs(const QueryResult& results); |
| + |
| + // Mark remaining jobs as errors and remove active jobs. |
| + void PurgeJobs(); |
| // Updates the state and performs the appropriate notifications. |
| void JobStateUpdated(CupsPrintJob* job, CupsPrintJob::State new_state); |
| @@ -67,6 +76,9 @@ class CupsPrintJobManagerImpl : public CupsPrintJobManager, |
| // Prevents multiple queries from being scheduled simultaneously. |
| bool in_query_ = false; |
| + // Records the number of consecutive times the GetJobs query has failed. |
| + int retry_count = 0; |
|
Carlson
2017/02/24 00:02:08
Missing trailing underscore?
skau
2017/02/28 00:59:58
Done.
|
| + |
| ::printing::CupsConnection cups_connection_; |
| content::NotificationRegistrar registrar_; |
| base::WeakPtrFactory<CupsPrintJobManagerImpl> weak_ptr_factory_; |