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); |
+} |