| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 static const int v8PrototypeTypeIndex = 0; | 48 static const int v8PrototypeTypeIndex = 0; |
| 49 static const int v8PrototypeInternalFieldcount = 1; | 49 static const int v8PrototypeInternalFieldcount = 1; |
| 50 | 50 |
| 51 static const uint16_t v8DOMNodeClassId = 1; | 51 static const uint16_t v8DOMNodeClassId = 1; |
| 52 static const uint16_t v8DOMObjectClassId = 2; | 52 static const uint16_t v8DOMObjectClassId = 2; |
| 53 | 53 |
| 54 enum WrapperWorldType { | 54 typedef v8::Handle<v8::FunctionTemplate> (*DomTemplateFunction)(v8::Isolate*
); |
| 55 MainWorld, | |
| 56 IsolatedWorld, | |
| 57 WorkerWorld | |
| 58 }; | |
| 59 | |
| 60 typedef v8::Handle<v8::FunctionTemplate> (*DomTemplateFunction)(v8::Isolate*
, WrapperWorldType); | |
| 61 typedef void (*DerefObjectFunction)(void*); | 55 typedef void (*DerefObjectFunction)(void*); |
| 62 typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>
); | 56 typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>
); |
| 63 typedef EventTarget* (*ToEventTargetFunction)(v8::Handle<v8::Object>); | 57 typedef EventTarget* (*ToEventTargetFunction)(v8::Handle<v8::Object>); |
| 64 typedef void (*ResolveWrapperReachabilityFunction)(void*, const v8::Persiste
nt<v8::Object>&, v8::Isolate*); | 58 typedef void (*ResolveWrapperReachabilityFunction)(void*, const v8::Persiste
nt<v8::Object>&, v8::Isolate*); |
| 65 typedef void (*InstallPerContextEnabledPrototypePropertiesFunction)(v8::Hand
le<v8::Object>, v8::Isolate*); | 59 typedef void (*InstallPerContextEnabledPrototypePropertiesFunction)(v8::Hand
le<v8::Object>, v8::Isolate*); |
| 66 | 60 |
| 67 enum WrapperTypePrototype { | 61 enum WrapperTypePrototype { |
| 68 WrapperTypeObjectPrototype, | 62 WrapperTypeObjectPrototype, |
| 69 WrapperTypeExceptionPrototype | 63 WrapperTypeExceptionPrototype |
| 70 }; | 64 }; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 93 bool isSubclass(const WrapperTypeInfo* that) const | 87 bool isSubclass(const WrapperTypeInfo* that) const |
| 94 { | 88 { |
| 95 for (const WrapperTypeInfo* current = this; current; current = curre
nt->parentClass) { | 89 for (const WrapperTypeInfo* current = this; current; current = curre
nt->parentClass) { |
| 96 if (current == that) | 90 if (current == that) |
| 97 return true; | 91 return true; |
| 98 } | 92 } |
| 99 | 93 |
| 100 return false; | 94 return false; |
| 101 } | 95 } |
| 102 | 96 |
| 103 v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate* isolate, Wrapp
erWorldType worldType) const { return domTemplateFunction(isolate, worldType); } | 97 v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate* isolate) const |
| 98 { |
| 99 return domTemplateFunction(isolate); |
| 100 } |
| 104 | 101 |
| 105 void installPerContextEnabledMethods(v8::Handle<v8::Object> prototypeTem
plate, v8::Isolate* isolate) const | 102 void installPerContextEnabledMethods(v8::Handle<v8::Object> prototypeTem
plate, v8::Isolate* isolate) const |
| 106 { | 103 { |
| 107 if (installPerContextEnabledMethodsFunction) | 104 if (installPerContextEnabledMethodsFunction) |
| 108 installPerContextEnabledMethodsFunction(prototypeTemplate, isola
te); | 105 installPerContextEnabledMethodsFunction(prototypeTemplate, isola
te); |
| 109 } | 106 } |
| 110 | 107 |
| 111 ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object> object) const | 108 ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object> object) const |
| 112 { | 109 { |
| 113 if (!toActiveDOMObjectFunction) | 110 if (!toActiveDOMObjectFunction) |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 228 } |
| 232 | 229 |
| 233 inline WrapperConfiguration buildWrapperConfiguration(Node*, WrapperConfigur
ation::Lifetime lifetime) | 230 inline WrapperConfiguration buildWrapperConfiguration(Node*, WrapperConfigur
ation::Lifetime lifetime) |
| 234 { | 231 { |
| 235 WrapperConfiguration configuration = {v8DOMNodeClassId, lifetime}; | 232 WrapperConfiguration configuration = {v8DOMNodeClassId, lifetime}; |
| 236 return configuration; | 233 return configuration; |
| 237 } | 234 } |
| 238 } | 235 } |
| 239 | 236 |
| 240 #endif // WrapperTypeInfo_h | 237 #endif // WrapperTypeInfo_h |
| OLD | NEW |