diff options
author | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-09 04:36:01 +0000 |
---|---|---|
committer | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-09 04:36:01 +0000 |
commit | 7b0c3f536f8ef4c248d03084a7e4ef9747cfc8c0 (patch) | |
tree | cb4afa76ecae3987687d70062aa136801ba93318 /chrome/renderer/native_handler.cc | |
parent | 1b9ab79cf95ef6956b56c06ba3466f4f14ee3b39 (diff) | |
download | chromium_src-7b0c3f536f8ef4c248d03084a7e4ef9747cfc8c0.zip chromium_src-7b0c3f536f8ef4c248d03084a7e4ef9747cfc8c0.tar.gz chromium_src-7b0c3f536f8ef4c248d03084a7e4ef9747cfc8c0.tar.bz2 |
Implement a module system for the extension bindings JS.
BUG=104100
TEST=existing browser tests
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=125132
Review URL: http://codereview.chromium.org/9386001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/native_handler.cc')
-rw-r--r-- | chrome/renderer/native_handler.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/renderer/native_handler.cc b/chrome/renderer/native_handler.cc index 614df08..afa21ff 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); +} |