| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | 123 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 124 { | 124 { |
| 125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 126 TestEventTargetV8Internal::indexedPropertyGetter(index, info); | 126 TestEventTargetV8Internal::indexedPropertyGetter(index, info); |
| 127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 128 } | 128 } |
| 129 | 129 |
| 130 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) | 130 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 131 { | 131 { |
| 132 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 132 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |
| 133 V8TRYCATCH_VOID(Node*, propertyValue, V8Node::hasInstance(jsValue, info.GetI
solate(), worldType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object
>::Cast(jsValue)) : 0); | 133 V8TRYCATCH_VOID(Node*, propertyValue, V8Node::hasInstance(jsValue, info.GetI
solate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); |
| 134 bool result = collection->anonymousIndexedSetter(index, propertyValue); | 134 bool result = collection->anonymousIndexedSetter(index, propertyValue); |
| 135 if (!result) | 135 if (!result) |
| 136 return; | 136 return; |
| 137 v8SetReturnValue(info, jsValue); | 137 v8SetReturnValue(info, jsValue); |
| 138 } | 138 } |
| 139 | 139 |
| 140 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 140 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 141 { | 141 { |
| 142 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 142 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 143 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info); | 143 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 return result->value.newLocal(isolate); | 306 return result->value.newLocal(isolate); |
| 307 | 307 |
| 308 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 308 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 309 v8::EscapableHandleScope handleScope(isolate); | 309 v8::EscapableHandleScope handleScope(isolate); |
| 310 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 310 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 311 configureV8TestEventTargetTemplate(templ, isolate, currentWorldType); | 311 configureV8TestEventTargetTemplate(templ, isolate, currentWorldType); |
| 312 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 312 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 313 return handleScope.Escape(templ); | 313 return handleScope.Escape(templ); |
| 314 } | 314 } |
| 315 | 315 |
| 316 bool V8TestEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate*
isolate, WrapperWorldType currentWorldType) | 316 bool V8TestEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate*
isolate) |
| 317 { | 317 { |
| 318 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 318 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 319 } | 319 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 320 | |
| 321 bool V8TestEventTarget::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8:
:Isolate* isolate) | |
| 322 { | |
| 323 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | |
| 324 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | |
| 325 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | |
| 326 } | 320 } |
| 327 | 321 |
| 328 EventTarget* V8TestEventTarget::toEventTarget(v8::Handle<v8::Object> object) | 322 EventTarget* V8TestEventTarget::toEventTarget(v8::Handle<v8::Object> object) |
| 329 { | 323 { |
| 330 return toNative(object); | 324 return toNative(object); |
| 331 } | 325 } |
| 332 | 326 |
| 333 v8::Handle<v8::Object> V8TestEventTarget::createWrapper(PassRefPtr<TestEventTarg
et> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 327 v8::Handle<v8::Object> V8TestEventTarget::createWrapper(PassRefPtr<TestEventTarg
et> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 334 { | 328 { |
| 335 ASSERT(impl); | 329 ASSERT(impl); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 355 fromInternalPointer(object)->deref(); | 349 fromInternalPointer(object)->deref(); |
| 356 } | 350 } |
| 357 | 351 |
| 358 template<> | 352 template<> |
| 359 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) | 353 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) |
| 360 { | 354 { |
| 361 return toV8(impl, creationContext, isolate); | 355 return toV8(impl, creationContext, isolate); |
| 362 } | 356 } |
| 363 | 357 |
| 364 } // namespace WebCore | 358 } // namespace WebCore |
| OLD | NEW |