OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 SVGTestInterfaceV8Internal::typeAttributeSetter(jsValue, info); | 102 SVGTestInterfaceV8Internal::typeAttributeSetter(jsValue, info); |
103 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 103 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
104 } | 104 } |
105 | 105 |
106 } // namespace SVGTestInterfaceV8Internal | 106 } // namespace SVGTestInterfaceV8Internal |
107 | 107 |
108 static const V8DOMConfiguration::AttributeConfiguration V8SVGTestInterfaceAttrib
utes[] = { | 108 static const V8DOMConfiguration::AttributeConfiguration V8SVGTestInterfaceAttrib
utes[] = { |
109 {"type", SVGTestInterfaceV8Internal::typeAttributeGetterCallback, SVGTestInt
erfaceV8Internal::typeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCo
ntrol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on insta
nce */}, | 109 {"type", SVGTestInterfaceV8Internal::typeAttributeGetterCallback, SVGTestInt
erfaceV8Internal::typeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCo
ntrol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on insta
nce */}, |
110 }; | 110 }; |
111 | 111 |
112 static void configureV8SVGTestInterfaceTemplate(v8::Handle<v8::FunctionTemplate>
functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 112 static void configureV8SVGTestInterfaceTemplate(v8::Handle<v8::FunctionTemplate>
functionTemplate, v8::Isolate* isolate) |
113 { | 113 { |
114 functionTemplate->ReadOnlyPrototype(); | 114 functionTemplate->ReadOnlyPrototype(); |
115 | 115 |
116 v8::Local<v8::Signature> defaultSignature; | 116 v8::Local<v8::Signature> defaultSignature; |
117 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "SVGTestInterface", v8::Local<v8::FunctionTemplate>(), V8SVGTestInterface::
internalFieldCount, | 117 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "SVGTestInterface", v8::Local<v8::FunctionTemplate>(), V8SVGTestInterface::
internalFieldCount, |
118 V8SVGTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SVGTestInterfaceAttribu
tes), | 118 V8SVGTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SVGTestInterfaceAttribu
tes), |
119 0, 0, | 119 0, 0, |
120 0, 0, | 120 0, 0, |
121 isolate, currentWorldType); | 121 isolate); |
122 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 122 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
123 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 123 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
124 | 124 |
125 // Custom toString template | 125 // Custom toString template |
126 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 126 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
127 } | 127 } |
128 | 128 |
129 v8::Handle<v8::FunctionTemplate> V8SVGTestInterface::domTemplate(v8::Isolate* is
olate, WrapperWorldType currentWorldType) | 129 v8::Handle<v8::FunctionTemplate> V8SVGTestInterface::domTemplate(v8::Isolate* is
olate) |
130 { | 130 { |
131 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 131 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
132 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 132 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
133 if (result != data->templateMap(currentWorldType).end()) | 133 if (result != data->templateMap().end()) |
134 return result->value.newLocal(isolate); | 134 return result->value.newLocal(isolate); |
135 | 135 |
136 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 136 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
137 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 137 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
138 configureV8SVGTestInterfaceTemplate(templ, isolate, currentWorldType); | 138 configureV8SVGTestInterfaceTemplate(templ, isolate); |
139 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 139 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
140 return templ; | 140 return templ; |
141 } | 141 } |
142 | 142 |
143 bool V8SVGTestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate*
isolate) | 143 bool V8SVGTestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate*
isolate) |
144 { | 144 { |
145 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 145 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
146 } | 146 } |
147 | 147 |
148 v8::Handle<v8::Object> V8SVGTestInterface::findInstanceInPrototypeChain(v8::Hand
le<v8::Value> jsValue, v8::Isolate* isolate) | 148 v8::Handle<v8::Object> V8SVGTestInterface::findInstanceInPrototypeChain(v8::Hand
le<v8::Value> jsValue, v8::Isolate* isolate) |
149 { | 149 { |
(...skipping 30 matching lines...) Expand all Loading... |
180 fromInternalPointer(object)->deref(); | 180 fromInternalPointer(object)->deref(); |
181 } | 181 } |
182 | 182 |
183 template<> | 183 template<> |
184 v8::Handle<v8::Value> toV8NoInline(SVGTestInterface* impl, v8::Handle<v8::Object
> creationContext, v8::Isolate* isolate) | 184 v8::Handle<v8::Value> toV8NoInline(SVGTestInterface* impl, v8::Handle<v8::Object
> creationContext, v8::Isolate* isolate) |
185 { | 185 { |
186 return toV8(impl, creationContext, isolate); | 186 return toV8(impl, creationContext, isolate); |
187 } | 187 } |
188 | 188 |
189 } // namespace WebCore | 189 } // namespace WebCore |
OLD | NEW |