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

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

Issue 149993003: IDL compiler: [Custom=PropertyEnumerator] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 v8SetReturnValue(info, jsValue); 206 v8SetReturnValue(info, jsValue);
207 } 207 }
208 208
209 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 209 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
210 { 210 {
211 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 211 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
212 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info); 212 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info);
213 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 213 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
214 } 214 }
215 215
216 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
217 {
218 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
219 AtomicString propertyName = toCoreAtomicString(name);
220 DeleteResult result = collection->anonymousNamedDeleter(propertyName);
221 if (result != DeleteUnknownProperty)
222 return v8SetReturnValueBool(info, result == DeleteSuccess);
223 }
224
225 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
226 {
227 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
228 TestEventTargetV8Internal::namedPropertyDeleter(name, info);
229 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
230 }
231
232 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 216 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
233 { 217 {
234 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 218 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
235 AtomicString propertyName = toCoreAtomicString(name); 219 AtomicString propertyName = toCoreAtomicString(name);
236 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 220 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
237 bool result = collection->namedPropertyQuery(propertyName, exceptionState); 221 bool result = collection->namedPropertyQuery(propertyName, exceptionState);
238 if (exceptionState.throwIfNeeded()) 222 if (exceptionState.throwIfNeeded())
239 return; 223 return;
240 if (!result) 224 if (!result)
241 return; 225 return;
242 v8SetReturnValueInt(info, v8::None); 226 v8SetReturnValueInt(info, v8::None);
243 } 227 }
244 228
245 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info) 229 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
246 { 230 {
247 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 231 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
248 TestEventTargetV8Internal::namedPropertyQuery(name, info); 232 TestEventTargetV8Internal::namedPropertyQuery(name, info);
249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 233 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
250 } 234 }
251 235
236 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
237 {
238 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
239 AtomicString propertyName = toCoreAtomicString(name);
240 DeleteResult result = collection->anonymousNamedDeleter(propertyName);
241 if (result != DeleteUnknownProperty)
242 return v8SetReturnValueBool(info, result == DeleteSuccess);
243 }
244
245 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
246 {
247 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
248 TestEventTargetV8Internal::namedPropertyDeleter(name, info);
249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
250 }
251
252 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 252 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
253 { 253 {
254 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 254 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
255 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 255 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
256 Vector<String> names; 256 Vector<String> names;
257 collection->namedPropertyEnumerator(names, exceptionState); 257 collection->namedPropertyEnumerator(names, exceptionState);
258 if (exceptionState.throwIfNeeded()) 258 if (exceptionState.throwIfNeeded())
259 return; 259 return;
260 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ()); 260 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ());
261 for (size_t i = 0; i < names.size(); ++i) 261 for (size_t i = 0; i < names.size(); ++i)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 fromInternalPointer(object)->deref(); 347 fromInternalPointer(object)->deref();
348 } 348 }
349 349
350 template<> 350 template<>
351 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 351 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
352 { 352 {
353 return toV8(impl, creationContext, isolate); 353 return toV8(impl, creationContext, isolate);
354 } 354 }
355 355
356 } // namespace WebCore 356 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698