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

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

Issue 163883006: Add context to generated named and indexed property operations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh. 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
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* imp = V8TestSpecialOperationsInt::toNative(info.Ho lder()); 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(ExceptionState::IndexedSetterContext, "TestSpe cialOperationsInt", info.Holder(), info.GetIsolate());
95 bool result = imp->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);
(...skipping 25 matching lines...) Expand all
130 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 130 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
131 { 131 {
132 if (info.Holder()->HasRealNamedProperty(name)) 132 if (info.Holder()->HasRealNamedProperty(name))
133 return; 133 return;
134 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 134 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
135 return; 135 return;
136 136
137 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho lder()); 137 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho lder());
138 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ; 138 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ;
139 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(jsValue, excepti onState), exceptionState); 139 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(jsValue, excepti onState), exceptionState);
140 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 140 v8::String::Utf8Value namedProperty(name);
141 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestSpecialOperationsInt", info.Holder(), info.GetIsolate());
141 bool result = imp->anonymousNamedSetter(propertyName, propertyValue); 142 bool result = imp->anonymousNamedSetter(propertyName, propertyValue);
142 if (!result) 143 if (!result)
143 return; 144 return;
144 v8SetReturnValue(info, jsValue); 145 v8SetReturnValue(info, jsValue);
145 } 146 }
146 147
147 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 148 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
148 { 149 {
149 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 150 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
150 TestSpecialOperationsIntV8Internal::namedPropertySetter(name, jsValue, info) ; 151 TestSpecialOperationsIntV8Internal::namedPropertySetter(name, jsValue, info) ;
151 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 152 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
152 } 153 }
153 154
154 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 155 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
155 { 156 {
156 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho lder()); 157 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho lder());
157 AtomicString propertyName = toCoreAtomicString(name); 158 AtomicString propertyName = toCoreAtomicString(name);
158 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 159 v8::String::Utf8Value namedProperty(name);
160 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperationsInt", info.Holder(), info.GetIsolate());
159 bool result = imp->namedPropertyQuery(propertyName, exceptionState); 161 bool result = imp->namedPropertyQuery(propertyName, exceptionState);
160 if (exceptionState.throwIfNeeded()) 162 if (exceptionState.throwIfNeeded())
161 return; 163 return;
162 if (!result) 164 if (!result)
163 return; 165 return;
164 v8SetReturnValueInt(info, v8::None); 166 v8SetReturnValueInt(info, v8::None);
165 } 167 }
166 168
167 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info) 169 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
168 { 170 {
169 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 171 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
170 TestSpecialOperationsIntV8Internal::namedPropertyQuery(name, info); 172 TestSpecialOperationsIntV8Internal::namedPropertyQuery(name, info);
171 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 173 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
172 } 174 }
173 175
174 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 176 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
175 { 177 {
176 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho lder()); 178 TestSpecialOperationsInt* imp = V8TestSpecialOperationsInt::toNative(info.Ho lder());
177 Vector<String> names; 179 Vector<String> names;
178 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 180 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci alOperationsInt", info.Holder(), info.GetIsolate());
179 imp->namedPropertyEnumerator(names, exceptionState); 181 imp->namedPropertyEnumerator(names, exceptionState);
180 if (exceptionState.throwIfNeeded()) 182 if (exceptionState.throwIfNeeded())
181 return; 183 return;
182 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ()); 184 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ());
183 for (size_t i = 0; i < names.size(); ++i) 185 for (size_t i = 0; i < names.size(); ++i)
184 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i])); 186 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i]));
185 v8SetReturnValue(info, v8names); 187 v8SetReturnValue(info, v8names);
186 } 188 }
187 189
188 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) 190 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 fromInternalPointer(object)->deref(); 266 fromInternalPointer(object)->deref();
265 } 267 }
266 268
267 template<> 269 template<>
268 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate) 270 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
269 { 271 {
270 return toV8(impl, creationContext, isolate); 272 return toV8(impl, creationContext, isolate);
271 } 273 }
272 274
273 } // namespace WebCore 275 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698