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

Unified Diff: gin/modules/module_registry.h

Issue 90203002: [Mojo] Remove static "bootstrap" state in mojo_js (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CHECK, CHECK, CHECK 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 | « no previous file | 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 a7732c8091854261dcda24501b0362514cfb3ac8..d3bed3260bdcc22f31a54a3b76498118522a17a7 100644
--- a/gin/modules/module_registry.h
+++ b/gin/modules/module_registry.h
@@ -6,9 +6,11 @@
#define GIN_MODULES_MODULE_REGISTRY_H_
#include <list>
+#include <map>
#include <set>
#include <string>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "gin/per_context_data.h"
@@ -30,6 +32,8 @@ struct PendingModule;
//
class ModuleRegistry : public ContextSupplement {
public:
+ typedef base::Callback<void (v8::Handle<v8::Value>)> LoadModuleCallback;
+
virtual ~ModuleRegistry();
static ModuleRegistry* From(v8::Handle<v8::Context> context);
@@ -46,6 +50,10 @@ class ModuleRegistry : public ContextSupplement {
void AddPendingModule(v8::Isolate* isolate,
scoped_ptr<PendingModule> pending);
+ void LoadModule(v8::Isolate* isolate,
+ const std::string& id,
+ LoadModuleCallback callback);
+
// The caller must have already entered our context.
void AttemptToLoadMoreModules(v8::Isolate* isolate);
@@ -59,6 +67,7 @@ class ModuleRegistry : public ContextSupplement {
private:
typedef ScopedVector<PendingModule> PendingModuleVector;
+ typedef std::map<std::string, LoadModuleCallback> LoadModuleCallbackMap;
explicit ModuleRegistry(v8::Isolate* isolate);
@@ -73,9 +82,13 @@ class ModuleRegistry : public ContextSupplement {
bool CheckDependencies(PendingModule* pending);
bool AttemptToLoad(v8::Isolate* isolate, scoped_ptr<PendingModule> pending);
+ v8::Handle<v8::Value> GetModule(v8::Isolate* isolate, const std::string& id);
+
std::set<std::string> available_modules_;
std::set<std::string> unsatisfied_dependencies_;
+ LoadModuleCallbackMap waiting_callbacks_;
+
PendingModuleVector pending_modules_;
v8::Persistent<v8::Object> modules_;
« no previous file with comments | « no previous file | gin/modules/module_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698