| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "bindings/v8/V8DOMConfiguration.h" | 30 #include "bindings/v8/V8DOMConfiguration.h" |
| 31 | 31 |
| 32 #include "bindings/v8/V8Binding.h" | 32 #include "bindings/v8/V8Binding.h" |
| 33 #include "bindings/v8/V8ObjectConstructor.h" |
| 34 #include "platform/TraceEvent.h" |
| 33 | 35 |
| 34 namespace WebCore { | 36 namespace WebCore { |
| 35 | 37 |
| 36 void V8DOMConfiguration::installAttributes(v8::Handle<v8::ObjectTemplate> instan
ceTemplate, v8::Handle<v8::ObjectTemplate> prototype, const AttributeConfigurati
on* attributes, size_t attributeCount, v8::Isolate* isolate) | 38 void V8DOMConfiguration::installAttributes(v8::Handle<v8::ObjectTemplate> instan
ceTemplate, v8::Handle<v8::ObjectTemplate> prototype, const AttributeConfigurati
on* attributes, size_t attributeCount, v8::Isolate* isolate) |
| 37 { | 39 { |
| 38 for (size_t i = 0; i < attributeCount; ++i) | 40 for (size_t i = 0; i < attributeCount; ++i) |
| 39 installAttribute(instanceTemplate, prototype, attributes[i], isolate); | 41 installAttribute(instanceTemplate, prototype, attributes[i], isolate); |
| 40 } | 42 } |
| 41 | 43 |
| 42 void V8DOMConfiguration::installAccessors(v8::Handle<v8::ObjectTemplate> prototy
pe, v8::Handle<v8::Signature> signature, const AccessorConfiguration* accessors,
size_t accessorCount, v8::Isolate* isolate) | 44 void V8DOMConfiguration::installAccessors(v8::Handle<v8::ObjectTemplate> prototy
pe, v8::Handle<v8::Signature> signature, const AccessorConfiguration* accessors,
size_t accessorCount, v8::Isolate* isolate) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, func
tionDescriptor); | 112 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, func
tionDescriptor); |
| 111 if (attributeCount) | 113 if (attributeCount) |
| 112 installAttributes(instanceTemplate, functionDescriptor->PrototypeTemplat
e(), attributes, attributeCount, isolate); | 114 installAttributes(instanceTemplate, functionDescriptor->PrototypeTemplat
e(), attributes, attributeCount, isolate); |
| 113 if (accessorCount) | 115 if (accessorCount) |
| 114 installAccessors(functionDescriptor->PrototypeTemplate(), defaultSignatu
re, accessors, accessorCount, isolate); | 116 installAccessors(functionDescriptor->PrototypeTemplate(), defaultSignatu
re, accessors, accessorCount, isolate); |
| 115 if (callbackCount) | 117 if (callbackCount) |
| 116 installCallbacks(functionDescriptor->PrototypeTemplate(), defaultSignatu
re, static_cast<v8::PropertyAttribute>(v8::DontDelete), callbacks, callbackCount
, isolate); | 118 installCallbacks(functionDescriptor->PrototypeTemplate(), defaultSignatu
re, static_cast<v8::PropertyAttribute>(v8::DontDelete), callbacks, callbackCount
, isolate); |
| 117 return defaultSignature; | 119 return defaultSignature; |
| 118 } | 120 } |
| 119 | 121 |
| 122 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::domClassTemplate(v8::Isolat
e* isolate, WrapperTypeInfo* wrapperTypeInfo, void (*configureDOMClassTemplate)(
v8::Handle<v8::FunctionTemplate>, v8::Isolate*)) |
| 123 { |
| 124 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 125 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(wrapperTy
peInfo); |
| 126 if (!result.IsEmpty()) |
| 127 return result; |
| 128 |
| 129 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 130 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
| 131 configureDOMClassTemplate(result, isolate); |
| 132 data->setDOMTemplate(wrapperTypeInfo, result); |
| 133 return result; |
| 134 } |
| 135 |
| 120 } // namespace WebCore | 136 } // namespace WebCore |
| OLD | NEW |