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

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

Issue 1372373002: bindings: Reduces the custom registration of methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 static const int v8DefaultWrapperInternalFieldCount = static_cast<int>(gin::kNum berOfInternalFields); 50 static const int v8DefaultWrapperInternalFieldCount = static_cast<int>(gin::kNum berOfInternalFields);
51 static const int v8PrototypeTypeIndex = 0; 51 static const int v8PrototypeTypeIndex = 0;
52 static const int v8PrototypeInternalFieldcount = 1; 52 static const int v8PrototypeInternalFieldcount = 1;
53 53
54 typedef v8::Local<v8::FunctionTemplate> (*DomTemplateFunction)(v8::Isolate*); 54 typedef v8::Local<v8::FunctionTemplate> (*DomTemplateFunction)(v8::Isolate*);
55 typedef void (*RefObjectFunction)(ScriptWrappable*); 55 typedef void (*RefObjectFunction)(ScriptWrappable*);
56 typedef void (*DerefObjectFunction)(ScriptWrappable*); 56 typedef void (*DerefObjectFunction)(ScriptWrappable*);
57 typedef void (*TraceFunction)(Visitor*, ScriptWrappable*); 57 typedef void (*TraceFunction)(Visitor*, ScriptWrappable*);
58 typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Local<v8::Object>); 58 typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Local<v8::Object>);
59 typedef void (*ResolveWrapperReachabilityFunction)(v8::Isolate*, ScriptWrappable *, const v8::Persistent<v8::Object>&); 59 typedef void (*ResolveWrapperReachabilityFunction)(v8::Isolate*, ScriptWrappable *, const v8::Persistent<v8::Object>&);
60 typedef void (*PreparePrototypeObjectFunction)(v8::Isolate*, v8::Local<v8::Objec t>, v8::Local<v8::FunctionTemplate>); 60 typedef void (*PreparePrototypeAndInterfaceObjectFunction)(v8::Isolate*, v8::Loc al<v8::Object>, v8::Local<v8::Function>, v8::Local<v8::FunctionTemplate>);
61 typedef void (*InstallConditionallyEnabledPropertiesFunction)(v8::Local<v8::Obje ct>, v8::Isolate*); 61 typedef void (*InstallConditionallyEnabledPropertiesFunction)(v8::Local<v8::Obje ct>, v8::Isolate*);
62 62
63 inline void setObjectGroup(v8::Isolate* isolate, ScriptWrappable* scriptWrappabl e, const v8::Persistent<v8::Object>& wrapper) 63 inline void setObjectGroup(v8::Isolate* isolate, ScriptWrappable* scriptWrappabl e, const v8::Persistent<v8::Object>& wrapper)
64 { 64 {
65 isolate->SetObjectGroupId(wrapper, v8::UniqueId(reinterpret_cast<intptr_t>(s criptWrappable))); 65 isolate->SetObjectGroupId(wrapper, v8::UniqueId(reinterpret_cast<intptr_t>(s criptWrappable)));
66 } 66 }
67 67
68 // This struct provides a way to store a bunch of information that is helpful wh en unwrapping 68 // This struct provides a way to store a bunch of information that is helpful wh en unwrapping
69 // v8 objects. Each v8 bindings class has exactly one static WrapperTypeInfo mem ber, so 69 // v8 objects. Each v8 bindings class has exactly one static WrapperTypeInfo mem ber, so
70 // comparing pointers is a safe way to determine if types match. 70 // comparing pointers is a safe way to determine if types match.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 ASSERT(isGarbageCollected()); 162 ASSERT(isGarbageCollected());
163 Heap::decreaseWrapperCount(1); 163 Heap::decreaseWrapperCount(1);
164 } 164 }
165 165
166 void trace(Visitor* visitor, ScriptWrappable* scriptWrappable) const 166 void trace(Visitor* visitor, ScriptWrappable* scriptWrappable) const
167 { 167 {
168 ASSERT(traceFunction); 168 ASSERT(traceFunction);
169 return traceFunction(visitor, scriptWrappable); 169 return traceFunction(visitor, scriptWrappable);
170 } 170 }
171 171
172 void preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prot otypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) const 172 void preparePrototypeAndInterfaceObject(v8::Isolate* isolate, v8::Local<v8:: Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8:: FunctionTemplate> interfaceTemplate) const
173 { 173 {
174 if (preparePrototypeObjectFunction) 174 if (preparePrototypeAndInterfaceObjectFunction)
175 preparePrototypeObjectFunction(isolate, prototypeObject, interfaceTe mplate); 175 preparePrototypeAndInterfaceObjectFunction(isolate, prototypeObject, interfaceObject, interfaceTemplate);
176 } 176 }
177 177
178 void installConditionallyEnabledProperties(v8::Local<v8::Object> prototypeOb ject, v8::Isolate* isolate) const 178 void installConditionallyEnabledProperties(v8::Local<v8::Object> prototypeOb ject, v8::Isolate* isolate) const
179 { 179 {
180 if (installConditionallyEnabledPropertiesFunction) 180 if (installConditionallyEnabledPropertiesFunction)
181 installConditionallyEnabledPropertiesFunction(prototypeObject, isola te); 181 installConditionallyEnabledPropertiesFunction(prototypeObject, isola te);
182 } 182 }
183 183
184 ActiveDOMObject* toActiveDOMObject(v8::Local<v8::Object> object) const 184 ActiveDOMObject* toActiveDOMObject(v8::Local<v8::Object> object) const
185 { 185 {
(...skipping 14 matching lines...) Expand all
200 200
201 // This field must be the first member of the struct WrapperTypeInfo. This i s also checked by a static_assert() below. 201 // This field must be the first member of the struct WrapperTypeInfo. This i s also checked by a static_assert() below.
202 const gin::GinEmbedder ginEmbedder; 202 const gin::GinEmbedder ginEmbedder;
203 203
204 DomTemplateFunction domTemplateFunction; 204 DomTemplateFunction domTemplateFunction;
205 const RefObjectFunction refObjectFunction; 205 const RefObjectFunction refObjectFunction;
206 const DerefObjectFunction derefObjectFunction; 206 const DerefObjectFunction derefObjectFunction;
207 const TraceFunction traceFunction; 207 const TraceFunction traceFunction;
208 const ToActiveDOMObjectFunction toActiveDOMObjectFunction; 208 const ToActiveDOMObjectFunction toActiveDOMObjectFunction;
209 const ResolveWrapperReachabilityFunction visitDOMWrapperFunction; 209 const ResolveWrapperReachabilityFunction visitDOMWrapperFunction;
210 PreparePrototypeObjectFunction preparePrototypeObjectFunction; 210 PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfaceObjec tFunction;
211 const InstallConditionallyEnabledPropertiesFunction installConditionallyEnab ledPropertiesFunction; 211 const InstallConditionallyEnabledPropertiesFunction installConditionallyEnab ledPropertiesFunction;
212 const char* const interfaceName; 212 const char* const interfaceName;
213 const WrapperTypeInfo* parentClass; 213 const WrapperTypeInfo* parentClass;
214 const unsigned wrapperTypePrototype : 1; // WrapperTypePrototype 214 const unsigned wrapperTypePrototype : 1; // WrapperTypePrototype
215 const unsigned wrapperClassId : 2; // WrapperClassId 215 const unsigned wrapperClassId : 2; // WrapperClassId
216 const unsigned eventTargetInheritance : 1; // EventTargetInheritance 216 const unsigned eventTargetInheritance : 1; // EventTargetInheritance
217 const unsigned lifetime : 1; // Lifetime 217 const unsigned lifetime : 1; // Lifetime
218 const unsigned gcType : 2; // GCType 218 const unsigned gcType : 2; // GCType
219 }; 219 };
220 220
(...skipping 27 matching lines...) Expand all
248 } 248 }
249 249
250 inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Local<v8::Object> wrapper) 250 inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Local<v8::Object> wrapper)
251 { 251 {
252 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); 252 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper);
253 } 253 }
254 254
255 } // namespace blink 255 } // namespace blink
256 256
257 #endif // WrapperTypeInfo_h 257 #endif // WrapperTypeInfo_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698