| 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 5233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5244 { | 5244 { |
| 5245 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 5245 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 5246 TestObjectV8Internal::namedPropertyGetter(name, info); | 5246 TestObjectV8Internal::namedPropertyGetter(name, info); |
| 5247 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 5247 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 5248 } | 5248 } |
| 5249 | 5249 |
| 5250 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 5250 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 5251 { | 5251 { |
| 5252 TestObject* imp = V8TestObject::toNative(info.Holder()); | 5252 TestObject* imp = V8TestObject::toNative(info.Holder()); |
| 5253 AtomicString propertyName = toCoreAtomicString(name); | 5253 AtomicString propertyName = toCoreAtomicString(name); |
| 5254 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 5254 v8::String::Utf8Value namedProperty(name); |
| 5255 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestObject", info.Holder(), info.GetIsolate()); |
| 5255 bool result = imp->namedPropertyQuery(propertyName, exceptionState); | 5256 bool result = imp->namedPropertyQuery(propertyName, exceptionState); |
| 5256 if (exceptionState.throwIfNeeded()) | 5257 if (exceptionState.throwIfNeeded()) |
| 5257 return; | 5258 return; |
| 5258 if (!result) | 5259 if (!result) |
| 5259 return; | 5260 return; |
| 5260 v8SetReturnValueInt(info, v8::None); | 5261 v8SetReturnValueInt(info, v8::None); |
| 5261 } | 5262 } |
| 5262 | 5263 |
| 5263 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 5264 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 5264 { | 5265 { |
| 5265 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 5266 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 5266 TestObjectV8Internal::namedPropertyQuery(name, info); | 5267 TestObjectV8Internal::namedPropertyQuery(name, info); |
| 5267 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 5268 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 5268 } | 5269 } |
| 5269 | 5270 |
| 5270 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 5271 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 5271 { | 5272 { |
| 5272 TestObject* imp = V8TestObject::toNative(info.Holder()); | 5273 TestObject* imp = V8TestObject::toNative(info.Holder()); |
| 5273 Vector<String> names; | 5274 Vector<String> names; |
| 5274 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 5275 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestObjec
t", info.Holder(), info.GetIsolate()); |
| 5275 imp->namedPropertyEnumerator(names, exceptionState); | 5276 imp->namedPropertyEnumerator(names, exceptionState); |
| 5276 if (exceptionState.throwIfNeeded()) | 5277 if (exceptionState.throwIfNeeded()) |
| 5277 return; | 5278 return; |
| 5278 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 5279 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 5279 for (size_t i = 0; i < names.size(); ++i) | 5280 for (size_t i = 0; i < names.size(); ++i) |
| 5280 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 5281 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 5281 v8SetReturnValue(info, v8names); | 5282 v8SetReturnValue(info, v8names); |
| 5282 } | 5283 } |
| 5283 | 5284 |
| 5284 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 5285 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5607 fromInternalPointer(object)->deref(); | 5608 fromInternalPointer(object)->deref(); |
| 5608 } | 5609 } |
| 5609 | 5610 |
| 5610 template<> | 5611 template<> |
| 5611 v8::Handle<v8::Value> toV8NoInline(TestObject* impl, v8::Handle<v8::Object> crea
tionContext, v8::Isolate* isolate) | 5612 v8::Handle<v8::Value> toV8NoInline(TestObject* impl, v8::Handle<v8::Object> crea
tionContext, v8::Isolate* isolate) |
| 5612 { | 5613 { |
| 5613 return toV8(impl, creationContext, isolate); | 5614 return toV8(impl, creationContext, isolate); |
| 5614 } | 5615 } |
| 5615 | 5616 |
| 5616 } // namespace WebCore | 5617 } // namespace WebCore |
| OLD | NEW |