107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved. 207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch// found in the LICENSE file. 407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch 507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#include "config.h" 85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#include "V8TestException.h" 95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 10197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/ExceptionState.h" 11197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/V8DOMConfiguration.h" 12197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/V8HiddenValue.h" 13197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/V8ObjectConstructor.h" 1453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/dom/ContextFeatures.h" 15e52495584422c5edb5b2944981473a2e208da323Torne (Richard Coles)#include "core/dom/Document.h" 1676c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)#include "platform/RuntimeEnabledFeatures.h" 171e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "platform/TraceEvent.h" 1809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "wtf/GetPtr.h" 1909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "wtf/RefPtr.h" 205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 21c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 237242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucciconst WrapperTypeInfo V8TestException::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestException::domTemplate, V8TestException::refObject, V8TestException::derefObject, V8TestException::createPersistentHandle, 0, 0, 0, V8TestException::installConditionallyEnabledMethods, V8TestException::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeExceptionPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; 245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 257242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestException.h. 267242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci// For details, see the comment of DEFINE_WRAPPERTYPEINFO in 277242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci// bindings/core/v8/ScriptWrappable.h. 287242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucciconst WrapperTypeInfo& TestException::s_wrapperTypeInfo = V8TestException::wrapperTypeInfo; 295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)namespace TestExceptionV8Internal { 315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)template <typename T> void V8_USE(T) { } 335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 3409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)static void readonlyUnsignedShortAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 3607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch v8::Handle<v8::Object> holder = info.Holder(); 377242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci TestException* impl = V8TestException::toImpl(holder); 3843e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles) v8SetReturnValueUnsigned(info, impl->readonlyUnsignedShortAttribute()); 39926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)} 40926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 4109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)static void readonlyUnsignedShortAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 42926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){ 43197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); 4409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) TestExceptionV8Internal::readonlyUnsignedShortAttributeAttributeGetter(info); 45197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 4609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)} 4709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) 4809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 4909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){ 5007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch v8::Handle<v8::Object> holder = info.Holder(); 517242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci TestException* impl = V8TestException::toImpl(holder); 5243e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles) v8SetReturnValueString(info, impl->readonlyStringAttribute(), info.GetIsolate()); 5309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)} 5409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) 5509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)static void readonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 5609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){ 57197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); 5809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) TestExceptionV8Internal::readonlyStringAttributeAttributeGetter(info); 59197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 6009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)} 6109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) 6209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 6309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){ 647242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci TestException* impl = V8TestException::toImpl(info.Holder()); 6543e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles) v8SetReturnValueString(info, impl->toString(), info.GetIsolate()); 6609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)} 6709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) 6809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 6909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){ 70197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 7109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) TestExceptionV8Internal::toStringMethod(info); 72197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} // namespace TestExceptionV8Internal 765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 77c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)static const V8DOMConfiguration::AttributeConfiguration V8TestExceptionAttributes[] = { 78c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) {"readonlyUnsignedShortAttribute", TestExceptionV8Internal::readonlyUnsignedShortAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, 79c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) {"readonlyStringAttribute", TestExceptionV8Internal::readonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, 805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}; 815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 82197021e6b966cfb06891637935ef33fff06433d1Ben Murdochstatic void installV8TestExceptionTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) 835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 8451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) functionTemplate->ReadOnlyPrototype(); 855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) v8::Local<v8::Signature> defaultSignature; 8751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestException", v8::Local<v8::FunctionTemplate>(), V8TestException::internalFieldCount, 88c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles) V8TestExceptionAttributes, WTF_ARRAY_LENGTH(V8TestExceptionAttributes), 8919cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles) 0, 0, 9051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) 0, 0, 91d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) isolate); 92f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate(); 93f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate(); 9409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) static const V8DOMConfiguration::ConstantConfiguration V8TestExceptionConstants[] = { 95197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch {"UNSIGNED_SHORT_CONSTANT", 1, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort}, 9609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) }; 9709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8TestExceptionConstants, WTF_ARRAY_LENGTH(V8TestExceptionConstants), isolate); 98197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch static const V8DOMConfiguration::MethodConfiguration toStringMethodConfiguration = { 99c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) "toString", TestExceptionV8Internal::toStringMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, 100197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch }; 101c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum), toStringMethodConfiguration, isolate); 1025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Custom toString template 104a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); 1055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 107d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)v8::Handle<v8::FunctionTemplate> V8TestException::domTemplate(v8::Isolate* isolate) 1085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 109197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestExceptionTemplate); 1105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 11207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdochbool V8TestException::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 1135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 11407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); 115d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)} 116d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 11707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdochv8::Handle<v8::Object> V8TestException::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 118d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles){ 11907a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); 120d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)} 121d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 1227242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano TucciTestException* V8TestException::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) 123d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles){ 1247242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestException>() : 0; 1255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1277242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci 1287242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tuccivoid V8TestException::refObject(ScriptWrappableBase* internalPointer) 1295d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles){ 1307242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci internalPointer->toImpl<TestException>()->ref(); 1315d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles)} 1325d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) 1337242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tuccivoid V8TestException::derefObject(ScriptWrappableBase* internalPointer) 1345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1357242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci internalPointer->toImpl<TestException>()->deref(); 1365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 137c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles) 1387242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano TucciWrapperPersistentNode* V8TestException::createPersistentHandle(ScriptWrappableBase* internalPointer) 1395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1407242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci ASSERT_NOT_REACHED(); 1417242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci return 0; 1425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 14451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)template<> 14551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 14651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){ 14751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) return toV8(impl, creationContext, isolate); 14851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} 14951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) 150c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink 151