| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 isolate, currentWorldType); | 165 isolate, currentWorldType); |
| 166 UNUSED_PARAM(defaultSignature); | 166 UNUSED_PARAM(defaultSignature); |
| 167 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 167 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 168 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 168 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 169 UNUSED_PARAM(instanceTemplate); | 169 UNUSED_PARAM(instanceTemplate); |
| 170 UNUSED_PARAM(prototypeTemplate); | 170 UNUSED_PARAM(prototypeTemplate); |
| 171 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestCustomAc
cessorsV8Internal::indexedPropertyGetterCallback, TestCustomAccessorsV8Internal:
:indexedPropertySetterCallback, 0, TestCustomAccessorsV8Internal::indexedPropert
yDeleterCallback, 0); | 171 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestCustomAc
cessorsV8Internal::indexedPropertyGetterCallback, TestCustomAccessorsV8Internal:
:indexedPropertySetterCallback, 0, TestCustomAccessorsV8Internal::indexedPropert
yDeleterCallback, 0); |
| 172 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestCustomAcce
ssorsV8Internal::namedPropertyGetterCallback, TestCustomAccessorsV8Internal::nam
edPropertySetterCallback, TestCustomAccessorsV8Internal::namedPropertyQueryCallb
ack, TestCustomAccessorsV8Internal::namedPropertyDeleterCallback, TestCustomAcce
ssorsV8Internal::namedPropertyEnumeratorCallback); | 172 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestCustomAcce
ssorsV8Internal::namedPropertyGetterCallback, TestCustomAccessorsV8Internal::nam
edPropertySetterCallback, TestCustomAccessorsV8Internal::namedPropertyQueryCallb
ack, TestCustomAccessorsV8Internal::namedPropertyDeleterCallback, TestCustomAcce
ssorsV8Internal::namedPropertyEnumeratorCallback); |
| 173 | 173 |
| 174 // Custom toString template | 174 // Custom toString template |
| 175 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 175 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 176 return functionTemplate; | 176 return functionTemplate; |
| 177 } | 177 } |
| 178 | 178 |
| 179 v8::Handle<v8::FunctionTemplate> V8TestCustomAccessors::GetTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) | 179 v8::Handle<v8::FunctionTemplate> V8TestCustomAccessors::GetTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) |
| 180 { | 180 { |
| 181 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 181 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 182 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 182 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 183 if (result != data->templateMap(currentWorldType).end()) | 183 if (result != data->templateMap(currentWorldType).end()) |
| 184 return result->value.newLocal(isolate); | 184 return result->value.newLocal(isolate); |
| 185 | 185 |
| 186 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 186 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 187 v8::HandleScope handleScope(isolate); | 187 v8::EscapableHandleScope handleScope(isolate); |
| 188 v8::Handle<v8::FunctionTemplate> templ = | 188 v8::Local<v8::FunctionTemplate> templ = |
| 189 ConfigureV8TestCustomAccessorsTemplate(data->rawTemplate(&wrapperTypeInf
o, currentWorldType), isolate, currentWorldType); | 189 ConfigureV8TestCustomAccessorsTemplate(data->rawTemplate(&wrapperTypeInf
o, currentWorldType), isolate, currentWorldType); |
| 190 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 190 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 191 return handleScope.Close(templ); | 191 return handleScope.Escape(templ); |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool V8TestCustomAccessors::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate, WrapperWorldType currentWorldType) | 194 bool V8TestCustomAccessors::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate, WrapperWorldType currentWorldType) |
| 195 { | 195 { |
| 196 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 196 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 197 } | 197 } |
| 198 | 198 |
| 199 bool V8TestCustomAccessors::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) | 199 bool V8TestCustomAccessors::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) |
| 200 { | 200 { |
| 201 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 201 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 228 fromInternalPointer(object)->deref(); | 228 fromInternalPointer(object)->deref(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 template<> | 231 template<> |
| 232 v8::Handle<v8::Value> toV8NoInline(TestCustomAccessors* impl, v8::Handle<v8::Obj
ect> creationContext, v8::Isolate* isolate) | 232 v8::Handle<v8::Value> toV8NoInline(TestCustomAccessors* impl, v8::Handle<v8::Obj
ect> creationContext, v8::Isolate* isolate) |
| 233 { | 233 { |
| 234 return toV8(impl, creationContext, isolate); | 234 return toV8(impl, creationContext, isolate); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace WebCore | 237 } // namespace WebCore |
| OLD | NEW |