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

Unified Diff: gin/modules/module_runner_delegate.cc

Issue 467263006: JavaScript Content Handler Version 0.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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
Index: gin/modules/module_runner_delegate.cc
diff --git a/gin/modules/module_runner_delegate.cc b/gin/modules/module_runner_delegate.cc
index 16b5afd0303ba8a8819cbe54aef25ec8c4c24a84..9d8ce2e7133d61ed9944fe72404f410ec5c8d3b7 100644
--- a/gin/modules/module_runner_delegate.cc
+++ b/gin/modules/module_runner_delegate.cc
@@ -4,6 +4,8 @@
#include "gin/modules/module_runner_delegate.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "gin/modules/module_registry.h"
#include "gin/object_template_builder.h"
#include "gin/public/context_holder.h"
@@ -20,6 +22,11 @@ ModuleRunnerDelegate::~ModuleRunnerDelegate() {
void ModuleRunnerDelegate::AddBuiltinModule(const std::string& id,
ModuleGetter getter) {
+ builtin_modules_[id] = base::Bind(getter);
+}
+
+void ModuleRunnerDelegate::AddBuiltinModule(const std::string& id,
+ const ModuleGetterCallback& getter) {
builtin_modules_[id] = getter;
}
@@ -46,9 +53,10 @@ void ModuleRunnerDelegate::DidCreateContext(ShellRunner* runner) {
ModuleRegistry* registry = ModuleRegistry::From(context);
v8::Isolate* isolate = runner->GetContextHolder()->isolate();
+
for (BuiltinModuleMap::const_iterator it = builtin_modules_.begin();
it != builtin_modules_.end(); ++it) {
- registry->AddBuiltinModule(isolate, it->first, it->second(isolate));
+ registry->AddBuiltinModule(isolate, it->first, it->second.Run(isolate));
}
}

Powered by Google App Engine
This is Rietveld 408576698