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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 EventTarget* toEventTarget(v8::Handle<v8::Object>) const; | 164 EventTarget* toEventTarget(v8::Handle<v8::Object>) const; |
165 | 165 |
166 void visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable,
const v8::Persistent<v8::Object>& wrapper) const | 166 void visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable,
const v8::Persistent<v8::Object>& wrapper) const |
167 { | 167 { |
168 if (!visitDOMWrapperFunction) | 168 if (!visitDOMWrapperFunction) |
169 setObjectGroup(isolate, scriptWrappable, wrapper); | 169 setObjectGroup(isolate, scriptWrappable, wrapper); |
170 else | 170 else |
171 visitDOMWrapperFunction(isolate, scriptWrappable, wrapper); | 171 visitDOMWrapperFunction(isolate, scriptWrappable, wrapper); |
172 } | 172 } |
173 | 173 |
174 // This field must be the first member of the struct WrapperTypeInfo. This i
s also checked by a COMPILE_ASSERT() below. | 174 // This field must be the first member of the struct WrapperTypeInfo. This i
s also checked by a static_assert() below. |
175 const gin::GinEmbedder ginEmbedder; | 175 const gin::GinEmbedder ginEmbedder; |
176 | 176 |
177 DomTemplateFunction domTemplateFunction; | 177 DomTemplateFunction domTemplateFunction; |
178 const RefObjectFunction refObjectFunction; | 178 const RefObjectFunction refObjectFunction; |
179 const DerefObjectFunction derefObjectFunction; | 179 const DerefObjectFunction derefObjectFunction; |
180 const TraceFunction traceFunction; | 180 const TraceFunction traceFunction; |
181 const ToActiveDOMObjectFunction toActiveDOMObjectFunction; | 181 const ToActiveDOMObjectFunction toActiveDOMObjectFunction; |
182 const ResolveWrapperReachabilityFunction visitDOMWrapperFunction; | 182 const ResolveWrapperReachabilityFunction visitDOMWrapperFunction; |
183 InstallConditionallyEnabledMethodsFunction installConditionallyEnabledMethod
sFunction; | 183 InstallConditionallyEnabledMethodsFunction installConditionallyEnabledMethod
sFunction; |
184 const InstallConditionallyEnabledPropertiesFunction installConditionallyEnab
ledPropertiesFunction; | 184 const InstallConditionallyEnabledPropertiesFunction installConditionallyEnab
ledPropertiesFunction; |
185 const WrapperTypeInfo* parentClass; | 185 const WrapperTypeInfo* parentClass; |
186 const unsigned wrapperTypePrototype : 1; // WrapperTypePrototype | 186 const unsigned wrapperTypePrototype : 1; // WrapperTypePrototype |
187 const unsigned wrapperClassId : 2; // WrapperClassId | 187 const unsigned wrapperClassId : 2; // WrapperClassId |
188 const unsigned eventTargetInheritance : 1; // EventTargetInheritance | 188 const unsigned eventTargetInheritance : 1; // EventTargetInheritance |
189 const unsigned lifetime : 1; // Lifetime | 189 const unsigned lifetime : 1; // Lifetime |
190 const unsigned gcType : 2; // GCType | 190 const unsigned gcType : 2; // GCType |
191 }; | 191 }; |
192 | 192 |
193 COMPILE_ASSERT(offsetof(struct WrapperTypeInfo, ginEmbedder) == offsetof(struct
gin::WrapperInfo, embedder), wrapper_type_info_compatible_to_gin); | 193 static_assert(offsetof(struct WrapperTypeInfo, ginEmbedder) == offsetof(struct g
in::WrapperInfo, embedder), "offset of WrapperTypeInfo.ginEmbedder must be the s
ame as gin::WrapperInfo.embedder"); |
194 | 194 |
195 template<typename T, int offset> | 195 template<typename T, int offset> |
196 inline T* getInternalField(const v8::Persistent<v8::Object>& persistent) | 196 inline T* getInternalField(const v8::Persistent<v8::Object>& persistent) |
197 { | 197 { |
198 ASSERT(offset < v8::Object::InternalFieldCount(persistent)); | 198 ASSERT(offset < v8::Object::InternalFieldCount(persistent)); |
199 return static_cast<T*>(v8::Object::GetAlignedPointerFromInternalField(persis
tent, offset)); | 199 return static_cast<T*>(v8::Object::GetAlignedPointerFromInternalField(persis
tent, offset)); |
200 } | 200 } |
201 | 201 |
202 template<typename T, int offset> | 202 template<typename T, int offset> |
203 inline T* getInternalField(v8::Handle<v8::Object> wrapper) | 203 inline T* getInternalField(v8::Handle<v8::Object> wrapper) |
(...skipping 23 matching lines...) Expand all Loading... |
227 } | 227 } |
228 | 228 |
229 inline void releaseObject(v8::Handle<v8::Object> wrapper) | 229 inline void releaseObject(v8::Handle<v8::Object> wrapper) |
230 { | 230 { |
231 toWrapperTypeInfo(wrapper)->derefObject(toScriptWrappable(wrapper)); | 231 toWrapperTypeInfo(wrapper)->derefObject(toScriptWrappable(wrapper)); |
232 } | 232 } |
233 | 233 |
234 } // namespace blink | 234 } // namespace blink |
235 | 235 |
236 #endif // WrapperTypeInfo_h | 236 #endif // WrapperTypeInfo_h |
OLD | NEW |