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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #include "core/dom/ContextFeatures.h" | 69 #include "core/dom/ContextFeatures.h" |
70 #include "core/dom/Document.h" | 70 #include "core/dom/Document.h" |
71 #include "core/dom/custom/CustomElementCallbackDispatcher.h" | 71 #include "core/dom/custom/CustomElementCallbackDispatcher.h" |
72 #include "core/frame/DOMWindow.h" | 72 #include "core/frame/DOMWindow.h" |
73 #include "core/frame/UseCounter.h" | 73 #include "core/frame/UseCounter.h" |
74 #include "core/svg/properties/SVGPropertyTearOff.h" | 74 #include "core/svg/properties/SVGPropertyTearOff.h" |
75 #include "core/svg/properties/SVGStaticPropertyTearOff.h" | 75 #include "core/svg/properties/SVGStaticPropertyTearOff.h" |
76 #include "platform/TraceEvent.h" | 76 #include "platform/TraceEvent.h" |
77 #include "wtf/GetPtr.h" | 77 #include "wtf/GetPtr.h" |
78 #include "wtf/RefPtr.h" | 78 #include "wtf/RefPtr.h" |
79 #include "wtf/UnusedParam.h" | |
80 | 79 |
81 namespace WebCore { | 80 namespace WebCore { |
82 | 81 |
83 static void initializeScriptWrappableForInterface(TestObj* object) | 82 static void initializeScriptWrappableForInterface(TestObj* object) |
84 { | 83 { |
85 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 84 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
86 ScriptWrappable::setTypeInfoInObject(object, &V8TestObject::wrapperTypeI
nfo); | 85 ScriptWrappable::setTypeInfoInObject(object, &V8TestObject::wrapperTypeI
nfo); |
87 else | 86 else |
88 ASSERT_NOT_REACHED(); | 87 ASSERT_NOT_REACHED(); |
89 } | 88 } |
(...skipping 5140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5230 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestObjectTemplate(v8::Handle
<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType
currentWorldType) | 5229 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestObjectTemplate(v8::Handle
<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType
currentWorldType) |
5231 { | 5230 { |
5232 functionTemplate->ReadOnlyPrototype(); | 5231 functionTemplate->ReadOnlyPrototype(); |
5233 | 5232 |
5234 v8::Local<v8::Signature> defaultSignature; | 5233 v8::Local<v8::Signature> defaultSignature; |
5235 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestObject", V8EventTarget::GetTemplate(isolate, currentWorldType), V8Test
Object::internalFieldCount, | 5234 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestObject", V8EventTarget::GetTemplate(isolate, currentWorldType), V8Test
Object::internalFieldCount, |
5236 V8TestObjectAttributes, WTF_ARRAY_LENGTH(V8TestObjectAttributes), | 5235 V8TestObjectAttributes, WTF_ARRAY_LENGTH(V8TestObjectAttributes), |
5237 V8TestObjectAccessors, WTF_ARRAY_LENGTH(V8TestObjectAccessors), | 5236 V8TestObjectAccessors, WTF_ARRAY_LENGTH(V8TestObjectAccessors), |
5238 V8TestObjectMethods, WTF_ARRAY_LENGTH(V8TestObjectMethods), | 5237 V8TestObjectMethods, WTF_ARRAY_LENGTH(V8TestObjectMethods), |
5239 isolate, currentWorldType); | 5238 isolate, currentWorldType); |
5240 UNUSED_PARAM(defaultSignature); | |
5241 functionTemplate->SetCallHandler(V8TestObject::constructorCallback); | 5239 functionTemplate->SetCallHandler(V8TestObject::constructorCallback); |
5242 functionTemplate->SetLength(1); | 5240 functionTemplate->SetLength(1); |
5243 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 5241 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
5244 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 5242 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
5245 UNUSED_PARAM(instanceTemplate); | |
5246 UNUSED_PARAM(prototypeTemplate); | |
5247 if (RuntimeEnabledFeatures::featureNameEnabled()) { | 5243 if (RuntimeEnabledFeatures::featureNameEnabled()) { |
5248 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ | 5244 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ |
5249 {"enabledAtRuntimeAttr", TestObjV8Internal::enabledAtRuntimeAttrAttribut
eGetterCallback, TestObjV8Internal::enabledAtRuntimeAttrAttributeSetterCallback,
0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA
ttribute>(v8::None), 0 /* on instance */}; | 5245 {"enabledAtRuntimeAttr", TestObjV8Internal::enabledAtRuntimeAttrAttribut
eGetterCallback, TestObjV8Internal::enabledAtRuntimeAttrAttributeSetterCallback,
0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA
ttribute>(v8::None), 0 /* on instance */}; |
5250 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate
, attributeConfiguration, isolate, currentWorldType); | 5246 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate
, attributeConfiguration, isolate, currentWorldType); |
5251 } | 5247 } |
5252 static const V8DOMConfiguration::ConstantConfiguration V8TestObjectConstants
[] = { | 5248 static const V8DOMConfiguration::ConstantConfiguration V8TestObjectConstants
[] = { |
5253 {"DEPRECATED_CONSTANT", 1}, | 5249 {"DEPRECATED_CONSTANT", 1}, |
5254 }; | 5250 }; |
5255 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestObjectConstants, WTF_ARRAY_LENGTH(V8TestObjectConstants), isolate); | 5251 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestObjectConstants, WTF_ARRAY_LENGTH(V8TestObjectConstants), isolate); |
5256 COMPILE_ASSERT(1 == TestObj::DEPRECATED_CONSTANT, TheValueOfTestObj_DEPRECAT
ED_CONSTANTDoesntMatchWithImplementation); | 5252 COMPILE_ASSERT(1 == TestObj::DEPRECATED_CONSTANT, TheValueOfTestObj_DEPRECAT
ED_CONSTANTDoesntMatchWithImplementation); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5361 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan
ceTemplate->GetPrototype()); | 5357 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan
ceTemplate->GetPrototype()); |
5362 if (ContextFeatures::featureNameEnabled(impl->document())) { | 5358 if (ContextFeatures::featureNameEnabled(impl->document())) { |
5363 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ | 5359 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 */}; | 5360 {"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); | 5361 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate
, attributeConfiguration, isolate); |
5366 } | 5362 } |
5367 } | 5363 } |
5368 | 5364 |
5369 void V8TestObject::installPerContextEnabledMethods(v8::Handle<v8::Object> protot
ypeTemplate, v8::Isolate* isolate) | 5365 void V8TestObject::installPerContextEnabledMethods(v8::Handle<v8::Object> protot
ypeTemplate, v8::Isolate* isolate) |
5370 { | 5366 { |
5371 UNUSED_PARAM(prototypeTemplate); | |
5372 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, GetT
emplate(isolate, worldType(isolate))); | 5367 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, GetT
emplate(isolate, worldType(isolate))); |
5373 UNUSED_PARAM(defaultSignature); | |
5374 | 5368 |
5375 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo
ntext()); | 5369 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo
ntext()); |
5376 if (context && context->isDocument() && ContextFeatures::featureNameEnabled(
toDocument(context))) | 5370 if (context && context->isDocument() && ContextFeatures::featureNameEnabled(
toDocument(context))) |
5377 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "enabledPerConte
xtMethod", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate,
TestObjV8Internal::enabledPerContextMethodMethodCallback, v8Undefined(), default
Signature, 1)->GetFunction()); | 5371 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "enabledPerConte
xtMethod", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate,
TestObjV8Internal::enabledPerContextMethodMethodCallback, v8Undefined(), default
Signature, 1)->GetFunction()); |
5378 } | 5372 } |
5379 | 5373 |
5380 EventTarget* V8TestObject::toEventTarget(v8::Handle<v8::Object> object) | 5374 EventTarget* V8TestObject::toEventTarget(v8::Handle<v8::Object> object) |
5381 { | 5375 { |
5382 return toNative(object); | 5376 return toNative(object); |
5383 } | 5377 } |
(...skipping 23 matching lines...) Expand all Loading... |
5407 fromInternalPointer(object)->deref(); | 5401 fromInternalPointer(object)->deref(); |
5408 } | 5402 } |
5409 | 5403 |
5410 template<> | 5404 template<> |
5411 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) | 5405 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) |
5412 { | 5406 { |
5413 return toV8(impl, creationContext, isolate); | 5407 return toV8(impl, creationContext, isolate); |
5414 } | 5408 } |
5415 | 5409 |
5416 } // namespace WebCore | 5410 } // namespace WebCore |
OLD | NEW |