| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 } // namespace RealClassV8Internal | 163 } // namespace RealClassV8Internal |
| 164 | 164 |
| 165 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceImplement
edAsAttributes[] = { | 165 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceImplement
edAsAttributes[] = { |
| 166 {"a", RealClassV8Internal::aAttributeGetterCallback, RealClassV8Internal::aA
ttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st
atic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 166 {"a", RealClassV8Internal::aAttributeGetterCallback, RealClassV8Internal::aA
ttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st
atic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 167 {"b", RealClassV8Internal::bAttributeGetterCallback, RealClassV8Internal::bA
ttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st
atic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 167 {"b", RealClassV8Internal::bAttributeGetterCallback, RealClassV8Internal::bA
ttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st
atic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceImplementedA
sMethods[] = { | 170 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceImplementedA
sMethods[] = { |
| 171 {"func1", RealClassV8Internal::func1MethodCallback, 0, 1}, | 171 {"func1", RealClassV8Internal::func1MethodCallback, 0, 1}, |
| 172 {"funcTestInterfaceImplementedAsParam", RealClassV8Internal::funcTestInterfa
ceImplementedAsParamMethodCallback, 0, 1}, |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceImplementedAsTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) | 175 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceImplementedAsTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) |
| 175 { | 176 { |
| 176 functionTemplate->ReadOnlyPrototype(); | 177 functionTemplate->ReadOnlyPrototype(); |
| 177 | 178 |
| 178 v8::Local<v8::Signature> defaultSignature; | 179 v8::Local<v8::Signature> defaultSignature; |
| 179 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceImplementedAs", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceImplementedAs::internalFieldCount, | 180 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceImplementedAs", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceImplementedAs::internalFieldCount, |
| 180 V8TestInterfaceImplementedAsAttributes, WTF_ARRAY_LENGTH(V8TestInterface
ImplementedAsAttributes), | 181 V8TestInterfaceImplementedAsAttributes, WTF_ARRAY_LENGTH(V8TestInterface
ImplementedAsAttributes), |
| 181 0, 0, | 182 0, 0, |
| 182 V8TestInterfaceImplementedAsMethods, WTF_ARRAY_LENGTH(V8TestInterfaceImp
lementedAsMethods), | 183 V8TestInterfaceImplementedAsMethods, WTF_ARRAY_LENGTH(V8TestInterfaceImp
lementedAsMethods), |
| 183 isolate, currentWorldType); | 184 isolate, currentWorldType); |
| 184 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 185 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 185 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 186 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 186 | 187 |
| 187 // Custom Signature 'funcTestInterfaceImplementedAsParam' | |
| 188 const int funcTestInterfaceImplementedAsParamArgc = 1; | |
| 189 v8::Handle<v8::FunctionTemplate> funcTestInterfaceImplementedAsParamArgv[fun
cTestInterfaceImplementedAsParamArgc] = { V8PerIsolateData::from(isolate)->rawDO
MTemplate(&V8TestInterfaceImplementedAs::wrapperTypeInfo, currentWorldType) }; | |
| 190 v8::Handle<v8::Signature> funcTestInterfaceImplementedAsParamSignature = v8:
:Signature::New(isolate, functionTemplate, funcTestInterfaceImplementedAsParamAr
gc, funcTestInterfaceImplementedAsParamArgv); | |
| 191 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "funcTestInterfaceIm
plementedAsParam", v8::String::kInternalizedString), v8::FunctionTemplate::New(i
solate, RealClassV8Internal::funcTestInterfaceImplementedAsParamMethodCallback,
v8Undefined(), funcTestInterfaceImplementedAsParamSignature, 1)); | |
| 192 | |
| 193 // Custom toString template | 188 // Custom toString template |
| 194 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 189 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 195 return functionTemplate; | 190 return functionTemplate; |
| 196 } | 191 } |
| 197 | 192 |
| 198 v8::Handle<v8::FunctionTemplate> V8TestInterfaceImplementedAs::domTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) | 193 v8::Handle<v8::FunctionTemplate> V8TestInterfaceImplementedAs::domTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) |
| 199 { | 194 { |
| 200 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 195 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 201 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 196 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 202 if (result != data->templateMap(currentWorldType).end()) | 197 if (result != data->templateMap(currentWorldType).end()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 fromInternalPointer(object)->deref(); | 242 fromInternalPointer(object)->deref(); |
| 248 } | 243 } |
| 249 | 244 |
| 250 template<> | 245 template<> |
| 251 v8::Handle<v8::Value> toV8NoInline(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) | 246 v8::Handle<v8::Value> toV8NoInline(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) |
| 252 { | 247 { |
| 253 return toV8(impl, creationContext, isolate); | 248 return toV8(impl, creationContext, isolate); |
| 254 } | 249 } |
| 255 | 250 |
| 256 } // namespace WebCore | 251 } // namespace WebCore |
| OLD | NEW |