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

Unified Diff: chrome/browser/policy/cloud/component_cloud_policy_updater.h

Issue 13792003: Switch ComponentCloudPolicyUpdater to ExternalPolicyDataUpdater backend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
Index: chrome/browser/policy/cloud/component_cloud_policy_updater.h
diff --git a/chrome/browser/policy/cloud/component_cloud_policy_updater.h b/chrome/browser/policy/cloud/component_cloud_policy_updater.h
index ba9ec850945cb77e4668ef91e51ea4bec094d5de..061b25c13faf479ff3b38e892311eaa8ba9b0a93 100644
--- a/chrome/browser/policy/cloud/component_cloud_policy_updater.h
+++ b/chrome/browser/policy/cloud/component_cloud_policy_updater.h
@@ -5,15 +5,10 @@
#ifndef CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_UPDATER_H_
#define CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_UPDATER_H_
-#include <map>
-#include <queue>
-
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/non_thread_safe.h"
-#include "chrome/browser/policy/policy_service.h"
+#include "chrome/browser/policy/cloud/external_policy_data_updater.h"
namespace base {
class SequencedTaskRunner;
@@ -36,7 +31,7 @@ class ComponentCloudPolicyStore;
// them in a ComponentCloudPolicyStore. It also enforces size limits on what's
// cached.
// It retries to download the policy data periodically when a download fails.
-class ComponentCloudPolicyUpdater : public base::NonThreadSafe {
+class ComponentCloudPolicyUpdater {
public:
// |task_runner| must support file I/O, and is used to post delayed retry
// tasks.
@@ -47,7 +42,6 @@ class ComponentCloudPolicyUpdater : public base::NonThreadSafe {
scoped_refptr<base::SequencedTaskRunner> task_runner,
scoped_refptr<net::URLRequestContextGetter> request_context,
ComponentCloudPolicyStore* store);
- ~ComponentCloudPolicyUpdater();
Joao da Silva 2013/04/08 14:49:40 Please leave this, even if the impl is empty.
bartfab (slow) 2013/04/08 15:32:12 Done.
// |response| is the latest policy information fetched for some component.
// This method schedules the download of the policy data, if |response| is
@@ -57,40 +51,8 @@ class ComponentCloudPolicyUpdater : public base::NonThreadSafe {
scoped_ptr<enterprise_management::PolicyFetchResponse> response);
private:
- class FetchJob;
- typedef std::map<PolicyNamespace, FetchJob*> FetchJobMap;
-
- // Starts |job| if the job queue is empty, otherwise schedules it.
- void ScheduleJob(FetchJob* job);
-
- // Appends |job| to the |job_queue_|, and starts it immediately if it's the
- // only scheduled job.
- void StartNextJob();
-
- // Callback for jobs that succeeded.
- void OnJobSucceeded(FetchJob* job);
-
- // Callback for jobs that failed.
- void OnJobFailed(FetchJob* job);
-
- scoped_refptr<base::SequencedTaskRunner> task_runner_;
- scoped_refptr<net::URLRequestContextGetter> request_context_;
ComponentCloudPolicyStore* store_;
-
- // Map of jobs that have been scheduled and haven't succeeded yet. Failing
- // jobs stay in |fetch_jobs_|, and may have retries scheduled in the future.
- // This map owns all the currently existing jobs.
- FetchJobMap fetch_jobs_;
-
- // Queue of jobs to start as soon as possible. Each job starts once the
- // previous job completes, to avoid starting too many downloads in parallel
- // at once. The job at the front of the queue is the currently executing
- // job, and will call OnJobSucceeded or OnJobFailed.
- std::queue<base::WeakPtr<FetchJob> > job_queue_;
-
- // True once the destructor enters. Prevents jobs from being scheduled during
- // shutdown.
- bool shutting_down_;
+ ExternalPolicyDataUpdater external_policy_data_updater_;
DISALLOW_COPY_AND_ASSIGN(ComponentCloudPolicyUpdater);
};

Powered by Google App Engine
This is Rietveld 408576698