| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 125 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 126 { | 126 { |
| 127 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 127 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 128 V8TestSpecialOperationsCustom::namedPropertyEnumeratorCustom(info); | 128 V8TestSpecialOperationsCustom::namedPropertyEnumeratorCustom(info); |
| 129 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 129 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace TestSpecialOperationsCustomV8Internal | 132 } // namespace TestSpecialOperationsCustomV8Internal |
| 133 | 133 |
| 134 static void configureV8TestSpecialOperationsCustomTemplate(v8::Handle<v8::Functi
onTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorl
dType) | 134 static void configureV8TestSpecialOperationsCustomTemplate(v8::Handle<v8::Functi
onTemplate> functionTemplate, v8::Isolate* isolate) |
| 135 { | 135 { |
| 136 functionTemplate->ReadOnlyPrototype(); | 136 functionTemplate->ReadOnlyPrototype(); |
| 137 | 137 |
| 138 v8::Local<v8::Signature> defaultSignature; | 138 v8::Local<v8::Signature> defaultSignature; |
| 139 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsCustom", v8::Local<v8::FunctionTemplate>(), V8TestSpe
cialOperationsCustom::internalFieldCount, | 139 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsCustom", v8::Local<v8::FunctionTemplate>(), V8TestSpe
cialOperationsCustom::internalFieldCount, |
| 140 0, 0, | 140 0, 0, |
| 141 0, 0, | 141 0, 0, |
| 142 0, 0, | 142 0, 0, |
| 143 isolate, currentWorldType); | 143 isolate); |
| 144 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 144 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 145 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 145 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 146 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsCustomV8Internal::indexedPropertyGetterCallback, TestSpecialOperationsC
ustomV8Internal::indexedPropertySetterCallback, 0, TestSpecialOperationsCustomV8
Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestSpecialO
perationsCustom>); | 146 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsCustomV8Internal::indexedPropertyGetterCallback, TestSpecialOperationsC
ustomV8Internal::indexedPropertySetterCallback, 0, TestSpecialOperationsCustomV8
Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestSpecialO
perationsCustom>); |
| 147 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsCustomV8Internal::namedPropertyGetterCallback, TestSpecialOperationsCusto
mV8Internal::namedPropertySetterCallback, TestSpecialOperationsCustomV8Internal:
:namedPropertyQueryCallback, TestSpecialOperationsCustomV8Internal::namedPropert
yDeleterCallback, TestSpecialOperationsCustomV8Internal::namedPropertyEnumerator
Callback); | 147 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsCustomV8Internal::namedPropertyGetterCallback, TestSpecialOperationsCusto
mV8Internal::namedPropertySetterCallback, TestSpecialOperationsCustomV8Internal:
:namedPropertyQueryCallback, TestSpecialOperationsCustomV8Internal::namedPropert
yDeleterCallback, TestSpecialOperationsCustomV8Internal::namedPropertyEnumerator
Callback); |
| 148 | 148 |
| 149 // Custom toString template | 149 // Custom toString template |
| 150 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 150 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsCustom::domTemplate(v8::
Isolate* isolate, WrapperWorldType currentWorldType) | 153 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsCustom::domTemplate(v8::
Isolate* isolate) |
| 154 { | 154 { |
| 155 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 155 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 156 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 156 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
| 157 if (result != data->templateMap(currentWorldType).end()) | 157 if (result != data->templateMap().end()) |
| 158 return result->value.newLocal(isolate); | 158 return result->value.newLocal(isolate); |
| 159 | 159 |
| 160 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 160 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 161 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 161 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 162 configureV8TestSpecialOperationsCustomTemplate(templ, isolate, currentWorldT
ype); | 162 configureV8TestSpecialOperationsCustomTemplate(templ, isolate); |
| 163 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 163 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
| 164 return templ; | 164 return templ; |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool V8TestSpecialOperationsCustom::hasInstance(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) | 167 bool V8TestSpecialOperationsCustom::hasInstance(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) |
| 168 { | 168 { |
| 169 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 169 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
| 170 } | 170 } |
| 171 | 171 |
| 172 v8::Handle<v8::Object> V8TestSpecialOperationsCustom::findInstanceInPrototypeCha
in(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 172 v8::Handle<v8::Object> V8TestSpecialOperationsCustom::findInstanceInPrototypeCha
in(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
| 173 { | 173 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 204 fromInternalPointer(object)->deref(); | 204 fromInternalPointer(object)->deref(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 template<> | 207 template<> |
| 208 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsCustom* impl, v8::Handle
<v8::Object> creationContext, v8::Isolate* isolate) | 208 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsCustom* impl, v8::Handle
<v8::Object> creationContext, v8::Isolate* isolate) |
| 209 { | 209 { |
| 210 return toV8(impl, creationContext, isolate); | 210 return toV8(impl, creationContext, isolate); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace WebCore | 213 } // namespace WebCore |
| OLD | NEW |