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

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: Merge with aa's changes 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') | gin/modules/module_registry.cc » ('J')
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..342c3e1ae6dbf22aadf869a44463a3087fc21e38 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"
@@ -17,6 +19,8 @@ namespace gin {
struct PendingModule;
+typedef base::Callback<void (v8::Handle<v8::Value>)> ModuleLoadCallback;
Aaron Boodman 2013/11/27 19:02:41 Does this need to be namespace scoped?
Aaron Boodman 2013/11/27 19:02:41 Nit: The general style in Chrome is for non-primit
Aaron Boodman 2013/11/27 19:02:41 Nit: LoadModuleCallback, for parallelism with Load
abarth-chromium 2013/11/27 19:18:09 Done.
abarth-chromium 2013/11/27 19:18:09 v8::Handles are just pointers to pointers. Having
abarth-chromium 2013/11/27 19:18:09 Done.
+
// This class implements the Asynchronous Module Definition (AMD) API.
// https://github.com/amdjs/amdjs-api/wiki/AMD
//
@@ -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,
+ ModuleLoadCallback 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, ModuleLoadCallback> ModuleLoadCallbackMap;
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_;
+ ModuleLoadCallbackMap waiting_callbacks_;
+
PendingModuleVector pending_modules_;
v8::Persistent<v8::Object> modules_;
« no previous file with comments | « no previous file | gin/modules/module_registry.cc » ('j') | gin/modules/module_registry.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698