| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile_dependency_manager.h" | 5 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 | 10 |
| 11 #include "chrome/browser/background/background_contents_service_factory.h" | 11 #include "chrome/browser/background/background_contents_service_factory.h" |
| 12 #include "chrome/browser/plugin_prefs.h" | |
| 13 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 12 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 14 #include "chrome/browser/profiles/profile_keyed_service.h" | 13 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 15 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 14 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
| 16 #include "chrome/browser/search_engines/template_url_service_factory.h" | 15 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 17 #include "chrome/browser/sessions/session_service_factory.h" | 16 #include "chrome/browser/sessions/session_service_factory.h" |
| 18 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 17 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 19 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
| 20 | 19 |
| 21 class Profile; | 20 class Profile; |
| 22 | 21 |
| 23 namespace { | 22 namespace { |
| 24 | 23 |
| 25 bool g_initialized = false; | 24 bool g_initialized = false; |
| 26 | 25 |
| 27 // This method gets the instance of each ServiceFactory. We do this so that | 26 // This method gets the instance of each ServiceFactory. We do this so that |
| 28 // each ServiceFactory initializes iteslf and registers its dependencies with | 27 // each ServiceFactory initializes iteslf and registers its dependencies with |
| 29 // the global PreferenceDependencyManager. We need to have a complete | 28 // the global PreferenceDependencyManager. We need to have a complete |
| 30 // dependency graph when we create a profile so we can dispatch the profile | 29 // dependency graph when we create a profile so we can dispatch the profile |
| 31 // creation message to the services that want to create their services at | 30 // creation message to the services that want to create their services at |
| 32 // profile creation time. | 31 // profile creation time. |
| 33 // | 32 // |
| 34 // TODO(erg): This needs to be something else. I don't think putting every | 33 // TODO(erg): This needs to be something else. I don't think putting every |
| 35 // FooServiceFactory here will scale or is desireable long term. | 34 // FooServiceFactory here will scale or is desireable long term. |
| 36 void AssertFactoriesBuilt() { | 35 void AssertFactoriesBuilt() { |
| 37 if (!g_initialized) { | 36 if (!g_initialized) { |
| 38 BackgroundContentsServiceFactory::GetInstance(); | 37 BackgroundContentsServiceFactory::GetInstance(); |
| 39 CloudPrintProxyServiceFactory::GetInstance(); | 38 CloudPrintProxyServiceFactory::GetInstance(); |
| 40 PluginPrefs::Initialize(); | |
| 41 SessionServiceFactory::GetInstance(); | 39 SessionServiceFactory::GetInstance(); |
| 42 TabRestoreServiceFactory::GetInstance(); | 40 TabRestoreServiceFactory::GetInstance(); |
| 43 TemplateURLServiceFactory::GetInstance(); | 41 TemplateURLServiceFactory::GetInstance(); |
| 44 | 42 |
| 45 g_initialized = true; | 43 g_initialized = true; |
| 46 } | 44 } |
| 47 } | 45 } |
| 48 | 46 |
| 49 } // namespace | 47 } // namespace |
| 50 | 48 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 189 } |
| 192 } | 190 } |
| 193 | 191 |
| 194 if (edges.size()) { | 192 if (edges.size()) { |
| 195 NOTREACHED() << "Dependency graph has a cycle. We are doomed."; | 193 NOTREACHED() << "Dependency graph has a cycle. We are doomed."; |
| 196 } | 194 } |
| 197 | 195 |
| 198 std::reverse(output.begin(), output.end()); | 196 std::reverse(output.begin(), output.end()); |
| 199 destruction_order_ = output; | 197 destruction_order_ = output; |
| 200 } | 198 } |
| OLD | NEW |