| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 v8SetReturnValue(info, jsValue); | 274 v8SetReturnValue(info, jsValue); |
| 275 } | 275 } |
| 276 | 276 |
| 277 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 277 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 278 { | 278 { |
| 279 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 279 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 280 TestSpecialOperationsIdentifierV8Internal::namedPropertySetter(name, jsValue
, info); | 280 TestSpecialOperationsIdentifierV8Internal::namedPropertySetter(name, jsValue
, info); |
| 281 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 281 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 282 } | 282 } |
| 283 | 283 |
| 284 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) | |
| 285 { | |
| 286 TestSpecialOperationsIdentifier* collection = V8TestSpecialOperationsIdentif
ier::toNative(info.Holder()); | |
| 287 AtomicString propertyName = toCoreAtomicString(name); | |
| 288 DeleteResult result = collection->deleteNamedItem(propertyName); | |
| 289 if (result != DeleteUnknownProperty) | |
| 290 return v8SetReturnValueBool(info, result == DeleteSuccess); | |
| 291 } | |
| 292 | |
| 293 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | |
| 294 { | |
| 295 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 296 TestSpecialOperationsIdentifierV8Internal::namedPropertyDeleter(name, info); | |
| 297 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 298 } | |
| 299 | |
| 300 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 284 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 301 { | 285 { |
| 302 TestSpecialOperationsIdentifier* collection = V8TestSpecialOperationsIdentif
ier::toNative(info.Holder()); | 286 TestSpecialOperationsIdentifier* collection = V8TestSpecialOperationsIdentif
ier::toNative(info.Holder()); |
| 303 AtomicString propertyName = toCoreAtomicString(name); | 287 AtomicString propertyName = toCoreAtomicString(name); |
| 304 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 288 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 305 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 289 bool result = collection->namedPropertyQuery(propertyName, exceptionState); |
| 306 if (exceptionState.throwIfNeeded()) | 290 if (exceptionState.throwIfNeeded()) |
| 307 return; | 291 return; |
| 308 if (!result) | 292 if (!result) |
| 309 return; | 293 return; |
| 310 v8SetReturnValueInt(info, v8::None); | 294 v8SetReturnValueInt(info, v8::None); |
| 311 } | 295 } |
| 312 | 296 |
| 313 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 297 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 314 { | 298 { |
| 315 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 299 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 316 TestSpecialOperationsIdentifierV8Internal::namedPropertyQuery(name, info); | 300 TestSpecialOperationsIdentifierV8Internal::namedPropertyQuery(name, info); |
| 317 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 301 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 318 } | 302 } |
| 319 | 303 |
| 304 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) |
| 305 { |
| 306 TestSpecialOperationsIdentifier* collection = V8TestSpecialOperationsIdentif
ier::toNative(info.Holder()); |
| 307 AtomicString propertyName = toCoreAtomicString(name); |
| 308 DeleteResult result = collection->deleteNamedItem(propertyName); |
| 309 if (result != DeleteUnknownProperty) |
| 310 return v8SetReturnValueBool(info, result == DeleteSuccess); |
| 311 } |
| 312 |
| 313 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) |
| 314 { |
| 315 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 316 TestSpecialOperationsIdentifierV8Internal::namedPropertyDeleter(name, info); |
| 317 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 318 } |
| 319 |
| 320 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 320 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 321 { | 321 { |
| 322 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 322 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 323 TestSpecialOperationsIdentifier* collection = V8TestSpecialOperationsIdentif
ier::toNative(info.Holder()); | 323 TestSpecialOperationsIdentifier* collection = V8TestSpecialOperationsIdentif
ier::toNative(info.Holder()); |
| 324 Vector<String> names; | 324 Vector<String> names; |
| 325 collection->namedPropertyEnumerator(names, exceptionState); | 325 collection->namedPropertyEnumerator(names, exceptionState); |
| 326 if (exceptionState.throwIfNeeded()) | 326 if (exceptionState.throwIfNeeded()) |
| 327 return; | 327 return; |
| 328 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 328 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 329 for (size_t i = 0; i < names.size(); ++i) | 329 for (size_t i = 0; i < names.size(); ++i) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 fromInternalPointer(object)->deref(); | 414 fromInternalPointer(object)->deref(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 template<> | 417 template<> |
| 418 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifier* impl, v8::Ha
ndle<v8::Object> creationContext, v8::Isolate* isolate) | 418 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifier* impl, v8::Ha
ndle<v8::Object> creationContext, v8::Isolate* isolate) |
| 419 { | 419 { |
| 420 return toV8(impl, creationContext, isolate); | 420 return toV8(impl, creationContext, isolate); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace WebCore | 423 } // namespace WebCore |
| OLD | NEW |