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

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc

Issue 2389763003: arc: Fix race when arc package sync service starts. (Closed)
Patch Set: Add Check in case ArcAppListPrefs gets deleted early. Created 4 years, 2 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/ui/app_list/arc/arc_app_list_prefs.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
index b86400a65d6f48420e2ca720407d9504d8bd7cda..708dd83372fb2bbe16e4c48e13de0ddc45dbb1ab 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
@@ -666,6 +666,7 @@ void ArcAppListPrefs::OnInstanceClosed() {
}
is_initialized_ = false;
+ package_list_initial_refreshed_ = false;
}
void ArcAppListPrefs::MaybeAddNonLaunchableApp(const std::string& name,
@@ -1132,12 +1133,13 @@ void ArcAppListPrefs::OnPackageListRefreshed(
RemovePackageFromPrefs(prefs_, package_name);
}
- // Start ArcPackageSyncService ASAP. This is the call_back of
- // app_instance->RefreshAppList() in OnInstanceReady(). SyncStarted() should
- // only be called after packagelist refresh is completed. SyncStarted() is
- // no-op after first time setup or if sync is disabled.
- DCHECK(sync_service_);
- sync_service_->SyncStarted();
+ // TODO(lgcheng@) File http://b/31944261. Remove the flag after Android side
+ // cleanup.
+ if (package_list_initial_refreshed_)
+ return;
+
+ package_list_initial_refreshed_ = true;
+ FOR_EACH_OBSERVER(Observer, observer_list_, OnPackageListInitialRefreshed());
}
std::vector<std::string> ArcAppListPrefs::GetPackagesFromPrefs() const {

Powered by Google App Engine
This is Rietveld 408576698