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_WRAPPABLE_H_ | 5 #ifndef GIN_WRAPPABLE_H_ |
6 #define GIN_WRAPPABLE_H_ | 6 #define GIN_WRAPPABLE_H_ |
7 | 7 |
8 #include <type_traits> | 8 #include <type_traits> |
9 | 9 |
| 10 #include "base/macros.h" |
10 #include "base/template_util.h" | 11 #include "base/template_util.h" |
11 #include "gin/converter.h" | 12 #include "gin/converter.h" |
12 #include "gin/gin_export.h" | 13 #include "gin/gin_export.h" |
13 #include "gin/public/wrapper_info.h" | 14 #include "gin/public/wrapper_info.h" |
14 | 15 |
15 namespace gin { | 16 namespace gin { |
16 | 17 |
17 // Wrappable is a base class for C++ objects that have corresponding v8 wrapper | 18 // Wrappable is a base class for C++ objects that have corresponding v8 wrapper |
18 // objects. To retain a Wrappable object on the stack, use a gin::Handle. | 19 // objects. To retain a Wrappable object on the stack, use a gin::Handle. |
19 // | 20 // |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val, T** out) { | 115 static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val, T** out) { |
115 *out = static_cast<T*>(static_cast<WrappableBase*>( | 116 *out = static_cast<T*>(static_cast<WrappableBase*>( |
116 internal::FromV8Impl(isolate, val, &T::kWrapperInfo))); | 117 internal::FromV8Impl(isolate, val, &T::kWrapperInfo))); |
117 return *out != NULL; | 118 return *out != NULL; |
118 } | 119 } |
119 }; | 120 }; |
120 | 121 |
121 } // namespace gin | 122 } // namespace gin |
122 | 123 |
123 #endif // GIN_WRAPPABLE_H_ | 124 #endif // GIN_WRAPPABLE_H_ |
OLD | NEW |