Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: Source/bindings/tests/results/core/V8TestInterface.cpp

Issue 1019773006: use non-masking, string interceptors in generated bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix test Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #if ENABLE(CONDITION) 8 #if ENABLE(CONDITION)
9 #include "V8TestInterface.h" 9 #include "V8TestInterface.h"
10 10
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 2009
2010 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 2010 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
2011 { 2011 {
2012 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); 2012 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
2013 TestInterfaceImplementationV8Internal::indexedPropertyDeleter(index, info); 2013 TestInterfaceImplementationV8Internal::indexedPropertyDeleter(index, info);
2014 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 2014 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
2015 } 2015 }
2016 2016
2017 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall backInfo<v8::Value>& info) 2017 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall backInfo<v8::Value>& info)
2018 { 2018 {
2019 if (!name->IsString())
2020 return;
2021 auto nameString = name.As<v8::String>(); 2019 auto nameString = name.As<v8::String>();
2022 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
2023 if (v8CallBoolean(info.Holder()->HasRealNamedProperty(context, nameString)))
2024 return;
2025 v8::Local<v8::Value> namedPropertyValue;
2026 if (info.Holder()->GetRealNamedPropertyInPrototypeChain(context, nameString) .ToLocal(&namedPropertyValue))
2027 return;
2028
2029 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 2020 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
2030 AtomicString propertyName = toCoreAtomicString(nameString); 2021 AtomicString propertyName = toCoreAtomicString(nameString);
2031 String result = impl->anonymousNamedGetter(propertyName); 2022 String result = impl->anonymousNamedGetter(propertyName);
2032 if (result.isNull()) 2023 if (result.isNull())
2033 return; 2024 return;
2034 v8SetReturnValueString(info, result, info.GetIsolate()); 2025 v8SetReturnValueString(info, result, info.GetIsolate());
2035 } 2026 }
2036 2027
2037 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop ertyCallbackInfo<v8::Value>& info) 2028 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop ertyCallbackInfo<v8::Value>& info)
2038 { 2029 {
2039 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); 2030 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
2040 TestInterfaceImplementationV8Internal::namedPropertyGetter(name, info); 2031 TestInterfaceImplementationV8Internal::namedPropertyGetter(name, info);
2041 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 2032 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
2042 } 2033 }
2043 2034
2044 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 2035 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
2045 { 2036 {
2046 if (!name->IsString())
2047 return;
2048 auto nameString = name.As<v8::String>(); 2037 auto nameString = name.As<v8::String>();
2049 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
2050 if (v8CallBoolean(info.Holder()->HasRealNamedProperty(context, nameString)))
2051 return;
2052 v8::Local<v8::Value> namedPropertyValue;
2053 if (info.Holder()->GetRealNamedPropertyInPrototypeChain(context, nameString) .ToLocal(&namedPropertyValue))
2054 return;
2055
2056 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 2038 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
2057 V8StringResource<> propertyName(nameString); 2039 V8StringResource<> propertyName(nameString);
2058 if (!propertyName.prepare()) 2040 if (!propertyName.prepare())
2059 return; 2041 return;
2060 V8StringResource<> propertyValue = v8Value; 2042 V8StringResource<> propertyValue = v8Value;
2061 if (!propertyValue.prepare()) 2043 if (!propertyValue.prepare())
2062 return; 2044 return;
2063 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); 2045 bool result = impl->anonymousNamedSetter(propertyName, propertyValue);
2064 if (!result) 2046 if (!result)
2065 return; 2047 return;
2066 v8SetReturnValue(info, v8Value); 2048 v8SetReturnValue(info, v8Value);
2067 } 2049 }
2068 2050
2069 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8:: Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 2051 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8:: Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
2070 { 2052 {
2071 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); 2053 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
2072 TestInterfaceImplementationV8Internal::namedPropertySetter(name, v8Value, in fo); 2054 TestInterfaceImplementationV8Internal::namedPropertySetter(name, v8Value, in fo);
2073 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 2055 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
2074 } 2056 }
2075 2057
2076 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb ackInfo<v8::Integer>& info) 2058 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb ackInfo<v8::Integer>& info)
2077 { 2059 {
2078 if (!name->IsString())
2079 return;
2080 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 2060 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
2081 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); 2061 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
2082 v8::String::Utf8Value namedProperty(name); 2062 v8::String::Utf8Value namedProperty(name);
2083 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface", info.Holder(), info.GetIsolate()); 2063 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface", info.Holder(), info.GetIsolate());
2084 bool result = impl->namedPropertyQuery(propertyName, exceptionState); 2064 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
2085 if (exceptionState.throwIfNeeded()) 2065 if (exceptionState.throwIfNeeded())
2086 return; 2066 return;
2087 if (!result) 2067 if (!result)
2088 return; 2068 return;
2089 v8SetReturnValueInt(info, v8::None); 2069 v8SetReturnValueInt(info, v8::None);
2090 } 2070 }
2091 2071
2092 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope rtyCallbackInfo<v8::Integer>& info) 2072 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope rtyCallbackInfo<v8::Integer>& info)
2093 { 2073 {
2094 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); 2074 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
2095 TestInterfaceImplementationV8Internal::namedPropertyQuery(name, info); 2075 TestInterfaceImplementationV8Internal::namedPropertyQuery(name, info);
2096 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 2076 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
2097 } 2077 }
2098 2078
2099 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 2079 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
2100 { 2080 {
2101 if (!name->IsString())
2102 return;
2103 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 2081 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
2104 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); 2082 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
2105 DeleteResult result = impl->anonymousNamedDeleter(propertyName); 2083 DeleteResult result = impl->anonymousNamedDeleter(propertyName);
2106 if (result != DeleteUnknownProperty) 2084 if (result != DeleteUnknownProperty)
2107 return v8SetReturnValueBool(info, result == DeleteSuccess); 2085 return v8SetReturnValueBool(info, result == DeleteSuccess);
2108 } 2086 }
2109 2087
2110 static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::Pro pertyCallbackInfo<v8::Boolean>& info) 2088 static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::Pro pertyCallbackInfo<v8::Boolean>& info)
2111 { 2089 {
2112 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); 2090 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 static const V8DOMConfiguration::ConstantConfiguration constantConfigura tion = {"PARTIAL_UNSIGNED_SHORT", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsig nedShort}; 2232 static const V8DOMConfiguration::ConstantConfiguration constantConfigura tion = {"PARTIAL_UNSIGNED_SHORT", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsig nedShort};
2255 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototype Template, constantConfiguration); 2233 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototype Template, constantConfiguration);
2256 } 2234 }
2257 { 2235 {
2258 v8::IndexedPropertyHandlerConfiguration config(TestInterfaceImplementati onV8Internal::indexedPropertyGetterCallback, TestInterfaceImplementationV8Intern al::indexedPropertySetterCallback, 0, TestInterfaceImplementationV8Internal::ind exedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterfaceImplementati on>); 2236 v8::IndexedPropertyHandlerConfiguration config(TestInterfaceImplementati onV8Internal::indexedPropertyGetterCallback, TestInterfaceImplementationV8Intern al::indexedPropertySetterCallback, 0, TestInterfaceImplementationV8Internal::ind exedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterfaceImplementati on>);
2259 config.flags = v8::PropertyHandlerFlags::kAllCanRead; 2237 config.flags = v8::PropertyHandlerFlags::kAllCanRead;
2260 functionTemplate->InstanceTemplate()->SetHandler(config); 2238 functionTemplate->InstanceTemplate()->SetHandler(config);
2261 } 2239 }
2262 { 2240 {
2263 v8::NamedPropertyHandlerConfiguration config(TestInterfaceImplementation V8Internal::namedPropertyGetterCallback, TestInterfaceImplementationV8Internal:: namedPropertySetterCallback, TestInterfaceImplementationV8Internal::namedPropert yQueryCallback, TestInterfaceImplementationV8Internal::namedPropertyDeleterCallb ack, TestInterfaceImplementationV8Internal::namedPropertyEnumeratorCallback); 2241 v8::NamedPropertyHandlerConfiguration config(TestInterfaceImplementation V8Internal::namedPropertyGetterCallback, TestInterfaceImplementationV8Internal:: namedPropertySetterCallback, TestInterfaceImplementationV8Internal::namedPropert yQueryCallback, TestInterfaceImplementationV8Internal::namedPropertyDeleterCallb ack, TestInterfaceImplementationV8Internal::namedPropertyEnumeratorCallback);
2242 config.flags = static_cast<v8::PropertyHandlerFlags>(static_cast<int>(co nfig.flags) | static_cast<int>(v8::PropertyHandlerFlags::kOnlyInterceptStrings)) ;
2264 config.flags = v8::PropertyHandlerFlags::kAllCanRead; 2243 config.flags = v8::PropertyHandlerFlags::kAllCanRead;
2244 config.flags = static_cast<v8::PropertyHandlerFlags>(static_cast<int>(co nfig.flags) | static_cast<int>(v8::PropertyHandlerFlags::kNonMasking));
2265 functionTemplate->InstanceTemplate()->SetHandler(config); 2245 functionTemplate->InstanceTemplate()->SetHandler(config);
2266 } 2246 }
2267 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, TestInterfaceImplementationV8I nternal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; 2247 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, TestInterfaceImplementationV8I nternal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts };
2268 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu re, v8::DontDelete, symbolKeyedIteratorConfiguration); 2248 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu re, v8::DontDelete, symbolKeyedIteratorConfiguration);
2269 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterfa ce::legacyCallCustom); 2249 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterfa ce::legacyCallCustom);
2270 const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMethodMetho dConfiguration = { 2250 const V8DOMConfiguration::MethodConfiguration alwaysExposedStaticMethodMetho dConfiguration = {
2271 "alwaysExposedStaticMethod", TestInterfaceImplementationV8Internal::alwa ysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScrip ts, 2251 "alwaysExposedStaticMethod", TestInterfaceImplementationV8Internal::alwa ysExposedStaticMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScrip ts,
2272 }; 2252 };
2273 V8DOMConfiguration::installMethod(isolate, functionTemplate, v8::Local<v8::S ignature>(), v8::None, alwaysExposedStaticMethodMethodConfiguration); 2253 V8DOMConfiguration::installMethod(isolate, functionTemplate, v8::Local<v8::S ignature>(), v8::None, alwaysExposedStaticMethodMethodConfiguration);
2274 if (context && (context->isWorkerGlobalScope())) { 2254 if (context && (context->isWorkerGlobalScope())) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 void V8TestInterface::registerPartial2VoidMethodMethodForPartialInterface(void ( *method)(const v8::FunctionCallbackInfo<v8::Value>&)) 2559 void V8TestInterface::registerPartial2VoidMethodMethodForPartialInterface(void ( *method)(const v8::FunctionCallbackInfo<v8::Value>&))
2580 { 2560 {
2581 TestInterfaceImplementationV8Internal::partial2VoidMethodMethodForPartialInt erface = method; 2561 TestInterfaceImplementationV8Internal::partial2VoidMethodMethodForPartialInt erface = method;
2582 } 2562 }
2583 void V8TestInterface::registerPartial2StaticVoidMethodMethodForPartialInterface( void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 2563 void V8TestInterface::registerPartial2StaticVoidMethodMethodForPartialInterface( void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
2584 { 2564 {
2585 TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethodForPart ialInterface = method; 2565 TestInterfaceImplementationV8Internal::partial2StaticVoidMethodMethodForPart ialInterface = method;
2586 } 2566 }
2587 } // namespace blink 2567 } // namespace blink
2588 #endif // ENABLE(CONDITION) 2568 #endif // ENABLE(CONDITION)
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface_base.cpp ('k') | Source/bindings/tests/results/core/V8TestInterface2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698