Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: Source/bindings/core/v8/V8DOMWrapper.h

Issue 537403002: bindings: Renames from/toInternalPointer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/core/v8/V8BindingTest.cpp ('k') | Source/bindings/core/v8/V8GCController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 ASSERT(wrapperTypeInfo); 126 ASSERT(wrapperTypeInfo);
127 // clearNativeInfo() is used only by NP objects, which are not garbage colle cted. 127 // clearNativeInfo() is used only by NP objects, which are not garbage colle cted.
128 ASSERT(wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject); 128 ASSERT(wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject);
129 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast< WrapperTypeInfo*>(wrapperTypeInfo)); 129 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast< WrapperTypeInfo*>(wrapperTypeInfo));
130 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, 0); 130 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, 0);
131 } 131 }
132 132
133 template<typename V8T, typename T> 133 template<typename V8T, typename T>
134 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(PassRefPt r<T> object, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrap per, v8::Isolate* isolate) 134 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(PassRefPt r<T> object, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrap per, v8::Isolate* isolate)
135 { 135 {
136 setNativeInfo(wrapper, wrapperTypeInfo, V8T::toInternalPointer(object.get()) ); 136 setNativeInfo(wrapper, wrapperTypeInfo, V8T::toScriptWrappableBase(object.ge t()));
137 ASSERT(isDOMWrapper(wrapper)); 137 ASSERT(isDOMWrapper(wrapper));
138 DOMDataStore::setWrapper<V8T>(object.leakRef(), wrapper, isolate, wrapperTyp eInfo); 138 DOMDataStore::setWrapper<V8T>(object.leakRef(), wrapper, isolate, wrapperTyp eInfo);
139 return wrapper; 139 return wrapper;
140 } 140 }
141 141
142 template<typename V8T, typename T> 142 template<typename V8T, typename T>
143 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(T* object , const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Is olate* isolate) 143 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(T* object , const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wrapper, v8::Is olate* isolate)
144 { 144 {
145 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, V8T::toInternalP ointer(object), new WrapperPersistent<T>(object)); 145 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, V8T::toScriptWra ppableBase(object), new WrapperPersistent<T>(object));
146 ASSERT(isDOMWrapper(wrapper)); 146 ASSERT(isDOMWrapper(wrapper));
147 DOMDataStore::setWrapper<V8T>(object, wrapper, isolate, wrapperTypeInfo); 147 DOMDataStore::setWrapper<V8T>(object, wrapper, isolate, wrapperTypeInfo);
148 return wrapper; 148 return wrapper;
149 } 149 }
150 150
151 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplat e(ScriptWrappable* impl, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8:: Object> wrapper, v8::Isolate* isolate) 151 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplat e(ScriptWrappable* impl, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8:: Object> wrapper, v8::Isolate* isolate)
152 { 152 {
153 #if ENABLE(OILPAN) 153 #if ENABLE(OILPAN)
154 if (wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject) 154 if (wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject)
155 setNativeInfo(wrapper, wrapperTypeInfo, impl->toInternalPointer()); 155 setNativeInfo(wrapper, wrapperTypeInfo, impl->toScriptWrappableBase());
156 else 156 else
157 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, impl->toInte rnalPointer(), wrapperTypeInfo->createPersistentHandle(impl)); 157 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, impl->toScri ptWrappableBase(), wrapperTypeInfo->createPersistentHandle(impl));
158 #else 158 #else
159 if (wrapperTypeInfo->gcType != WrapperTypeInfo::GarbageCollectedObject) 159 if (wrapperTypeInfo->gcType != WrapperTypeInfo::GarbageCollectedObject)
160 setNativeInfo(wrapper, wrapperTypeInfo, impl->toInternalPointer()); 160 setNativeInfo(wrapper, wrapperTypeInfo, impl->toScriptWrappableBase());
161 else 161 else
162 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, impl->toInte rnalPointer(), wrapperTypeInfo->createPersistentHandle(impl)); 162 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, impl->toScri ptWrappableBase(), wrapperTypeInfo->createPersistentHandle(impl));
163 #endif 163 #endif
164 ASSERT(isDOMWrapper(wrapper)); 164 ASSERT(isDOMWrapper(wrapper));
165 DOMDataStore::setWrapperNonTemplate(impl, wrapper, isolate, wrapperTypeInfo) ; 165 DOMDataStore::setWrapperNonTemplate(impl, wrapper, isolate, wrapperTypeInfo) ;
166 return wrapper; 166 return wrapper;
167 } 167 }
168 168
169 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplat e(Node* node, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wra pper, v8::Isolate* isolate) 169 inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapperNonTemplat e(Node* node, const WrapperTypeInfo* wrapperTypeInfo, v8::Handle<v8::Object> wra pper, v8::Isolate* isolate)
170 { 170 {
171 #if ENABLE(OILPAN) 171 #if ENABLE(OILPAN)
172 if (wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject) 172 if (wrapperTypeInfo->gcType == WrapperTypeInfo::RefCountedObject)
173 setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node )->toInternalPointer()); 173 setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node )->toScriptWrappableBase());
174 else 174 else
175 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, ScriptWrappa ble::fromObject(node)->toInternalPointer(), wrapperTypeInfo->createPersistentHan dle(ScriptWrappable::fromObject(node))); 175 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, ScriptWrappa ble::fromObject(node)->toScriptWrappableBase(), wrapperTypeInfo->createPersisten tHandle(ScriptWrappable::fromObject(node)));
176 #else 176 #else
177 if (wrapperTypeInfo->gcType != WrapperTypeInfo::GarbageCollectedObject) 177 if (wrapperTypeInfo->gcType != WrapperTypeInfo::GarbageCollectedObject)
178 setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node )->toInternalPointer()); 178 setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromObject(node )->toScriptWrappableBase());
179 else 179 else
180 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, ScriptWrappa ble::fromObject(node)->toInternalPointer(), wrapperTypeInfo->createPersistentHan dle(ScriptWrappable::fromObject(node))); 180 setNativeInfoWithPersistentHandle(wrapper, wrapperTypeInfo, ScriptWrappa ble::fromObject(node)->toScriptWrappableBase(), wrapperTypeInfo->createPersisten tHandle(ScriptWrappable::fromObject(node)));
181 #endif 181 #endif
182 ASSERT(isDOMWrapper(wrapper)); 182 ASSERT(isDOMWrapper(wrapper));
183 DOMDataStore::setWrapperNonTemplate(node, wrapper, isolate, wrapperTypeInfo) ; 183 DOMDataStore::setWrapperNonTemplate(node, wrapper, isolate, wrapperTypeInfo) ;
184 return wrapper; 184 return wrapper;
185 } 185 }
186 186
187 class V8WrapperInstantiationScope { 187 class V8WrapperInstantiationScope {
188 public: 188 public:
189 V8WrapperInstantiationScope(v8::Handle<v8::Object> creationContext, v8::Isol ate* isolate) 189 V8WrapperInstantiationScope(v8::Handle<v8::Object> creationContext, v8::Isol ate* isolate)
190 : m_didEnterContext(false) 190 : m_didEnterContext(false)
(...skipping 23 matching lines...) Expand all
214 v8::Handle<v8::Context> context() const { return m_context; } 214 v8::Handle<v8::Context> context() const { return m_context; }
215 215
216 private: 216 private:
217 bool m_didEnterContext; 217 bool m_didEnterContext;
218 v8::Handle<v8::Context> m_context; 218 v8::Handle<v8::Context> m_context;
219 }; 219 };
220 220
221 } // namespace blink 221 } // namespace blink
222 222
223 #endif // V8DOMWrapper_h 223 #endif // V8DOMWrapper_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8BindingTest.cpp ('k') | Source/bindings/core/v8/V8GCController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698