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

Side by Side Diff: Source/bindings/tests/results/V8TestEventTarget.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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<v8::Value>& info) 144 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<v8::Value>& info)
145 { 145 {
146 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 146 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
147 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info); 147 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info);
148 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 148 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
149 } 149 }
150 150
151 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info) 151 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
152 { 152 {
153 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); 153 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder());
154 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 154 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestE ventTarget", info.Holder(), info.GetIsolate());
155 DeleteResult result = imp->anonymousIndexedDeleter(index, exceptionState); 155 DeleteResult result = imp->anonymousIndexedDeleter(index, exceptionState);
156 if (exceptionState.throwIfNeeded()) 156 if (exceptionState.throwIfNeeded())
157 return; 157 return;
158 if (result != DeleteUnknownProperty) 158 if (result != DeleteUnknownProperty)
159 return v8SetReturnValueBool(info, result == DeleteSuccess); 159 return v8SetReturnValueBool(info, result == DeleteSuccess);
160 } 160 }
161 161
162 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 162 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
163 { 163 {
164 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 164 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 { 208 {
209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
210 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info); 210 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info);
211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
212 } 212 }
213 213
214 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 214 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
215 { 215 {
216 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); 216 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder());
217 AtomicString propertyName = toCoreAtomicString(name); 217 AtomicString propertyName = toCoreAtomicString(name);
218 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 218 v8::String::Utf8Value namedProperty(name);
219 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestEventTarget", info.Holder(), info.GetIsolate());
219 bool result = imp->namedPropertyQuery(propertyName, exceptionState); 220 bool result = imp->namedPropertyQuery(propertyName, exceptionState);
220 if (exceptionState.throwIfNeeded()) 221 if (exceptionState.throwIfNeeded())
221 return; 222 return;
222 if (!result) 223 if (!result)
223 return; 224 return;
224 v8SetReturnValueInt(info, v8::None); 225 v8SetReturnValueInt(info, v8::None);
225 } 226 }
226 227
227 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info) 228 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
228 { 229 {
(...skipping 15 matching lines...) Expand all
244 { 245 {
245 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 246 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
246 TestEventTargetV8Internal::namedPropertyDeleter(name, info); 247 TestEventTargetV8Internal::namedPropertyDeleter(name, info);
247 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 248 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
248 } 249 }
249 250
250 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 251 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
251 { 252 {
252 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); 253 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder());
253 Vector<String> names; 254 Vector<String> names;
254 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 255 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestEvent Target", info.Holder(), info.GetIsolate());
255 imp->namedPropertyEnumerator(names, exceptionState); 256 imp->namedPropertyEnumerator(names, exceptionState);
256 if (exceptionState.throwIfNeeded()) 257 if (exceptionState.throwIfNeeded())
257 return; 258 return;
258 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ()); 259 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ());
259 for (size_t i = 0; i < names.size(); ++i) 260 for (size_t i = 0; i < names.size(); ++i)
260 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i])); 261 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i]));
261 v8SetReturnValue(info, v8names); 262 v8SetReturnValue(info, v8names);
262 } 263 }
263 264
264 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) 265 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 fromInternalPointer(object)->deref(); 351 fromInternalPointer(object)->deref();
351 } 352 }
352 353
353 template<> 354 template<>
354 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 355 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
355 { 356 {
356 return toV8(impl, creationContext, isolate); 357 return toV8(impl, creationContext, isolate);
357 } 358 }
358 359
359 } // namespace WebCore 360 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/tests/results/V8TestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698