OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 static v8::Local<v8::Object> createWrapper(v8::Handle<v8::Object> creati
onContext, WrapperTypeInfo*, void*, v8::Isolate*); | 56 static v8::Local<v8::Object> createWrapper(v8::Handle<v8::Object> creati
onContext, WrapperTypeInfo*, void*, v8::Isolate*); |
57 | 57 |
58 template<typename T> | 58 template<typename T> |
59 static inline v8::Handle<v8::Object> associateObjectWithWrapper(PassRefP
tr<T>, WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfigurat
ion::Lifetime); | 59 static inline v8::Handle<v8::Object> associateObjectWithWrapper(PassRefP
tr<T>, WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfigurat
ion::Lifetime); |
60 static inline void setNativeInfo(v8::Handle<v8::Object>, WrapperTypeInfo
*, void*); | 60 static inline void setNativeInfo(v8::Handle<v8::Object>, WrapperTypeInfo
*, void*); |
61 static inline void clearNativeInfo(v8::Handle<v8::Object>, WrapperTypeIn
fo*); | 61 static inline void clearNativeInfo(v8::Handle<v8::Object>, WrapperTypeIn
fo*); |
62 | 62 |
63 static bool isDOMWrapper(v8::Handle<v8::Value>); | 63 static bool isDOMWrapper(v8::Handle<v8::Value>); |
64 static bool isWrapperOfType(v8::Handle<v8::Value>, WrapperTypeInfo*); | 64 static bool isWrapperOfType(v8::Handle<v8::Value>, WrapperTypeInfo*); |
65 | 65 |
66 #if ENABLE(CUSTOM_ELEMENTS) | |
67 // Used for V8WrapAsFunction, which is used only by CUSTOM_ELEMENTS | 66 // Used for V8WrapAsFunction, which is used only by CUSTOM_ELEMENTS |
68 static v8::Handle<v8::Function> toFunction(v8::Handle<v8::Value>); | 67 static v8::Handle<v8::Function> toFunction(v8::Handle<v8::Value>); |
69 static v8::Handle<v8::Function> toFunction(v8::Handle<v8::Object>, const
AtomicString& name, v8::Isolate*); | 68 static v8::Handle<v8::Function> toFunction(v8::Handle<v8::Object>, const
AtomicString& name, v8::Isolate*); |
70 static v8::Handle<v8::Object> fromFunction(v8::Handle<v8::Object>); | 69 static v8::Handle<v8::Object> fromFunction(v8::Handle<v8::Object>); |
71 #endif // ENABLE(CUSTOM_ELEMENTS) | |
72 }; | 70 }; |
73 | 71 |
74 inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, Wrap
perTypeInfo* type, void* object) | 72 inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, Wrap
perTypeInfo* type, void* object) |
75 { | 73 { |
76 ASSERT(wrapper->InternalFieldCount() >= 2); | 74 ASSERT(wrapper->InternalFieldCount() >= 2); |
77 ASSERT(object); | 75 ASSERT(object); |
78 ASSERT(type); | 76 ASSERT(type); |
79 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, objec
t); | 77 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, objec
t); |
80 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, type); | 78 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, type); |
81 } | 79 } |
(...skipping 12 matching lines...) Expand all Loading... |
94 setNativeInfo(wrapper, type, object.get()); | 92 setNativeInfo(wrapper, type, object.get()); |
95 ASSERT(maybeDOMWrapper(wrapper)); | 93 ASSERT(maybeDOMWrapper(wrapper)); |
96 WrapperConfiguration configuration = buildWrapperConfiguration(object.ge
t(), lifetime); | 94 WrapperConfiguration configuration = buildWrapperConfiguration(object.ge
t(), lifetime); |
97 DOMDataStore::setWrapper(object.leakRef(), wrapper, isolate, configurati
on); | 95 DOMDataStore::setWrapper(object.leakRef(), wrapper, isolate, configurati
on); |
98 return wrapper; | 96 return wrapper; |
99 } | 97 } |
100 | 98 |
101 } | 99 } |
102 | 100 |
103 #endif // V8DOMWrapper_h | 101 #endif // V8DOMWrapper_h |
OLD | NEW |