| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 147 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
| 148 v8SetReturnValue(info, info.Holder()); | 148 v8SetReturnValue(info, info.Holder()); |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 | 151 |
| 152 TestInterfaceConstructorV8Internal::constructor(info); | 152 TestInterfaceConstructorV8Internal::constructor(info); |
| 153 } | 153 } |
| 154 | 154 |
| 155 static void configureV8TestInterfaceConstructorTemplate(v8::Handle<v8::FunctionT
emplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldTy
pe) | 155 static void configureV8TestInterfaceConstructorTemplate(v8::Handle<v8::FunctionT
emplate> functionTemplate, v8::Isolate* isolate) |
| 156 { | 156 { |
| 157 functionTemplate->ReadOnlyPrototype(); | 157 functionTemplate->ReadOnlyPrototype(); |
| 158 | 158 |
| 159 v8::Local<v8::Signature> defaultSignature; | 159 v8::Local<v8::Signature> defaultSignature; |
| 160 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterf
aceConstructor::internalFieldCount, | 160 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterf
aceConstructor::internalFieldCount, |
| 161 0, 0, | 161 0, 0, |
| 162 0, 0, | 162 0, 0, |
| 163 0, 0, | 163 0, 0, |
| 164 isolate, currentWorldType); | 164 isolate); |
| 165 functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCall
back); | 165 functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCall
back); |
| 166 functionTemplate->SetLength(0); | 166 functionTemplate->SetLength(0); |
| 167 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 167 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 168 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 168 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 169 | 169 |
| 170 // Custom toString template | 170 // Custom toString template |
| 171 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 171 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::domTemplate(v8::Iso
late* isolate, WrapperWorldType currentWorldType) | 174 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::domTemplate(v8::Iso
late* isolate) |
| 175 { | 175 { |
| 176 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 176 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 177 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 177 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
| 178 if (result != data->templateMap(currentWorldType).end()) | 178 if (result != data->templateMap().end()) |
| 179 return result->value.newLocal(isolate); | 179 return result->value.newLocal(isolate); |
| 180 | 180 |
| 181 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 181 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 182 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 182 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 183 configureV8TestInterfaceConstructorTemplate(templ, isolate, currentWorldType
); | 183 configureV8TestInterfaceConstructorTemplate(templ, isolate); |
| 184 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 184 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
| 185 return templ; | 185 return templ; |
| 186 } | 186 } |
| 187 | 187 |
| 188 bool V8TestInterfaceConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::
Isolate* isolate) | 188 bool V8TestInterfaceConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::
Isolate* isolate) |
| 189 { | 189 { |
| 190 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 190 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
| 191 } | 191 } |
| 192 | 192 |
| 193 v8::Handle<v8::Object> V8TestInterfaceConstructor::findInstanceInPrototypeChain(
v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 193 v8::Handle<v8::Object> V8TestInterfaceConstructor::findInstanceInPrototypeChain(
v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
| 194 { | 194 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 225 fromInternalPointer(object)->deref(); | 225 fromInternalPointer(object)->deref(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 template<> | 228 template<> |
| 229 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 229 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 230 { | 230 { |
| 231 return toV8(impl, creationContext, isolate); | 231 return toV8(impl, creationContext, isolate); |
| 232 } | 232 } |
| 233 | 233 |
| 234 } // namespace WebCore | 234 } // namespace WebCore |
| OLD | NEW |