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

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

Issue 131203009: Make event names of TRACE_EVENT_SAMPLING_STATE macros more descriptive (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); 83 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder());
84 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState); 84 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
85 v8SetReturnValue(info, imp->item(index)); 85 v8SetReturnValue(info, imp->item(index));
86 } 86 }
87 87
88 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 88 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
89 { 89 {
90 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 90 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
91 TestEventTargetV8Internal::itemMethod(info); 91 TestEventTargetV8Internal::itemMethod(info);
92 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 92 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
93 } 93 }
94 94
95 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 95 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
96 { 96 {
97 if (UNLIKELY(info.Length() < 1)) { 97 if (UNLIKELY(info.Length() < 1)) {
98 throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestEven tTarget", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsol ate()); 98 throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestEven tTarget", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsol ate());
99 return; 99 return;
100 } 100 }
101 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); 101 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder());
102 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); 102 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
103 v8SetReturnValue(info, imp->namedItem(name)); 103 v8SetReturnValue(info, imp->namedItem(name));
104 } 104 }
105 105
106 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 106 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
107 { 107 {
108 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 108 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
109 TestEventTargetV8Internal::namedItemMethod(info); 109 TestEventTargetV8Internal::namedItemMethod(info);
110 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 110 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
111 } 111 }
112 112
113 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) 113 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
114 { 114 {
115 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); 115 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
116 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 116 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
117 RefPtr<Node> element = collection->item(index); 117 RefPtr<Node> element = collection->item(index);
118 if (!element) 118 if (!element)
119 return; 119 return;
120 v8SetReturnValueFast(info, element.release(), collection); 120 v8SetReturnValueFast(info, element.release(), collection);
121 } 121 }
122 122
123 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info) 123 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info)
124 { 124 {
125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
126 TestEventTargetV8Internal::indexedPropertyGetter(index, info); 126 TestEventTargetV8Internal::indexedPropertyGetter(index, info);
127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
128 } 128 }
129 129
130 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 130 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
131 { 131 {
132 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 132 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
133 V8TRYCATCH_VOID(Node*, propertyValue, V8Node::hasInstance(jsValue, info.GetI solate(), worldType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object >::Cast(jsValue)) : 0); 133 V8TRYCATCH_VOID(Node*, propertyValue, V8Node::hasInstance(jsValue, info.GetI solate(), worldType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object >::Cast(jsValue)) : 0);
134 bool result = collection->anonymousIndexedSetter(index, propertyValue); 134 bool result = collection->anonymousIndexedSetter(index, propertyValue);
135 if (!result) 135 if (!result)
136 return; 136 return;
137 v8SetReturnValue(info, jsValue); 137 v8SetReturnValue(info, jsValue);
138 } 138 }
139 139
140 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<v8::Value>& info) 140 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<v8::Value>& info)
141 { 141 {
142 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 142 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
143 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info); 143 TestEventTargetV8Internal::indexedPropertySetter(index, jsValue, info);
144 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 144 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
145 } 145 }
146 146
147 static void indexedPropertyDeleter(unsigned index, const v8::PropertyCallbackInf o<v8::Boolean>& info) 147 static void indexedPropertyDeleter(unsigned index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
148 { 148 {
149 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 149 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
150 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 150 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
151 DeleteResult result = collection->anonymousIndexedDeleter(index, exceptionSt ate); 151 DeleteResult result = collection->anonymousIndexedDeleter(index, exceptionSt ate);
152 if (exceptionState.throwIfNeeded()) 152 if (exceptionState.throwIfNeeded())
153 return; 153 return;
154 if (result != DeleteUnknownProperty) 154 if (result != DeleteUnknownProperty)
155 return v8SetReturnValueBool(info, result == DeleteSuccess); 155 return v8SetReturnValueBool(info, result == DeleteSuccess);
156 } 156 }
157 157
158 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 158 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
159 { 159 {
160 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 160 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
161 TestEventTargetV8Internal::indexedPropertyDeleter(index, info); 161 TestEventTargetV8Internal::indexedPropertyDeleter(index, info);
162 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 162 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
163 } 163 }
164 164
165 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info) 165 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
166 { 166 {
167 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 167 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
168 return; 168 return;
169 if (info.Holder()->HasRealNamedCallbackProperty(name)) 169 if (info.Holder()->HasRealNamedCallbackProperty(name))
170 return; 170 return;
171 if (info.Holder()->HasRealNamedProperty(name)) 171 if (info.Holder()->HasRealNamedProperty(name))
172 return; 172 return;
173 173
174 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); 174 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
175 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 175 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
176 AtomicString propertyName = toCoreAtomicString(name); 176 AtomicString propertyName = toCoreAtomicString(name);
177 RefPtr<Node> element = collection->namedItem(propertyName); 177 RefPtr<Node> element = collection->namedItem(propertyName);
178 if (!element) 178 if (!element)
179 return; 179 return;
180 v8SetReturnValueFast(info, element.release(), collection); 180 v8SetReturnValueFast(info, element.release(), collection);
181 } 181 }
182 182
183 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) 183 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
184 { 184 {
185 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 185 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
186 TestEventTargetV8Internal::namedPropertyGetter(name, info); 186 TestEventTargetV8Internal::namedPropertyGetter(name, info);
187 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 187 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
188 } 188 }
189 189
190 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 190 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
191 { 191 {
192 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 192 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
193 return; 193 return;
194 if (info.Holder()->HasRealNamedCallbackProperty(name)) 194 if (info.Holder()->HasRealNamedCallbackProperty(name))
195 return; 195 return;
196 if (info.Holder()->HasRealNamedProperty(name)) 196 if (info.Holder()->HasRealNamedProperty(name))
197 return; 197 return;
198 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 198 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
199 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ; 199 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ;
200 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa lue); 200 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa lue);
201 bool result; 201 bool result;
202 if (jsValue->IsUndefined()) 202 if (jsValue->IsUndefined())
203 result = collection->anonymousNamedSetterUndefined(propertyName); 203 result = collection->anonymousNamedSetterUndefined(propertyName);
204 else 204 else
205 result = collection->anonymousNamedSetter(propertyName, propertyValue); 205 result = collection->anonymousNamedSetter(propertyName, propertyValue);
206 if (!result) 206 if (!result)
207 return; 207 return;
208 v8SetReturnValue(info, jsValue); 208 v8SetReturnValue(info, jsValue);
209 } 209 }
210 210
211 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 211 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
212 { 212 {
213 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 213 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
214 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info); 214 TestEventTargetV8Internal::namedPropertySetter(name, jsValue, info);
215 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 215 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
216 } 216 }
217 217
218 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info) 218 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
219 { 219 {
220 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 220 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
221 AtomicString propertyName = toCoreAtomicString(name); 221 AtomicString propertyName = toCoreAtomicString(name);
222 DeleteResult result = collection->anonymousNamedDeleter(propertyName); 222 DeleteResult result = collection->anonymousNamedDeleter(propertyName);
223 if (result != DeleteUnknownProperty) 223 if (result != DeleteUnknownProperty)
224 return v8SetReturnValueBool(info, result == DeleteSuccess); 224 return v8SetReturnValueBool(info, result == DeleteSuccess);
225 } 225 }
226 226
227 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info) 227 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
228 { 228 {
229 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 229 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
230 TestEventTargetV8Internal::namedPropertyDeleter(name, info); 230 TestEventTargetV8Internal::namedPropertyDeleter(name, info);
231 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 231 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
232 } 232 }
233 233
234 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 234 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
235 { 235 {
236 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 236 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
237 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder()); 237 TestEventTarget* collection = V8TestEventTarget::toNative(info.Holder());
238 Vector<String> names; 238 Vector<String> names;
239 collection->namedPropertyEnumerator(names, exceptionState); 239 collection->namedPropertyEnumerator(names, exceptionState);
240 if (exceptionState.throwIfNeeded()) 240 if (exceptionState.throwIfNeeded())
241 return; 241 return;
(...skipping 13 matching lines...) Expand all
255 return; 255 return;
256 if (!result) 256 if (!result)
257 return; 257 return;
258 v8SetReturnValueInt(info, v8::None); 258 v8SetReturnValueInt(info, v8::None);
259 } 259 }
260 260
261 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) 261 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
262 { 262 {
263 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 263 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
264 TestEventTargetV8Internal::namedPropertyEnumerator(info); 264 TestEventTargetV8Internal::namedPropertyEnumerator(info);
265 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 265 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
266 } 266 }
267 267
268 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info) 268 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
269 { 269 {
270 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 270 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
271 TestEventTargetV8Internal::namedPropertyQuery(name, info); 271 TestEventTargetV8Internal::namedPropertyQuery(name, info);
272 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 272 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
273 } 273 }
274 274
275 } // namespace TestEventTargetV8Internal 275 } // namespace TestEventTargetV8Internal
276 276
277 static const V8DOMConfiguration::MethodConfiguration V8TestEventTargetMethods[] = { 277 static const V8DOMConfiguration::MethodConfiguration V8TestEventTargetMethods[] = {
278 {"item", TestEventTargetV8Internal::itemMethodCallback, 0, 1}, 278 {"item", TestEventTargetV8Internal::itemMethodCallback, 0, 1},
279 {"namedItem", TestEventTargetV8Internal::namedItemMethodCallback, 0, 1}, 279 {"namedItem", TestEventTargetV8Internal::namedItemMethodCallback, 0, 1},
280 }; 280 };
281 281
282 static void configureV8TestEventTargetTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) 282 static void configureV8TestEventTargetTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 fromInternalPointer(object)->deref(); 355 fromInternalPointer(object)->deref();
356 } 356 }
357 357
358 template<> 358 template<>
359 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 359 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
360 { 360 {
361 return toV8(impl, creationContext, isolate); 361 return toV8(impl, creationContext, isolate);
362 } 362 }
363 363
364 } // namespace WebCore 364 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestCustomAccessors.cpp ('k') | Source/bindings/tests/results/V8TestException.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698