| 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 V8TestSpecialOperationsOverrideBuiltins::wrapperTypeInfo =
{ gin::kEmbedderBlink, V8TestSpecialOperationsOverrideBuiltins::domTemplate, V8
TestSpecialOperationsOverrideBuiltins::derefObject, 0, 0, 0, V8TestSpecialOperat
ionsOverrideBuiltins::installPerContextEnabledMethods, 0, WrapperTypeObjectProto
type, false }; | 69 const WrapperTypeInfo V8TestSpecialOperationsOverrideBuiltins::wrapperTypeInfo =
{ gin::kEmbedderBlink, V8TestSpecialOperationsOverrideBuiltins::domTemplate, V8
TestSpecialOperationsOverrideBuiltins::derefObject, 0, 0, 0, V8TestSpecialOperat
ionsOverrideBuiltins::installPerContextEnabledMethods, 0, WrapperTypeObjectProto
type, false }; |
| 70 | 70 |
| 71 namespace TestSpecialOperationsOverrideBuiltinsV8Internal { | 71 namespace TestSpecialOperationsOverrideBuiltinsV8Internal { |
| 72 | 72 |
| 73 template <typename T> void V8_USE(T) { } | 73 template <typename T> void V8_USE(T) { } |
| 74 | 74 |
| 75 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 75 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 76 { | 76 { |
| 77 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); | 77 TestSpecialOperationsOverrideBuiltins* impl = V8TestSpecialOperationsOverrid
eBuiltins::toNative(info.Holder()); |
| 78 AtomicString propertyName = toCoreAtomicString(name); | 78 AtomicString propertyName = toCoreAtomicString(name); |
| 79 String result = imp->anonymousNamedGetter(propertyName); | 79 String result = impl->anonymousNamedGetter(propertyName); |
| 80 if (result.isNull()) | 80 if (result.isNull()) |
| 81 return; | 81 return; |
| 82 v8SetReturnValueString(info, result, info.GetIsolate()); | 82 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 85 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 86 { | 86 { |
| 87 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 87 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 88 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyGetter(name, i
nfo); | 88 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyGetter(name, i
nfo); |
| 89 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 89 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 90 } | 90 } |
| 91 | 91 |
| 92 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 92 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 93 { | 93 { |
| 94 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); | 94 TestSpecialOperationsOverrideBuiltins* impl = V8TestSpecialOperationsOverrid
eBuiltins::toNative(info.Holder()); |
| 95 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 95 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
| 96 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 96 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); |
| 97 bool result = imp->anonymousNamedSetter(propertyName, propertyValue); | 97 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); |
| 98 if (!result) | 98 if (!result) |
| 99 return; | 99 return; |
| 100 v8SetReturnValue(info, jsValue); | 100 v8SetReturnValue(info, jsValue); |
| 101 } | 101 } |
| 102 | 102 |
| 103 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 103 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 104 { | 104 { |
| 105 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 105 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 106 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertySetter(name, j
sValue, info); | 106 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertySetter(name, j
sValue, info); |
| 107 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 107 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 108 } | 108 } |
| 109 | 109 |
| 110 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 110 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 111 { | 111 { |
| 112 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); | 112 TestSpecialOperationsOverrideBuiltins* impl = V8TestSpecialOperationsOverrid
eBuiltins::toNative(info.Holder()); |
| 113 AtomicString propertyName = toCoreAtomicString(name); | 113 AtomicString propertyName = toCoreAtomicString(name); |
| 114 v8::String::Utf8Value namedProperty(name); | 114 v8::String::Utf8Value namedProperty(name); |
| 115 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsOverrideBuiltins", info.Holder(), info.GetIsolate()); | 115 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsOverrideBuiltins", info.Holder(), info.GetIsolate()); |
| 116 bool result = imp->namedPropertyQuery(propertyName, exceptionState); | 116 bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| 117 if (exceptionState.throwIfNeeded()) | 117 if (exceptionState.throwIfNeeded()) |
| 118 return; | 118 return; |
| 119 if (!result) | 119 if (!result) |
| 120 return; | 120 return; |
| 121 v8SetReturnValueInt(info, v8::None); | 121 v8SetReturnValueInt(info, v8::None); |
| 122 } | 122 } |
| 123 | 123 |
| 124 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 124 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 125 { | 125 { |
| 126 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 126 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
| 127 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyQuery(name, in
fo); | 127 TestSpecialOperationsOverrideBuiltinsV8Internal::namedPropertyQuery(name, in
fo); |
| 128 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 128 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 129 } | 129 } |
| 130 | 130 |
| 131 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 131 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 132 { | 132 { |
| 133 TestSpecialOperationsOverrideBuiltins* imp = V8TestSpecialOperationsOverride
Builtins::toNative(info.Holder()); | 133 TestSpecialOperationsOverrideBuiltins* impl = V8TestSpecialOperationsOverrid
eBuiltins::toNative(info.Holder()); |
| 134 Vector<String> names; | 134 Vector<String> names; |
| 135 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsOverrideBuiltins", info.Holder(), info.GetIsolate()); | 135 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsOverrideBuiltins", info.Holder(), info.GetIsolate()); |
| 136 imp->namedPropertyEnumerator(names, exceptionState); | 136 impl->namedPropertyEnumerator(names, exceptionState); |
| 137 if (exceptionState.throwIfNeeded()) | 137 if (exceptionState.throwIfNeeded()) |
| 138 return; | 138 return; |
| 139 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 139 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 140 for (size_t i = 0; i < names.size(); ++i) | 140 for (size_t i = 0; i < names.size(); ++i) |
| 141 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 141 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 142 v8SetReturnValue(info, v8names); | 142 v8SetReturnValue(info, v8names); |
| 143 } | 143 } |
| 144 | 144 |
| 145 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 145 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 146 { | 146 { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 fromInternalPointer(object)->deref(); | 223 fromInternalPointer(object)->deref(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 template<> | 226 template<> |
| 227 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 227 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 228 { | 228 { |
| 229 return toV8(impl, creationContext, isolate); | 229 return toV8(impl, creationContext, isolate); |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace WebCore | 232 } // namespace WebCore |
| OLD | NEW |