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

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

Issue 1928013004: Add delayed retry to DeviceManagementService requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit: punctuation Created 4 years, 7 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: components/policy/core/common/cloud/device_management_service.h
diff --git a/components/policy/core/common/cloud/device_management_service.h b/components/policy/core/common/cloud/device_management_service.h
index cbec90ffc21c950e5b7fe77584a54182a1a3f0ea..623245e4c8507cc3a725a8f0dade902aba6b8235 100644
--- a/components/policy/core/common/cloud/device_management_service.h
+++ b/components/policy/core/common/cloud/device_management_service.h
@@ -19,6 +19,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_split.h"
+#include "base/threading/thread_checker.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/policy_export.h"
#include "net/url_request/url_fetcher_delegate.h"
@@ -155,6 +156,10 @@ class POLICY_EXPORT DeviceManagementService : public net::URLFetcherDelegate {
// Gets the URL that the DMServer requests are sent to.
std::string GetServerUrl();
+ // Sets the retry delay to a shorter time to prevent browser tests from
+ // timing out.
+ static void SetRetryDelayForTesting(long retryDelayMs);
+
private:
typedef std::map<const net::URLFetcher*,
DeviceManagementRequestJobImpl*> JobFetcherMap;
@@ -193,7 +198,12 @@ class POLICY_EXPORT DeviceManagementService : public net::URLFetcherDelegate {
// If it is not initialized, incoming requests are queued.
bool initialized_;
- // Used to create tasks to run |Initialize| delayed on the UI thread.
+ // TaskRunner used to schedule retry attempts.
+ const scoped_refptr<base::SequencedTaskRunner> task_runner_;
+
+ base::ThreadChecker thread_checker_;
+
+ // Used to create tasks which run delayed on the UI thread.
base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DeviceManagementService);

Powered by Google App Engine
This is Rietveld 408576698