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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 14757022: Add a non-blocking "OneShotEvent" class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename Latch to OneShotEvent Created 7 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: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 2cfc14495d5feff32ae24d9208049e49ab16d2bc..9b2c6ca2ef5c12db8c91f174674d8a8423d8bdf4 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -350,7 +350,6 @@ ExtensionService::ExtensionService(Profile* profile,
extensions_enabled_(extensions_enabled),
show_extensions_prompts_(true),
install_updates_when_idle_(true),
- ready_(false),
toolbar_model_(this),
menu_manager_(profile),
event_routers_initialized_(false),
@@ -562,7 +561,7 @@ const Extension* ExtensionService::GetExtensionById(
void ExtensionService::Init() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!ready_); // Can't redo init.
+ DCHECK(!is_ready()); // Can't redo init.
DCHECK_EQ(extensions_.size(), 0u);
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
@@ -585,12 +584,13 @@ void ExtensionService::Init() {
// import process.
extensions::InstalledLoader(this).LoadAllExtensions();
+ SetReadyAndNotifyListeners();
RegisterForImportFinished();
} else {
- // In this case, LoadAllExtensions() calls OnLoadedInstalledExtensions(),
- // which calls SetReadyAndNotifyListeners().
+ // In this case, LoadAllExtensions() calls OnLoadedInstalledExtensions().
component_loader_->LoadAll();
extensions::InstalledLoader(this).LoadAllExtensions();
+ SetReadyAndNotifyListeners();
// TODO(erikkay) this should probably be deferred to a future point
// rather than running immediately at startup.
@@ -1235,7 +1235,7 @@ extensions::ContentSettingsStore* ExtensionService::GetContentSettingsStore() {
}
bool ExtensionService::is_ready() {
- return ready_;
+ return system_->ready().is_signaled();
}
base::SequencedTaskRunner* ExtensionService::GetFileTaskRunner() {
@@ -1959,6 +1959,8 @@ void ExtensionService::ReloadExtensions() {
UnloadAllExtensions();
component_loader_->LoadAll();
extensions::InstalledLoader(this).LoadAllExtensions();
+ // Don't call SetReadyAndNotifyListeners() since tests call this multiple
+ // times.
}
void ExtensionService::GarbageCollectExtensions() {
@@ -2017,7 +2019,7 @@ void ExtensionService::SyncExtensionChangeIfNeeded(const Extension& extension) {
}
void ExtensionService::SetReadyAndNotifyListeners() {
- ready_ = true;
+ system_->ExtensionServiceReady();
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSIONS_READY,
content::Source<Profile>(profile_),
@@ -2029,8 +2031,6 @@ void ExtensionService::OnLoadedInstalledExtensions() {
updater_->Start();
OnBlacklistUpdated();
-
- SetReadyAndNotifyListeners();
}
void ExtensionService::AddExtension(const Extension* extension) {

Powered by Google App Engine
This is Rietveld 408576698