diff --git a/native_mate/wrappable.h b/native_mate/wrappable.h index 2dedc31547fd..19552ce3c46c 100644 --- a/native_mate/wrappable.h +++ b/native_mate/wrappable.h @@ -27,13 +27,13 @@ class Wrappable : public WrappableBase { template static void SetConstructor(v8::Isolate* isolate, const std::string& name, - const base::Callback& factory) { - v8::Local constructor = CreateFunctionTemplate( - isolate, base::Bind(&internal::InvokeNew, factory)); - constructor->InstanceTemplate()->SetInternalFieldCount(1); - constructor->SetClassName(StringToV8(isolate, name)); - T::BuildPrototype(isolate, constructor->PrototypeTemplate()); - templ_ = new v8::Global(isolate, constructor); + const base::Callback& constructor) { + v8::Local templ = CreateFunctionTemplate( + isolate, base::Bind(&internal::InvokeNew, constructor)); + templ->InstanceTemplate()->SetInternalFieldCount(1); + templ->SetClassName(StringToV8(isolate, name)); + T::BuildPrototype(isolate, templ); + templ_ = new v8::Global(isolate, templ); } static v8::Local GetConstructor(v8::Isolate* isolate) { @@ -41,7 +41,7 @@ class Wrappable : public WrappableBase { if (!templ_) { v8::Local templ = v8::FunctionTemplate::New(isolate); templ->InstanceTemplate()->SetInternalFieldCount(1); - T::BuildPrototype(isolate, templ->PrototypeTemplate()); + T::BuildPrototype(isolate, templ); templ_ = new v8::Global(isolate, templ); } return v8::Local::New(isolate, *templ_);