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