OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WrapperTypeInfo_h | 31 #ifndef WrapperTypeInfo_h |
32 #define WrapperTypeInfo_h | 32 #define WrapperTypeInfo_h |
33 | 33 |
| 34 #include <v8.h> |
34 #include "bindings/core/v8/ActiveScriptWrappable.h" | 35 #include "bindings/core/v8/ActiveScriptWrappable.h" |
35 #include "gin/public/wrapper_info.h" | 36 #include "gin/public/wrapper_info.h" |
36 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
37 #include "wtf/Allocator.h" | 38 #include "wtf/Allocator.h" |
38 #include "wtf/Assertions.h" | 39 #include "wtf/Assertions.h" |
39 #include <v8.h> | |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class DOMWrapperWorld; | 43 class DOMWrapperWorld; |
44 class ScriptWrappable; | 44 class ScriptWrappable; |
45 | 45 |
46 ScriptWrappable* toScriptWrappable( | 46 ScriptWrappable* toScriptWrappable( |
47 const v8::PersistentBase<v8::Object>& wrapper); | 47 const v8::PersistentBase<v8::Object>& wrapper); |
48 ScriptWrappable* toScriptWrappable(v8::Local<v8::Object> wrapper); | 48 ScriptWrappable* toScriptWrappable(v8::Local<v8::Object> wrapper); |
49 | 49 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 const TraceFunction traceFunction; | 173 const TraceFunction traceFunction; |
174 const TraceWrappersFunction traceWrappersFunction; | 174 const TraceWrappersFunction traceWrappersFunction; |
175 PreparePrototypeAndInterfaceObjectFunction | 175 PreparePrototypeAndInterfaceObjectFunction |
176 preparePrototypeAndInterfaceObjectFunction; | 176 preparePrototypeAndInterfaceObjectFunction; |
177 const char* const interfaceName; | 177 const char* const interfaceName; |
178 const WrapperTypeInfo* parentClass; | 178 const WrapperTypeInfo* parentClass; |
179 const unsigned wrapperTypePrototype : 1; // WrapperTypePrototype | 179 const unsigned wrapperTypePrototype : 1; // WrapperTypePrototype |
180 const unsigned wrapperClassId : 2; // WrapperClassId | 180 const unsigned wrapperClassId : 2; // WrapperClassId |
181 const unsigned | 181 const unsigned |
182 activeScriptWrappableInheritance : 1; // ActiveScriptWrappableInheritance | 182 activeScriptWrappableInheritance : 1; // ActiveScriptWrappableInheritance |
183 const unsigned lifetime : 1; // Lifetime | 183 const unsigned lifetime : 1; // Lifetime |
184 }; | 184 }; |
185 | 185 |
186 template <typename T, int offset> | 186 template <typename T, int offset> |
187 inline T* getInternalField(const v8::PersistentBase<v8::Object>& persistent) { | 187 inline T* getInternalField(const v8::PersistentBase<v8::Object>& persistent) { |
188 ASSERT(offset < v8::Object::InternalFieldCount(persistent)); | 188 ASSERT(offset < v8::Object::InternalFieldCount(persistent)); |
189 return reinterpret_cast<T*>( | 189 return reinterpret_cast<T*>( |
190 v8::Object::GetAlignedPointerFromInternalField(persistent, offset)); | 190 v8::Object::GetAlignedPointerFromInternalField(persistent, offset)); |
191 } | 191 } |
192 | 192 |
193 template <typename T, int offset> | 193 template <typename T, int offset> |
(...skipping 17 matching lines...) Expand all Loading... |
211 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); | 211 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); |
212 } | 212 } |
213 | 213 |
214 inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Local<v8::Object> wrapper) { | 214 inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Local<v8::Object> wrapper) { |
215 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); | 215 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); |
216 } | 216 } |
217 | 217 |
218 } // namespace blink | 218 } // namespace blink |
219 | 219 |
220 #endif // WrapperTypeInfo_h | 220 #endif // WrapperTypeInfo_h |
OLD | NEW |