| 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 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 | 1648 |
| 1649 static void cachedAttribute2AttributeGetterCallback(v8::Local<v8::String>, const
v8::PropertyCallbackInfo<v8::Value>& info) | 1649 static void cachedAttribute2AttributeGetterCallback(v8::Local<v8::String>, const
v8::PropertyCallbackInfo<v8::Value>& info) |
| 1650 { | 1650 { |
| 1651 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 1651 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 1652 TestObjV8Internal::cachedAttribute2AttributeGetter(info); | 1652 TestObjV8Internal::cachedAttribute2AttributeGetter(info); |
| 1653 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 1653 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 static void cachedDirtyableAttributeAttributeGetter(const v8::PropertyCallbackIn
fo<v8::Value>& info) | 1656 static void cachedDirtyableAttributeAttributeGetter(const v8::PropertyCallbackIn
fo<v8::Value>& info) |
| 1657 { | 1657 { |
| 1658 v8::Handle<v8::String> propertyName = v8::String::NewSymbol("cachedDirtyable
Attribute"); | 1658 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "cachedDirtyableAttribute", v8::String::kInternalizedString); |
| 1659 TestObj* imp = V8TestObject::toNative(info.Holder()); | 1659 TestObj* imp = V8TestObject::toNative(info.Holder()); |
| 1660 if (!imp->isValueDirty()) { | 1660 if (!imp->isValueDirty()) { |
| 1661 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); | 1661 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); |
| 1662 if (!jsValue.IsEmpty()) { | 1662 if (!jsValue.IsEmpty()) { |
| 1663 v8SetReturnValue(info, jsValue); | 1663 v8SetReturnValue(info, jsValue); |
| 1664 return; | 1664 return; |
| 1665 } | 1665 } |
| 1666 } | 1666 } |
| 1667 ScriptValue jsValue = imp->cachedDirtyableAttribute(); | 1667 ScriptValue jsValue = imp->cachedDirtyableAttribute(); |
| 1668 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); | 1668 info.Holder()->SetHiddenValue(propertyName, jsValue.v8Value()); |
| 1669 v8SetReturnValue(info, jsValue.v8Value()); | 1669 v8SetReturnValue(info, jsValue.v8Value()); |
| 1670 } | 1670 } |
| 1671 | 1671 |
| 1672 static void cachedDirtyableAttributeAttributeGetterCallback(v8::Local<v8::String
>, const v8::PropertyCallbackInfo<v8::Value>& info) | 1672 static void cachedDirtyableAttributeAttributeGetterCallback(v8::Local<v8::String
>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 1673 { | 1673 { |
| 1674 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 1674 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 1675 TestObjV8Internal::cachedDirtyableAttributeAttributeGetter(info); | 1675 TestObjV8Internal::cachedDirtyableAttributeAttributeGetter(info); |
| 1676 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 1676 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 1677 } | 1677 } |
| 1678 | 1678 |
| 1679 static void cachedDirtyableAttributeRaisesAttributeGetter(const v8::PropertyCall
backInfo<v8::Value>& info) | 1679 static void cachedDirtyableAttributeRaisesAttributeGetter(const v8::PropertyCall
backInfo<v8::Value>& info) |
| 1680 { | 1680 { |
| 1681 v8::Handle<v8::String> propertyName = v8::String::NewSymbol("cachedDirtyable
AttributeRaises"); | 1681 v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolat
e(), "cachedDirtyableAttributeRaises", v8::String::kInternalizedString); |
| 1682 TestObj* imp = V8TestObject::toNative(info.Holder()); | 1682 TestObj* imp = V8TestObject::toNative(info.Holder()); |
| 1683 if (!imp->isValueDirty()) { | 1683 if (!imp->isValueDirty()) { |
| 1684 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); | 1684 v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyNa
me); |
| 1685 if (!jsValue.IsEmpty()) { | 1685 if (!jsValue.IsEmpty()) { |
| 1686 v8SetReturnValue(info, jsValue); | 1686 v8SetReturnValue(info, jsValue); |
| 1687 return; | 1687 return; |
| 1688 } | 1688 } |
| 1689 } | 1689 } |
| 1690 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 1690 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 1691 ScriptValue jsValue = imp->cachedDirtyableAttributeRaises(exceptionState); | 1691 ScriptValue jsValue = imp->cachedDirtyableAttributeRaises(exceptionState); |
| (...skipping 3290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4982 } | 4982 } |
| 4983 | 4983 |
| 4984 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 4984 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 4985 { | 4985 { |
| 4986 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 4986 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 4987 TestObj* collection = V8TestObject::toNative(info.Holder()); | 4987 TestObj* collection = V8TestObject::toNative(info.Holder()); |
| 4988 Vector<String> names; | 4988 Vector<String> names; |
| 4989 collection->namedPropertyEnumerator(names, exceptionState); | 4989 collection->namedPropertyEnumerator(names, exceptionState); |
| 4990 if (exceptionState.throwIfNeeded()) | 4990 if (exceptionState.throwIfNeeded()) |
| 4991 return; | 4991 return; |
| 4992 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); | 4992 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 4993 for (size_t i = 0; i < names.size(); ++i) | 4993 for (size_t i = 0; i < names.size(); ++i) |
| 4994 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i],
info.GetIsolate())); | 4994 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(names[i],
info.GetIsolate())); |
| 4995 v8SetReturnValue(info, v8names); | 4995 v8SetReturnValue(info, v8names); |
| 4996 } | 4996 } |
| 4997 | 4997 |
| 4998 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 4998 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 4999 { | 4999 { |
| 5000 TestObj* collection = V8TestObject::toNative(info.Holder()); | 5000 TestObj* collection = V8TestObject::toNative(info.Holder()); |
| 5001 AtomicString propertyName = toWebCoreAtomicString(name); | 5001 AtomicString propertyName = toWebCoreAtomicString(name); |
| 5002 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 5002 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 5003 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 5003 bool result = collection->namedPropertyQuery(propertyName, exceptionState); |
| 5004 if (exceptionState.throwIfNeeded()) | 5004 if (exceptionState.throwIfNeeded()) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5253 {"DEPRECATED_CONSTANT", 1}, | 5253 {"DEPRECATED_CONSTANT", 1}, |
| 5254 }; | 5254 }; |
| 5255 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestObjectConstants, WTF_ARRAY_LENGTH(V8TestObjectConstants), isolate); | 5255 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestObjectConstants, WTF_ARRAY_LENGTH(V8TestObjectConstants), isolate); |
| 5256 COMPILE_ASSERT(1 == TestObj::DEPRECATED_CONSTANT, TheValueOfTestObj_DEPRECAT
ED_CONSTANTDoesntMatchWithImplementation); | 5256 COMPILE_ASSERT(1 == TestObj::DEPRECATED_CONSTANT, TheValueOfTestObj_DEPRECAT
ED_CONSTANTDoesntMatchWithImplementation); |
| 5257 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestObjV8Int
ernal::indexedPropertyGetterCallback, 0, 0, 0, indexedPropertyEnumerator<TestObj
>); | 5257 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestObjV8Int
ernal::indexedPropertyGetterCallback, 0, 0, 0, indexedPropertyEnumerator<TestObj
>); |
| 5258 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestObjV8Inter
nal::namedPropertyGetterCallback, 0, TestObjV8Internal::namedPropertyQueryCallba
ck, 0, TestObjV8Internal::namedPropertyEnumeratorCallback); | 5258 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestObjV8Inter
nal::namedPropertyGetterCallback, 0, TestObjV8Internal::namedPropertyQueryCallba
ck, 0, TestObjV8Internal::namedPropertyEnumeratorCallback); |
| 5259 | 5259 |
| 5260 // Custom Signature 'voidMethodWithArgs' | 5260 // Custom Signature 'voidMethodWithArgs' |
| 5261 const int voidMethodWithArgsArgc = 3; | 5261 const int voidMethodWithArgsArgc = 3; |
| 5262 v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsAr
gc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(),
V8PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::wrapperTypeInfo, cur
rentWorldType) }; | 5262 v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsAr
gc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(),
V8PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::wrapperTypeInfo, cur
rentWorldType) }; |
| 5263 v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(f
unctionTemplate, voidMethodWithArgsArgc, voidMethodWithArgsArgv); | 5263 v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(i
solate, functionTemplate, voidMethodWithArgsArgc, voidMethodWithArgsArgv); |
| 5264 prototypeTemplate->Set(v8::String::NewSymbol("voidMethodWithArgs"), v8::Func
tionTemplate::New(TestObjV8Internal::voidMethodWithArgsMethodCallback, v8Undefin
ed(), voidMethodWithArgsSignature, 3)); | 5264 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "voidMethodWithArgs"
, v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8
Internal::voidMethodWithArgsMethodCallback, v8Undefined(), voidMethodWithArgsSig
nature, 3)); |
| 5265 | 5265 |
| 5266 // Custom Signature 'longMethodWithArgs' | 5266 // Custom Signature 'longMethodWithArgs' |
| 5267 const int longMethodWithArgsArgc = 3; | 5267 const int longMethodWithArgsArgc = 3; |
| 5268 v8::Handle<v8::FunctionTemplate> longMethodWithArgsArgv[longMethodWithArgsAr
gc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(),
V8PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::wrapperTypeInfo, cur
rentWorldType) }; | 5268 v8::Handle<v8::FunctionTemplate> longMethodWithArgsArgv[longMethodWithArgsAr
gc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(),
V8PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::wrapperTypeInfo, cur
rentWorldType) }; |
| 5269 v8::Handle<v8::Signature> longMethodWithArgsSignature = v8::Signature::New(f
unctionTemplate, longMethodWithArgsArgc, longMethodWithArgsArgv); | 5269 v8::Handle<v8::Signature> longMethodWithArgsSignature = v8::Signature::New(i
solate, functionTemplate, longMethodWithArgsArgc, longMethodWithArgsArgv); |
| 5270 prototypeTemplate->Set(v8::String::NewSymbol("longMethodWithArgs"), v8::Func
tionTemplate::New(TestObjV8Internal::longMethodWithArgsMethodCallback, v8Undefin
ed(), longMethodWithArgsSignature, 3)); | 5270 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "longMethodWithArgs"
, v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8
Internal::longMethodWithArgsMethodCallback, v8Undefined(), longMethodWithArgsSig
nature, 3)); |
| 5271 | 5271 |
| 5272 // Custom Signature 'objMethodWithArgs' | 5272 // Custom Signature 'objMethodWithArgs' |
| 5273 const int objMethodWithArgsArgc = 3; | 5273 const int objMethodWithArgsArgc = 3; |
| 5274 v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc
] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8
PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::wrapperTypeInfo, curre
ntWorldType) }; | 5274 v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc
] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8
PerIsolateData::from(isolate)->rawTemplate(&V8TestObject::wrapperTypeInfo, curre
ntWorldType) }; |
| 5275 v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(fu
nctionTemplate, objMethodWithArgsArgc, objMethodWithArgsArgv); | 5275 v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(is
olate, functionTemplate, objMethodWithArgsArgc, objMethodWithArgsArgv); |
| 5276 prototypeTemplate->Set(v8::String::NewSymbol("objMethodWithArgs"), v8::Funct
ionTemplate::New(TestObjV8Internal::objMethodWithArgsMethodCallback, v8Undefined
(), objMethodWithArgsSignature, 3)); | 5276 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "objMethodWithArgs",
v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8I
nternal::objMethodWithArgsMethodCallback, v8Undefined(), objMethodWithArgsSignat
ure, 3)); |
| 5277 | 5277 |
| 5278 // Custom Signature 'methodThatRequiresAllArgsAndThrows' | 5278 // Custom Signature 'methodThatRequiresAllArgsAndThrows' |
| 5279 const int methodThatRequiresAllArgsAndThrowsArgc = 2; | 5279 const int methodThatRequiresAllArgsAndThrowsArgc = 2; |
| 5280 v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[meth
odThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8Pe
rIsolateData::from(isolate)->rawTemplate(&V8TestObject::wrapperTypeInfo, current
WorldType) }; | 5280 v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[meth
odThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8Pe
rIsolateData::from(isolate)->rawTemplate(&V8TestObject::wrapperTypeInfo, current
WorldType) }; |
| 5281 v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::
Signature::New(functionTemplate, methodThatRequiresAllArgsAndThrowsArgc, methodT
hatRequiresAllArgsAndThrowsArgv); | 5281 v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::
Signature::New(isolate, functionTemplate, methodThatRequiresAllArgsAndThrowsArgc
, methodThatRequiresAllArgsAndThrowsArgv); |
| 5282 prototypeTemplate->Set(v8::String::NewSymbol("methodThatRequiresAllArgsAndTh
rows"), v8::FunctionTemplate::New(TestObjV8Internal::methodThatRequiresAllArgsAn
dThrowsMethodCallback, v8Undefined(), methodThatRequiresAllArgsAndThrowsSignatur
e, 2)); | 5282 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "methodThatRequiresA
llArgsAndThrows", v8::String::kInternalizedString), v8::FunctionTemplate::New(is
olate, TestObjV8Internal::methodThatRequiresAllArgsAndThrowsMethodCallback, v8Un
defined(), methodThatRequiresAllArgsAndThrowsSignature, 2)); |
| 5283 functionTemplate->Set(v8::String::NewSymbol("staticMethodWithCallbackAndOpti
onalArg"), v8::FunctionTemplate::New(TestObjV8Internal::staticMethodWithCallback
AndOptionalArgMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); | 5283 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "staticMethodWithCall
backAndOptionalArg", v8::String::kInternalizedString), v8::FunctionTemplate::New
(isolate, TestObjV8Internal::staticMethodWithCallbackAndOptionalArgMethodCallbac
k, v8Undefined(), v8::Local<v8::Signature>(), 0)); |
| 5284 functionTemplate->Set(v8::String::NewSymbol("staticMethodWithCallbackArg"),
v8::FunctionTemplate::New(TestObjV8Internal::staticMethodWithCallbackArgMethodCa
llback, v8Undefined(), v8::Local<v8::Signature>(), 1)); | 5284 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "staticMethodWithCall
backArg", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, T
estObjV8Internal::staticMethodWithCallbackArgMethodCallback, v8Undefined(), v8::
Local<v8::Signature>(), 1)); |
| 5285 functionTemplate->Set(v8::String::NewSymbol("classMethod"), v8::FunctionTemp
late::New(TestObjV8Internal::classMethodMethodCallback, v8Undefined(), v8::Local
<v8::Signature>(), 0)); | 5285 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "classMethod", v8::St
ring::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8Internal
::classMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0)); |
| 5286 functionTemplate->Set(v8::String::NewSymbol("classMethodWithOptional"), v8::
FunctionTemplate::New(TestObjV8Internal::classMethodWithOptionalMethodCallback,
v8Undefined(), v8::Local<v8::Signature>(), 0)); | 5286 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "classMethodWithOptio
nal", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestO
bjV8Internal::classMethodWithOptionalMethodCallback, v8Undefined(), v8::Local<v8
::Signature>(), 0)); |
| 5287 functionTemplate->Set(v8::String::NewSymbol("classMethod2"), v8::FunctionTem
plate::New(TestObjV8Internal::classMethod2MethodCallback, v8Undefined(), v8::Loc
al<v8::Signature>(), 1)); | 5287 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "classMethod2", v8::S
tring::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8Interna
l::classMethod2MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 1)); |
| 5288 if (RuntimeEnabledFeatures::featureNameEnabled()) | 5288 if (RuntimeEnabledFeatures::featureNameEnabled()) |
| 5289 prototypeTemplate->Set(v8::String::NewSymbol("enabledAtRuntimeMethod"),
v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethodMethodCallbac
k, v8Undefined(), defaultSignature, 1)); | 5289 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "enabledAtRuntim
eMethod", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, T
estObjV8Internal::enabledAtRuntimeMethodMethodCallback, v8Undefined(), defaultSi
gnature, 1)); |
| 5290 | 5290 |
| 5291 // Custom Signature 'domStringListFunction' | 5291 // Custom Signature 'domStringListFunction' |
| 5292 const int domStringListFunctionArgc = 1; | 5292 const int domStringListFunctionArgc = 1; |
| 5293 v8::Handle<v8::FunctionTemplate> domStringListFunctionArgv[domStringListFunc
tionArgc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8DOMStringList::wra
pperTypeInfo, currentWorldType) }; | 5293 v8::Handle<v8::FunctionTemplate> domStringListFunctionArgv[domStringListFunc
tionArgc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8DOMStringList::wra
pperTypeInfo, currentWorldType) }; |
| 5294 v8::Handle<v8::Signature> domStringListFunctionSignature = v8::Signature::Ne
w(functionTemplate, domStringListFunctionArgc, domStringListFunctionArgv); | 5294 v8::Handle<v8::Signature> domStringListFunctionSignature = v8::Signature::Ne
w(isolate, functionTemplate, domStringListFunctionArgc, domStringListFunctionArg
v); |
| 5295 prototypeTemplate->Set(v8::String::NewSymbol("domStringListFunction"), v8::F
unctionTemplate::New(TestObjV8Internal::domStringListFunctionMethodCallback, v8U
ndefined(), domStringListFunctionSignature, 1)); | 5295 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "domStringListFuncti
on", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestOb
jV8Internal::domStringListFunctionMethodCallback, v8Undefined(), domStringListFu
nctionSignature, 1)); |
| 5296 | 5296 |
| 5297 // Custom Signature 'convert1' | 5297 // Custom Signature 'convert1' |
| 5298 const int convert1Argc = 1; | 5298 const int convert1Argc = 1; |
| 5299 v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8PerIsolate
Data::from(isolate)->rawTemplate(&V8TestNode::wrapperTypeInfo, currentWorldType)
}; | 5299 v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8PerIsolate
Data::from(isolate)->rawTemplate(&V8TestNode::wrapperTypeInfo, currentWorldType)
}; |
| 5300 v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(functionTem
plate, convert1Argc, convert1Argv); | 5300 v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(isolate, fu
nctionTemplate, convert1Argc, convert1Argv); |
| 5301 prototypeTemplate->Set(v8::String::NewSymbol("convert1"), v8::FunctionTempla
te::New(TestObjV8Internal::convert1MethodCallback, v8Undefined(), convert1Signat
ure, 1)); | 5301 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "convert1", v8::Stri
ng::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8Internal::
convert1MethodCallback, v8Undefined(), convert1Signature, 1)); |
| 5302 | 5302 |
| 5303 // Custom Signature 'convert2' | 5303 // Custom Signature 'convert2' |
| 5304 const int convert2Argc = 1; | 5304 const int convert2Argc = 1; |
| 5305 v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8PerIsolate
Data::from(isolate)->rawTemplate(&V8TestNode::wrapperTypeInfo, currentWorldType)
}; | 5305 v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8PerIsolate
Data::from(isolate)->rawTemplate(&V8TestNode::wrapperTypeInfo, currentWorldType)
}; |
| 5306 v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(functionTem
plate, convert2Argc, convert2Argv); | 5306 v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(isolate, fu
nctionTemplate, convert2Argc, convert2Argv); |
| 5307 prototypeTemplate->Set(v8::String::NewSymbol("convert2"), v8::FunctionTempla
te::New(TestObjV8Internal::convert2MethodCallback, v8Undefined(), convert2Signat
ure, 1)); | 5307 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "convert2", v8::Stri
ng::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8Internal::
convert2MethodCallback, v8Undefined(), convert2Signature, 1)); |
| 5308 | 5308 |
| 5309 // Custom Signature 'svgPointMethod' | 5309 // Custom Signature 'svgPointMethod' |
| 5310 const int svgPointMethodArgc = 2; | 5310 const int svgPointMethodArgc = 2; |
| 5311 v8::Handle<v8::FunctionTemplate> svgPointMethodArgv[svgPointMethodArgc] = {
V8PerIsolateData::from(isolate)->rawTemplate(&V8SVGPoint::wrapperTypeInfo, curre
ntWorldType), v8::Handle<v8::FunctionTemplate>() }; | 5311 v8::Handle<v8::FunctionTemplate> svgPointMethodArgv[svgPointMethodArgc] = {
V8PerIsolateData::from(isolate)->rawTemplate(&V8SVGPoint::wrapperTypeInfo, curre
ntWorldType), v8::Handle<v8::FunctionTemplate>() }; |
| 5312 v8::Handle<v8::Signature> svgPointMethodSignature = v8::Signature::New(funct
ionTemplate, svgPointMethodArgc, svgPointMethodArgv); | 5312 v8::Handle<v8::Signature> svgPointMethodSignature = v8::Signature::New(isola
te, functionTemplate, svgPointMethodArgc, svgPointMethodArgv); |
| 5313 prototypeTemplate->Set(v8::String::NewSymbol("svgPointMethod"), v8::Function
Template::New(TestObjV8Internal::svgPointMethodMethodCallback, v8Undefined(), sv
gPointMethodSignature, 2)); | 5313 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "svgPointMethod", v8
::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8Inte
rnal::svgPointMethodMethodCallback, v8Undefined(), svgPointMethodSignature, 2)); |
| 5314 | 5314 |
| 5315 // Custom Signature 'variadicNodeMethod' | 5315 // Custom Signature 'variadicNodeMethod' |
| 5316 const int variadicNodeMethodArgc = 2; | 5316 const int variadicNodeMethodArgc = 2; |
| 5317 v8::Handle<v8::FunctionTemplate> variadicNodeMethodArgv[variadicNodeMethodAr
gc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, c
urrentWorldType), V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperT
ypeInfo, currentWorldType) }; | 5317 v8::Handle<v8::FunctionTemplate> variadicNodeMethodArgv[variadicNodeMethodAr
gc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, c
urrentWorldType), V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperT
ypeInfo, currentWorldType) }; |
| 5318 v8::Handle<v8::Signature> variadicNodeMethodSignature = v8::Signature::New(f
unctionTemplate, variadicNodeMethodArgc, variadicNodeMethodArgv); | 5318 v8::Handle<v8::Signature> variadicNodeMethodSignature = v8::Signature::New(i
solate, functionTemplate, variadicNodeMethodArgc, variadicNodeMethodArgv); |
| 5319 prototypeTemplate->Set(v8::String::NewSymbol("variadicNodeMethod"), v8::Func
tionTemplate::New(TestObjV8Internal::variadicNodeMethodMethodCallback, v8Undefin
ed(), variadicNodeMethodSignature, 2)); | 5319 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "variadicNodeMethod"
, v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestObjV8
Internal::variadicNodeMethodMethodCallback, v8Undefined(), variadicNodeMethodSig
nature, 2)); |
| 5320 functionTemplate->Set(v8::String::NewSymbol("deprecatedStaticMethod"), v8::F
unctionTemplate::New(TestObjV8Internal::deprecatedStaticMethodMethodCallback, v8
Undefined(), v8::Local<v8::Signature>(), 0)); | 5320 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "deprecatedStaticMeth
od", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestOb
jV8Internal::deprecatedStaticMethodMethodCallback, v8Undefined(), v8::Local<v8::
Signature>(), 0)); |
| 5321 functionTemplate->SetNativeDataProperty(v8::String::NewSymbol("staticReadOnl
yLongAttr"), TestObjV8Internal::staticReadOnlyLongAttrAttributeGetterCallback, 0
, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v
8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT))
; | 5321 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st
aticReadOnlyLongAttr", v8::String::kInternalizedString), TestObjV8Internal::stat
icReadOnlyLongAttrAttributeGetterCallback, 0, v8::External::New(isolate, 0), sta
tic_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(),
static_cast<v8::AccessControl>(v8::DEFAULT)); |
| 5322 functionTemplate->SetNativeDataProperty(v8::String::NewSymbol("staticStringA
ttr"), TestObjV8Internal::staticStringAttrAttributeGetterCallback, TestObjV8Inte
rnal::staticStringAttrAttributeSetterCallback, v8::External::New(isolate, 0), st
atic_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(),
static_cast<v8::AccessControl>(v8::DEFAULT)); | 5322 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "st
aticStringAttr", v8::String::kInternalizedString), TestObjV8Internal::staticStri
ngAttrAttributeGetterCallback, TestObjV8Internal::staticStringAttrAttributeSette
rCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8:
:None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::
DEFAULT)); |
| 5323 functionTemplate->SetNativeDataProperty(v8::String::NewSymbol("TestSubObj"),
TestObjV8Internal::TestObjConstructorGetter, 0, v8::External::New(isolate, cons
t_cast<WrapperTypeInfo*>(&V8TestSubObj::wrapperTypeInfo)), static_cast<v8::Prope
rtyAttribute>(v8::DontEnum), v8::Handle<v8::AccessorSignature>(), static_cast<v8
::AccessControl>(v8::DEFAULT)); | 5323 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "Te
stSubObj", v8::String::kInternalizedString), TestObjV8Internal::TestObjConstruct
orGetter, 0, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestSubO
bj::wrapperTypeInfo)), static_cast<v8::PropertyAttribute>(v8::DontEnum), v8::Han
dle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| 5324 functionTemplate->SetNativeDataProperty(v8::String::NewSymbol("deprecatedSta
ticReadOnlyAttr"), TestObjV8Internal::deprecatedStaticReadOnlyAttrAttributeGette
rCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(
v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v
8::DEFAULT)); | 5324 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "de
precatedStaticReadOnlyAttr", v8::String::kInternalizedString), TestObjV8Internal
::deprecatedStaticReadOnlyAttrAttributeGetterCallback, 0, v8::External::New(isol
ate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSi
gnature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| 5325 functionTemplate->SetNativeDataProperty(v8::String::NewSymbol("deprecatedSta
ticAttr"), TestObjV8Internal::deprecatedStaticAttrAttributeGetterCallback, TestO
bjV8Internal::deprecatedStaticAttrAttributeSetterCallback, v8::External::New(iso
late, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorS
ignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); | 5325 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "de
precatedStaticAttr", v8::String::kInternalizedString), TestObjV8Internal::deprec
atedStaticAttrAttributeGetterCallback, TestObjV8Internal::deprecatedStaticAttrAt
tributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAt
tribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessC
ontrol>(v8::DEFAULT)); |
| 5326 | 5326 |
| 5327 // Custom toString template | 5327 // Custom toString template |
| 5328 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 5328 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 5329 return functionTemplate; | 5329 return functionTemplate; |
| 5330 } | 5330 } |
| 5331 | 5331 |
| 5332 v8::Handle<v8::FunctionTemplate> V8TestObject::GetTemplate(v8::Isolate* isolate,
WrapperWorldType currentWorldType) | 5332 v8::Handle<v8::FunctionTemplate> V8TestObject::GetTemplate(v8::Isolate* isolate,
WrapperWorldType currentWorldType) |
| 5333 { | 5333 { |
| 5334 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 5334 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 5335 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 5335 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 5336 if (result != data->templateMap(currentWorldType).end()) | 5336 if (result != data->templateMap(currentWorldType).end()) |
| 5337 return result->value.newLocal(isolate); | 5337 return result->value.newLocal(isolate); |
| 5338 | 5338 |
| 5339 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 5339 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 5340 v8::HandleScope handleScope(isolate); | 5340 v8::EscapableHandleScope handleScope(isolate); |
| 5341 v8::Handle<v8::FunctionTemplate> templ = | 5341 v8::Local<v8::FunctionTemplate> templ = |
| 5342 ConfigureV8TestObjectTemplate(data->rawTemplate(&wrapperTypeInfo, curren
tWorldType), isolate, currentWorldType); | 5342 ConfigureV8TestObjectTemplate(data->rawTemplate(&wrapperTypeInfo, curren
tWorldType), isolate, currentWorldType); |
| 5343 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 5343 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 5344 return handleScope.Close(templ); | 5344 return handleScope.Escape(templ); |
| 5345 } | 5345 } |
| 5346 | 5346 |
| 5347 bool V8TestObject::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola
te, WrapperWorldType currentWorldType) | 5347 bool V8TestObject::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola
te, WrapperWorldType currentWorldType) |
| 5348 { | 5348 { |
| 5349 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 5349 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 5350 } | 5350 } |
| 5351 | 5351 |
| 5352 bool V8TestObject::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) | 5352 bool V8TestObject::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) |
| 5353 { | 5353 { |
| 5354 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 5354 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 5355 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 5355 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 5356 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 5356 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 5357 } | 5357 } |
| 5358 | 5358 |
| 5359 void V8TestObject::installPerContextEnabledProperties(v8::Handle<v8::Object> ins
tanceTemplate, TestObj* impl, v8::Isolate* isolate) | 5359 void V8TestObject::installPerContextEnabledProperties(v8::Handle<v8::Object> ins
tanceTemplate, TestObj* impl, v8::Isolate* isolate) |
| 5360 { | 5360 { |
| 5361 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan
ceTemplate->GetPrototype()); | 5361 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan
ceTemplate->GetPrototype()); |
| 5362 if (ContextFeatures::featureNameEnabled(impl->document())) { | 5362 if (ContextFeatures::featureNameEnabled(impl->document())) { |
| 5363 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ | 5363 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ |
| 5364 {"enabledPerContextAttr", TestObjV8Internal::enabledPerContextAttrAttrib
uteGetterCallback, TestObjV8Internal::enabledPerContextAttrAttributeSetterCallba
ck, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Proper
tyAttribute>(v8::None), 0 /* on instance */}; | 5364 {"enabledPerContextAttr", TestObjV8Internal::enabledPerContextAttrAttrib
uteGetterCallback, TestObjV8Internal::enabledPerContextAttrAttributeSetterCallba
ck, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Proper
tyAttribute>(v8::None), 0 /* on instance */}; |
| 5365 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate
, attributeConfiguration, isolate); | 5365 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate
, attributeConfiguration, isolate); |
| 5366 } | 5366 } |
| 5367 } | 5367 } |
| 5368 | 5368 |
| 5369 void V8TestObject::installPerContextEnabledMethods(v8::Handle<v8::Object> protot
ypeTemplate, v8::Isolate* isolate) | 5369 void V8TestObject::installPerContextEnabledMethods(v8::Handle<v8::Object> protot
ypeTemplate, v8::Isolate* isolate) |
| 5370 { | 5370 { |
| 5371 UNUSED_PARAM(prototypeTemplate); | 5371 UNUSED_PARAM(prototypeTemplate); |
| 5372 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate(i
solate, worldType(isolate))); | 5372 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, GetT
emplate(isolate, worldType(isolate))); |
| 5373 UNUSED_PARAM(defaultSignature); | 5373 UNUSED_PARAM(defaultSignature); |
| 5374 | 5374 |
| 5375 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo
ntext()); | 5375 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo
ntext()); |
| 5376 if (context && context->isDocument() && ContextFeatures::featureNameEnabled(
toDocument(context))) | 5376 if (context && context->isDocument() && ContextFeatures::featureNameEnabled(
toDocument(context))) |
| 5377 prototypeTemplate->Set(v8::String::NewSymbol("enabledPerContextMethod"),
v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethodMethodCallb
ack, v8Undefined(), defaultSignature, 1)->GetFunction()); | 5377 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "enabledPerConte
xtMethod", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate,
TestObjV8Internal::enabledPerContextMethodMethodCallback, v8Undefined(), default
Signature, 1)->GetFunction()); |
| 5378 } | 5378 } |
| 5379 | 5379 |
| 5380 EventTarget* V8TestObject::toEventTarget(v8::Handle<v8::Object> object) | 5380 EventTarget* V8TestObject::toEventTarget(v8::Handle<v8::Object> object) |
| 5381 { | 5381 { |
| 5382 return toNative(object); | 5382 return toNative(object); |
| 5383 } | 5383 } |
| 5384 | 5384 |
| 5385 v8::Handle<v8::Object> V8TestObject::createWrapper(PassRefPtr<TestObj> impl, v8:
:Handle<v8::Object> creationContext, v8::Isolate* isolate) | 5385 v8::Handle<v8::Object> V8TestObject::createWrapper(PassRefPtr<TestObj> impl, v8:
:Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 5386 { | 5386 { |
| 5387 ASSERT(impl); | 5387 ASSERT(impl); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 5407 fromInternalPointer(object)->deref(); | 5407 fromInternalPointer(object)->deref(); |
| 5408 } | 5408 } |
| 5409 | 5409 |
| 5410 template<> | 5410 template<> |
| 5411 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) | 5411 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) |
| 5412 { | 5412 { |
| 5413 return toV8(impl, creationContext, isolate); | 5413 return toV8(impl, creationContext, isolate); |
| 5414 } | 5414 } |
| 5415 | 5415 |
| 5416 } // namespace WebCore | 5416 } // namespace WebCore |
| OLD | NEW |