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

Side by Side Diff: extensions/browser/process_manager.cc

Issue 959513002: Refactor Extension initialization logic. Add tracing and additional histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: yoz comments Created 5 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/installed_loader.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "extensions/browser/process_manager.h" 5 #include "extensions/browser/process_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 746
747 // static 747 // static
748 void ProcessManager::SetEventPageSuspendingTimeForTesting( 748 void ProcessManager::SetEventPageSuspendingTimeForTesting(
749 unsigned suspending_time_msec) { 749 unsigned suspending_time_msec) {
750 g_event_page_suspending_time_msec = suspending_time_msec; 750 g_event_page_suspending_time_msec = suspending_time_msec;
751 } 751 }
752 752
753 void ProcessManager::Observe(int type, 753 void ProcessManager::Observe(int type,
754 const content::NotificationSource& source, 754 const content::NotificationSource& source,
755 const content::NotificationDetails& details) { 755 const content::NotificationDetails& details) {
756 TRACE_EVENT0("browser,startup", "ProcessManager::Observe");
756 switch (type) { 757 switch (type) {
757 case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: { 758 case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED: {
758 // TODO(jamescook): Convert this to use ExtensionSystem::ready() instead 759 // TODO(jamescook): Convert this to use ExtensionSystem::ready() instead
759 // of a notification. 760 // of a notification.
760 const base::TimeTicks start_time = base::TimeTicks::Now(); 761 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.ProcessManagerStartupHostsTime");
761 MaybeCreateStartupBackgroundHosts(); 762 MaybeCreateStartupBackgroundHosts();
762 UMA_HISTOGRAM_TIMES("Extensions.ProcessManagerStartupHostsTime",
763 base::TimeTicks::Now() - start_time);
764 break; 763 break;
765 } 764 }
766 765
767 case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { 766 case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
768 BrowserContext* context = content::Source<BrowserContext>(source).ptr(); 767 BrowserContext* context = content::Source<BrowserContext>(source).ptr();
769 ExtensionSystem* system = ExtensionSystem::Get(context); 768 ExtensionSystem* system = ExtensionSystem::Get(context);
770 if (system->ready().is_signaled()) { 769 if (system->ready().is_signaled()) {
771 // The extension system is ready, so create the background host. 770 // The extension system is ready, so create the background host.
772 const Extension* extension = 771 const Extension* extension =
773 content::Details<const Extension>(details).ptr(); 772 content::Details<const Extension>(details).ptr();
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 if (extension && !IncognitoInfo::IsSplitMode(extension)) { 1036 if (extension && !IncognitoInfo::IsSplitMode(extension)) {
1038 BrowserContext* original_context = 1037 BrowserContext* original_context =
1039 ExtensionsBrowserClient::Get()->GetOriginalContext(GetBrowserContext()); 1038 ExtensionsBrowserClient::Get()->GetOriginalContext(GetBrowserContext());
1040 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url); 1039 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url);
1041 } 1040 }
1042 1041
1043 return ProcessManager::GetSiteInstanceForURL(url); 1042 return ProcessManager::GetSiteInstanceForURL(url);
1044 } 1043 }
1045 1044
1046 } // namespace extensions 1045 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/installed_loader.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698