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 #ifndef GIN_MODULES_MODULE_REGISTRY_H_ | 5 #ifndef GIN_MODULES_MODULE_REGISTRY_H_ |
6 #define GIN_MODULES_MODULE_REGISTRY_H_ | 6 #define GIN_MODULES_MODULE_REGISTRY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
| 13 #include <vector> |
13 | 14 |
14 #include "base/callback.h" | 15 #include "base/callback.h" |
15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/scoped_vector.h" | |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "gin/gin_export.h" | 19 #include "gin/gin_export.h" |
20 #include "v8/include/v8.h" | 20 #include "v8/include/v8.h" |
21 | 21 |
22 namespace gin { | 22 namespace gin { |
23 | 23 |
24 class ModuleRegistryObserver; | 24 class ModuleRegistryObserver; |
25 struct PendingModule; | 25 struct PendingModule; |
26 | 26 |
27 // This class implements the Asynchronous Module Definition (AMD) API. | 27 // This class implements the Asynchronous Module Definition (AMD) API. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 const std::set<std::string>& available_modules() const { | 71 const std::set<std::string>& available_modules() const { |
72 return available_modules_; | 72 return available_modules_; |
73 } | 73 } |
74 | 74 |
75 const std::set<std::string>& unsatisfied_dependencies() const { | 75 const std::set<std::string>& unsatisfied_dependencies() const { |
76 return unsatisfied_dependencies_; | 76 return unsatisfied_dependencies_; |
77 } | 77 } |
78 | 78 |
79 private: | 79 private: |
80 typedef ScopedVector<PendingModule> PendingModuleVector; | 80 typedef std::vector<std::unique_ptr<PendingModule>> PendingModuleVector; |
81 typedef std::multimap<std::string, LoadModuleCallback> LoadModuleCallbackMap; | 81 typedef std::multimap<std::string, LoadModuleCallback> LoadModuleCallbackMap; |
82 | 82 |
83 explicit ModuleRegistry(v8::Isolate* isolate); | 83 explicit ModuleRegistry(v8::Isolate* isolate); |
84 | 84 |
85 bool Load(v8::Isolate* isolate, std::unique_ptr<PendingModule> pending); | 85 bool Load(v8::Isolate* isolate, std::unique_ptr<PendingModule> pending); |
86 bool RegisterModule(v8::Isolate* isolate, | 86 bool RegisterModule(v8::Isolate* isolate, |
87 const std::string& id, | 87 const std::string& id, |
88 v8::Local<v8::Value> module); | 88 v8::Local<v8::Value> module); |
89 | 89 |
90 bool CheckDependencies(PendingModule* pending); | 90 bool CheckDependencies(PendingModule* pending); |
(...skipping 11 matching lines...) Expand all Loading... |
102 v8::Persistent<v8::Object> modules_; | 102 v8::Persistent<v8::Object> modules_; |
103 | 103 |
104 base::ObserverList<ModuleRegistryObserver> observer_list_; | 104 base::ObserverList<ModuleRegistryObserver> observer_list_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(ModuleRegistry); | 106 DISALLOW_COPY_AND_ASSIGN(ModuleRegistry); |
107 }; | 107 }; |
108 | 108 |
109 } // namespace gin | 109 } // namespace gin |
110 | 110 |
111 #endif // GIN_MODULES_MODULE_REGISTRY_H_ | 111 #endif // GIN_MODULES_MODULE_REGISTRY_H_ |
OLD | NEW |