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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 137 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
138 v8SetReturnValue(info, info.Holder()); | 138 v8SetReturnValue(info, info.Holder()); |
139 return; | 139 return; |
140 } | 140 } |
141 | 141 |
142 TestInterfaceConstructor2V8Internal::constructor(info); | 142 TestInterfaceConstructor2V8Internal::constructor(info); |
143 } | 143 } |
144 | 144 |
145 static void configureV8TestInterfaceConstructor2Template(v8::Handle<v8::Function
Template> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldT
ype) | 145 static void configureV8TestInterfaceConstructor2Template(v8::Handle<v8::Function
Template> functionTemplate, v8::Isolate* isolate) |
146 { | 146 { |
147 functionTemplate->ReadOnlyPrototype(); | 147 functionTemplate->ReadOnlyPrototype(); |
148 | 148 |
149 v8::Local<v8::Signature> defaultSignature; | 149 v8::Local<v8::Signature> defaultSignature; |
150 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor2", v8::Local<v8::FunctionTemplate>(), V8TestInter
faceConstructor2::internalFieldCount, | 150 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor2", v8::Local<v8::FunctionTemplate>(), V8TestInter
faceConstructor2::internalFieldCount, |
151 0, 0, | 151 0, 0, |
152 0, 0, | 152 0, 0, |
153 0, 0, | 153 0, 0, |
154 isolate, currentWorldType); | 154 isolate); |
155 functionTemplate->SetCallHandler(V8TestInterfaceConstructor2::constructorCal
lback); | 155 functionTemplate->SetCallHandler(V8TestInterfaceConstructor2::constructorCal
lback); |
156 functionTemplate->SetLength(1); | 156 functionTemplate->SetLength(1); |
157 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 157 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
158 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 158 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
159 | 159 |
160 // Custom toString template | 160 // Custom toString template |
161 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 161 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
162 } | 162 } |
163 | 163 |
164 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor2::domTemplate(v8::Is
olate* isolate, WrapperWorldType currentWorldType) | 164 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor2::domTemplate(v8::Is
olate* isolate) |
165 { | 165 { |
166 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 166 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
167 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 167 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
168 if (result != data->templateMap(currentWorldType).end()) | 168 if (result != data->templateMap().end()) |
169 return result->value.newLocal(isolate); | 169 return result->value.newLocal(isolate); |
170 | 170 |
171 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 171 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
172 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 172 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
173 configureV8TestInterfaceConstructor2Template(templ, isolate, currentWorldTyp
e); | 173 configureV8TestInterfaceConstructor2Template(templ, isolate); |
174 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 174 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
175 return templ; | 175 return templ; |
176 } | 176 } |
177 | 177 |
178 bool V8TestInterfaceConstructor2::hasInstance(v8::Handle<v8::Value> jsValue, v8:
:Isolate* isolate) | 178 bool V8TestInterfaceConstructor2::hasInstance(v8::Handle<v8::Value> jsValue, v8:
:Isolate* isolate) |
179 { | 179 { |
180 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 180 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
181 } | 181 } |
182 | 182 |
183 v8::Handle<v8::Object> V8TestInterfaceConstructor2::findInstanceInPrototypeChain
(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 183 v8::Handle<v8::Object> V8TestInterfaceConstructor2::findInstanceInPrototypeChain
(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
184 { | 184 { |
(...skipping 30 matching lines...) Expand all Loading... |
215 fromInternalPointer(object)->deref(); | 215 fromInternalPointer(object)->deref(); |
216 } | 216 } |
217 | 217 |
218 template<> | 218 template<> |
219 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor2* impl, v8::Handle<v
8::Object> creationContext, v8::Isolate* isolate) | 219 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor2* impl, v8::Handle<v
8::Object> creationContext, v8::Isolate* isolate) |
220 { | 220 { |
221 return toV8(impl, creationContext, isolate); | 221 return toV8(impl, creationContext, isolate); |
222 } | 222 } |
223 | 223 |
224 } // namespace WebCore | 224 } // namespace WebCore |
OLD | NEW |