Bug 1515800 - Rename some more GetCurrentTime methods to avoid winbase.h bustage r=birtles,bzbarsky
authorCameron McCormack <cam@mcc.id.au>
Fri, 21 Dec 2018 05:37:58 +0000
changeset 451647 84931341bac16f5c047f137fffd9c69bb05a7a77
parent 451646 8ad209d77614e79e1a8cd2b9dc6ca9aab4469917
child 451648 e16b548dc14c58efd713bfac10a5944fd6bdfc5e
child 451665 e6f94ab104ba8ed6e1439d7b70d072e599d16a26
push id110700
push userebalazs@mozilla.com
push dateFri, 21 Dec 2018 09:45:20 +0000
treeherdermozilla-inbound@e4a0eaea4126 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles, bzbarsky
bugs1515800
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515800 - Rename some more GetCurrentTime methods to avoid winbase.h bustage r=birtles,bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D15167
dom/smil/nsSMILAnimationController.cpp
dom/smil/nsSMILTimeContainer.cpp
dom/smil/nsSMILTimeContainer.h
dom/smil/nsSMILTimeValueSpec.cpp
dom/smil/nsSMILTimedElement.cpp
dom/svg/SVGAnimationElement.cpp
dom/svg/SVGAnimationElement.h
dom/svg/SVGSVGElement.cpp
dom/svg/SVGSVGElement.h
dom/webidl/SVGAnimationElement.webidl
dom/webidl/SVGSVGElement.webidl
image/SVGDocumentWrapper.cpp
image/SVGDocumentWrapper.h
image/VectorImage.cpp
--- a/dom/smil/nsSMILAnimationController.cpp
+++ b/dom/smil/nsSMILAnimationController.cpp
@@ -466,31 +466,31 @@ void nsSMILAnimationController::DoMilest
   nsSMILTime sampleTime = INT64_MIN;
 
   while (true) {
     // We want to find any milestones AT OR BEFORE the current sample time so we
     // initialise the next milestone to the moment after (1ms after, to be
     // precise) the current sample time and see if there are any milestones
     // before that. Any other milestones will be dealt with in a subsequent
     // sample.
-    nsSMILMilestone nextMilestone(GetCurrentTime() + 1, true);
+    nsSMILMilestone nextMilestone(GetCurrentTimeAsSMILTime() + 1, true);
     for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
       nsSMILTimeContainer* container = iter.Get()->GetKey();
       if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) {
         continue;
       }
       nsSMILMilestone thisMilestone;
       bool didGetMilestone =
           container->GetNextMilestoneInParentTime(thisMilestone);
       if (didGetMilestone && thisMilestone < nextMilestone) {
         nextMilestone = thisMilestone;
       }
     }
 
-    if (nextMilestone.mTime > GetCurrentTime()) {
+    if (nextMilestone.mTime > GetCurrentTimeAsSMILTime()) {
       break;
     }
 
     nsTArray<RefPtr<mozilla::dom::SVGAnimationElement>> elements;
     for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
       nsSMILTimeContainer* container = iter.Get()->GetKey();
       if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) {
         continue;
@@ -548,17 +548,17 @@ void nsSMILAnimationController::DoMilest
   // containers so the paused ones don't need a sample any more and they'll
   // return false.
   //
   // Instead we build up a hashmap of active time containers during the previous
   // step (SampleTimeContainer) and then test here if the container for this
   // timed element is in the list.
   if (!aActiveContainers->GetEntry(timeContainer)) return;
 
-  nsSMILTime containerTime = timeContainer->GetCurrentTime();
+  nsSMILTime containerTime = timeContainer->GetCurrentTimeAsSMILTime();
 
   MOZ_ASSERT(!timeContainer->IsSeeking(),
              "Doing a regular sample but the time container is still seeking");
   aElement->TimedElement().SampleAt(containerTime);
 }
 
 /*static*/ void nsSMILAnimationController::AddAnimationToCompositorTable(
     SVGAnimationElement* aElement, nsSMILCompositorTable* aCompositorTable,
--- a/dom/smil/nsSMILTimeContainer.cpp
+++ b/dom/smil/nsSMILTimeContainer.cpp
@@ -90,17 +90,17 @@ void nsSMILTimeContainer::Resume(uint32_
 
   if (!mPauseState) {
     nsSMILTime extraOffset = GetParentTime() - mPauseStart;
     mParentOffset += extraOffset;
     NotifyTimeChange();
   }
 }
 
-nsSMILTime nsSMILTimeContainer::GetCurrentTime() const {
+nsSMILTime nsSMILTimeContainer::GetCurrentTimeAsSMILTime() const {
   // The following behaviour is consistent with:
   // http://www.w3.org/2003/01/REC-SVG11-20030114-errata
   //  #getCurrentTime_setCurrentTime_undefined_before_document_timeline_begin
   // which says that if GetCurrentTime is called before the document timeline
   // has begun we should just return 0.
   if (IsPausedByType(PAUSE_BEGIN)) return 0L;
 
   return mCurrentTime;
@@ -134,17 +134,17 @@ void nsSMILTimeContainer::SetCurrentTime
   // Force an update to the current time in case we get a call to GetCurrentTime
   // before another call to Sample().
   UpdateCurrentTime();
 
   NotifyTimeChange();
 }
 
 nsSMILTime nsSMILTimeContainer::GetParentTime() const {
-  if (mParent) return mParent->GetCurrentTime();
+  if (mParent) return mParent->GetCurrentTimeAsSMILTime();
 
   return 0L;
 }
 
 void nsSMILTimeContainer::SyncPauseTime() {
   if (IsPaused()) {
     nsSMILTime parentTime = GetParentTime();
     nsSMILTime extraOffset = parentTime - mPauseStart;
--- a/dom/smil/nsSMILTimeContainer.h
+++ b/dom/smil/nsSMILTimeContainer.h
@@ -78,17 +78,17 @@ class nsSMILTimeContainer {
    * @return true if this container is paused, false otherwise.
    */
   bool IsPaused() const { return mPauseState != 0; }
 
   /*
    * Return the time elapsed since this time container's begin time (expressed
    * in parent time) minus any accumulated offset from pausing.
    */
-  nsSMILTime GetCurrentTime() const;
+  nsSMILTime GetCurrentTimeAsSMILTime() const;
 
   /*
    * Seek the document timeline to the specified time.
    *
    * @param aSeekTo The time to seek to, expressed in this time container's time
    * base (i.e. the same units as GetCurrentTime).
    */
   void SetCurrentTime(nsSMILTime aSeekTo);
--- a/dom/smil/nsSMILTimeValueSpec.cpp
+++ b/dom/smil/nsSMILTimeValueSpec.cpp
@@ -297,17 +297,17 @@ void nsSMILTimeValueSpec::HandleEvent(Ev
   nsSMILTimeContainer* container = mOwner->GetTimeContainer();
   if (!container) return;
 
   if (mParams.mType == nsSMILTimeValueSpecParams::REPEAT &&
       !CheckRepeatEventDetail(aEvent)) {
     return;
   }
 
-  nsSMILTime currentTime = container->GetCurrentTime();
+  nsSMILTime currentTime = container->GetCurrentTimeAsSMILTime();
   nsSMILTimeValue newTime(currentTime);
   if (!ApplyOffset(newTime)) {
     NS_WARNING("New time generated from event overflows nsSMILTime, ignoring");
     return;
   }
 
   RefPtr<nsSMILInstanceTime> newInstance =
       new nsSMILInstanceTime(newTime, nsSMILInstanceTime::SOURCE_EVENT);
--- a/dom/smil/nsSMILTimedElement.cpp
+++ b/dom/smil/nsSMILTimedElement.cpp
@@ -292,25 +292,25 @@ dom::Element* nsSMILTimedElement::GetTar
 //
 // which favours the definition in SMIL, i.e. instance times are just added
 // without first checking the restart mode.
 
 nsresult nsSMILTimedElement::BeginElementAt(double aOffsetSeconds) {
   nsSMILTimeContainer* container = GetTimeContainer();
   if (!container) return NS_ERROR_FAILURE;
 
-  nsSMILTime currentTime = container->GetCurrentTime();
+  nsSMILTime currentTime = container->GetCurrentTimeAsSMILTime();
   return AddInstanceTimeFromCurrentTime(currentTime, aOffsetSeconds, true);
 }
 
 nsresult nsSMILTimedElement::EndElementAt(double aOffsetSeconds) {
   nsSMILTimeContainer* container = GetTimeContainer();
   if (!container) return NS_ERROR_FAILURE;
 
-  nsSMILTime currentTime = container->GetCurrentTime();
+  nsSMILTime currentTime = container->GetCurrentTimeAsSMILTime();
   return AddInstanceTimeFromCurrentTime(currentTime, aOffsetSeconds, false);
 }
 
 //----------------------------------------------------------------------
 // nsSVGAnimationElement methods
 
 nsSMILTimeValue nsSMILTimedElement::GetStartTime() const {
   return mElementState == STATE_WAITING || mElementState == STATE_ACTIVE
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -104,22 +104,22 @@ float SVGAnimationElement::GetStartTime(
   if (!startTime.IsDefinite()) {
     rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return 0.f;
   }
 
   return float(double(startTime.GetMillis()) / PR_MSEC_PER_SEC);
 }
 
-float SVGAnimationElement::GetCurrentTime() {
+float SVGAnimationElement::GetCurrentTimeAsFloat() {
   // Not necessary to call FlushAnimations() for this
 
   nsSMILTimeContainer* root = GetTimeContainer();
   if (root) {
-    return float(double(root->GetCurrentTime()) / PR_MSEC_PER_SEC);
+    return float(double(root->GetCurrentTimeAsSMILTime()) / PR_MSEC_PER_SEC);
   }
 
   return 0.0f;
 }
 
 float SVGAnimationElement::GetSimpleDuration(ErrorResult& rv) {
   // Not necessary to call FlushAnimations() for this
 
--- a/dom/svg/SVGAnimationElement.h
+++ b/dom/svg/SVGAnimationElement.h
@@ -68,17 +68,17 @@ class SVGAnimationElement : public SVGAn
   virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;
 
   // Utility methods for within SVG
   void ActivateByHyperlink();
 
   // WebIDL
   nsSVGElement* GetTargetElement();
   float GetStartTime(ErrorResult& rv);
-  float GetCurrentTime();
+  float GetCurrentTimeAsFloat();
   float GetSimpleDuration(ErrorResult& rv);
   void BeginElement(ErrorResult& rv) { BeginElementAt(0.f, rv); }
   void BeginElementAt(float offset, ErrorResult& rv);
   void EndElement(ErrorResult& rv) { EndElementAt(0.f, rv); }
   void EndElementAt(float offset, ErrorResult& rv);
 
   // SVGTests
   nsSVGElement* AsSVGElement() final { return this; }
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -207,20 +207,20 @@ void SVGSVGElement::UnpauseAnimations() 
   // else we're not the outermost <svg> or not bound to a tree, so silently fail
 }
 
 bool SVGSVGElement::AnimationsPaused() {
   nsSMILTimeContainer* root = GetTimedDocumentRoot();
   return root && root->IsPausedByType(nsSMILTimeContainer::PAUSE_SCRIPT);
 }
 
-float SVGSVGElement::GetCurrentTime() {
+float SVGSVGElement::GetCurrentTimeAsFloat() {
   nsSMILTimeContainer* root = GetTimedDocumentRoot();
   if (root) {
-    double fCurrentTimeMs = double(root->GetCurrentTime());
+    double fCurrentTimeMs = double(root->GetCurrentTimeAsSMILTime());
     return (float)(fCurrentTimeMs / PR_MSEC_PER_SEC);
   } else {
     return 0.f;
   }
 }
 
 void SVGSVGElement::SetCurrentTime(float seconds) {
   if (mTimedDocumentRoot) {
--- a/dom/svg/SVGSVGElement.h
+++ b/dom/svg/SVGSVGElement.h
@@ -123,17 +123,17 @@ class SVGSVGElement final : public SVGSV
   void SetCurrentTranslate(float x, float y);
   uint32_t SuspendRedraw(uint32_t max_wait_milliseconds);
   void UnsuspendRedraw(uint32_t suspend_handle_id);
   void UnsuspendRedrawAll();
   void ForceRedraw();
   void PauseAnimations();
   void UnpauseAnimations();
   bool AnimationsPaused();
-  float GetCurrentTime();
+  float GetCurrentTimeAsFloat();
   void SetCurrentTime(float seconds);
   void DeselectAll();
   already_AddRefed<DOMSVGNumber> CreateSVGNumber();
   already_AddRefed<DOMSVGLength> CreateSVGLength();
   already_AddRefed<SVGAngle> CreateSVGAngle();
   already_AddRefed<nsISVGPoint> CreateSVGPoint();
   already_AddRefed<SVGMatrix> CreateSVGMatrix();
   already_AddRefed<SVGIRect> CreateSVGRect();
@@ -256,17 +256,18 @@ class SVGSVGElement final : public SVGSV
 };
 
 }  // namespace dom
 
 class MOZ_RAII AutoSVGTimeSetRestore {
  public:
   AutoSVGTimeSetRestore(dom::SVGSVGElement* aRootElem,
                         float aFrameTime MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-      : mRootElem(aRootElem), mOriginalTime(mRootElem->GetCurrentTime()) {
+      : mRootElem(aRootElem),
+        mOriginalTime(mRootElem->GetCurrentTimeAsFloat()) {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     mRootElem->SetCurrentTime(
         aFrameTime);  // Does nothing if there's no change.
   }
 
   ~AutoSVGTimeSetRestore() { mRootElem->SetCurrentTime(mOriginalTime); }
 
  private:
--- a/dom/webidl/SVGAnimationElement.webidl
+++ b/dom/webidl/SVGAnimationElement.webidl
@@ -11,16 +11,17 @@
  */
 
 interface SVGAnimationElement : SVGElement {
 
   readonly attribute SVGElement? targetElement;
 
   [Throws]
   float getStartTime();
+  [BinaryName="getCurrentTimeAsFloat"]
   float getCurrentTime();
   [Throws]
   float getSimpleDuration();
 
   [Throws]
   void beginElement();
   [Throws]
   void beginElementAt(float offset);
--- a/dom/webidl/SVGSVGElement.webidl
+++ b/dom/webidl/SVGSVGElement.webidl
@@ -35,16 +35,17 @@ interface SVGSVGElement : SVGGraphicsEle
   void unsuspendRedraw(unsigned long suspendHandleID);
   [DependsOn=Nothing, Affects=Nothing]
   void unsuspendRedrawAll();
   [DependsOn=Nothing, Affects=Nothing]
   void forceRedraw();
   void pauseAnimations();
   void unpauseAnimations();
   boolean animationsPaused();
+  [BinaryName="getCurrentTimeAsFloat"]
   float getCurrentTime();
   void setCurrentTime(float seconds);
   // NodeList getIntersectionList(SVGRect rect, SVGElement referenceElement);
   // NodeList getEnclosureList(SVGRect rect, SVGElement referenceElement);
   // boolean checkIntersection(SVGElement element, SVGRect rect);
   // boolean checkEnclosure(SVGElement element, SVGRect rect);
   void deselectAll();
   [NewObject]
--- a/image/SVGDocumentWrapper.cpp
+++ b/image/SVGDocumentWrapper.cpp
@@ -26,19 +26,16 @@
 #include "mozilla/dom/SVGSVGElement.h"
 #include "SVGObserverUtils.h"
 #include "mozilla/dom/SVGAnimatedLength.h"
 #include "nsMimeTypes.h"
 #include "DOMSVGLength.h"
 #include "nsDocument.h"
 #include "mozilla/dom/ImageTracker.h"
 
-// undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
-#undef GetCurrentTime
-
 namespace mozilla {
 
 using namespace dom;
 using namespace gfx;
 
 namespace image {
 
 NS_IMPL_ISUPPORTS(SVGDocumentWrapper, nsIStreamListener, nsIRequestObserver,
@@ -161,24 +158,24 @@ void SVGDocumentWrapper::ResetAnimation(
   SVGSVGElement* svgElem = GetRootSVGElem();
   if (!svgElem) {
     return;
   }
 
   svgElem->SetCurrentTime(0.0f);
 }
 
-float SVGDocumentWrapper::GetCurrentTime() {
+float SVGDocumentWrapper::GetCurrentTimeAsFloat() {
   SVGSVGElement* svgElem = GetRootSVGElem();
-  return svgElem ? svgElem->GetCurrentTime() : 0.0f;
+  return svgElem ? svgElem->GetCurrentTimeAsFloat() : 0.0f;
 }
 
 void SVGDocumentWrapper::SetCurrentTime(float aTime) {
   SVGSVGElement* svgElem = GetRootSVGElem();
-  if (svgElem && svgElem->GetCurrentTime() != aTime) {
+  if (svgElem && svgElem->GetCurrentTimeAsFloat() != aTime) {
     svgElem->SetCurrentTime(aTime);
   }
 }
 
 void SVGDocumentWrapper::TickRefreshDriver() {
   nsCOMPtr<nsIPresShell> presShell = mViewer->GetPresShell();
   if (presShell) {
     nsPresContext* presContext = presShell->GetPresContext();
--- a/image/SVGDocumentWrapper.h
+++ b/image/SVGDocumentWrapper.h
@@ -19,19 +19,16 @@
 
 class nsIPresShell;
 class nsIRequest;
 class nsILoadGroup;
 class nsIFrame;
 
 #define OBSERVER_SVC_CID "@mozilla.org/observer-service;1"
 
-// undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
-#undef GetCurrentTime
-
 namespace mozilla {
 namespace dom {
 class SVGSVGElement;
 class SVGDocument;
 }  // namespace dom
 
 namespace image {
 
@@ -105,17 +102,17 @@ class SVGDocumentWrapper final : public 
   bool ShouldIgnoreInvalidation() { return mIgnoreInvalidation; }
 
   /**
    * Methods to control animation.
    */
   void StartAnimation();
   void StopAnimation();
   void ResetAnimation();
-  float GetCurrentTime();
+  float GetCurrentTimeAsFloat();
   void SetCurrentTime(float aTime);
   void TickRefreshDriver();
 
   /**
    * Force a layout flush of the underlying SVG document.
    */
   void FlushLayout();
 
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -33,19 +33,16 @@
 #include "LookupResult.h"
 #include "Orientation.h"
 #include "SVGDocumentWrapper.h"
 #include "SVGDrawingParameters.h"
 #include "nsIDOMEventListener.h"
 #include "SurfaceCache.h"
 #include "nsDocument.h"
 
-// undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
-#undef GetCurrentTime
-
 namespace mozilla {
 
 using namespace dom;
 using namespace dom::SVGPreserveAspectRatio_Binding;
 using namespace gfx;
 using namespace layers;
 
 namespace image {
@@ -761,18 +758,18 @@ VectorImage::GetFrameInternal(const IntS
 
   // By using a null gfxContext, we ensure that we will always attempt to
   // create a surface, even if we aren't capable of caching it (e.g. due to our
   // flags, having an animation, etc). Otherwise CreateSurface will assume that
   // the caller is capable of drawing directly to its own draw target if we
   // cannot cache.
   SVGDrawingParameters params(
       nullptr, decodeSize, aSize, ImageRegion::Create(decodeSize),
-      SamplingFilter::POINT, aSVGContext, mSVGDocumentWrapper->GetCurrentTime(),
-      aFlags, 1.0);
+      SamplingFilter::POINT, aSVGContext,
+      mSVGDocumentWrapper->GetCurrentTimeAsFloat(), aFlags, 1.0);
 
   bool didCache;  // Was the surface put into the cache?
   bool contextPaint = aSVGContext && aSVGContext->GetContextPaint();
 
   AutoRestoreSVGState autoRestore(params, mSVGDocumentWrapper, mIsDrawing,
                                   contextPaint);
 
   RefPtr<gfxDrawable> svgDrawable = CreateSVGDrawable(params);
@@ -943,17 +940,17 @@ VectorImage::Draw(gfxContext* aContext, 
 
   MOZ_ASSERT(!(aFlags & FLAG_FORCE_PRESERVEASPECTRATIO_NONE) ||
                  (aSVGContext && aSVGContext->GetViewportSize()),
              "Viewport size is required when using "
              "FLAG_FORCE_PRESERVEASPECTRATIO_NONE");
 
   float animTime = (aWhichFrame == FRAME_FIRST)
                        ? 0.0f
-                       : mSVGDocumentWrapper->GetCurrentTime();
+                       : mSVGDocumentWrapper->GetCurrentTimeAsFloat();
 
   Maybe<SVGImageContext> newSVGContext;
   bool contextPaint =
       MaybeRestrictSVGContext(newSVGContext, aSVGContext, aFlags);
 
   SVGDrawingParameters params(aContext, aSize, aSize, aRegion, aSamplingFilter,
                               newSVGContext ? newSVGContext : aSVGContext,
                               animTime, aFlags, aOpacity);
@@ -1309,18 +1306,19 @@ VectorImage::ResetAnimation() {
   mSVGDocumentWrapper->ResetAnimation();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP_(float)
 VectorImage::GetFrameIndex(uint32_t aWhichFrame) {
   MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE, "Invalid argument");
-  return aWhichFrame == FRAME_FIRST ? 0.0f
-                                    : mSVGDocumentWrapper->GetCurrentTime();
+  return aWhichFrame == FRAME_FIRST
+             ? 0.0f
+             : mSVGDocumentWrapper->GetCurrentTimeAsFloat();
 }
 
 //------------------------------------------------------------------------------
 // nsIRequestObserver methods
 
 //******************************************************************************
 NS_IMETHODIMP
 VectorImage::OnStartRequest(nsIRequest* aRequest, nsISupports* aCtxt) {