| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 namespace WebCore { | 67 namespace WebCore { |
| 68 const WrapperTypeInfo V8TestSpecialOperationsOverrideBuiltins::wrapperTypeInfo =
{ gin::kEmbedderBlink, V8TestSpecialOperationsOverrideBuiltins::domTemplate, V8
TestSpecialOperationsOverrideBuiltins::derefObject, 0, 0, 0, V8TestSpecialOperat
ionsOverrideBuiltins::installPerContextEnabledMethods, 0, WrapperTypeObjectProto
type, false }; | 68 const WrapperTypeInfo V8TestSpecialOperationsOverrideBuiltins::wrapperTypeInfo =
{ gin::kEmbedderBlink, V8TestSpecialOperationsOverrideBuiltins::domTemplate, V8
TestSpecialOperationsOverrideBuiltins::derefObject, 0, 0, 0, V8TestSpecialOperat
ionsOverrideBuiltins::installPerContextEnabledMethods, 0, WrapperTypeObjectProto
type, false }; |
| 69 | 69 |
| 70 namespace TestSpecialOperationsOverrideBuiltinsV8Internal { | 70 namespace TestSpecialOperationsOverrideBuiltinsV8Internal { |
| 71 | 71 |
| 72 template <typename T> void V8_USE(T) { } | 72 template <typename T> void V8_USE(T) { } |
| 73 | 73 |
| 74 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 74 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 75 { | 75 { |
| 76 TestSpecialOperationsOverrideBuiltins* collection = V8TestSpecialOperationsO
verrideBuiltins::toNative(info.Holder()); | 76 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); |
| 77 AtomicString propertyName = toCoreAtomicString(name); | 77 AtomicString propertyName = toCoreAtomicString(name); |
| 78 String element = collection->anonymousNamedGetter(propertyName); | 78 String result = imp->anonymousNamedGetter(propertyName); |
| 79 if (element.isNull()) | 79 if (result.isNull()) |
| 80 return; | 80 return; |
| 81 v8SetReturnValueString(info, element, info.GetIsolate()); | 81 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 84 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 85 { | 85 { |
| 86 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 86 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 87 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyGetter(name, i
nfo); | 87 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyGetter(name, i
nfo); |
| 88 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 88 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 89 } | 89 } |
| 90 | 90 |
| 91 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 91 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 92 { | 92 { |
| 93 TestSpecialOperationsOverrideBuiltins* collection = V8TestSpecialOperationsO
verrideBuiltins::toNative(info.Holder()); | 93 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); |
| 94 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 94 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
| 95 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 95 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); |
| 96 bool result = collection->anonymousNamedSetter(propertyName, propertyValue); | 96 bool result = imp->anonymousNamedSetter(propertyName, 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 namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 102 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 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* collection = V8TestSpecialOperationsO
verrideBuiltins::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 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 114 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 114 bool result = imp->namedPropertyQuery(propertyName, exceptionState); |
| 115 if (exceptionState.throwIfNeeded()) | 115 if (exceptionState.throwIfNeeded()) |
| 116 return; | 116 return; |
| 117 if (!result) | 117 if (!result) |
| 118 return; | 118 return; |
| 119 v8SetReturnValueInt(info, v8::None); | 119 v8SetReturnValueInt(info, v8::None); |
| 120 } | 120 } |
| 121 | 121 |
| 122 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 122 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 123 { | 123 { |
| 124 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 124 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 125 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyQuery(name, in
fo); | 125 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyQuery(name, in
fo); |
| 126 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 126 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 127 } | 127 } |
| 128 | 128 |
| 129 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 129 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 130 { | 130 { |
| 131 TestSpecialOperationsOverrideBuiltins* collection = V8TestSpecialOperationsO
verrideBuiltins::toNative(info.Holder()); | 131 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); |
| 132 Vector<String> names; | 132 Vector<String> names; |
| 133 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 133 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 134 collection->namedPropertyEnumerator(names, exceptionState); | 134 imp->namedPropertyEnumerator(names, exceptionState); |
| 135 if (exceptionState.throwIfNeeded()) | 135 if (exceptionState.throwIfNeeded()) |
| 136 return; | 136 return; |
| 137 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 137 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 138 for (size_t i = 0; i < names.size(); ++i) | 138 for (size_t i = 0; i < names.size(); ++i) |
| 139 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 139 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 140 v8SetReturnValue(info, v8names); | 140 v8SetReturnValue(info, v8names); |
| 141 } | 141 } |
| 142 | 142 |
| 143 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 143 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 144 { | 144 { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 fromInternalPointer(object)->deref(); | 213 fromInternalPointer(object)->deref(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 template<> | 216 template<> |
| 217 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 217 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 218 { | 218 { |
| 219 return toV8(impl, creationContext, isolate); | 219 return toV8(impl, creationContext, isolate); |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace WebCore | 222 } // namespace WebCore |
| OLD | NEW |