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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 static const int v8DefaultWrapperInternalFieldCount = static_cast<int>(gin::kNum
berOfInternalFields); | 47 static const int v8DefaultWrapperInternalFieldCount = static_cast<int>(gin::kNum
berOfInternalFields); |
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 typedef v8::Handle<v8::FunctionTemplate> (*DomTemplateFunction)(v8::Isolate*); | 51 typedef v8::Handle<v8::FunctionTemplate> (*DomTemplateFunction)(v8::Isolate*); |
52 typedef void (*RefObjectFunction)(ScriptWrappable*); | 52 typedef void (*RefObjectFunction)(ScriptWrappable*); |
53 typedef void (*DerefObjectFunction)(ScriptWrappable*); | 53 typedef void (*DerefObjectFunction)(ScriptWrappable*); |
54 typedef void (*TraceFunction)(Visitor*, ScriptWrappable*); | 54 typedef void (*TraceFunction)(Visitor*, ScriptWrappable*); |
55 typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>); | 55 typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>); |
56 typedef void (*ResolveWrapperReachabilityFunction)(v8::Isolate*, ScriptWrappable
*, const v8::Persistent<v8::Object>&); | 56 typedef void (*ResolveWrapperReachabilityFunction)(v8::Isolate*, ScriptWrappable
*, const v8::Persistent<v8::Object>&); |
57 typedef void (*InstallConditionallyEnabledMethodsFunction)(v8::Handle<v8::Object
>, v8::Isolate*); | 57 typedef void (*InstallConditionallyEnabledMethodsFunction)(v8::Local<v8::Object>
, v8::Isolate*); |
58 typedef void (*InstallConditionallyEnabledPropertiesFunction)(v8::Handle<v8::Obj
ect>, v8::Isolate*); | 58 typedef void (*InstallConditionallyEnabledPropertiesFunction)(v8::Local<v8::Obje
ct>, v8::Isolate*); |
59 | 59 |
60 inline void setObjectGroup(v8::Isolate* isolate, ScriptWrappable* scriptWrappabl
e, const v8::Persistent<v8::Object>& wrapper) | 60 inline void setObjectGroup(v8::Isolate* isolate, ScriptWrappable* scriptWrappabl
e, const v8::Persistent<v8::Object>& wrapper) |
61 { | 61 { |
62 isolate->SetObjectGroupId(wrapper, v8::UniqueId(reinterpret_cast<intptr_t>(s
criptWrappable))); | 62 isolate->SetObjectGroupId(wrapper, v8::UniqueId(reinterpret_cast<intptr_t>(s
criptWrappable))); |
63 } | 63 } |
64 | 64 |
65 // This struct provides a way to store a bunch of information that is helpful wh
en unwrapping | 65 // This struct provides a way to store a bunch of information that is helpful wh
en unwrapping |
66 // v8 objects. Each v8 bindings class has exactly one static WrapperTypeInfo mem
ber, so | 66 // v8 objects. Each v8 bindings class has exactly one static WrapperTypeInfo mem
ber, so |
67 // comparing pointers is a safe way to determine if types match. | 67 // comparing pointers is a safe way to determine if types match. |
68 struct WrapperTypeInfo { | 68 struct WrapperTypeInfo { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 ASSERT(derefObjectFunction); | 135 ASSERT(derefObjectFunction); |
136 derefObjectFunction(scriptWrappable); | 136 derefObjectFunction(scriptWrappable); |
137 } | 137 } |
138 | 138 |
139 void trace(Visitor* visitor, ScriptWrappable* scriptWrappable) const | 139 void trace(Visitor* visitor, ScriptWrappable* scriptWrappable) const |
140 { | 140 { |
141 ASSERT(traceFunction); | 141 ASSERT(traceFunction); |
142 return traceFunction(visitor, scriptWrappable); | 142 return traceFunction(visitor, scriptWrappable); |
143 } | 143 } |
144 | 144 |
145 void installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeTemp
late, v8::Isolate* isolate) const | 145 void installConditionallyEnabledMethods(v8::Local<v8::Object> prototypeTempl
ate, v8::Isolate* isolate) const |
146 { | 146 { |
147 if (installConditionallyEnabledMethodsFunction) | 147 if (installConditionallyEnabledMethodsFunction) |
148 installConditionallyEnabledMethodsFunction(prototypeTemplate, isolat
e); | 148 installConditionallyEnabledMethodsFunction(prototypeTemplate, isolat
e); |
149 } | 149 } |
150 | 150 |
151 void installConditionallyEnabledProperties(v8::Handle<v8::Object> prototypeT
emplate, v8::Isolate* isolate) const | 151 void installConditionallyEnabledProperties(v8::Local<v8::Object> prototypeTe
mplate, v8::Isolate* isolate) const |
152 { | 152 { |
153 if (installConditionallyEnabledPropertiesFunction) | 153 if (installConditionallyEnabledPropertiesFunction) |
154 installConditionallyEnabledPropertiesFunction(prototypeTemplate, iso
late); | 154 installConditionallyEnabledPropertiesFunction(prototypeTemplate, iso
late); |
155 } | 155 } |
156 | 156 |
157 ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object> object) const | 157 ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object> object) const |
158 { | 158 { |
159 if (!toActiveDOMObjectFunction) | 159 if (!toActiveDOMObjectFunction) |
160 return 0; | 160 return 0; |
161 return toActiveDOMObjectFunction(object); | 161 return toActiveDOMObjectFunction(object); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |