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

Side by Side Diff: gin/function_template.h

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 | « no previous file | gin/function_template.h.pump » ('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 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 typedef internal::CallbackHolder<Sig> HolderT; 494 typedef internal::CallbackHolder<Sig> HolderT;
495 HolderT* holder = new HolderT(isolate, callback, callback_flags); 495 HolderT* holder = new HolderT(isolate, callback, callback_flags);
496 496
497 return v8::FunctionTemplate::New( 497 return v8::FunctionTemplate::New(
498 isolate, 498 isolate,
499 &internal::Dispatcher<Sig>::DispatchToCallback, 499 &internal::Dispatcher<Sig>::DispatchToCallback,
500 ConvertToV8<v8::Handle<v8::External> >(isolate, 500 ConvertToV8<v8::Handle<v8::External> >(isolate,
501 holder->GetHandle(isolate))); 501 holder->GetHandle(isolate)));
502 } 502 }
503 503
504 // CreateFunctionHandler installs a CallAsFunction handler on the given
505 // object template that forwards to a provided C++ function or base::Callback.
506 template<typename Sig>
507 void CreateFunctionHandler(v8::Isolate* isolate,
508 v8::Local<v8::ObjectTemplate> tmpl,
509 const base::Callback<Sig> callback,
510 int callback_flags = 0) {
511 typedef internal::CallbackHolder<Sig> HolderT;
512 HolderT* holder = new HolderT(isolate, callback, callback_flags);
513 tmpl->SetCallAsFunctionHandler(&internal::Dispatcher<Sig>::DispatchToCallback,
514 ConvertToV8<v8::Handle<v8::External> >(
515 isolate, holder->GetHandle(isolate)));
516 }
517
504 } // namespace gin 518 } // namespace gin
505 519
506 #endif // GIN_FUNCTION_TEMPLATE_H_ 520 #endif // GIN_FUNCTION_TEMPLATE_H_
OLDNEW
« 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