| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 85 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
| 86 v8SetReturnValue(info, info.Holder()); | 86 v8SetReturnValue(info, info.Holder()); |
| 87 return; | 87 return; |
| 88 } | 88 } |
| 89 | 89 |
| 90 V8TestInterfaceCustomConstructor::constructorCustom(info); | 90 V8TestInterfaceCustomConstructor::constructorCustom(info); |
| 91 } | 91 } |
| 92 | 92 |
| 93 static void configureV8TestInterfaceCustomConstructorTemplate(v8::Handle<v8::Fun
ctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentW
orldType) | 93 static void configureV8TestInterfaceCustomConstructorTemplate(v8::Handle<v8::Fun
ctionTemplate> functionTemplate, v8::Isolate* isolate) |
| 94 { | 94 { |
| 95 functionTemplate->ReadOnlyPrototype(); | 95 functionTemplate->ReadOnlyPrototype(); |
| 96 | 96 |
| 97 v8::Local<v8::Signature> defaultSignature; | 97 v8::Local<v8::Signature> defaultSignature; |
| 98 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceCustomConstructor", v8::Local<v8::FunctionTemplate>(), V8Test
InterfaceCustomConstructor::internalFieldCount, | 98 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceCustomConstructor", v8::Local<v8::FunctionTemplate>(), V8Test
InterfaceCustomConstructor::internalFieldCount, |
| 99 0, 0, | 99 0, 0, |
| 100 0, 0, | 100 0, 0, |
| 101 0, 0, | 101 0, 0, |
| 102 isolate, currentWorldType); | 102 isolate); |
| 103 functionTemplate->SetCallHandler(V8TestInterfaceCustomConstructor::construct
orCallback); | 103 functionTemplate->SetCallHandler(V8TestInterfaceCustomConstructor::construct
orCallback); |
| 104 functionTemplate->SetLength(0); | 104 functionTemplate->SetLength(0); |
| 105 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 105 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 106 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 106 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 107 | 107 |
| 108 // Custom toString template | 108 // Custom toString template |
| 109 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 109 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 v8::Handle<v8::FunctionTemplate> V8TestInterfaceCustomConstructor::domTemplate(v
8::Isolate* isolate, WrapperWorldType currentWorldType) | 112 v8::Handle<v8::FunctionTemplate> V8TestInterfaceCustomConstructor::domTemplate(v
8::Isolate* isolate) |
| 113 { | 113 { |
| 114 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 114 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 115 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 115 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
| 116 if (result != data->templateMap(currentWorldType).end()) | 116 if (result != data->templateMap().end()) |
| 117 return result->value.newLocal(isolate); | 117 return result->value.newLocal(isolate); |
| 118 | 118 |
| 119 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 119 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 120 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 120 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 121 configureV8TestInterfaceCustomConstructorTemplate(templ, isolate, currentWor
ldType); | 121 configureV8TestInterfaceCustomConstructorTemplate(templ, isolate); |
| 122 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 122 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
| 123 return templ; | 123 return templ; |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool V8TestInterfaceCustomConstructor::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) | 126 bool V8TestInterfaceCustomConstructor::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) |
| 127 { | 127 { |
| 128 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 128 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
| 129 } | 129 } |
| 130 | 130 |
| 131 v8::Handle<v8::Object> V8TestInterfaceCustomConstructor::findInstanceInPrototype
Chain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 131 v8::Handle<v8::Object> V8TestInterfaceCustomConstructor::findInstanceInPrototype
Chain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
| 132 { | 132 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 163 fromInternalPointer(object)->deref(); | 163 fromInternalPointer(object)->deref(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 template<> | 166 template<> |
| 167 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCustomConstructor* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | 167 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCustomConstructor* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) |
| 168 { | 168 { |
| 169 return toV8(impl, creationContext, isolate); | 169 return toV8(impl, creationContext, isolate); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace WebCore | 172 } // namespace WebCore |
| OLD | NEW |