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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 { | 162 { |
163 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 163 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
164 return; | 164 return; |
165 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 165 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
166 return; | 166 return; |
167 if (info.Holder()->HasRealNamedProperty(name)) | 167 if (info.Holder()->HasRealNamedProperty(name)) |
168 return; | 168 return; |
169 | 169 |
170 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); | 170 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); |
171 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 171 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |
172 AtomicString propertyName = toWebCoreAtomicString(name); | 172 AtomicString propertyName = toCoreAtomicString(name); |
173 RefPtr<Node> element = collection->namedItem(propertyName); | 173 RefPtr<Node> element = collection->namedItem(propertyName); |
174 if (!element) | 174 if (!element) |
175 return; | 175 return; |
176 v8SetReturnValueFast(info, element.release(), collection); | 176 v8SetReturnValueFast(info, element.release(), collection); |
177 } | 177 } |
178 | 178 |
179 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 179 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
180 { | 180 { |
181 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 181 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
182 TestEventTargetV8Internal::namedPropertyGetter(name, info); | 182 TestEventTargetV8Internal::namedPropertyGetter(name, info); |
(...skipping 24 matching lines...) Expand all Loading... |
207 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 207 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
208 { | 208 { |
209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
210 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info); | 210 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info); |
211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
212 } | 212 } |
213 | 213 |
214 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) | 214 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) |
215 { | 215 { |
216 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 216 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |
217 AtomicString propertyName = toWebCoreAtomicString(name); | 217 AtomicString propertyName = toCoreAtomicString(name); |
218 bool result = collection->anonymousNamedDeleter(propertyName); | 218 bool result = collection->anonymousNamedDeleter(propertyName); |
219 return v8SetReturnValueBool(info, result); | 219 return v8SetReturnValueBool(info, result); |
220 } | 220 } |
221 | 221 |
222 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | 222 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) |
223 { | 223 { |
224 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 224 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
225 TestEventTargetV8Internal::namedPropertyDeleter(name, info); | 225 TestEventTargetV8Internal::namedPropertyDeleter(name, info); |
226 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 226 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
227 } | 227 } |
228 | 228 |
229 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 229 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
230 { | 230 { |
231 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 231 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
232 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 232 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |
233 Vector<String> names; | 233 Vector<String> names; |
234 collection->namedPropertyEnumerator(names, exceptionState); | 234 collection->namedPropertyEnumerator(names, exceptionState); |
235 if (exceptionState.throwIfNeeded()) | 235 if (exceptionState.throwIfNeeded()) |
236 return; | 236 return; |
237 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 237 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
238 for (size_t i = 0; i < names.size(); ++i) | 238 for (size_t i = 0; i < names.size(); ++i) |
239 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 239 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
240 v8SetReturnValue(info, v8names); | 240 v8SetReturnValue(info, v8names); |
241 } | 241 } |
242 | 242 |
243 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 243 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
244 { | 244 { |
245 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); | 245 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); |
246 AtomicString propertyName = toWebCoreAtomicString(name); | 246 AtomicString propertyName = toCoreAtomicString(name); |
247 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 247 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
248 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 248 bool result = collection->namedPropertyQuery(propertyName, exceptionState); |
249 if (exceptionState.throwIfNeeded()) | 249 if (exceptionState.throwIfNeeded()) |
250 return; | 250 return; |
251 if (!result) | 251 if (!result) |
252 return; | 252 return; |
253 v8SetReturnValueInt(info, v8::None); | 253 v8SetReturnValueInt(info, v8::None); |
254 } | 254 } |
255 | 255 |
256 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 256 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 fromInternalPointer(object)->deref(); | 351 fromInternalPointer(object)->deref(); |
352 } | 352 } |
353 | 353 |
354 template<> | 354 template<> |
355 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) | 355 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) |
356 { | 356 { |
357 return toV8(impl, creationContext, isolate); | 357 return toV8(impl, creationContext, isolate); |
358 } | 358 } |
359 | 359 |
360 } // namespace WebCore | 360 } // namespace WebCore |
OLD | NEW |