| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 9b1d01cd8f4ead1bab6e46f03c3ed362157f8c13..579af7aebd442e4c346d1bc65dcc56d75b1b8073 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -961,6 +961,22 @@ void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) {
|
| }
|
|
|
|
|
| +// TODO(dcarney): Remove this abstraction when old callbacks are removed.
|
| +class CallHandlerHelper {
|
| + public:
|
| + static inline void Set(Local<FunctionTemplate> function_template,
|
| + InvocationCallback callback,
|
| + v8::Handle<Value> data) {
|
| + function_template->SetCallHandlerInternal(callback, data);
|
| + }
|
| + static inline void Set(Local<FunctionTemplate> function_template,
|
| + FunctionCallback callback,
|
| + v8::Handle<Value> data) {
|
| + function_template->SetCallHandler(callback, data);
|
| + }
|
| +};
|
| +
|
| +
|
| template<typename Callback>
|
| static Local<FunctionTemplate> FunctionTemplateNew(
|
| Callback callback,
|
| @@ -981,7 +997,7 @@ static Local<FunctionTemplate> FunctionTemplateNew(
|
| obj->set_serial_number(i::Smi::FromInt(next_serial_number));
|
| if (callback != 0) {
|
| if (data.IsEmpty()) data = v8::Undefined();
|
| - Utils::ToLocal(obj)->SetCallHandler(callback, data);
|
| + CallHandlerHelper::Set(Utils::ToLocal(obj), callback, data);
|
| }
|
| obj->set_length(length);
|
| obj->set_undetectable(false);
|
| @@ -1225,6 +1241,11 @@ void FunctionTemplate::SetCallHandler(InvocationCallback callback,
|
| FunctionTemplateSetCallHandler(this, callback, data);
|
| }
|
|
|
| +void FunctionTemplate::SetCallHandlerInternal(InvocationCallback callback,
|
| + v8::Handle<Value> data) {
|
| + FunctionTemplateSetCallHandler(this, callback, data);
|
| +}
|
| +
|
| void FunctionTemplate::SetCallHandler(FunctionCallback callback,
|
| v8::Handle<Value> data) {
|
| FunctionTemplateSetCallHandler(this, callback, data);
|
|
|