| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 { | 80 { |
| 81 // see V8WindowShell::installDOMWindow() comment for why this version is
needed and safe. | 81 // see V8WindowShell::installDOMWindow() comment for why this version is
needed and safe. |
| 82 ASSERT(wrapper->InternalFieldCount() >= 2); | 82 ASSERT(wrapper->InternalFieldCount() >= 2); |
| 83 ASSERT(object); | 83 ASSERT(object); |
| 84 ASSERT(wrapperTypeInfo); | 84 ASSERT(wrapperTypeInfo); |
| 85 #if ENABLE(OILPAN) | 85 #if ENABLE(OILPAN) |
| 86 ASSERT(wrapperTypeInfo->gcType != RefCountedObject); | 86 ASSERT(wrapperTypeInfo->gcType != RefCountedObject); |
| 87 #else | 87 #else |
| 88 ASSERT(wrapperTypeInfo->gcType == RefCountedObject || wrapperTypeInfo->g
cType == WillBeGarbageCollectedObject); | 88 ASSERT(wrapperTypeInfo->gcType == RefCountedObject || wrapperTypeInfo->g
cType == WillBeGarbageCollectedObject); |
| 89 #endif | 89 #endif |
| 90 |
| 91 // Clear out the last internal field, which is assumed to contain a vali
d persistent pointer value. |
| 92 if (wrapperTypeInfo->gcType == GarbageCollectedObject) { |
| 93 wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCoun
t() - 1, 0); |
| 94 } else if (wrapperTypeInfo->gcType == WillBeGarbageCollectedObject) { |
| 95 #if ENABLE(OILPAN) |
| 96 wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCoun
t() - 1, 0); |
| 97 #endif |
| 98 } |
| 90 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, objec
t); | 99 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, objec
t); |
| 91 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_c
ast<WrapperTypeInfo*>(wrapperTypeInfo)); | 100 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_c
ast<WrapperTypeInfo*>(wrapperTypeInfo)); |
| 92 // Clear out the last internal field, which is assumed to contain a vali
d persistent pointer value. | |
| 93 wrapper->SetAlignedPointerInInternalField(wrapper->InternalFieldCount()
- 1, 0); | |
| 94 } | 101 } |
| 95 | 102 |
| 96 inline void V8DOMWrapper::setNativeInfoWithPersistentHandle(v8::Handle<v8::O
bject> wrapper, const WrapperTypeInfo* wrapperTypeInfo, void* object, Persistent
Node* handle) | 103 inline void V8DOMWrapper::setNativeInfoWithPersistentHandle(v8::Handle<v8::O
bject> wrapper, const WrapperTypeInfo* wrapperTypeInfo, void* object, Persistent
Node* handle) |
| 97 { | 104 { |
| 98 ASSERT(wrapper->InternalFieldCount() >= 3); | 105 ASSERT(wrapper->InternalFieldCount() >= 3); |
| 99 ASSERT(object); | 106 ASSERT(object); |
| 100 ASSERT(wrapperTypeInfo); | 107 ASSERT(wrapperTypeInfo); |
| 101 ASSERT(wrapperTypeInfo->gcType != RefCountedObject); | 108 ASSERT(wrapperTypeInfo->gcType != RefCountedObject); |
| 102 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, objec
t); | 109 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, objec
t); |
| 103 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_c
ast<WrapperTypeInfo*>(wrapperTypeInfo)); | 110 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_c
ast<WrapperTypeInfo*>(wrapperTypeInfo)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 v8::Handle<v8::Context> context() const { return m_context; } | 173 v8::Handle<v8::Context> context() const { return m_context; } |
| 167 | 174 |
| 168 private: | 175 private: |
| 169 bool m_didEnterContext; | 176 bool m_didEnterContext; |
| 170 v8::Handle<v8::Context> m_context; | 177 v8::Handle<v8::Context> m_context; |
| 171 }; | 178 }; |
| 172 | 179 |
| 173 } | 180 } |
| 174 | 181 |
| 175 #endif // V8DOMWrapper_h | 182 #endif // V8DOMWrapper_h |
| OLD | NEW |