| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 namespace WebCore { | 68 namespace WebCore { |
| 69 const WrapperTypeInfo V8TestSpecialOperationsInt::wrapperTypeInfo = { gin::kEmbe
dderBlink, V8TestSpecialOperationsInt::domTemplate, V8TestSpecialOperationsInt::
derefObject, 0, 0, 0, V8TestSpecialOperationsInt::installPerContextEnabledMethod
s, 0, WrapperTypeObjectPrototype, false }; | 69 const WrapperTypeInfo V8TestSpecialOperationsInt::wrapperTypeInfo = { gin::kEmbe
dderBlink, V8TestSpecialOperationsInt::domTemplate, V8TestSpecialOperationsInt::
derefObject, 0, 0, 0, V8TestSpecialOperationsInt::installPerContextEnabledMethod
s, 0, WrapperTypeObjectPrototype, false }; |
| 70 | 70 |
| 71 namespace TestSpecialOperationsIntV8Internal { | 71 namespace TestSpecialOperationsIntV8Internal { |
| 72 | 72 |
| 73 template <typename T> void V8_USE(T) { } | 73 template <typename T> void V8_USE(T) { } |
| 74 | 74 |
| 75 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 75 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
| 76 { | 76 { |
| 77 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho
lder()); | 77 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 78 int result = imp->anonymousIndexedGetter(index); | 78 int result = impl->anonymousIndexedGetter(index); |
| 79 if () | 79 if () |
| 80 return; | 80 return; |
| 81 v8SetReturnValueInt(info, result); | 81 v8SetReturnValueInt(info, result); |
| 82 } | 82 } |
| 83 | 83 |
| 84 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | 84 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 85 { | 85 { |
| 86 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 86 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 87 TestSpecialOperationsIntV8Internal::indexedPropertyGetter(index, info); | 87 TestSpecialOperationsIntV8Internal::indexedPropertyGetter(index, info); |
| 88 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 88 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 89 } | 89 } |
| 90 | 90 |
| 91 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) | 91 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 92 { | 92 { |
| 93 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho
lder()); | 93 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 94 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(jsValue, excepti
onState), exceptionState); | 94 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(jsValue, excepti
onState), exceptionState); |
| 95 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestSpe
cialOperationsInt", info.Holder(), info.GetIsolate()); | 95 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestSpe
cialOperationsInt", info.Holder(), info.GetIsolate()); |
| 96 bool result = imp->anonymousIndexedSetter(index, propertyValue); | 96 bool result = impl->anonymousIndexedSetter(index, propertyValue); |
| 97 if (!result) | 97 if (!result) |
| 98 return; | 98 return; |
| 99 v8SetReturnValue(info, jsValue); | 99 v8SetReturnValue(info, jsValue); |
| 100 } | 100 } |
| 101 | 101 |
| 102 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 102 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 103 { | 103 { |
| 104 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 104 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| 105 TestSpecialOperationsIntV8Internal::indexedPropertySetter(index, jsValue, in
fo); | 105 TestSpecialOperationsIntV8Internal::indexedPropertySetter(index, jsValue, in
fo); |
| 106 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 106 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 107 } | 107 } |
| 108 | 108 |
| 109 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 109 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 110 { | 110 { |
| 111 if (info.Holder()->HasRealNamedProperty(name)) | 111 if (info.Holder()->HasRealNamedProperty(name)) |
| 112 return; | 112 return; |
| 113 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 113 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho
lder()); | 116 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 117 AtomicString propertyName = toCoreAtomicString(name); | 117 AtomicString propertyName = toCoreAtomicString(name); |
| 118 int result = imp->anonymousNamedGetter(propertyName); | 118 int result = impl->anonymousNamedGetter(propertyName); |
| 119 if () | 119 if () |
| 120 return; | 120 return; |
| 121 v8SetReturnValueInt(info, result); | 121 v8SetReturnValueInt(info, result); |
| 122 } | 122 } |
| 123 | 123 |
| 124 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 124 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 125 { | 125 { |
| 126 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 126 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 127 TestSpecialOperationsIntV8Internal::namedPropertyGetter(name, info); | 127 TestSpecialOperationsIntV8Internal::namedPropertyGetter(name, info); |
| 128 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 128 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 129 } | 129 } |
| 130 | 130 |
| 131 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 131 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 132 { | 132 { |
| 133 if (info.Holder()->HasRealNamedProperty(name)) | 133 if (info.Holder()->HasRealNamedProperty(name)) |
| 134 return; | 134 return; |
| 135 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 135 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 136 return; | 136 return; |
| 137 | 137 |
| 138 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho
lder()); | 138 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 139 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 139 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
| 140 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(jsValue, excepti
onState), exceptionState); | 140 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(jsValue, excepti
onState), exceptionState); |
| 141 v8::String::Utf8Value namedProperty(name); | 141 v8::String::Utf8Value namedProperty(name); |
| 142 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestSpecialOperationsInt", info.Holder(), info.GetIsolate()); | 142 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestSpecialOperationsInt", info.Holder(), info.GetIsolate()); |
| 143 bool result = imp->anonymousNamedSetter(propertyName, propertyValue); | 143 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); |
| 144 if (!result) | 144 if (!result) |
| 145 return; | 145 return; |
| 146 v8SetReturnValue(info, jsValue); | 146 v8SetReturnValue(info, jsValue); |
| 147 } | 147 } |
| 148 | 148 |
| 149 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 149 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 150 { | 150 { |
| 151 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 151 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 152 TestSpecialOperationsIntV8Internal::namedPropertySetter(name, jsValue, info)
; | 152 TestSpecialOperationsIntV8Internal::namedPropertySetter(name, jsValue, info)
; |
| 153 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 153 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 154 } | 154 } |
| 155 | 155 |
| 156 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 156 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 157 { | 157 { |
| 158 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho
lder()); | 158 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 159 AtomicString propertyName = toCoreAtomicString(name); | 159 AtomicString propertyName = toCoreAtomicString(name); |
| 160 v8::String::Utf8Value namedProperty(name); | 160 v8::String::Utf8Value namedProperty(name); |
| 161 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsInt", info.Holder(), info.GetIsolate()); | 161 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsInt", info.Holder(), info.GetIsolate()); |
| 162 bool result = imp->namedPropertyQuery(propertyName, exceptionState); | 162 bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| 163 if (exceptionState.throwIfNeeded()) | 163 if (exceptionState.throwIfNeeded()) |
| 164 return; | 164 return; |
| 165 if (!result) | 165 if (!result) |
| 166 return; | 166 return; |
| 167 v8SetReturnValueInt(info, v8::None); | 167 v8SetReturnValueInt(info, v8::None); |
| 168 } | 168 } |
| 169 | 169 |
| 170 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 170 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 171 { | 171 { |
| 172 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 172 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 173 TestSpecialOperationsIntV8Internal::namedPropertyQuery(name, info); | 173 TestSpecialOperationsIntV8Internal::namedPropertyQuery(name, info); |
| 174 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 174 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 175 } | 175 } |
| 176 | 176 |
| 177 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 177 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 178 { | 178 { |
| 179 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho
lder()); | 179 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); |
| 180 Vector<String> names; | 180 Vector<String> names; |
| 181 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsInt", info.Holder(), info.GetIsolate()); | 181 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsInt", info.Holder(), info.GetIsolate()); |
| 182 imp->namedPropertyEnumerator(names, exceptionState); | 182 impl->namedPropertyEnumerator(names, exceptionState); |
| 183 if (exceptionState.throwIfNeeded()) | 183 if (exceptionState.throwIfNeeded()) |
| 184 return; | 184 return; |
| 185 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 185 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 186 for (size_t i = 0; i < names.size(); ++i) | 186 for (size_t i = 0; i < names.size(); ++i) |
| 187 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 187 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 188 v8SetReturnValue(info, v8names); | 188 v8SetReturnValue(info, v8names); |
| 189 } | 189 } |
| 190 | 190 |
| 191 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 191 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 192 { | 192 { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 fromInternalPointer(object)->deref(); | 270 fromInternalPointer(object)->deref(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 template<> | 273 template<> |
| 274 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 274 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 275 { | 275 { |
| 276 return toV8(impl, creationContext, isolate); | 276 return toV8(impl, creationContext, isolate); |
| 277 } | 277 } |
| 278 | 278 |
| 279 } // namespace WebCore | 279 } // namespace WebCore |
| OLD | NEW |