| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // | 52 // |
| 53 // v8::FunctionTemplate only supports passing void* as data so how do we know | 53 // v8::FunctionTemplate only supports passing void* as data so how do we know |
| 54 // when to delete the base::Callback? That's where CallbackHolderBase comes in. | 54 // when to delete the base::Callback? That's where CallbackHolderBase comes in. |
| 55 // It inherits from Wrappable, which delete itself when both (a) the refcount | 55 // It inherits from Wrappable, which delete itself when both (a) the refcount |
| 56 // via base::RefCounted has dropped to zero, and (b) there are no more | 56 // via base::RefCounted has dropped to zero, and (b) there are no more |
| 57 // JavaScript references in V8. | 57 // JavaScript references in V8. |
| 58 | 58 |
| 59 // This simple base class is used so that we can share a single object template | 59 // This simple base class is used so that we can share a single object template |
| 60 // among every CallbackHolder instance. | 60 // among every CallbackHolder instance. |
| 61 class CallbackHolderBase : public Wrappable<CallbackHolderBase> { | 61 class CallbackHolderBase : public Wrappable<CallbackHolderBase> { |
| 62 public: |
| 63 static WrapperInfo kWrapperInfo; |
| 62 protected: | 64 protected: |
| 63 ~CallbackHolderBase() {} | 65 ~CallbackHolderBase() {} |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 template<typename Sig> | 68 template<typename Sig> |
| 67 class CallbackHolder : public CallbackHolderBase { | 69 class CallbackHolder : public CallbackHolderBase { |
| 68 public: | 70 public: |
| 69 CallbackHolder(const base::Callback<Sig>& callback, int flags) | 71 CallbackHolder(const base::Callback<Sig>& callback, int flags) |
| 70 : callback(callback), flags(flags) {} | 72 : callback(callback), flags(flags) {} |
| 71 base::Callback<Sig> callback; | 73 base::Callback<Sig> callback; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 gin::Handle<HolderT> holder = CreateHandle( | 347 gin::Handle<HolderT> holder = CreateHandle( |
| 346 isolate, new HolderT(callback, callback_flags)); | 348 isolate, new HolderT(callback, callback_flags)); |
| 347 return v8::FunctionTemplate::New( | 349 return v8::FunctionTemplate::New( |
| 348 &internal::Dispatcher<Sig>::DispatchToCallback, | 350 &internal::Dispatcher<Sig>::DispatchToCallback, |
| 349 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); | 351 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); |
| 350 } | 352 } |
| 351 | 353 |
| 352 } // namespace gin | 354 } // namespace gin |
| 353 | 355 |
| 354 #endif // GIN_FUNCTION_TEMPLATE_H_ | 356 #endif // GIN_FUNCTION_TEMPLATE_H_ |
| OLD | NEW |