| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 v8SetReturnValue(info, jsValue); | 158 v8SetReturnValue(info, jsValue); |
| 159 } | 159 } |
| 160 | 160 |
| 161 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 161 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 162 { | 162 { |
| 163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 164 TestSpecialOperationsAnonymousV8Internal::namedPropertySetter(name, jsValue,
info); | 164 TestSpecialOperationsAnonymousV8Internal::namedPropertySetter(name, jsValue,
info); |
| 165 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 165 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 166 } | 166 } |
| 167 | 167 |
| 168 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) | |
| 169 { | |
| 170 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | |
| 171 AtomicString propertyName = toCoreAtomicString(name); | |
| 172 DeleteResult result = collection->anonymousNamedDeleter(propertyName); | |
| 173 if (result != DeleteUnknownProperty) | |
| 174 return v8SetReturnValueBool(info, result == DeleteSuccess); | |
| 175 } | |
| 176 | |
| 177 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | |
| 178 { | |
| 179 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 180 TestSpecialOperationsAnonymousV8Internal::namedPropertyDeleter(name, info); | |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 182 } | |
| 183 | |
| 184 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 168 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 185 { | 169 { |
| 186 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | 170 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); |
| 187 AtomicString propertyName = toCoreAtomicString(name); | 171 AtomicString propertyName = toCoreAtomicString(name); |
| 188 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 172 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 189 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 173 bool result = collection->namedPropertyQuery(propertyName, exceptionState); |
| 190 if (exceptionState.throwIfNeeded()) | 174 if (exceptionState.throwIfNeeded()) |
| 191 return; | 175 return; |
| 192 if (!result) | 176 if (!result) |
| 193 return; | 177 return; |
| 194 v8SetReturnValueInt(info, v8::None); | 178 v8SetReturnValueInt(info, v8::None); |
| 195 } | 179 } |
| 196 | 180 |
| 197 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 181 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 198 { | 182 { |
| 199 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 183 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 200 TestSpecialOperationsAnonymousV8Internal::namedPropertyQuery(name, info); | 184 TestSpecialOperationsAnonymousV8Internal::namedPropertyQuery(name, info); |
| 201 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 185 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 202 } | 186 } |
| 203 | 187 |
| 188 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) |
| 189 { |
| 190 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); |
| 191 AtomicString propertyName = toCoreAtomicString(name); |
| 192 DeleteResult result = collection->anonymousNamedDeleter(propertyName); |
| 193 if (result != DeleteUnknownProperty) |
| 194 return v8SetReturnValueBool(info, result == DeleteSuccess); |
| 195 } |
| 196 |
| 197 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) |
| 198 { |
| 199 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 200 TestSpecialOperationsAnonymousV8Internal::namedPropertyDeleter(name, info); |
| 201 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 202 } |
| 203 |
| 204 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 204 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 205 { | 205 { |
| 206 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 206 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 207 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); | 207 TestSpecialOperationsAnonymous* collection = V8TestSpecialOperationsAnonymou
s::toNative(info.Holder()); |
| 208 Vector<String> names; | 208 Vector<String> names; |
| 209 collection->namedPropertyEnumerator(names, exceptionState); | 209 collection->namedPropertyEnumerator(names, exceptionState); |
| 210 if (exceptionState.throwIfNeeded()) | 210 if (exceptionState.throwIfNeeded()) |
| 211 return; | 211 return; |
| 212 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 212 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 213 for (size_t i = 0; i < names.size(); ++i) | 213 for (size_t i = 0; i < names.size(); ++i) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 fromInternalPointer(object)->deref(); | 289 fromInternalPointer(object)->deref(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 template<> | 292 template<> |
| 293 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsAnonymous* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | 293 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsAnonymous* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) |
| 294 { | 294 { |
| 295 return toV8(impl, creationContext, isolate); | 295 return toV8(impl, creationContext, isolate); |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace WebCore | 298 } // namespace WebCore |
| OLD | NEW |