Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Unified Diff: gin/modules/module_registry.h

Issue 74753002: Introduce gin_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more header nits Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gin/modules/file_module_provider.cc ('k') | gin/modules/module_registry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/modules/module_registry.h
diff --git a/gin/modules/module_registry.h b/gin/modules/module_registry.h
index 7cff355963725107010cdf99994ed8e85ec32bd6..a7732c8091854261dcda24501b0362514cfb3ac8 100644
--- a/gin/modules/module_registry.h
+++ b/gin/modules/module_registry.h
@@ -6,8 +6,11 @@
#define GIN_MODULES_MODULE_REGISTRY_H_
#include <list>
+#include <set>
#include <string>
+
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "gin/per_context_data.h"
namespace gin {
@@ -27,6 +30,8 @@ struct PendingModule;
//
class ModuleRegistry : public ContextSupplement {
public:
+ virtual ~ModuleRegistry();
+
static ModuleRegistry* From(v8::Handle<v8::Context> context);
static void RegisterGlobals(v8::Isolate* isolate,
@@ -37,25 +42,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);
- virtual ~ModuleRegistry();
// 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);
};
« no previous file with comments | « gin/modules/file_module_provider.cc ('k') | gin/modules/module_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698