Chromium Code Reviews| Index: gin/modules/module_registry.h |
| diff --git a/gin/modules/module_registry.h b/gin/modules/module_registry.h |
| index 96ea1496f2396cf7505f643e999e5fdbd0cbc143..fb63d03024cc59e1311734c613ca9c392f971da1 100644 |
| --- a/gin/modules/module_registry.h |
| +++ b/gin/modules/module_registry.h |
| @@ -6,8 +6,10 @@ |
| #define GIN_MODULES_MODULE_REGISTRY_H_ |
| #include <list> |
| +#include <set> |
| #include <string> |
| #include "base/compiler_specific.h" |
|
jochen (gone - plz use gerrit)
2013/11/18 12:46:05
nit empty line before this line
abarth-chromium
2013/11/18 15:33:06
Done.
|
| +#include "base/memory/scoped_ptr.h" |
| #include "gin/per_context_data.h" |
| namespace gin { |
| @@ -39,24 +41,42 @@ class ModuleRegistry : public ContextSupplement { |
| const std::string& id, |
| v8::Handle<v8::ObjectTemplate> templ); |
| - // Takes ownership of |pending|. The caller must have already entered |
| - // our context. |
| - void AddPendingModule(v8::Isolate* isolate, PendingModule* pending); |
| + // The caller must have already entered our context. |
| + void AddPendingModule(v8::Isolate* isolate, |
| + scoped_ptr<PendingModule> pending); |
| + |
| + // The caller must have already entered our context. |
| + void AttemptToLoadMoreModules(v8::Isolate* isolate); |
| + |
| + const std::set<std::string>& available_modules() const { |
| + return available_modules_; |
| + } |
| + |
| + const std::set<std::string>& unsatisfied_dependencies() const { |
| + return unsatisfied_dependencies_; |
| + } |
| private: |
| - typedef std::list<PendingModule*> PendingModuleList; // Owning reference. |
| + typedef ScopedVector<PendingModule> PendingModuleVector; |
| explicit ModuleRegistry(v8::Isolate* isolate); |
| // From ContextSupplement: |
| virtual void Detach(v8::Handle<v8::Context> context) OVERRIDE; |
| - // Takes ownership of |pending|. |
| - bool AttemptToLoad(v8::Isolate* isolate, PendingModule* pending); |
| - void AttemptToLoadPendingModules(v8::Isolate* isolate); |
| + void Load(v8::Isolate* isolate, scoped_ptr<PendingModule> pending); |
| + void RegisterModule(v8::Isolate* isolate, |
| + const std::string& id, |
| + v8::Handle<v8::Value> module); |
| + |
| + bool CheckDependencies(PendingModule* pending); |
| + bool AttemptToLoad(v8::Isolate* isolate, scoped_ptr<PendingModule> pending); |
| + |
| + std::set<std::string> available_modules_; |
| + std::set<std::string> unsatisfied_dependencies_; |
| + PendingModuleVector pending_modules_; |
| v8::Persistent<v8::Object> modules_; |
| - PendingModuleList pending_modules_; |
| DISALLOW_COPY_AND_ASSIGN(ModuleRegistry); |
| }; |