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

Unified Diff: gin/modules/module_registry.h

Issue 187653004: Adds ModuleRegistryObserver interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: integrate feedback Created 6 years, 10 months 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/gin.gyp ('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 2270d31ab38ec8387477c7f970943e5fe11f0e0d..5775a34a3db21ee563921fe55111bf721ec3f6bf 100644
--- a/gin/modules/module_registry.h
+++ b/gin/modules/module_registry.h
@@ -14,11 +14,13 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
+#include "base/observer_list.h"
#include "gin/gin_export.h"
#include "v8/include/v8.h"
namespace gin {
+class ModuleRegistryObserver;
struct PendingModule;
// This class implements the Asynchronous Module Definition (AMD) API.
@@ -43,6 +45,13 @@ class GIN_EXPORT ModuleRegistry {
static void RegisterGlobals(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> templ);
+ // Installs the necessary functions needed for modules.
+ // WARNING: this may execute script in the page.
+ static void InstallGlobals(v8::Isolate* isolate, v8::Handle<v8::Object> obj);
+
+ void AddObserver(ModuleRegistryObserver* observer);
+ void RemoveObserver(ModuleRegistryObserver* observer);
+
// The caller must have already entered our context.
void AddBuiltinModule(v8::Isolate* isolate, const std::string& id,
v8::Handle<v8::Value> module);
@@ -90,6 +99,8 @@ class GIN_EXPORT ModuleRegistry {
PendingModuleVector pending_modules_;
v8::Persistent<v8::Object> modules_;
+ ObserverList<ModuleRegistryObserver> observer_list_;
+
DISALLOW_COPY_AND_ASSIGN(ModuleRegistry);
};
« no previous file with comments | « gin/gin.gyp ('k') | gin/modules/module_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698