OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |