OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GIN_OBJECT_TEMPLATE_BUILDER_H_ | 5 #ifndef GIN_OBJECT_TEMPLATE_BUILDER_H_ |
6 #define GIN_OBJECT_TEMPLATE_BUILDER_H_ | 6 #define GIN_OBJECT_TEMPLATE_BUILDER_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 v8::Local<v8::ObjectTemplate> tmpl, | 64 v8::Local<v8::ObjectTemplate> tmpl, |
65 T callback) { | 65 T callback) { |
66 CreateFunctionHandler( | 66 CreateFunctionHandler( |
67 isolate, tmpl, base::Bind(callback), HolderIsFirstArgument); | 67 isolate, tmpl, base::Bind(callback), HolderIsFirstArgument); |
68 } | 68 } |
69 }; | 69 }; |
70 | 70 |
71 // This specialization allows people to construct function templates directly if | 71 // This specialization allows people to construct function templates directly if |
72 // they need to do fancier stuff. | 72 // they need to do fancier stuff. |
73 template<> | 73 template<> |
74 struct GIN_EXPORT CallbackTraits<v8::Handle<v8::FunctionTemplate> > { | 74 struct CallbackTraits<v8::Handle<v8::FunctionTemplate> > { |
75 static v8::Handle<v8::FunctionTemplate> CreateTemplate( | 75 static v8::Handle<v8::FunctionTemplate> CreateTemplate( |
76 v8::Handle<v8::FunctionTemplate> templ) { | 76 v8::Handle<v8::FunctionTemplate> templ) { |
77 return templ; | 77 return templ; |
78 } | 78 } |
79 }; | 79 }; |
80 | 80 |
81 } // namespace | 81 } // namespace |
82 | 82 |
83 | 83 |
84 // ObjectTemplateBuilder provides a handy interface to creating | 84 // ObjectTemplateBuilder provides a handy interface to creating |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 v8::Isolate* isolate_; | 139 v8::Isolate* isolate_; |
140 | 140 |
141 // ObjectTemplateBuilder should only be used on the stack. | 141 // ObjectTemplateBuilder should only be used on the stack. |
142 v8::Local<v8::ObjectTemplate> template_; | 142 v8::Local<v8::ObjectTemplate> template_; |
143 }; | 143 }; |
144 | 144 |
145 } // namespace gin | 145 } // namespace gin |
146 | 146 |
147 #endif // GIN_OBJECT_TEMPLATE_BUILDER_H_ | 147 #endif // GIN_OBJECT_TEMPLATE_BUILDER_H_ |
OLD | NEW |