| OLD | NEW |
| 1 // This file was GENERATED by command: | 1 // This file was GENERATED by command: |
| 2 // pump.py function_template.h.pump | 2 // pump.py function_template.h.pump |
| 3 // DO NOT EDIT BY HAND!!! | 3 // DO NOT EDIT BY HAND!!! |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 #ifndef GIN_FUNCTION_TEMPLATE_H_ | 7 #ifndef GIN_FUNCTION_TEMPLATE_H_ |
| 8 #define GIN_FUNCTION_TEMPLATE_H_ | 8 #define GIN_FUNCTION_TEMPLATE_H_ |
| 9 | 9 |
| 10 // Copyright 2013 The Chromium Authors. All rights reserved. | 10 // Copyright 2013 The Chromium Authors. All rights reserved. |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return; | 324 return; |
| 325 } | 325 } |
| 326 | 326 |
| 327 Invoker<R, P1, P2, P3, P4>::Go(&args, holder->callback, a1, a2, a3, a4); | 327 Invoker<R, P1, P2, P3, P4>::Go(&args, holder->callback, a1, a2, a3, a4); |
| 328 } | 328 } |
| 329 }; | 329 }; |
| 330 | 330 |
| 331 } // namespace internal | 331 } // namespace internal |
| 332 | 332 |
| 333 | 333 |
| 334 // This should be called once per-isolate to initialize the function template | |
| 335 // system. | |
| 336 GIN_EXPORT void InitFunctionTemplates(PerIsolateData* isolate_data); | |
| 337 | |
| 338 | |
| 339 // CreateFunctionTemplate creates a v8::FunctionTemplate that will create | 334 // CreateFunctionTemplate creates a v8::FunctionTemplate that will create |
| 340 // JavaScript functions that execute a provided C++ function or base::Callback. | 335 // JavaScript functions that execute a provided C++ function or base::Callback. |
| 341 // JavaScript arguments are automatically converted via gin::Converter, as is | 336 // JavaScript arguments are automatically converted via gin::Converter, as is |
| 342 // the return value of the C++ function, if any. | 337 // the return value of the C++ function, if any. |
| 343 template<typename Sig> | 338 template<typename Sig> |
| 344 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( | 339 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( |
| 345 v8::Isolate* isolate, const base::Callback<Sig> callback, | 340 v8::Isolate* isolate, const base::Callback<Sig> callback, |
| 346 int callback_flags = 0) { | 341 int callback_flags = 0) { |
| 347 typedef internal::CallbackHolder<Sig> HolderT; | 342 typedef internal::CallbackHolder<Sig> HolderT; |
| 348 gin::Handle<HolderT> holder = CreateHandle( | 343 gin::Handle<HolderT> holder = CreateHandle( |
| 349 isolate, new HolderT(callback, callback_flags)); | 344 isolate, new HolderT(callback, callback_flags)); |
| 350 return v8::FunctionTemplate::New( | 345 return v8::FunctionTemplate::New( |
| 351 &internal::Dispatcher<Sig>::DispatchToCallback, | 346 &internal::Dispatcher<Sig>::DispatchToCallback, |
| 352 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); | 347 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); |
| 353 } | 348 } |
| 354 | 349 |
| 355 } // namespace gin | 350 } // namespace gin |
| 356 | 351 |
| 357 #endif // GIN_FUNCTION_TEMPLATE_H_ | 352 #endif // GIN_FUNCTION_TEMPLATE_H_ |
| OLD | NEW |