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

Side by Side Diff: Source/bindings/tests/results/V8TestSpecialOperationsInt.cpp

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

Powered by Google App Engine
This is Rietveld 408576698