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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp

Issue 2243173002: SVG: Use counters for SMIL methods on animation elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 { 232 {
233 // Assumptions may not hold after an attribute change. 233 // Assumptions may not hold after an attribute change.
234 m_animationValid = false; 234 m_animationValid = false;
235 m_lastValuesAnimationFrom = String(); 235 m_lastValuesAnimationFrom = String();
236 m_lastValuesAnimationTo = String(); 236 m_lastValuesAnimationTo = String();
237 setInactive(); 237 setInactive();
238 } 238 }
239 239
240 float SVGAnimationElement::getStartTime(ExceptionState& exceptionState) const 240 float SVGAnimationElement::getStartTime(ExceptionState& exceptionState) const
241 { 241 {
242 UseCounter::count(document(), UseCounter::SVGSMILAnimationElementTiming);
kouhei (in TOK) 2016/08/15 03:34:45 If you intend to only measure JS callers, you can
Eric Willigers 2016/08/15 04:31:49 Done.
242 SMILTime startTime = intervalBegin(); 243 SMILTime startTime = intervalBegin();
243 if (!startTime.isFinite()) { 244 if (!startTime.isFinite()) {
244 exceptionState.throwDOMException(InvalidStateError, "No current interval ."); 245 exceptionState.throwDOMException(InvalidStateError, "No current interval .");
245 return 0; 246 return 0;
246 } 247 }
247 return narrowPrecisionToFloat(startTime.value()); 248 return narrowPrecisionToFloat(startTime.value());
248 } 249 }
249 250
250 float SVGAnimationElement::getCurrentTime() const 251 float SVGAnimationElement::getCurrentTime() const
251 { 252 {
253 UseCounter::count(document(), UseCounter::SVGSMILAnimationElementTiming);
252 return narrowPrecisionToFloat(elapsed().value()); 254 return narrowPrecisionToFloat(elapsed().value());
253 } 255 }
254 256
255 float SVGAnimationElement::getSimpleDuration(ExceptionState& exceptionState) con st 257 float SVGAnimationElement::getSimpleDuration(ExceptionState& exceptionState) con st
256 { 258 {
259 UseCounter::count(document(), UseCounter::SVGSMILAnimationElementTiming);
257 SMILTime duration = simpleDuration(); 260 SMILTime duration = simpleDuration();
258 if (!duration.isFinite()) { 261 if (!duration.isFinite()) {
259 exceptionState.throwDOMException(NotSupportedError, "No simple duration defined."); 262 exceptionState.throwDOMException(NotSupportedError, "No simple duration defined.");
260 return 0; 263 return 0;
261 } 264 }
262 return narrowPrecisionToFloat(duration.value()); 265 return narrowPrecisionToFloat(duration.value());
263 } 266 }
264 267
265 void SVGAnimationElement::beginElement() 268 void SVGAnimationElement::beginElement()
266 { 269 {
267 beginElementAt(0); 270 beginElementAt(0);
268 } 271 }
269 272
270 void SVGAnimationElement::beginElementAt(float offset) 273 void SVGAnimationElement::beginElementAt(float offset)
271 { 274 {
272 ASSERT(std::isfinite(offset)); 275 ASSERT(std::isfinite(offset));
276 UseCounter::count(document(), UseCounter::SVGSMILBeginEndAnimationElement);
273 SMILTime elapsed = this->elapsed(); 277 SMILTime elapsed = this->elapsed();
274 addBeginTime(elapsed, elapsed + offset, SMILTimeWithOrigin::ScriptOrigin); 278 addBeginTime(elapsed, elapsed + offset, SMILTimeWithOrigin::ScriptOrigin);
275 } 279 }
276 280
277 void SVGAnimationElement::endElement() 281 void SVGAnimationElement::endElement()
278 { 282 {
279 endElementAt(0); 283 endElementAt(0);
280 } 284 }
281 285
282 void SVGAnimationElement::endElementAt(float offset) 286 void SVGAnimationElement::endElementAt(float offset)
283 { 287 {
284 ASSERT(std::isfinite(offset)); 288 ASSERT(std::isfinite(offset));
289 UseCounter::count(document(), UseCounter::SVGSMILBeginEndAnimationElement);
285 SMILTime elapsed = this->elapsed(); 290 SMILTime elapsed = this->elapsed();
286 addEndTime(elapsed, elapsed + offset, SMILTimeWithOrigin::ScriptOrigin); 291 addEndTime(elapsed, elapsed + offset, SMILTimeWithOrigin::ScriptOrigin);
287 } 292 }
288 293
289 void SVGAnimationElement::updateAnimationMode() 294 void SVGAnimationElement::updateAnimationMode()
290 { 295 {
291 // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues 296 // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
292 if (hasAttribute(SVGNames::valuesAttr)) 297 if (hasAttribute(SVGNames::valuesAttr))
293 setAnimationMode(ValuesAnimation); 298 setAnimationMode(ValuesAnimation);
294 else if (!toValue().isEmpty()) 299 else if (!toValue().isEmpty())
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 if (!hasInvalidCSSAttributeType) 740 if (!hasInvalidCSSAttributeType)
736 schedule(); 741 schedule();
737 } 742 }
738 743
739 // Clear values that may depend on the previous target. 744 // Clear values that may depend on the previous target.
740 if (targetElement()) 745 if (targetElement())
741 clearAnimatedType(); 746 clearAnimatedType();
742 } 747 }
743 748
744 } // namespace blink 749 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698