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

Unified Diff: gin/function_template.h

Issue 105423003: gin::Wrappable shouldn't inherit from base::RefCounted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win Created 7 years 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 | « no previous file | gin/function_template.h.pump » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/function_template.h
diff --git a/gin/function_template.h b/gin/function_template.h
index 020357d12fda7d938eee7620f70f25ccfbd8086b..643131776b8fac78617d2d1d3d39281c9696a282 100644
--- a/gin/function_template.h
+++ b/gin/function_template.h
@@ -15,6 +15,7 @@
#include "base/logging.h"
#include "gin/arguments.h"
#include "gin/converter.h"
+#include "gin/handle.h"
#include "gin/public/gin_embedders.h"
#include "gin/public/wrapper_info.h"
#include "gin/wrappable.h"
@@ -306,8 +307,9 @@ v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
v8::Isolate* isolate,
const base::Callback<R()> callback) {
typedef internal::CallbackHolder<R()> HolderT;
- scoped_refptr<HolderT> holder(new HolderT(callback));
+ gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
return v8::FunctionTemplate::New(
+ isolate,
&internal::DispatchToCallback<R>,
ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
}
@@ -317,8 +319,9 @@ v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
v8::Isolate* isolate,
const base::Callback<R(P1)> callback) {
typedef internal::CallbackHolder<R(P1)> HolderT;
- scoped_refptr<HolderT> holder(new HolderT(callback));
+ gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
return v8::FunctionTemplate::New(
+ isolate,
&internal::DispatchToCallback<R, P1>,
ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
}
@@ -328,8 +331,9 @@ v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
v8::Isolate* isolate,
const base::Callback<R(P1, P2)> callback) {
typedef internal::CallbackHolder<R(P1, P2)> HolderT;
- scoped_refptr<HolderT> holder(new HolderT(callback));
+ gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
return v8::FunctionTemplate::New(
+ isolate,
&internal::DispatchToCallback<R, P1, P2>,
ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
}
@@ -339,8 +343,9 @@ v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
v8::Isolate* isolate,
const base::Callback<R(P1, P2, P3)> callback) {
typedef internal::CallbackHolder<R(P1, P2, P3)> HolderT;
- scoped_refptr<HolderT> holder(new HolderT(callback));
+ gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
return v8::FunctionTemplate::New(
+ isolate,
&internal::DispatchToCallback<R, P1, P2, P3>,
ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
}
@@ -350,8 +355,9 @@ v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
v8::Isolate* isolate,
const base::Callback<R(P1, P2, P3, P4)> callback) {
typedef internal::CallbackHolder<R(P1, P2, P3, P4)> HolderT;
- scoped_refptr<HolderT> holder(new HolderT(callback));
+ gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
return v8::FunctionTemplate::New(
+ isolate,
&internal::DispatchToCallback<R, P1, P2, P3, P4>,
ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
}
« no previous file with comments | « no previous file | gin/function_template.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698