| OLD | NEW |
| 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 "extensions/common/manifest_handler.h" | 5 #include "extensions/common/manifest_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 14 #include "extensions/common/permissions/manifest_permission.h" | 14 #include "extensions/common/permissions/manifest_permission.h" |
| 15 #include "extensions/common/permissions/manifest_permission_set.h" | 15 #include "extensions/common/permissions/manifest_permission_set.h" |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 static base::LazyInstance<ManifestHandlerRegistry> g_registry = | 21 static base::LazyInstance<ManifestHandlerRegistry>::DestructorAtExit |
| 22 LAZY_INSTANCE_INITIALIZER; | 22 g_registry = LAZY_INSTANCE_INITIALIZER; |
| 23 static ManifestHandlerRegistry* g_registry_override = NULL; | 23 static ManifestHandlerRegistry* g_registry_override = NULL; |
| 24 | 24 |
| 25 ManifestHandlerRegistry* GetRegistry() { | 25 ManifestHandlerRegistry* GetRegistry() { |
| 26 if (!g_registry_override) | 26 if (!g_registry_override) |
| 27 return g_registry.Pointer(); | 27 return g_registry.Pointer(); |
| 28 return g_registry_override; | 28 return g_registry_override; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 unsorted_handlers.swap(next_unsorted_handlers); | 243 unsorted_handlers.swap(next_unsorted_handlers); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // If there are any leftover unsorted handlers, they must have had | 246 // If there are any leftover unsorted handlers, they must have had |
| 247 // circular dependencies. | 247 // circular dependencies. |
| 248 CHECK_EQ(unsorted_handlers.size(), std::set<ManifestHandler*>::size_type(0)) | 248 CHECK_EQ(unsorted_handlers.size(), std::set<ManifestHandler*>::size_type(0)) |
| 249 << "Extension manifest handlers have circular dependencies!"; | 249 << "Extension manifest handlers have circular dependencies!"; |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace extensions | 252 } // namespace extensions |
| OLD | NEW |