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

Side by Side Diff: gin/function_template.h

Issue 107113005: Gin: Consolidate all the Converter<Wrappable> subclasses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unneeded friend declaration 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 }; 326 };
327 327
328 } // namespace internal 328 } // namespace internal
329 329
330 330
331 // This should be called once per-isolate to initialize the function template 331 // This should be called once per-isolate to initialize the function template
332 // system. 332 // system.
333 void InitFunctionTemplates(PerIsolateData* isolate_data); 333 void InitFunctionTemplates(PerIsolateData* isolate_data);
334 334
335 335
336 // This has to be outside the internal namespace because template
337 // specializations must be declared in the same namespace as the original
338 // template.
339 template<>
340 struct Converter<internal::CallbackHolderBase*>
341 : public WrappableConverter<internal::CallbackHolderBase> {};
342
343
344 // CreateFunctionTemplate creates a v8::FunctionTemplate that will create 336 // CreateFunctionTemplate creates a v8::FunctionTemplate that will create
345 // JavaScript functions that execute a provided C++ function or base::Callback. 337 // JavaScript functions that execute a provided C++ function or base::Callback.
346 // JavaScript arguments are automatically converted via gin::Converter, as is 338 // JavaScript arguments are automatically converted via gin::Converter, as is
347 // the return value of the C++ function, if any. 339 // the return value of the C++ function, if any.
348 template<typename Sig> 340 template<typename Sig>
349 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( 341 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
350 v8::Isolate* isolate, const base::Callback<Sig> callback, 342 v8::Isolate* isolate, const base::Callback<Sig> callback,
351 int callback_flags = 0) { 343 int callback_flags = 0) {
352 typedef internal::CallbackHolder<Sig> HolderT; 344 typedef internal::CallbackHolder<Sig> HolderT;
353 gin::Handle<HolderT> holder = CreateHandle( 345 gin::Handle<HolderT> holder = CreateHandle(
354 isolate, new HolderT(callback, callback_flags)); 346 isolate, new HolderT(callback, callback_flags));
355 return v8::FunctionTemplate::New( 347 return v8::FunctionTemplate::New(
356 &internal::Dispatcher<Sig>::DispatchToCallback, 348 &internal::Dispatcher<Sig>::DispatchToCallback,
357 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); 349 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
358 } 350 }
359 351
360 } // namespace gin 352 } // namespace gin
361 353
362 #endif // GIN_FUNCTION_TEMPLATE_H_ 354 #endif // GIN_FUNCTION_TEMPLATE_H_
OLDNEW
« no previous file with comments | « gin/converter.h ('k') | gin/function_template.h.pump » ('j') | gin/wrappable.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698