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

Unified Diff: components/policy/core/common/cloud/cloud_policy_client.h

Issue 885653007: Modify CloudPolicyClient to support multiple concurrent requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More review feedback Created 5 years, 10 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 | « no previous file | components/policy/core/common/cloud/cloud_policy_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/cloud/cloud_policy_client.h
diff --git a/components/policy/core/common/cloud/cloud_policy_client.h b/components/policy/core/common/cloud/cloud_policy_client.h
index 3cb846808cf518f97ce52a498e632c3dfd1d17d1..4fefa864743c5f32ba3a94d1219c20c9f4d4bb97 100644
--- a/components/policy/core/common/cloud/cloud_policy_client.h
+++ b/components/policy/core/common/cloud/cloud_policy_client.h
@@ -14,6 +14,7 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
@@ -216,6 +217,9 @@ class POLICY_EXPORT CloudPolicyClient {
scoped_refptr<net::URLRequestContextGetter> GetRequestContext();
+ // Returns the number of active requests.
+ int GetActiveRequestCountForTest() const;
+
protected:
// A set of (policy type, settings entity ID) pairs to fetch.
typedef std::set<std::pair<std::string, std::string>> PolicyTypeSet;
@@ -249,6 +253,7 @@ class POLICY_EXPORT CloudPolicyClient {
// Callback for certificate upload requests.
void OnCertificateUploadCompleted(
+ const DeviceManagementRequestJob* job,
const StatusCallback& callback,
DeviceManagementStatus status,
int net_error,
@@ -256,11 +261,15 @@ class POLICY_EXPORT CloudPolicyClient {
// Callback for status upload requests.
void OnStatusUploadCompleted(
+ const DeviceManagementRequestJob* job,
const StatusCallback& callback,
DeviceManagementStatus status,
int net_error,
const enterprise_management::DeviceManagementResponse& response);
+ // Helper to remove a job from request_jobs_.
+ void RemoveJob(const DeviceManagementRequestJob* job);
+
// Observer notification helpers.
void NotifyPolicyFetched();
void NotifyRegistrationStateChanged();
@@ -293,7 +302,14 @@ class POLICY_EXPORT CloudPolicyClient {
// Used for issuing requests to the cloud.
DeviceManagementService* service_;
- scoped_ptr<DeviceManagementRequestJob> request_job_;
+
+ // Only one outstanding policy fetch is allowed, so this is tracked in
+ // its own member variable.
+ scoped_ptr<DeviceManagementRequestJob> policy_fetch_request_job_;
+
+ // All of the outstanding non-policy-fetch request jobs. These jobs are
+ // silently cancelled if Unregister() is called.
+ ScopedVector<DeviceManagementRequestJob> request_jobs_;
// The policy responses returned by the last policy fetch operation.
ResponseMap responses_;
« no previous file with comments | « no previous file | components/policy/core/common/cloud/cloud_policy_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698