| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 functionTemplate->SetLength(1); | 172 functionTemplate->SetLength(1); |
| 173 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 173 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 174 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 174 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 175 UNUSED_PARAM(instanceTemplate); | 175 UNUSED_PARAM(instanceTemplate); |
| 176 UNUSED_PARAM(prototypeTemplate); | 176 UNUSED_PARAM(prototypeTemplate); |
| 177 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(Float64Array
V8Internal::indexedPropertyGetterCallback, Float64ArrayV8Internal::indexedProper
tySetterCallback, 0, 0, indexedPropertyEnumerator<Float64Array>); | 177 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(Float64Array
V8Internal::indexedPropertyGetterCallback, Float64ArrayV8Internal::indexedProper
tySetterCallback, 0, 0, indexedPropertyEnumerator<Float64Array>); |
| 178 | 178 |
| 179 // Custom Signature 'foo' | 179 // Custom Signature 'foo' |
| 180 const int fooArgc = 1; | 180 const int fooArgc = 1; |
| 181 v8::Handle<v8::FunctionTemplate> fooArgv[fooArgc] = { v8::Handle<v8::Functio
nTemplate>() }; | 181 v8::Handle<v8::FunctionTemplate> fooArgv[fooArgc] = { v8::Handle<v8::Functio
nTemplate>() }; |
| 182 v8::Handle<v8::Signature> fooSignature = v8::Signature::New(functionTemplate
, fooArgc, fooArgv); | 182 v8::Handle<v8::Signature> fooSignature = v8::Signature::New(isolate, functio
nTemplate, fooArgc, fooArgv); |
| 183 prototypeTemplate->Set(v8::String::NewSymbol("foo"), v8::FunctionTemplate::N
ew(Float64ArrayV8Internal::fooMethodCallback, v8Undefined(), fooSignature, 1)); | 183 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "foo", v8::String::k
InternalizedString), v8::FunctionTemplate::New(isolate, Float64ArrayV8Internal::
fooMethodCallback, v8Undefined(), fooSignature, 1)); |
| 184 | 184 |
| 185 // Custom toString template | 185 // Custom toString template |
| 186 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 186 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 187 return functionTemplate; | 187 return functionTemplate; |
| 188 } | 188 } |
| 189 | 189 |
| 190 v8::Handle<v8::FunctionTemplate> V8Float64Array::GetTemplate(v8::Isolate* isolat
e, WrapperWorldType currentWorldType) | 190 v8::Handle<v8::FunctionTemplate> V8Float64Array::GetTemplate(v8::Isolate* isolat
e, WrapperWorldType currentWorldType) |
| 191 { | 191 { |
| 192 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 192 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 193 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 193 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 194 if (result != data->templateMap(currentWorldType).end()) | 194 if (result != data->templateMap(currentWorldType).end()) |
| 195 return result->value.newLocal(isolate); | 195 return result->value.newLocal(isolate); |
| 196 | 196 |
| 197 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 197 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 198 v8::HandleScope handleScope(isolate); | 198 v8::EscapableHandleScope handleScope(isolate); |
| 199 v8::Handle<v8::FunctionTemplate> templ = | 199 v8::Local<v8::FunctionTemplate> templ = |
| 200 ConfigureV8Float64ArrayTemplate(data->rawTemplate(&wrapperTypeInfo, curr
entWorldType), isolate, currentWorldType); | 200 ConfigureV8Float64ArrayTemplate(data->rawTemplate(&wrapperTypeInfo, curr
entWorldType), isolate, currentWorldType); |
| 201 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 201 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 202 return handleScope.Close(templ); | 202 return handleScope.Escape(templ); |
| 203 } | 203 } |
| 204 | 204 |
| 205 bool V8Float64Array::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late, WrapperWorldType currentWorldType) | 205 bool V8Float64Array::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late, WrapperWorldType currentWorldType) |
| 206 { | 206 { |
| 207 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 207 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 208 } | 208 } |
| 209 | 209 |
| 210 bool V8Float64Array::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Is
olate* isolate) | 210 bool V8Float64Array::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Is
olate* isolate) |
| 211 { | 211 { |
| 212 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 212 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 27 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(Float64Array* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 244 v8::Handle<v8::Value> toV8NoInline(Float64Array* impl, v8::Handle<v8::Object> cr
eationContext, 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 |