| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 std::set<int> process_ids; | 711 std::set<int> process_ids; |
| 712 size_t max_process_count = | 712 size_t max_process_count = |
| 713 content::RenderProcessHost::GetMaxRendererProcessCount(); | 713 content::RenderProcessHost::GetMaxRendererProcessCount(); |
| 714 | 714 |
| 715 // Go through all profiles to ensure we have total count of extension | 715 // Go through all profiles to ensure we have total count of extension |
| 716 // processes containing background pages, otherwise one profile can | 716 // processes containing background pages, otherwise one profile can |
| 717 // starve the other. | 717 // starve the other. |
| 718 std::vector<Profile*> profiles = g_browser_process->profile_manager()-> | 718 std::vector<Profile*> profiles = g_browser_process->profile_manager()-> |
| 719 GetLoadedProfiles(); | 719 GetLoadedProfiles(); |
| 720 for (size_t i = 0; i < profiles.size(); ++i) { | 720 for (size_t i = 0; i < profiles.size(); ++i) { |
| 721 ExtensionProcessManager* epm = profiles[i]->GetExtensionProcessManager(); | 721 ExtensionProcessManager* epm = |
| 722 extensions::ExtensionSystem::Get(profiles[i])->process_manager(); |
| 722 for (ExtensionProcessManager::const_iterator iter = | 723 for (ExtensionProcessManager::const_iterator iter = |
| 723 epm->background_hosts().begin(); | 724 epm->background_hosts().begin(); |
| 724 iter != epm->background_hosts().end(); ++iter) { | 725 iter != epm->background_hosts().end(); ++iter) { |
| 725 const extensions::ExtensionHost* host = *iter; | 726 const extensions::ExtensionHost* host = *iter; |
| 726 process_ids.insert(host->render_process_host()->GetID()); | 727 process_ids.insert(host->render_process_host()->GetID()); |
| 727 } | 728 } |
| 728 } | 729 } |
| 729 | 730 |
| 730 if (process_ids.size() > | 731 if (process_ids.size() > |
| 731 (max_process_count * chrome::kMaxShareOfExtensionProcesses)) { | 732 (max_process_count * chrome::kMaxShareOfExtensionProcesses)) { |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 partition_id = extension->id(); | 1854 partition_id = extension->id(); |
| 1854 } | 1855 } |
| 1855 | 1856 |
| 1856 // Enforce that IsValidStoragePartitionId() implementation stays in sync. | 1857 // Enforce that IsValidStoragePartitionId() implementation stays in sync. |
| 1857 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); | 1858 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); |
| 1858 return partition_id; | 1859 return partition_id; |
| 1859 } | 1860 } |
| 1860 | 1861 |
| 1861 | 1862 |
| 1862 } // namespace chrome | 1863 } // namespace chrome |
| OLD | NEW |