| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 { | 103 { |
| 104 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 104 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 105 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertySetter(name, j
sValue, info); | 105 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertySetter(name, j
sValue, info); |
| 106 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 106 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 107 } | 107 } |
| 108 | 108 |
| 109 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 109 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 110 { | 110 { |
| 111 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); | 111 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); |
| 112 AtomicString propertyName = toCoreAtomicString(name); | 112 AtomicString propertyName = toCoreAtomicString(name); |
| 113 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 113 v8::String::Utf8Value namedProperty(name); |
| 114 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsOverrideBuiltins", info.Holder(), info.GetIsolate()); |
| 114 bool result = imp->namedPropertyQuery(propertyName, exceptionState); | 115 bool result = imp->namedPropertyQuery(propertyName, exceptionState); |
| 115 if (exceptionState.throwIfNeeded()) | 116 if (exceptionState.throwIfNeeded()) |
| 116 return; | 117 return; |
| 117 if (!result) | 118 if (!result) |
| 118 return; | 119 return; |
| 119 v8SetReturnValueInt(info, v8::None); | 120 v8SetReturnValueInt(info, v8::None); |
| 120 } | 121 } |
| 121 | 122 |
| 122 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 123 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 123 { | 124 { |
| 124 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 125 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyQuery(name, in
fo); | 126 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyQuery(name, in
fo); |
| 126 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 127 } | 128 } |
| 128 | 129 |
| 129 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 130 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 130 { | 131 { |
| 131 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); | 132 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); |
| 132 Vector<String> names; | 133 Vector<String> names; |
| 133 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 134 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsOverrideBuiltins", info.Holder(), info.GetIsolate()); |
| 134 imp->namedPropertyEnumerator(names, exceptionState); | 135 imp->namedPropertyEnumerator(names, exceptionState); |
| 135 if (exceptionState.throwIfNeeded()) | 136 if (exceptionState.throwIfNeeded()) |
| 136 return; | 137 return; |
| 137 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 138 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 138 for (size_t i = 0; i < names.size(); ++i) | 139 for (size_t i = 0; i < names.size(); ++i) |
| 139 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 140 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 140 v8SetReturnValue(info, v8names); | 141 v8SetReturnValue(info, v8names); |
| 141 } | 142 } |
| 142 | 143 |
| 143 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 144 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 fromInternalPointer(object)->deref(); | 219 fromInternalPointer(object)->deref(); |
| 219 } | 220 } |
| 220 | 221 |
| 221 template<> | 222 template<> |
| 222 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 223 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 223 { | 224 { |
| 224 return toV8(impl, creationContext, isolate); | 225 return toV8(impl, creationContext, isolate); |
| 225 } | 226 } |
| 226 | 227 |
| 227 } // namespace WebCore | 228 } // namespace WebCore |
| OLD | NEW |