| 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 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 // For advanced use cases, we allow callers to request the unparsed Arguments | 136 // For advanced use cases, we allow callers to request the unparsed Arguments |
| 137 // object and poke around in it directly. | 137 // object and poke around in it directly. |
| 138 inline bool GetNextArgument(Arguments* args, int create_flags, bool is_first, | 138 inline bool GetNextArgument(Arguments* args, int create_flags, bool is_first, |
| 139 Arguments* result) { | 139 Arguments* result) { |
| 140 *result = *args; | 140 *result = *args; |
| 141 return true; | 141 return true; |
| 142 } | 142 } |
| 143 | 143 |
| 144 // It's common for clients to just need the isolate, so we make that easy. |
| 145 inline bool GetNextArgument(Arguments* args, int create_flags, |
| 146 bool is_first, v8::Isolate** result) { |
| 147 *result = args->isolate(); |
| 148 return true; |
| 149 } |
| 150 |
| 144 | 151 |
| 145 // DispatchToCallback converts all the JavaScript arguments to C++ types and | 152 // DispatchToCallback converts all the JavaScript arguments to C++ types and |
| 146 // invokes the base::Callback. | 153 // invokes the base::Callback. |
| 147 template<typename Sig> | 154 template<typename Sig> |
| 148 struct Dispatcher { | 155 struct Dispatcher { |
| 149 }; | 156 }; |
| 150 | 157 |
| 151 $range ARITY 0..MAX_ARITY | 158 $range ARITY 0..MAX_ARITY |
| 152 $for ARITY [[ | 159 $for ARITY [[ |
| 153 $range ARG 1..ARITY | 160 $range ARG 1..ARITY |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 gin::Handle<HolderT> holder = CreateHandle( | 205 gin::Handle<HolderT> holder = CreateHandle( |
| 199 isolate, new HolderT(callback, callback_flags)); | 206 isolate, new HolderT(callback, callback_flags)); |
| 200 return v8::FunctionTemplate::New( | 207 return v8::FunctionTemplate::New( |
| 201 &internal::Dispatcher<Sig>::DispatchToCallback, | 208 &internal::Dispatcher<Sig>::DispatchToCallback, |
| 202 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); | 209 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); |
| 203 } | 210 } |
| 204 | 211 |
| 205 } // namespace gin | 212 } // namespace gin |
| 206 | 213 |
| 207 #endif // GIN_FUNCTION_TEMPLATE_H_ | 214 #endif // GIN_FUNCTION_TEMPLATE_H_ |
| OLD | NEW |