OLD | NEW |
1 $$ This is a pump file for generating file templates. Pump is a python | 1 $$ This is a pump file for generating file templates. Pump is a python |
2 $$ script that is part of the Google Test suite of utilities. Description | 2 $$ script that is part of the Google Test suite of utilities. Description |
3 $$ can be found here: | 3 $$ can be found here: |
4 $$ | 4 $$ |
5 $$ http://code.google.com/p/googletest/wiki/PumpManual | 5 $$ http://code.google.com/p/googletest/wiki/PumpManual |
6 $$ | 6 $$ |
7 | 7 |
8 #ifndef GIN_FUNCTION_TEMPLATE_H_ | 8 #ifndef GIN_FUNCTION_TEMPLATE_H_ |
9 #define GIN_FUNCTION_TEMPLATE_H_ | 9 #define GIN_FUNCTION_TEMPLATE_H_ |
10 | 10 |
11 $var MAX_ARITY = 4 | 11 $var MAX_ARITY = 4 |
12 | 12 |
13 // Copyright 2013 The Chromium Authors. All rights reserved. | 13 // Copyright 2013 The Chromium Authors. All rights reserved. |
14 // Use of this source code is governed by a BSD-style license that can be | 14 // Use of this source code is governed by a BSD-style license that can be |
15 // found in the LICENSE file. | 15 // found in the LICENSE file. |
16 | 16 |
17 #include "base/callback.h" | 17 #include "base/callback.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "gin/arguments.h" | 19 #include "gin/arguments.h" |
20 #include "gin/converter.h" | 20 #include "gin/converter.h" |
| 21 #include "gin/handle.h" |
21 #include "gin/public/gin_embedders.h" | 22 #include "gin/public/gin_embedders.h" |
22 #include "gin/public/wrapper_info.h" | 23 #include "gin/public/wrapper_info.h" |
23 #include "gin/wrappable.h" | 24 #include "gin/wrappable.h" |
24 | 25 |
25 #include "v8/include/v8.h" | 26 #include "v8/include/v8.h" |
26 | 27 |
27 namespace gin { | 28 namespace gin { |
28 | 29 |
29 class PerIsolateData; | 30 class PerIsolateData; |
30 | 31 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // gin::Converter. | 168 // gin::Converter. |
168 $range ARITY 0..MAX_ARITY | 169 $range ARITY 0..MAX_ARITY |
169 $for ARITY [[ | 170 $for ARITY [[ |
170 $range ARG 1..ARITY | 171 $range ARG 1..ARITY |
171 | 172 |
172 template<typename R$for ARG [[, typename P$(ARG)]]> | 173 template<typename R$for ARG [[, typename P$(ARG)]]> |
173 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( | 174 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( |
174 v8::Isolate* isolate, | 175 v8::Isolate* isolate, |
175 const base::Callback<R($for ARG , [[P$(ARG)]])> callback) { | 176 const base::Callback<R($for ARG , [[P$(ARG)]])> callback) { |
176 typedef internal::CallbackHolder<R($for ARG , [[P$(ARG)]])> HolderT; | 177 typedef internal::CallbackHolder<R($for ARG , [[P$(ARG)]])> HolderT; |
177 scoped_refptr<HolderT> holder(new HolderT(callback)); | 178 gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback)); |
178 return v8::FunctionTemplate::New( | 179 return v8::FunctionTemplate::New( |
179 isolate, | 180 isolate, |
180 &internal::DispatchToCallback<R$for ARG [[, P$(ARG)]]>, | 181 &internal::DispatchToCallback<R$for ARG [[, P$(ARG)]]>, |
181 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); | 182 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); |
182 } | 183 } |
183 | 184 |
184 ]] | 185 ]] |
185 | 186 |
186 } // namespace gin | 187 } // namespace gin |
187 | 188 |
188 #endif // GIN_FUNCTION_TEMPLATE_H_ | 189 #endif // GIN_FUNCTION_TEMPLATE_H_ |
OLD | NEW |