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

Unified Diff: gin/modules/module_registry.h

Issue 74753002: Introduce gin_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: gin/modules/module_registry.h
diff --git a/gin/modules/module_registry.h b/gin/modules/module_registry.h
index 96ea1496f2396cf7505f643e999e5fdbd0cbc143..f7e9de36c99bc6bee97e59d0db269ab946210649 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"
+#include "base/memory/scoped_ptr.h"
#include "gin/per_context_data.h"
namespace gin {
@@ -34,29 +36,47 @@ class ModuleRegistry : public ContextSupplement {
static void RegisterGlobals(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> templ);
+
// The caller must have already entered our context.
void AddBuiltinModule(v8::Isolate* isolate,
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);
+
+ 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);
};

Powered by Google App Engine
This is Rietveld 408576698