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

Side by Side Diff: gin/function_template.h.pump

Issue 192693002: gin: Add ability to install call-as-function handlers on gin::Wrappable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gin/function_template.h ('k') | gin/object_template_builder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 typedef internal::CallbackHolder<Sig> HolderT; 214 typedef internal::CallbackHolder<Sig> HolderT;
215 HolderT* holder = new HolderT(isolate, callback, callback_flags); 215 HolderT* holder = new HolderT(isolate, callback, callback_flags);
216 216
217 return v8::FunctionTemplate::New( 217 return v8::FunctionTemplate::New(
218 isolate, 218 isolate,
219 &internal::Dispatcher<Sig>::DispatchToCallback, 219 &internal::Dispatcher<Sig>::DispatchToCallback,
220 ConvertToV8<v8::Handle<v8::External> >(isolate, 220 ConvertToV8<v8::Handle<v8::External> >(isolate,
221 holder->GetHandle(isolate))); 221 holder->GetHandle(isolate)));
222 } 222 }
223 223
224 // CreateFunctionHandler installs a CallAsFunction handler on the given
225 // object template that forwards to a provided C++ function or base::Callback.
226 template<typename Sig>
227 void CreateFunctionHandler(v8::Isolate* isolate,
228 v8::Local<v8::ObjectTemplate> tmpl,
229 const base::Callback<Sig> callback,
230 int callback_flags = 0) {
231 typedef internal::CallbackHolder<Sig> HolderT;
232 HolderT* holder = new HolderT(isolate, callback, callback_flags);
233 tmpl->SetCallAsFunctionHandler(&internal::Dispatcher<Sig>::DispatchToCallback,
234 ConvertToV8<v8::Handle<v8::External> >(
235 isolate, holder->GetHandle(isolate)));
236 }
237
224 } // namespace gin 238 } // namespace gin
225 239
226 #endif // GIN_FUNCTION_TEMPLATE_H_ 240 #endif // GIN_FUNCTION_TEMPLATE_H_
OLDNEW
« no previous file with comments | « gin/function_template.h ('k') | gin/object_template_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698