| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 static v8::Handle<v8::Object> associateObjectWithWrapper(RawPtr<T> object, c
onst WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isola
te* isolate, WrapperConfiguration::Lifetime lifetime) | 53 static v8::Handle<v8::Object> associateObjectWithWrapper(RawPtr<T> object, c
onst WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Isola
te* isolate, WrapperConfiguration::Lifetime lifetime) |
| 54 { | 54 { |
| 55 return associateObjectWithWrapper<V8T, T>(object.get(), wrapperTypeInfo,
wrapper, isolate, lifetime); | 55 return associateObjectWithWrapper<V8T, T>(object.get(), wrapperTypeInfo,
wrapper, isolate, lifetime); |
| 56 } | 56 } |
| 57 template<typename V8T, typename T> | 57 template<typename V8T, typename T> |
| 58 static v8::Handle<v8::Object> associateObjectWithWrapper(T*, const WrapperTy
peInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfiguration::Lifetime); | 58 static v8::Handle<v8::Object> associateObjectWithWrapper(T*, const WrapperTy
peInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfiguration::Lifetime); |
| 59 static v8::Handle<v8::Object> associateObjectWithWrapperNonTemplate(ScriptWr
appable*, const WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperC
onfiguration::Lifetime); | 59 static v8::Handle<v8::Object> associateObjectWithWrapperNonTemplate(ScriptWr
appable*, const WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperC
onfiguration::Lifetime); |
| 60 static v8::Handle<v8::Object> associateObjectWithWrapperNonTemplate(Node*, c
onst WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfiguratio
n::Lifetime); | 60 static v8::Handle<v8::Object> associateObjectWithWrapperNonTemplate(Node*, c
onst WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfiguratio
n::Lifetime); |
| 61 static void setNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*, Sc
riptWrappableBase* internalPointer); | 61 static void setNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*, Sc
riptWrappableBase* internalPointer); |
| 62 static void setNativeInfoForHiddenWrapper(v8::Handle<v8::Object>, const Wrap
perTypeInfo*, ScriptWrappableBase* internalPointer); | 62 static void setNativeInfoForHiddenWrapper(v8::Handle<v8::Object>, const Wrap
perTypeInfo*, ScriptWrappableBase* internalPointer); |
| 63 static void setNativeInfoWithPersistentHandle(v8::Handle<v8::Object>, const
WrapperTypeInfo*, ScriptWrappableBase* internalPointer, PersistentNode*); | 63 static void setNativeInfoWithPersistentHandle(v8::Handle<v8::Object>, const
WrapperTypeInfo*, ScriptWrappableBase* internalPointer, WrapperPersistentNode*); |
| 64 static void clearNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*); | 64 static void clearNativeInfo(v8::Handle<v8::Object>, const WrapperTypeInfo*); |
| 65 | 65 |
| 66 static bool isDOMWrapper(v8::Handle<v8::Value>); | 66 static bool isDOMWrapper(v8::Handle<v8::Value>); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, const Wr
apperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* internalPointer) | 69 inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, const Wr
apperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* internalPointer) |
| 70 { | 70 { |
| 71 ASSERT(wrapper->InternalFieldCount() >= 2); | 71 ASSERT(wrapper->InternalFieldCount() >= 2); |
| 72 ASSERT(internalPointer); | 72 ASSERT(internalPointer); |
| 73 ASSERT(wrapperTypeInfo); | 73 ASSERT(wrapperTypeInfo); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 97 wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount()
- 1, 0); | 97 wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount()
- 1, 0); |
| 98 } else if (wrapperTypeInfo->gcType == WillBeGarbageCollectedObject) { | 98 } else if (wrapperTypeInfo->gcType == WillBeGarbageCollectedObject) { |
| 99 #if ENABLE(OILPAN) | 99 #if ENABLE(OILPAN) |
| 100 wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount()
- 1, 0); | 100 wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount()
- 1, 0); |
| 101 #endif | 101 #endif |
| 102 } | 102 } |
| 103 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalP
ointer); | 103 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalP
ointer); |
| 104 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<
WrapperTypeInfo*>(wrapperTypeInfo)); | 104 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<
WrapperTypeInfo*>(wrapperTypeInfo)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 inline void V8DOMWrapper::setNativeInfoWithPersistentHandle(v8::Handle<v8::Objec
t> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* interna
lPointer, PersistentNode* handle) | 107 inline void V8DOMWrapper::setNativeInfoWithPersistentHandle(v8::Handle<v8::Objec
t> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappableBase* interna
lPointer, WrapperPersistentNode* handle) |
| 108 { | 108 { |
| 109 ASSERT(wrapper->InternalFieldCount() >= 3); | 109 ASSERT(wrapper->InternalFieldCount() >= 3); |
| 110 ASSERT(internalPointer); | 110 ASSERT(internalPointer); |
| 111 ASSERT(wrapperTypeInfo); | 111 ASSERT(wrapperTypeInfo); |
| 112 #if ENABLE(OILPAN) | 112 #if ENABLE(OILPAN) |
| 113 ASSERT(wrapperTypeInfo->gcType == WillBeGarbageCollectedObject || wrapperTyp
eInfo->gcType == GarbageCollectedObject); | 113 ASSERT(wrapperTypeInfo->gcType == WillBeGarbageCollectedObject || wrapperTyp
eInfo->gcType == GarbageCollectedObject); |
| 114 #else | 114 #else |
| 115 ASSERT(wrapperTypeInfo->gcType == GarbageCollectedObject); | 115 ASSERT(wrapperTypeInfo->gcType == GarbageCollectedObject); |
| 116 #endif | 116 #endif |
| 117 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalP
ointer); | 117 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, internalP
ointer); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 136 setNativeInfo(wrapper, wrapperTypeInfo, V8T::toInternalPointer(object.get())
); | 136 setNativeInfo(wrapper, wrapperTypeInfo, V8T::toInternalPointer(object.get())
); |
| 137 ASSERT(isDOMWrapper(wrapper)); | 137 ASSERT(isDOMWrapper(wrapper)); |
| 138 WrapperConfiguration configuration = buildWrapperConfiguration(object.get(),
lifetime); | 138 WrapperConfiguration configuration = buildWrapperConfiguration(object.get(),
lifetime); |
| 139 DOMDataStore::setWrapper<V8T>(object.leakRef(), wrapper, isolate, configurat
ion); | 139 DOMDataStore::setWrapper<V8T>(object.leakRef(), wrapper, isolate, configurat
ion); |
| 140 return wrapper; | 140 return wrapper; |
| 141 } | 141 } |
| 142 | 142 |
| 143 template<typename V8T, typename T> | 143 template<typename V8T, typename T> |
| 144 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(T* object
, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Is
olate* isolate, WrapperConfiguration::Lifetime lifetime) | 144 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(T* object
, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Is
olate* isolate, WrapperConfiguration::Lifetime lifetime) |
| 145 { | 145 { |
| 146 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, V8T::toInternalP
ointer(object), new Persistent<T>(object)); | 146 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, V8T::toInternalP
ointer(object), new WrapperPersistent<T>(object)); |
| 147 ASSERT(isDOMWrapper(wrapper)); | 147 ASSERT(isDOMWrapper(wrapper)); |
| 148 WrapperConfiguration configuration = buildWrapperConfiguration(object, lifet
ime); | 148 WrapperConfiguration configuration = buildWrapperConfiguration(object, lifet
ime); |
| 149 DOMDataStore::setWrapper<V8T>(object, wrapper, isolate, configuration); | 149 DOMDataStore::setWrapper<V8T>(object, wrapper, isolate, configuration); |
| 150 return wrapper; | 150 return wrapper; |
| 151 } | 151 } |
| 152 | 152 |
| 153 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplat
e(ScriptWrappable* impl, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::
Object> wrapper, v8::Isolate* isolate, WrapperConfiguration::Lifetime lifetime) | 153 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplat
e(ScriptWrappable* impl, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::
Object> wrapper, v8::Isolate* isolate, WrapperConfiguration::Lifetime lifetime) |
| 154 { | 154 { |
| 155 #if ENABLE(OILPAN) | 155 #if ENABLE(OILPAN) |
| 156 if (wrapperTypeInfo->gcType == RefCountedObject) | 156 if (wrapperTypeInfo->gcType == RefCountedObject) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 v8::Handle<v8::Context> context() const { return m_context; } | 218 v8::Handle<v8::Context> context() const { return m_context; } |
| 219 | 219 |
| 220 private: | 220 private: |
| 221 bool m_didEnterContext; | 221 bool m_didEnterContext; |
| 222 v8::Handle<v8::Context> m_context; | 222 v8::Handle<v8::Context> m_context; |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 } // namespace blink | 225 } // namespace blink |
| 226 | 226 |
| 227 #endif // V8DOMWrapper_h | 227 #endif // V8DOMWrapper_h |
| OLD | NEW |