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

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

Issue 106853005: Implement platform deleters per spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch to DeleteResult enum + extend scheme to indexed deleters Created 7 years 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 /* 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 { 138 {
139 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 139 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
140 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info); 140 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info);
141 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 141 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
142 } 142 }
143 143
144 static void indexedPropertyDeleter(unsigned index, const v8::PropertyCallbackInf o<v8::Boolean>& info) 144 static void indexedPropertyDeleter(unsigned index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
145 { 145 {
146 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 146 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
147 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 147 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
148 bool result = collection->anonymousIndexedDeleter(index, exceptionState); 148 DeleteResult result = collection->anonymousIndexedDeleter(index, exceptionSt ate);
149 if (exceptionState.throwIfNeeded()) 149 if (exceptionState.throwIfNeeded())
150 return; 150 return;
151 return v8SetReturnValueBool(info, result); 151 if (result != DeleteUnknownProperty)
152 return v8SetReturnValueBool(info, result == DeleteSuccess);
152 } 153 }
153 154
154 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 155 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
155 { 156 {
156 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 157 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
157 TestEventTargetV8Internal::indexedPropertyDeleter(index, info); 158 TestEventTargetV8Internal::indexedPropertyDeleter(index, info);
158 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 159 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
159 } 160 }
160 161
161 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info) 162 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 { 209 {
209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 210 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
210 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info); 211 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info);
211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 212 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
212 } 213 }
213 214
214 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info) 215 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
215 { 216 {
216 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 217 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
217 AtomicString propertyName = toCoreAtomicString(name); 218 AtomicString propertyName = toCoreAtomicString(name);
218 bool result = collection->anonymousNamedDeleter(propertyName); 219 DeleteResult result = collection->anonymousNamedDeleter(propertyName);
219 return v8SetReturnValueBool(info, result); 220 if (result != DeleteUnknownProperty)
221 return v8SetReturnValueBool(info, result == DeleteSuccess);
220 } 222 }
221 223
222 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info) 224 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
223 { 225 {
224 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 226 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
225 TestEventTargetV8Internal::namedPropertyDeleter(name, info); 227 TestEventTargetV8Internal::namedPropertyDeleter(name, info);
226 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 228 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
227 } 229 }
228 230
229 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 231 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 fromInternalPointer(object)->deref(); 353 fromInternalPointer(object)->deref();
352 } 354 }
353 355
354 template<> 356 template<>
355 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 357 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
356 { 358 {
357 return toV8(impl, creationContext, isolate); 359 return toV8(impl, creationContext, isolate);
358 } 360 }
359 361
360 } // namespace WebCore 362 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698