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

Unified Diff: chrome/renderer/native_handler.cc

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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 | « chrome/renderer/native_handler.h ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/native_handler.cc
diff --git a/chrome/renderer/native_handler.cc b/chrome/renderer/native_handler.cc
index 614df084cdf738d58f46878378f3e1d26d61767f..afa21ff65822d4ae6ecd3a6cf1f6dcf14b5b5274 100644
--- a/chrome/renderer/native_handler.cc
+++ b/chrome/renderer/native_handler.cc
@@ -28,9 +28,18 @@ v8::Handle<v8::Value> NativeHandler::Router(const v8::Arguments& args) {
void NativeHandler::RouteFunction(const std::string& name,
const HandlerFunction& handler_function) {
linked_ptr<HandlerFunction> function(new HandlerFunction(handler_function));
+ // TODO(koz): Investigate using v8's MakeWeak() function instead of holding
+ // on to these pointers here.
handler_functions_.push_back(function);
v8::Handle<v8::FunctionTemplate> function_template =
v8::FunctionTemplate::New(Router,
v8::External::New(function.get()));
object_template_->Set(name.c_str(), function_template);
}
+
+void NativeHandler::RouteStaticFunction(const std::string& name,
+ const HandlerFunc handler_func) {
+ v8::Handle<v8::FunctionTemplate> function_template =
+ v8::FunctionTemplate::New(handler_func, v8::External::New(this));
+ object_template_->Set(name.c_str(), function_template);
+}
« no previous file with comments | « chrome/renderer/native_handler.h ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698