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

Side by Side Diff: Source/bindings/v8/WrapperTypeInfo.h

Issue 139173012: Move encryptedmedia module to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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
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 27 matching lines...) Expand all
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 class ActiveDOMObject; 41 class ActiveDOMObject;
42 class EventTarget; 42 class EventTarget;
43 class Node; 43 class Node;
44 44
45 static const int v8DOMWrapperTypeIndex = static_cast<int>(gin::kWrapperInfoI ndex); 45 static const int v8DOMWrapperTypeIndex = static_cast<int>(gin::kWrapperInfoI ndex);
46 static const int v8DOMWrapperObjectIndex = static_cast<int>(gin::kEncodedVal ueIndex); 46 static const int v8DOMWrapperObjectIndex = static_cast<int>(gin::kEncodedVal ueIndex);
47 static const int v8DefaultWrapperInternalFieldCount = static_cast<int>(gin:: kNumberOfInternalFields); 47 static const int v8DefaultWrapperInternalFieldCount = static_cast<int>(gin:: kNumberOfInternalFields);
48 // If we have v8PersistentHandleIndex, it should be the first index of the c ustom internal fields.
49 // This contract is needed to keep the index consistent with generated code.
50 // FIXME: oilpan: Don't add an extra internal field for storing a persistent handle.
51 // Instead we should reuse the internal field of v8DOMWrapperObjectIndex.
52 static const int v8PersistentHandleIndex = v8DefaultWrapperInternalFieldCoun t;
53 static const int v8PrototypeTypeIndex = 0; 48 static const int v8PrototypeTypeIndex = 0;
54 static const int v8PrototypeInternalFieldcount = 1; 49 static const int v8PrototypeInternalFieldcount = 1;
55 50
56 static const uint16_t v8DOMNodeClassId = 1; 51 static const uint16_t v8DOMNodeClassId = 1;
57 static const uint16_t v8DOMObjectClassId = 2; 52 static const uint16_t v8DOMObjectClassId = 2;
58 53
59 enum WrapperWorldType { 54 enum WrapperWorldType {
60 MainWorld, 55 MainWorld,
61 IsolatedWorld, 56 IsolatedWorld,
62 WorkerWorld 57 WorkerWorld
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper) ; 178 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper) ;
184 } 179 }
185 180
186 inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Handle<v8::Object> wrapp er) 181 inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Handle<v8::Object> wrapp er)
187 { 182 {
188 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper) ; 183 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper) ;
189 } 184 }
190 185
191 inline const PersistentNode* toPersistentHandle(const v8::Handle<v8::Object> & wrapper) 186 inline const PersistentNode* toPersistentHandle(const v8::Handle<v8::Object> & wrapper)
192 { 187 {
193 return getInternalField<PersistentNode, v8PersistentHandleIndex>(wrapper ); 188 // Persistent handle is stored in the last internal field.
189 return static_cast<PersistentNode*>(wrapper->GetAlignedPointerFromIntern alField(wrapper->InternalFieldCount() - 1));
194 } 190 }
195 191
196 inline void releaseObject(v8::Handle<v8::Object> wrapper) 192 inline void releaseObject(v8::Handle<v8::Object> wrapper)
197 { 193 {
198 const WrapperTypeInfo* typeInfo = toWrapperTypeInfo(wrapper); 194 const WrapperTypeInfo* typeInfo = toWrapperTypeInfo(wrapper);
199 #if ENABLE(OILPAN) 195 #if ENABLE(OILPAN)
200 if (typeInfo->isGarbageCollected) { 196 if (typeInfo->isGarbageCollected) {
201 const PersistentNode* handle = toPersistentHandle(wrapper); 197 const PersistentNode* handle = toPersistentHandle(wrapper);
202 ASSERT(handle); 198 ASSERT(handle);
203 delete handle; 199 delete handle;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 return configuration; 236 return configuration;
241 } 237 }
242 238
243 template<class ElementType> 239 template<class ElementType>
244 class WrapperTypeTraits { 240 class WrapperTypeTraits {
245 // specialized classes have thier own functions, which are generated by binding generator. 241 // specialized classes have thier own functions, which are generated by binding generator.
246 }; 242 };
247 } 243 }
248 244
249 #endif // WrapperTypeInfo_h 245 #endif // WrapperTypeInfo_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698