| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 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 inline bool GetNextArgument(Arguments* args, int create_flags, bool is_first, |
| 144 Arguments** result) { |
| 145 *result = args; |
| 146 return true; |
| 147 } |
| 143 | 148 |
| 144 // It's common for clients to just need the isolate, so we make that easy. | 149 // It's common for clients to just need the isolate, so we make that easy. |
| 145 inline bool GetNextArgument(Arguments* args, int create_flags, | 150 inline bool GetNextArgument(Arguments* args, int create_flags, |
| 146 bool is_first, v8::Isolate** result) { | 151 bool is_first, v8::Isolate** result) { |
| 147 *result = args->isolate(); | 152 *result = args->isolate(); |
| 148 return true; | 153 return true; |
| 149 } | 154 } |
| 150 | 155 |
| 151 | 156 |
| 152 // DispatchToCallback converts all the JavaScript arguments to C++ types and | 157 // DispatchToCallback converts all the JavaScript arguments to C++ types and |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // JavaScript arguments are automatically converted via gin::Converter, as is | 203 // JavaScript arguments are automatically converted via gin::Converter, as is |
| 199 // the return value of the C++ function, if any. | 204 // the return value of the C++ function, if any. |
| 200 template<typename Sig> | 205 template<typename Sig> |
| 201 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( | 206 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( |
| 202 v8::Isolate* isolate, const base::Callback<Sig> callback, | 207 v8::Isolate* isolate, const base::Callback<Sig> callback, |
| 203 int callback_flags = 0) { | 208 int callback_flags = 0) { |
| 204 typedef internal::CallbackHolder<Sig> HolderT; | 209 typedef internal::CallbackHolder<Sig> HolderT; |
| 205 gin::Handle<HolderT> holder = CreateHandle( | 210 gin::Handle<HolderT> holder = CreateHandle( |
| 206 isolate, new HolderT(callback, callback_flags)); | 211 isolate, new HolderT(callback, callback_flags)); |
| 207 return v8::FunctionTemplate::New( | 212 return v8::FunctionTemplate::New( |
| 213 isolate, |
| 208 &internal::Dispatcher<Sig>::DispatchToCallback, | 214 &internal::Dispatcher<Sig>::DispatchToCallback, |
| 209 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); | 215 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); |
| 210 } | 216 } |
| 211 | 217 |
| 212 } // namespace gin | 218 } // namespace gin |
| 213 | 219 |
| 214 #endif // GIN_FUNCTION_TEMPLATE_H_ | 220 #endif // GIN_FUNCTION_TEMPLATE_H_ |
| OLD | NEW |