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

Unified Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc

Issue 23450022: Put a hard limit on initial policy fetch wait time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 3 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/chromeos/policy/user_cloud_policy_manager_chromeos.cc
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
index 6d51de5cfb6fef8003eb94d27980c29c335a4028..31b26a9200bc69284ebbdd30d5da05349edcc52b 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
@@ -27,12 +27,21 @@ namespace policy {
UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS(
scoped_ptr<CloudPolicyStore> store,
scoped_ptr<ResourceCache> resource_cache,
- bool wait_for_policy_fetch)
+ bool wait_for_policy_fetch,
+ base::TimeDelta initial_policy_fetch_timeout)
: CloudPolicyManager(
PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()),
store.get()),
store_(store.Pass()),
- wait_for_policy_fetch_(wait_for_policy_fetch) {
+ wait_for_policy_fetch_(wait_for_policy_fetch),
+ policy_fetch_timeout_(false, false) {
+ if (wait_for_policy_fetch_) {
+ policy_fetch_timeout_.Start(
+ FROM_HERE,
+ initial_policy_fetch_timeout,
+ base::Bind(&UserCloudPolicyManagerChromeOS::CancelWaitForPolicyFetch,
+ base::Unretained(this)));
+ }
if (resource_cache) {
// TODO(joaodasilva): Move the backend from the FILE thread to the blocking
// pool.
@@ -244,6 +253,9 @@ void UserCloudPolicyManagerChromeOS::OnInitialPolicyFetchComplete(
}
void UserCloudPolicyManagerChromeOS::CancelWaitForPolicyFetch() {
+ if (!wait_for_policy_fetch_)
+ return;
Andrew T Wilson (Slow) 2013/09/06 12:33:45 This is fine as-is. Alternatively, you could also
Mattias Nissler (ping if slow) 2013/09/06 13:37:30 This is better, there are already other code paths
+
wait_for_policy_fetch_ = false;
CheckAndPublishPolicy();
// Now that |wait_for_policy_fetch_| is guaranteed to be false, the scheduler

Powered by Google App Engine
This is Rietveld 408576698