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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 977673002: Additional tracing and histogram in Extensions startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 install_updates_when_idle_(true), 269 install_updates_when_idle_(true),
270 ready_(ready), 270 ready_(ready),
271 update_once_all_providers_are_ready_(false), 271 update_once_all_providers_are_ready_(false),
272 browser_terminating_(false), 272 browser_terminating_(false),
273 installs_delayed_for_gc_(false), 273 installs_delayed_for_gc_(false),
274 is_first_run_(false), 274 is_first_run_(false),
275 block_extensions_(false), 275 block_extensions_(false),
276 shared_module_service_(new extensions::SharedModuleService(profile_)), 276 shared_module_service_(new extensions::SharedModuleService(profile_)),
277 app_data_migrator_(new extensions::AppDataMigrator(profile_, registry_)) { 277 app_data_migrator_(new extensions::AppDataMigrator(profile_, registry_)) {
278 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 278 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
279 TRACE_EVENT0("browser,startup", "ExtensionService::ExtensionService::ctor");
279 280
280 // Figure out if extension installation should be enabled. 281 // Figure out if extension installation should be enabled.
281 if (extensions::ExtensionsBrowserClient::Get()->AreExtensionsDisabled( 282 if (extensions::ExtensionsBrowserClient::Get()->AreExtensionsDisabled(
282 *command_line, profile)) 283 *command_line, profile))
283 extensions_enabled_ = false; 284 extensions_enabled_ = false;
284 285
285 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, 286 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
286 content::NotificationService::AllBrowserContextsAndSources()); 287 content::NotificationService::AllBrowserContextsAndSources());
287 registrar_.Add(this, 288 registrar_.Add(this,
288 extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 289 extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
289 content::NotificationService::AllBrowserContextsAndSources()); 290 content::NotificationService::AllBrowserContextsAndSources());
290 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 291 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
291 content::NotificationService::AllBrowserContextsAndSources()); 292 content::NotificationService::AllBrowserContextsAndSources());
292 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 293 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
293 content::NotificationService::AllBrowserContextsAndSources()); 294 content::NotificationService::AllBrowserContextsAndSources());
294 registrar_.Add(this, 295 registrar_.Add(this,
295 chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 296 chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
296 content::Source<Profile>(profile_)); 297 content::Source<Profile>(profile_));
297 298
298 extensions::ExtensionManagementFactory::GetForBrowserContext(profile_) 299 extensions::ExtensionManagementFactory::GetForBrowserContext(profile_)
299 ->AddObserver(this); 300 ->AddObserver(this);
300 301
301 // Set up the ExtensionUpdater 302 // Set up the ExtensionUpdater.
302 if (autoupdate_enabled) { 303 if (autoupdate_enabled) {
303 int update_frequency = extensions::kDefaultUpdateFrequencySeconds; 304 int update_frequency = extensions::kDefaultUpdateFrequencySeconds;
304 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { 305 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) {
305 base::StringToInt(command_line->GetSwitchValueASCII( 306 base::StringToInt(command_line->GetSwitchValueASCII(
306 switches::kExtensionsUpdateFrequency), 307 switches::kExtensionsUpdateFrequency),
307 &update_frequency); 308 &update_frequency);
308 } 309 }
309 updater_.reset(new extensions::ExtensionUpdater( 310 updater_.reset(new extensions::ExtensionUpdater(
310 this, 311 this,
311 extension_prefs, 312 extension_prefs,
(...skipping 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 } 2557 }
2557 2558
2558 void ExtensionService::OnProfileDestructionStarted() { 2559 void ExtensionService::OnProfileDestructionStarted() {
2559 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2560 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2560 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2561 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2561 it != ids_to_unload.end(); 2562 it != ids_to_unload.end();
2562 ++it) { 2563 ++it) {
2563 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2564 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2564 } 2565 }
2565 } 2566 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698