| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 111 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace TestExceptionV8Internal | 114 } // namespace TestExceptionV8Internal |
| 115 | 115 |
| 116 static const V8DOMConfiguration::AttributeConfiguration V8TestExceptionAttribute
s[] = { | 116 static const V8DOMConfiguration::AttributeConfiguration V8TestExceptionAttribute
s[] = { |
| 117 {"readonlyUnsignedShortAttribute", TestExceptionV8Internal::readonlyUnsigned
ShortAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl
>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance *
/}, | 117 {"readonlyUnsignedShortAttribute", TestExceptionV8Internal::readonlyUnsigned
ShortAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl
>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance *
/}, |
| 118 {"readonlyStringAttribute", TestExceptionV8Internal::readonlyStringAttribute
AttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT)
, static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 118 {"readonlyStringAttribute", TestExceptionV8Internal::readonlyStringAttribute
AttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT)
, static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 static void configureV8TestExceptionTemplate(v8::Handle<v8::FunctionTemplate> fu
nctionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 121 static void configureV8TestExceptionTemplate(v8::Handle<v8::FunctionTemplate> fu
nctionTemplate, v8::Isolate* isolate) |
| 122 { | 122 { |
| 123 functionTemplate->ReadOnlyPrototype(); | 123 functionTemplate->ReadOnlyPrototype(); |
| 124 | 124 |
| 125 v8::Local<v8::Signature> defaultSignature; | 125 v8::Local<v8::Signature> defaultSignature; |
| 126 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestException", v8::Local<v8::FunctionTemplate>(), V8TestException::intern
alFieldCount, | 126 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestException", v8::Local<v8::FunctionTemplate>(), V8TestException::intern
alFieldCount, |
| 127 V8TestExceptionAttributes, WTF_ARRAY_LENGTH(V8TestExceptionAttributes), | 127 V8TestExceptionAttributes, WTF_ARRAY_LENGTH(V8TestExceptionAttributes), |
| 128 0, 0, | 128 0, 0, |
| 129 0, 0, | 129 0, 0, |
| 130 isolate, currentWorldType); | 130 isolate); |
| 131 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 131 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 132 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 132 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 133 static const V8DOMConfiguration::ConstantConfiguration V8TestExceptionConsta
nts[] = { | 133 static const V8DOMConfiguration::ConstantConfiguration V8TestExceptionConsta
nts[] = { |
| 134 {"UNSIGNED_SHORT_CONSTANT", 1}, | 134 {"UNSIGNED_SHORT_CONSTANT", 1}, |
| 135 }; | 135 }; |
| 136 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestExceptionConstants, WTF_ARRAY_LENGTH(V8TestExceptionConstants), isolate); | 136 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8
TestExceptionConstants, WTF_ARRAY_LENGTH(V8TestExceptionConstants), isolate); |
| 137 prototypeTemplate->Set(v8AtomicString(isolate, "toString"), v8::FunctionTemp
late::New(isolate, TestExceptionV8Internal::toStringMethodCallback, v8Undefined(
), defaultSignature, 0), static_cast<v8::PropertyAttribute>(v8::DontDelete | v8:
:DontEnum)); | 137 prototypeTemplate->Set(v8AtomicString(isolate, "toString"), v8::FunctionTemp
late::New(isolate, TestExceptionV8Internal::toStringMethodCallback, v8Undefined(
), defaultSignature, 0), static_cast<v8::PropertyAttribute>(v8::DontDelete | v8:
:DontEnum)); |
| 138 | 138 |
| 139 // Custom toString template | 139 // Custom toString template |
| 140 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 140 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 v8::Handle<v8::FunctionTemplate> V8TestException::domTemplate(v8::Isolate* isola
te, WrapperWorldType currentWorldType) | 143 v8::Handle<v8::FunctionTemplate> V8TestException::domTemplate(v8::Isolate* isola
te) |
| 144 { | 144 { |
| 145 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 145 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 146 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 146 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
| 147 if (result != data->templateMap(currentWorldType).end()) | 147 if (result != data->templateMap().end()) |
| 148 return result->value.newLocal(isolate); | 148 return result->value.newLocal(isolate); |
| 149 | 149 |
| 150 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 150 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 151 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 151 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 152 configureV8TestExceptionTemplate(templ, isolate, currentWorldType); | 152 configureV8TestExceptionTemplate(templ, isolate); |
| 153 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 153 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
| 154 return templ; | 154 return templ; |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool V8TestException::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is
olate) | 157 bool V8TestException::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is
olate) |
| 158 { | 158 { |
| 159 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 159 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
| 160 } | 160 } |
| 161 | 161 |
| 162 v8::Handle<v8::Object> V8TestException::findInstanceInPrototypeChain(v8::Handle<
v8::Value> jsValue, v8::Isolate* isolate) | 162 v8::Handle<v8::Object> V8TestException::findInstanceInPrototypeChain(v8::Handle<
v8::Value> jsValue, v8::Isolate* isolate) |
| 163 { | 163 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 194 fromInternalPointer(object)->deref(); | 194 fromInternalPointer(object)->deref(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 template<> | 197 template<> |
| 198 v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 198 v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
| 199 { | 199 { |
| 200 return toV8(impl, creationContext, isolate); | 200 return toV8(impl, creationContext, isolate); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace WebCore | 203 } // namespace WebCore |
| OLD | NEW |