| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // when to delete the base::Callback? That's where CallbackHolderBase comes in. | 55 // when to delete the base::Callback? That's where CallbackHolderBase comes in. |
| 56 // It inherits from Wrappable, which delete itself when both (a) the refcount | 56 // It inherits from Wrappable, which delete itself when both (a) the refcount |
| 57 // via base::RefCounted has dropped to zero, and (b) there are no more | 57 // via base::RefCounted has dropped to zero, and (b) there are no more |
| 58 // JavaScript references in V8. | 58 // JavaScript references in V8. |
| 59 | 59 |
| 60 // This simple base class is used so that we can share a single object template | 60 // This simple base class is used so that we can share a single object template |
| 61 // among every CallbackHolder instance. | 61 // among every CallbackHolder instance. |
| 62 class GIN_EXPORT CallbackHolderBase : public Wrappable<CallbackHolderBase> { | 62 class GIN_EXPORT CallbackHolderBase : public Wrappable<CallbackHolderBase> { |
| 63 public: | 63 public: |
| 64 static WrapperInfo kWrapperInfo; | 64 static WrapperInfo kWrapperInfo; |
| 65 | |
| 66 protected: | 65 protected: |
| 67 virtual ~CallbackHolderBase() {} | 66 virtual ~CallbackHolderBase() {} |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 template<typename Sig> | 69 template<typename Sig> |
| 71 class CallbackHolder : public CallbackHolderBase { | 70 class CallbackHolder : public CallbackHolderBase { |
| 72 public: | 71 public: |
| 73 CallbackHolder(const base::Callback<Sig>& callback, int flags) | 72 CallbackHolder(const base::Callback<Sig>& callback, int flags) |
| 74 : callback(callback), flags(flags) {} | 73 : callback(callback), flags(flags) {} |
| 75 base::Callback<Sig> callback; | 74 base::Callback<Sig> callback; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 261 } |
| 263 } | 262 } |
| 264 | 263 |
| 265 // For advanced use cases, we allow callers to request the unparsed Arguments | 264 // For advanced use cases, we allow callers to request the unparsed Arguments |
| 266 // object and poke around in it directly. | 265 // object and poke around in it directly. |
| 267 inline bool GetNextArgument(Arguments* args, int create_flags, bool is_first, | 266 inline bool GetNextArgument(Arguments* args, int create_flags, bool is_first, |
| 268 Arguments* result) { | 267 Arguments* result) { |
| 269 *result = *args; | 268 *result = *args; |
| 270 return true; | 269 return true; |
| 271 } | 270 } |
| 271 inline bool GetNextArgument(Arguments* args, int create_flags, bool is_first, |
| 272 Arguments** result) { |
| 273 *result = args; |
| 274 return true; |
| 275 } |
| 272 | 276 |
| 273 // It's common for clients to just need the isolate, so we make that easy. | 277 // It's common for clients to just need the isolate, so we make that easy. |
| 274 inline bool GetNextArgument(Arguments* args, int create_flags, | 278 inline bool GetNextArgument(Arguments* args, int create_flags, |
| 275 bool is_first, v8::Isolate** result) { | 279 bool is_first, v8::Isolate** result) { |
| 276 *result = args->isolate(); | 280 *result = args->isolate(); |
| 277 return true; | 281 return true; |
| 278 } | 282 } |
| 279 | 283 |
| 280 | 284 |
| 281 // DispatchToCallback converts all the JavaScript arguments to C++ types and | 285 // DispatchToCallback converts all the JavaScript arguments to C++ types and |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 isolate, new HolderT(callback, callback_flags)); | 479 isolate, new HolderT(callback, callback_flags)); |
| 476 return v8::FunctionTemplate::New( | 480 return v8::FunctionTemplate::New( |
| 477 isolate, | 481 isolate, |
| 478 &internal::Dispatcher<Sig>::DispatchToCallback, | 482 &internal::Dispatcher<Sig>::DispatchToCallback, |
| 479 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); | 483 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); |
| 480 } | 484 } |
| 481 | 485 |
| 482 } // namespace gin | 486 } // namespace gin |
| 483 | 487 |
| 484 #endif // GIN_FUNCTION_TEMPLATE_H_ | 488 #endif // GIN_FUNCTION_TEMPLATE_H_ |
| OLD | NEW |