| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 isolate, currentWorldType); | 177 isolate, currentWorldType); |
| 178 UNUSED_PARAM(defaultSignature); | 178 UNUSED_PARAM(defaultSignature); |
| 179 functionTemplate->SetCallHandler(V8TestOverloadedConstructors::constructorCa
llback); | 179 functionTemplate->SetCallHandler(V8TestOverloadedConstructors::constructorCa
llback); |
| 180 functionTemplate->SetLength(1); | 180 functionTemplate->SetLength(1); |
| 181 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 181 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 182 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 182 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 183 UNUSED_PARAM(instanceTemplate); | 183 UNUSED_PARAM(instanceTemplate); |
| 184 UNUSED_PARAM(prototypeTemplate); | 184 UNUSED_PARAM(prototypeTemplate); |
| 185 | 185 |
| 186 // Custom toString template | 186 // Custom toString template |
| 187 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 187 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 188 return functionTemplate; | 188 return functionTemplate; |
| 189 } | 189 } |
| 190 | 190 |
| 191 v8::Handle<v8::FunctionTemplate> V8TestOverloadedConstructors::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) | 191 v8::Handle<v8::FunctionTemplate> V8TestOverloadedConstructors::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) |
| 192 { | 192 { |
| 193 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 193 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 194 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 194 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 195 if (result != data->templateMap(currentWorldType).end()) | 195 if (result != data->templateMap(currentWorldType).end()) |
| 196 return result->value.newLocal(isolate); | 196 return result->value.newLocal(isolate); |
| 197 | 197 |
| 198 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 198 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 199 v8::HandleScope handleScope(isolate); | 199 v8::EscapableHandleScope handleScope(isolate); |
| 200 v8::Handle<v8::FunctionTemplate> templ = | 200 v8::Local<v8::FunctionTemplate> templ = |
| 201 ConfigureV8TestOverloadedConstructorsTemplate(data->rawTemplate(&wrapper
TypeInfo, currentWorldType), isolate, currentWorldType); | 201 ConfigureV8TestOverloadedConstructorsTemplate(data->rawTemplate(&wrapper
TypeInfo, currentWorldType), isolate, currentWorldType); |
| 202 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 202 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 203 return handleScope.Close(templ); | 203 return handleScope.Escape(templ); |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool V8TestOverloadedConstructors::hasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 206 bool V8TestOverloadedConstructors::hasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) |
| 207 { | 207 { |
| 208 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 208 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool V8TestOverloadedConstructors::hasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) | 211 bool V8TestOverloadedConstructors::hasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) |
| 212 { | 212 { |
| 213 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 213 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 240 fromInternalPointer(object)->deref(); | 240 fromInternalPointer(object)->deref(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 template<> | 243 template<> |
| 244 v8::Handle<v8::Value> toV8NoInline(TestOverloadedConstructors* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 244 v8::Handle<v8::Value> toV8NoInline(TestOverloadedConstructors* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
| 245 { | 245 { |
| 246 return toV8(impl, creationContext, isolate); | 246 return toV8(impl, creationContext, isolate); |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace WebCore | 249 } // namespace WebCore |
| OLD | NEW |