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

Unified Diff: chrome/browser/chromeos/settings/device_settings_service.cc

Issue 2714493002: Load DeviceLocalAccount policy and DeviceSettings immediately on restore after Chrome crash. (Closed)
Patch Set: add flag to correctly process LoadImmediately() call Created 3 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
Index: chrome/browser/chromeos/settings/device_settings_service.cc
diff --git a/chrome/browser/chromeos/settings/device_settings_service.cc b/chrome/browser/chromeos/settings/device_settings_service.cc
index 73cd7567a3d06791ed78d67452bd804b6ba75897..cdabe1075b575c92d890f73349170fe678bd5399 100644
--- a/chrome/browser/chromeos/settings/device_settings_service.cc
+++ b/chrome/browser/chromeos/settings/device_settings_service.cc
@@ -129,6 +129,16 @@ void DeviceSettingsService::Load() {
EnqueueLoad(false);
}
+void DeviceSettingsService::LoadImmediately() {
+ loading_immediately_ = true;
Andrew T Wilson (Slow) 2017/02/23 12:05:48 Can we get rid of this data member and instead pas
Sergey Poromov 2017/02/28 14:01:17 Done.
+ std::unique_ptr<SessionManagerOperation> operation(new LoadSettingsOperation(
emaxx 2017/02/22 17:24:33 Should the same check for "device_mode_ == policy:
Sergey Poromov 2017/02/28 14:01:17 Expect so, but needs review from tnagel@ for Activ
emaxx 2017/02/28 14:31:31 Yes, please ask Thiemo to pay special attention to
Thiemo Nagel 2017/02/28 15:41:05 Yes!
+ true /*force_key_load*/, true /*cloud_validations*/,
+ true /*force_immediate_load*/,
+ base::Bind(&DeviceSettingsService::HandleCompletedOperation,
+ weak_factory_.GetWeakPtr(), base::Closure())));
+ operation->Start(session_manager_client_, owner_key_util_, public_key_);
+}
+
void DeviceSettingsService::Store(
std::unique_ptr<em::PolicyFetchResponse> policy,
const base::Closure& callback) {
@@ -233,7 +243,7 @@ void DeviceSettingsService::EnqueueLoad(bool request_key_load) {
cloud_validations = false;
}
linked_ptr<SessionManagerOperation> operation(new LoadSettingsOperation(
- request_key_load, cloud_validations,
+ request_key_load, cloud_validations, false /*force_immediate_load*/,
Thiemo Nagel 2017/02/28 15:41:05 Nit: pls add blanks: /* force_immediate_load */
base::Bind(&DeviceSettingsService::HandleCompletedOperation,
weak_factory_.GetWeakPtr(), base::Closure())));
Enqueue(operation);
@@ -258,7 +268,8 @@ void DeviceSettingsService::HandleCompletedOperation(
const base::Closure& callback,
SessionManagerOperation* operation,
Status status) {
- DCHECK_EQ(operation, pending_operations_.front().get());
+ if (!loading_immediately_)
+ DCHECK_EQ(operation, pending_operations_.front().get());
store_status_ = status;
if (status == STORE_SUCCESS) {
@@ -299,11 +310,14 @@ void DeviceSettingsService::HandleCompletedOperation(
if (!callback.is_null())
callback.Run();
- // Only remove the pending operation here, so new operations triggered by any
- // of the callbacks above are queued up properly.
- pending_operations_.pop_front();
+ if (!loading_immediately_) {
emaxx 2017/02/22 17:24:33 Could we have a separate method for the async oper
Andrew T Wilson (Slow) 2017/02/23 12:05:48 Yes, I'd either do this, or else bind a boolean in
Sergey Poromov 2017/02/28 14:01:17 Done.
Sergey Poromov 2017/02/28 14:01:17 Done.
+ // Only remove the pending operation here, so new operations triggered by
+ // any of the callbacks above are queued up properly.
+ pending_operations_.pop_front();
- StartNextOperation();
+ StartNextOperation();
+ }
+ loading_immediately_ = false;
}
void DeviceSettingsService::HandleError(Status status,

Powered by Google App Engine
This is Rietveld 408576698