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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/WrapperTypeInfo.h

Issue 2693893007: binding: Changes the association among global-proxy/global/window-instance (2nd attempt). (Closed)
Patch Set: Fixed a typo in DOMWrapperWorld::DissociateDOMWindowWrappersInAllWorlds. Created 3 years, 8 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
OLDNEW
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 DomTemplateFunction dom_template_function; 174 DomTemplateFunction dom_template_function;
175 const TraceFunction trace_function; 175 const TraceFunction trace_function;
176 const TraceWrappersFunction trace_wrappers_function; 176 const TraceWrappersFunction trace_wrappers_function;
177 PreparePrototypeAndInterfaceObjectFunction 177 PreparePrototypeAndInterfaceObjectFunction
178 prepare_prototype_and_interface_object_function; 178 prepare_prototype_and_interface_object_function;
179 const char* const interface_name; 179 const char* const interface_name;
180 const WrapperTypeInfo* parent_class; 180 const WrapperTypeInfo* parent_class;
181 const unsigned wrapper_type_prototype : 1; // WrapperTypePrototype 181 const unsigned wrapper_type_prototype : 1; // WrapperTypePrototype
182 const unsigned wrapper_class_id : 2; // WrapperClassId 182 const unsigned wrapper_class_id : 2; // WrapperClassId
183 const unsigned 183 const unsigned // ActiveScriptWrappableInheritance
184 active_script_wrappable_inheritance : 1; // ActiveScriptWrappableInherita nce 184 active_script_wrappable_inheritance : 1;
185 const unsigned lifetime : 1; // Lifetime 185 const unsigned lifetime : 1; // Lifetime
186 }; 186 };
187 187
188 template <typename T, int offset> 188 template <typename T, int offset>
189 inline T* GetInternalField(const v8::PersistentBase<v8::Object>& persistent) { 189 inline T* GetInternalField(const v8::PersistentBase<v8::Object>& persistent) {
190 DCHECK_LT(offset, v8::Object::InternalFieldCount(persistent)); 190 DCHECK_LT(offset, v8::Object::InternalFieldCount(persistent));
191 return reinterpret_cast<T*>( 191 return reinterpret_cast<T*>(
192 v8::Object::GetAlignedPointerFromInternalField(persistent, offset)); 192 v8::Object::GetAlignedPointerFromInternalField(persistent, offset));
193 } 193 }
194 194
195 template <typename T, int offset> 195 template <typename T, int offset>
196 inline T* GetInternalField(v8::Local<v8::Object> wrapper) { 196 inline T* GetInternalField(v8::Local<v8::Object> wrapper) {
197 DCHECK_LT(offset, wrapper->InternalFieldCount()); 197 DCHECK_LT(offset, wrapper->InternalFieldCount());
198 return reinterpret_cast<T*>( 198 return reinterpret_cast<T*>(
199 wrapper->GetAlignedPointerFromInternalField(offset)); 199 wrapper->GetAlignedPointerFromInternalField(offset));
200 } 200 }
201 201
202 // The return value can be null if |wrapper| is a global proxy, which points to
203 // nothing while a navigation.
202 inline ScriptWrappable* ToScriptWrappable( 204 inline ScriptWrappable* ToScriptWrappable(
203 const v8::PersistentBase<v8::Object>& wrapper) { 205 const v8::PersistentBase<v8::Object>& wrapper) {
204 return GetInternalField<ScriptWrappable, kV8DOMWrapperObjectIndex>(wrapper); 206 return GetInternalField<ScriptWrappable, kV8DOMWrapperObjectIndex>(wrapper);
205 } 207 }
206 208
207 inline ScriptWrappable* ToScriptWrappable(v8::Local<v8::Object> wrapper) { 209 inline ScriptWrappable* ToScriptWrappable(v8::Local<v8::Object> wrapper) {
208 return GetInternalField<ScriptWrappable, kV8DOMWrapperObjectIndex>(wrapper); 210 return GetInternalField<ScriptWrappable, kV8DOMWrapperObjectIndex>(wrapper);
209 } 211 }
210 212
211 inline const WrapperTypeInfo* ToWrapperTypeInfo( 213 inline const WrapperTypeInfo* ToWrapperTypeInfo(
212 const v8::PersistentBase<v8::Object>& wrapper) { 214 const v8::PersistentBase<v8::Object>& wrapper) {
213 return GetInternalField<WrapperTypeInfo, kV8DOMWrapperTypeIndex>(wrapper); 215 return GetInternalField<WrapperTypeInfo, kV8DOMWrapperTypeIndex>(wrapper);
214 } 216 }
215 217
216 inline const WrapperTypeInfo* ToWrapperTypeInfo(v8::Local<v8::Object> wrapper) { 218 inline const WrapperTypeInfo* ToWrapperTypeInfo(v8::Local<v8::Object> wrapper) {
217 return GetInternalField<WrapperTypeInfo, kV8DOMWrapperTypeIndex>(wrapper); 219 return GetInternalField<WrapperTypeInfo, kV8DOMWrapperTypeIndex>(wrapper);
218 } 220 }
219 221
220 } // namespace blink 222 } // namespace blink
221 223
222 #endif // WrapperTypeInfo_h 224 #endif // WrapperTypeInfo_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/WindowProxy.h ('k') | third_party/WebKit/Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698