Bug 1528881 - Part 6: gfx/layers: Make some global functions static. r=mattwoodrow
authorChris Peterson <cpeterson@mozilla.com>
Sun, 17 Feb 2019 14:25:01 -0800
changeset 519495 53e277d161b2d43dccbc3b294ef14212bd4f9314
parent 519494 43d876b370317974ccc221278551be1b509d1647
child 519496 13bf48ec0625e11cd3a21e0db5da6bbc26b965fa
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1528881
milestone67.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 1528881 - Part 6: gfx/layers: Make some global functions static. r=mattwoodrow clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). gfx/layers/composite/ContainerLayerComposite.cpp:132:6 [-Wmissing-prototypes] no previous prototype for function 'TransformLayerGeometry' gfx/layers/composite/LayerManagerComposite.cpp:1409:6 [-Wmissing-prototypes] no previous prototype for function 'ComputeVisibleRegionForChildren' gfx/layers/composite/LayerManagerComposite.cpp:234:6 [-Wmissing-prototypes] no previous prototype for function 'ShouldProcessLayer' gfx/layers/composite/TiledContentHost.cpp:156:6 [-Wmissing-prototypes] no previous prototype for function 'UseTileTexture' gfx/layers/ipc/CompositorBridgeParent.cpp:1827:6 [-Wmissing-prototypes] no previous prototype for function 'EraseLayerState' gfx/layers/ipc/CompositorBridgeParent.cpp:2140:6 [-Wmissing-prototypes] no previous prototype for function 'UpdateIndirectTree' gfx/layers/opengl/OGLShaderProgram.cpp:28:6 [-Wmissing-prototypes] no previous prototype for function 'AddUniforms' Differential Revision: https://phabricator.services.mozilla.com/D20265
gfx/layers/RotatedBuffer.cpp
gfx/layers/TextureSync.cpp
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/GestureEventListener.cpp
gfx/layers/apz/test/gtest/APZTestCommon.h
gfx/layers/apz/test/gtest/InputUtils.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/TextureClient.cpp
gfx/layers/composite/ContainerLayerComposite.cpp
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/opengl/OGLShaderProgram.cpp
gfx/layers/wr/WebRenderCommandBuilder.cpp
gfx/tests/gtest/TestArena.cpp
gfx/tests/gtest/TestJobScheduler.cpp
gfx/tests/gtest/TestPolygon.cpp
gfx/tests/gtest/TestRegion.cpp
gfx/tests/gtest/TestTextureCompatibility.cpp
gfx/tests/gtest/TestTextures.cpp
gfx/tests/gtest/gfxSurfaceRefCountTest.cpp
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -188,17 +188,18 @@ void RotatedBuffer::DrawBufferWithRotati
   DrawBufferQuadrant(aTarget, RIGHT, TOP, aOpacity, aOperator, aMask,
                      aMaskTransform);
   DrawBufferQuadrant(aTarget, LEFT, BOTTOM, aOpacity, aOperator, aMask,
                      aMaskTransform);
   DrawBufferQuadrant(aTarget, RIGHT, BOTTOM, aOpacity, aOperator, aMask,
                      aMaskTransform);
 }
 
-bool IsClippingCheap(gfx::DrawTarget* aTarget, const nsIntRegion& aRegion) {
+static bool IsClippingCheap(gfx::DrawTarget* aTarget,
+                            const nsIntRegion& aRegion) {
   // Assume clipping is cheap if the draw target just has an integer
   // translation, and the visible region is simple.
   return !aTarget->GetTransform().HasNonIntegerTranslation() &&
          aRegion.GetNumRects() <= 1;
 }
 
 void RotatedBuffer::DrawTo(PaintedLayer* aLayer, DrawTarget* aTarget,
                            float aOpacity, CompositionOp aOp,
--- a/gfx/layers/TextureSync.cpp
+++ b/gfx/layers/TextureSync.cpp
@@ -48,28 +48,28 @@ const int kTextureLockTimeout = 32;  // 
 struct WaitForTexturesReply {
   bool success;
 };
 
 struct WaitForTexturesRequest {
   pid_t pid;
 };
 
-std::unordered_set<uint64_t>* GetLockedTextureIdsForProcess(pid_t pid) {
+static std::unordered_set<uint64_t>* GetLockedTextureIdsForProcess(pid_t pid) {
   gTextureLockMonitor.AssertCurrentThreadOwns();
 
   if (gProcessTextureIds.find(pid) == gProcessTextureIds.end()) {
     gProcessTextureIds[pid] = std::unordered_set<uint64_t>();
   }
 
   return &gProcessTextureIds.at(pid);
 }
 
-bool WaitForTextureIdsToUnlock(pid_t pid,
-                               const Span<const uint64_t>& textureIds) {
+static bool WaitForTextureIdsToUnlock(pid_t pid,
+                                      const Span<const uint64_t>& textureIds) {
   {
     StaticMonitorAutoLock lock(gTextureLockMonitor);
     std::unordered_set<uint64_t>* freedTextureIds =
         GetLockedTextureIdsForProcess(pid);
 
     TimeStamp start = TimeStamp::Now();
     while (true) {
       bool allCleared = true;
@@ -94,17 +94,17 @@ bool WaitForTextureIdsToUnlock(pid_t pid
       if ((TimeStamp::Now() - start).ToMilliseconds() >
           (double)kTextureLockTimeout) {
         return false;
       }
     }
   }
 }
 
-void CheckTexturesForUnlock() {
+static void CheckTexturesForUnlock() {
   if (gTextureSourceProviders) {
     for (auto it = gTextureSourceProviders->begin();
          it != gTextureSourceProviders->end(); ++it) {
       (*it)->TryUnlockTextures();
     }
   }
 }
 
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1755,17 +1755,17 @@ nsEventStatus APZCTreeManager::ProcessTo
     mHitResultForInputBlock = CompositorHitTestInvisibleToHit;
     mRetainedTouchIdentifier = -1;
     mInScrollbarTouchDrag = false;
   }
 
   return result;
 }
 
-MouseInput::MouseType MultiTouchTypeToMouseType(
+static MouseInput::MouseType MultiTouchTypeToMouseType(
     MultiTouchInput::MultiTouchType aType) {
   switch (aType) {
     case MultiTouchInput::MULTITOUCH_START:
       return MouseInput::MOUSE_DOWN;
     case MultiTouchInput::MULTITOUCH_MOVE:
       return MouseInput::MOUSE_MOVE;
     case MultiTouchInput::MULTITOUCH_END:
     case MultiTouchInput::MULTITOUCH_CANCEL:
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -3714,17 +3714,17 @@ void AsyncPanZoomController::RequestCont
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   ParentLayerPoint velocity = GetVelocityVector();
   Metrics().SetDisplayPortMargins(
       CalculatePendingDisplayPort(Metrics(), velocity));
   Metrics().SetPaintRequestTime(TimeStamp::Now());
   RequestContentRepaint(Metrics(), velocity, aUpdateType);
 }
 
-/*static*/ CSSRect GetDisplayPortRect(const FrameMetrics& aFrameMetrics) {
+static CSSRect GetDisplayPortRect(const FrameMetrics& aFrameMetrics) {
   // This computation is based on what happens in CalculatePendingDisplayPort.
   // If that changes then this might need to change too
   CSSRect baseRect(aFrameMetrics.GetScrollOffset(),
                    aFrameMetrics.CalculateBoundedCompositedSizeInCssPixels());
   baseRect.Inflate(aFrameMetrics.GetDisplayPortMargins() /
                    aFrameMetrics.DisplayportPixelsPerCSSPixel());
   return baseRect;
 }
--- a/gfx/layers/apz/src/GestureEventListener.cpp
+++ b/gfx/layers/apz/src/GestureEventListener.cpp
@@ -33,39 +33,39 @@ static const float PINCH_START_THRESHOLD
 /**
  * Determines how fast a one touch pinch zooms in and out. The greater the
  * value, the faster it zooms.
  */
 static const float ONE_TOUCH_PINCH_SPEED = 0.005f;
 
 static bool sLongTapEnabled = true;
 
-ScreenPoint GetCurrentFocus(const MultiTouchInput& aEvent) {
+static ScreenPoint GetCurrentFocus(const MultiTouchInput& aEvent) {
   const ScreenPoint& firstTouch = aEvent.mTouches[0].mScreenPoint;
   const ScreenPoint& secondTouch = aEvent.mTouches[1].mScreenPoint;
   return (firstTouch + secondTouch) / 2;
 }
 
-ScreenCoord GetCurrentSpan(const MultiTouchInput& aEvent) {
+static ScreenCoord GetCurrentSpan(const MultiTouchInput& aEvent) {
   const ScreenPoint& firstTouch = aEvent.mTouches[0].mScreenPoint;
   const ScreenPoint& secondTouch = aEvent.mTouches[1].mScreenPoint;
   ScreenPoint delta = secondTouch - firstTouch;
   return delta.Length();
 }
 
 ScreenCoord GestureEventListener::GetYSpanFromGestureStartPoint() {
   // use the position that began the one-touch-pinch gesture rather
   // mTouchStartPosition
   const ScreenPoint start = mOneTouchPinchStartPosition;
   const ScreenPoint& current = mTouches[0].mScreenPoint;
   return current.y - start.y;
 }
 
-TapGestureInput CreateTapEvent(const MultiTouchInput& aTouch,
-                               TapGestureInput::TapGestureType aType) {
+static TapGestureInput CreateTapEvent(const MultiTouchInput& aTouch,
+                                      TapGestureInput::TapGestureType aType) {
   return TapGestureInput(aType, aTouch.mTime, aTouch.mTimeStamp,
                          aTouch.mTouches[0].mScreenPoint, aTouch.modifiers);
 }
 
 GestureEventListener::GestureEventListener(
     AsyncPanZoomController* aAsyncPanZoomController)
     : mAsyncPanZoomController(aAsyncPanZoomController),
       mState(GESTURE_NONE),
--- a/gfx/layers/apz/test/gtest/APZTestCommon.h
+++ b/gfx/layers/apz/test/gtest/APZTestCommon.h
@@ -43,26 +43,27 @@ using ::testing::InSequence;
 using ::testing::MockFunction;
 using ::testing::NiceMock;
 typedef mozilla::layers::GeckoContentController::TapType TapType;
 
 // Some helper functions for constructing input event objects suitable to be
 // passed either to an APZC (which expects an transformed point), or to an APZTM
 // (which expects an untransformed point). We handle both cases by setting both
 // the transformed and untransformed fields to the same value.
-SingleTouchData CreateSingleTouchData(int32_t aIdentifier,
-                                      const ScreenIntPoint& aPoint) {
+inline SingleTouchData CreateSingleTouchData(int32_t aIdentifier,
+                                             const ScreenIntPoint& aPoint) {
   SingleTouchData touch(aIdentifier, aPoint, ScreenSize(0, 0), 0, 0);
   touch.mLocalScreenPoint = ParentLayerPoint(aPoint.x, aPoint.y);
   return touch;
 }
 
 // Convenience wrapper for CreateSingleTouchData() that takes loose coordinates.
-SingleTouchData CreateSingleTouchData(int32_t aIdentifier, ScreenIntCoord aX,
-                                      ScreenIntCoord aY) {
+inline SingleTouchData CreateSingleTouchData(int32_t aIdentifier,
+                                             ScreenIntCoord aX,
+                                             ScreenIntCoord aY) {
   return CreateSingleTouchData(aIdentifier, ScreenIntPoint(aX, aY));
 }
 
 template <class SetArg, class Storage>
 class ScopedGfxSetting {
  public:
   ScopedGfxSetting(SetArg (*aGetPrefFunc)(void), void (*aSetPrefFunc)(SetArg),
                    SetArg aVal)
@@ -800,24 +801,24 @@ void APZCTesterBase::PinchWithTouchInput
 AsyncPanZoomController* TestAPZCTreeManager::NewAPZCInstance(
     LayersId aLayersId, GeckoContentController* aController) {
   MockContentControllerDelayed* mcc =
       static_cast<MockContentControllerDelayed*>(aController);
   return new TestAsyncPanZoomController(
       aLayersId, mcc, this, AsyncPanZoomController::USE_GESTURE_DETECTOR);
 }
 
-FrameMetrics TestFrameMetrics() {
+inline FrameMetrics TestFrameMetrics() {
   FrameMetrics fm;
 
   fm.SetDisplayPort(CSSRect(0, 0, 10, 10));
   fm.SetCompositionBounds(ParentLayerRect(0, 0, 10, 10));
   fm.SetCriticalDisplayPort(CSSRect(0, 0, 10, 10));
   fm.SetScrollableRect(CSSRect(0, 0, 100, 100));
 
   return fm;
 }
 
-uint32_t MillisecondsSinceStartup(TimeStamp aTime) {
+inline uint32_t MillisecondsSinceStartup(TimeStamp aTime) {
   return (aTime - GetStartupTime()).ToMilliseconds();
 }
 
 #endif  // mozilla_layers_APZTestCommon_h
--- a/gfx/layers/apz/test/gtest/InputUtils.h
+++ b/gfx/layers/apz/test/gtest/InputUtils.h
@@ -23,17 +23,17 @@
  * void SetAllowedTouchBehavior(uint64_t aInputBlockId,
  *                              const nsTArray<uint32_t>& aBehaviours);
  * The classes that currently implement these are APZCTreeManager and
  * TestAsyncPanZoomController. Using this template allows us to test individual
  * APZC instances in isolation and also an entire APZ tree, while using the same
  * code to dispatch input events.
  */
 
-PinchGestureInput CreatePinchGestureInput(
+inline PinchGestureInput CreatePinchGestureInput(
     PinchGestureInput::PinchGestureType aType, const ScreenPoint& aFocus,
     float aCurrentSpan, float aPreviousSpan) {
   ParentLayerPoint localFocus(aFocus.x, aFocus.y);
   PinchGestureInput result(aType, 0, TimeStamp(), ExternalPoint(0, 0), aFocus,
                            aCurrentSpan, aPreviousSpan, 0);
   return result;
 }
 
@@ -48,18 +48,18 @@ void SetDefaultAllowedTouchBehavior(cons
         mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN |
         mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN |
         mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM |
         mozilla::layers::AllowedTouchBehavior::DOUBLE_TAP_ZOOM);
   }
   aTarget->SetAllowedTouchBehavior(aInputBlockId, defaultBehaviors);
 }
 
-MultiTouchInput CreateMultiTouchInput(MultiTouchInput::MultiTouchType aType,
-                                      TimeStamp aTime) {
+inline MultiTouchInput CreateMultiTouchInput(
+    MultiTouchInput::MultiTouchType aType, TimeStamp aTime) {
   return MultiTouchInput(aType, MillisecondsSinceStartup(aTime), aTime, 0);
 }
 
 template <class InputReceiver>
 nsEventStatus TouchDown(const RefPtr<InputReceiver>& aTarget,
                         const ScreenIntPoint& aPoint, TimeStamp aTime,
                         uint64_t* aOutInputBlockId = nullptr) {
   MultiTouchInput mti =
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -296,19 +296,19 @@ ContentClient::PaintState ContentClient:
 void ContentClient::EndPaint(
     PaintState& aPaintState,
     nsTArray<ReadbackProcessor::Update>* aReadbackUpdates) {
   if (aPaintState.mAsyncTask) {
     aPaintState.mAsyncTask->mCapture = mBuffer->EndCapture();
   }
 }
 
-nsIntRegion ExpandDrawRegion(ContentClient::PaintState& aPaintState,
-                             RotatedBuffer::DrawIterator* aIter,
-                             BackendType aBackendType) {
+static nsIntRegion ExpandDrawRegion(ContentClient::PaintState& aPaintState,
+                                    RotatedBuffer::DrawIterator* aIter,
+                                    BackendType aBackendType) {
   nsIntRegion* drawPtr = &aPaintState.mRegionToDraw;
   if (aIter) {
     // The iterators draw region currently only contains the bounds of the
     // region, this makes it the precise region.
     aIter->mDrawRegion.And(aIter->mDrawRegion, aPaintState.mRegionToDraw);
     drawPtr = &aIter->mDrawRegion;
   }
   if (aBackendType == BackendType::DIRECT2D ||
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -295,18 +295,19 @@ void TextureChild::Destroy(const Texture
   if (!mCompositableForwarder ||
       !mCompositableForwarder->DestroyInTransaction(this)) {
     this->SendDestroy();
   }
 }
 
 /* static */ Atomic<uint64_t> TextureClient::sSerialCounter(0);
 
-void DeallocateTextureClientSyncProxy(TextureDeallocParams params,
-                                      ReentrantMonitor* aBarrier, bool* aDone) {
+static void DeallocateTextureClientSyncProxy(TextureDeallocParams params,
+                                             ReentrantMonitor* aBarrier,
+                                             bool* aDone) {
   DeallocateTextureClient(params);
   ReentrantMonitorAutoEnter autoMon(*aBarrier);
   *aDone = true;
   aBarrier->NotifyAll();
 }
 
 /// The logic for synchronizing a TextureClient's deallocation goes here.
 ///
@@ -786,18 +787,18 @@ void TextureClient::SetAddedToCompositab
     LockActor();
     if (IsValid() && mActor && !mActor->mDestroyed && mActor->IPCOpen()) {
       mActor->SendRecycleTexture(mFlags);
     }
     UnlockActor();
   }
 }
 
-void CancelTextureClientRecycle(uint64_t aTextureId,
-                                LayersIPCChannel* aAllocator) {
+static void CancelTextureClientRecycle(uint64_t aTextureId,
+                                       LayersIPCChannel* aAllocator) {
   if (!aAllocator) {
     return;
   }
   MessageLoop* msgLoop = nullptr;
   msgLoop = aAllocator->GetMessageLoop();
   if (!msgLoop) {
     return;
   }
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -20,20 +20,21 @@
 #include "mozilla/gfx/Rect.h"                // for IntRect, Rect
 #include "mozilla/layers/APZSampler.h"       // for APZSampler
 #include "mozilla/layers/Compositor.h"       // for Compositor, etc
 #include "mozilla/layers/CompositorTypes.h"  // for DiagnosticFlags::CONTAINER
 #include "mozilla/layers/Effects.h"          // for Effect, EffectChain, etc
 #include "mozilla/layers/TextureHost.h"      // for CompositingRenderTarget
 #include "mozilla/layers/AsyncCompositionManager.h"  // for ViewTransform
 #include "mozilla/layers/LayerMetricsWrapper.h"      // for LayerMetricsWrapper
-#include "mozilla/mozalloc.h"                        // for operator delete, etc
-#include "mozilla/RefPtr.h"                          // for nsRefPtr
-#include "nsDebug.h"                                 // for NS_ASSERTION
-#include "nsISupportsImpl.h"                         // for MOZ_COUNT_CTOR, etc
+#include "mozilla/layers/LayersHelpers.h"
+#include "mozilla/mozalloc.h"  // for operator delete, etc
+#include "mozilla/RefPtr.h"    // for nsRefPtr
+#include "nsDebug.h"           // for NS_ASSERTION
+#include "nsISupportsImpl.h"   // for MOZ_COUNT_CTOR, etc
 #include "nsISupportsUtils.h"  // for NS_ADDREF, NS_RELEASE
 #include "nsRegion.h"          // for nsIntRegion
 #include "nsTArray.h"          // for AutoTArray
 #include <stack>
 #include "TextRenderer.h"  // for TextRenderer
 #include <vector>
 #include "GeckoProfiler.h"  // for GeckoProfiler
 
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -226,17 +226,17 @@ void LayerManagerComposite::PostProcessL
           PixelCastJustification::RenderTargetIsParentLayerForRoot),
       Nothing());
 }
 
 // We want to skip directly through ContainerLayers that don't have an
 // intermediate surface. We compute occlusions for leaves and intermediate
 // surfaces against the layer that they actually composite into so that we can
 // use the final (snapped) effective transform.
-bool ShouldProcessLayer(Layer* aLayer) {
+static bool ShouldProcessLayer(Layer* aLayer) {
   if (!aLayer->AsContainerLayer()) {
     return true;
   }
 
   return aLayer->AsContainerLayer()->UseIntermediateSurface();
 }
 
 void LayerManagerComposite::PostProcessLayers(
@@ -1401,18 +1401,18 @@ static void AddTransformedRegion(LayerIn
     aDest.Or(aDest, TransformRect(iter.Get(), aTransform));
   }
   aDest.SimplifyOutward(20);
 }
 
 // Async animations can move child layers without updating our visible region.
 // PostProcessLayers will recompute visible regions for layers with an
 // intermediate surface, but otherwise we need to do it now.
-void ComputeVisibleRegionForChildren(ContainerLayer* aContainer,
-                                     LayerIntRegion& aResult) {
+static void ComputeVisibleRegionForChildren(ContainerLayer* aContainer,
+                                            LayerIntRegion& aResult) {
   for (Layer* l = aContainer->GetFirstChild(); l; l = l->GetNextSibling()) {
     if (l->Extend3DContext()) {
       MOZ_ASSERT(l->AsContainerLayer());
       ComputeVisibleRegionForChildren(l->AsContainerLayer(), aResult);
     } else {
       AddTransformedRegion(aResult, l->GetLocalVisibleRegion(),
                            l->ComputeTransformToPreserve3DRoot());
     }
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -148,20 +148,20 @@ bool TiledContentHost::UseTiledLayerBuff
   } else {
     if (!mTiledBuffer.UseTiles(aTiledDescriptor, lm, aAllocator)) {
       return false;
     }
   }
   return true;
 }
 
-void UseTileTexture(CompositableTextureHostRef& aTexture,
-                    CompositableTextureSourceRef& aTextureSource,
-                    const IntRect& aUpdateRect,
-                    TextureSourceProvider* aProvider) {
+static void UseTileTexture(CompositableTextureHostRef& aTexture,
+                           CompositableTextureSourceRef& aTextureSource,
+                           const IntRect& aUpdateRect,
+                           TextureSourceProvider* aProvider) {
   MOZ_ASSERT(aTexture);
   if (!aTexture) {
     return;
   }
 
   if (aProvider) {
     aTexture->SetTextureSourceProvider(aProvider);
   }
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -1819,17 +1819,17 @@ RefPtr<WebRenderBridgeParent> Compositor
     const {
   return mWrBridge;
 }
 
 Maybe<TimeStamp> CompositorBridgeParent::GetTestingTimeStamp() const {
   return mTestTime;
 }
 
-void EraseLayerState(LayersId aId) {
+static void EraseLayerState(LayersId aId) {
   RefPtr<APZUpdater> apz;
 
   {  // scope lock
     MonitorAutoLock lock(*sIndirectLayerTreesLock);
     auto iter = sIndirectLayerTrees.find(aId);
     if (iter != sIndirectLayerTrees.end()) {
       CompositorBridgeParent* parent = iter->second.mParent;
       if (parent) {
@@ -2131,18 +2131,18 @@ void CompositorBridgeParent::InvalidateR
       [](LayerTreeState* lts, const LayersId& aLayersId) -> void {
         if (lts->mCrossProcessParent) {
           CrossProcessCompositorBridgeParent* cpcp = lts->mCrossProcessParent;
           Unused << cpcp->SendInvalidateLayers(aLayersId);
         }
       });
 }
 
-void UpdateIndirectTree(LayersId aId, Layer* aRoot,
-                        const TargetConfig& aTargetConfig) {
+static void UpdateIndirectTree(LayersId aId, Layer* aRoot,
+                               const TargetConfig& aTargetConfig) {
   MonitorAutoLock lock(*sIndirectLayerTreesLock);
   sIndirectLayerTrees[aId].mRoot = aRoot;
   sIndirectLayerTrees[aId].mTargetConfig = aTargetConfig;
 }
 
 /* static */ CompositorBridgeParent::LayerTreeState*
 CompositorBridgeParent::GetIndirectShadowTree(LayersId aId) {
   // Only the compositor thread should use this method variant
--- a/gfx/layers/opengl/OGLShaderProgram.cpp
+++ b/gfx/layers/opengl/OGLShaderProgram.cpp
@@ -21,17 +21,17 @@
 namespace mozilla {
 namespace layers {
 
 using namespace std;
 
 #define GAUSSIAN_KERNEL_HALF_WIDTH 11
 #define GAUSSIAN_KERNEL_STEP 0.2
 
-void AddUniforms(ProgramProfileOGL &aProfile) {
+static void AddUniforms(ProgramProfileOGL &aProfile) {
   // This needs to be kept in sync with the KnownUniformName enum
   static const char *sKnownUniformNames[] = {"uLayerTransform",
                                              "uLayerTransformInverse",
                                              "uMaskTransform",
                                              "uBackdropTransform",
                                              "uLayerRects",
                                              "uMatrixProj",
                                              "uTextureTransform",
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -246,17 +246,17 @@ static bool IsContainerLayerItem(nsDispl
       return true;
     }
     default: { return false; }
   }
 }
 
 #include <sstream>
 
-bool DetectContainerLayerPropertiesBoundsChange(
+static bool DetectContainerLayerPropertiesBoundsChange(
     nsDisplayItem* aItem, BlobItemData* aData,
     nsDisplayItemGeometry& aGeometry) {
   switch (aItem->GetType()) {
     case DisplayItemType::TYPE_MASK:
     case DisplayItemType::TYPE_FILTER: {
       // These two items go through BasicLayerManager composition which clips to
       // the BuildingRect
       aGeometry.mBounds = aGeometry.mBounds.Intersect(aItem->GetBuildingRect());
--- a/gfx/tests/gtest/TestArena.cpp
+++ b/gfx/tests/gtest/TestArena.cpp
@@ -59,17 +59,17 @@ class B : public Base {
 
 struct BigStruct {
   uint64_t mVal;
   uint8_t data[120];
 
   explicit BigStruct(uint64_t val) : mVal(val) {}
 };
 
-void TestArenaAlloc(IterableArena::ArenaType aType) {
+static void TestArenaAlloc(IterableArena::ArenaType aType) {
   sDtorItemA = 0;
   sDtorItemB = 0;
   IterableArena arena(aType, 256);
 
   // An empty arena has no items to iterate over.
   {
     int iterations = 0;
     arena.ForEach([&](void* item) { iterations++; });
@@ -128,17 +128,18 @@ void TestArenaAlloc(IterableArena::Arena
   // An empty arena has no items to iterate over (we just cleared it).
   {
     int iterations = 0;
     arena.ForEach([&](void* item) { iterations++; });
     ASSERT_EQ(iterations, 0);
   }
 }
 
-void TestArenaLimit(IterableArena::ArenaType aType, bool aShouldReachLimit) {
+static void TestArenaLimit(IterableArena::ArenaType aType,
+                           bool aShouldReachLimit) {
   IterableArena arena(aType, 128);
 
   // A non-growable arena should return a negative offset when running out
   // of space, without crashing.
   // We should not run out of space with a growable arena (unless the os is
   // running out of memory but this isn't expected for this test).
   bool reachedLimit = false;
   for (int i = 0; i < 100; ++i) {
--- a/gfx/tests/gtest/TestJobScheduler.cpp
+++ b/gfx/tests/gtest/TestJobScheduler.cpp
@@ -19,17 +19,17 @@
 namespace test_scheduler {
 
 using namespace mozilla::gfx;
 using namespace mozilla;
 using mozilla::gfx::SyncObject;
 
 // Artificially cause threads to yield randomly in an attempt to make racy
 // things more apparent (if any).
-void MaybeYieldThread() {
+static void MaybeYieldThread() {
 #ifndef WIN32
   if (rand() % 5 == 0) {
     sched_yield();
   }
 #endif
 }
 
 /// Used by the TestCommand to check that tasks are processed in the right
@@ -107,17 +107,17 @@ class TestJob : public Job {
 /// so that all tasks will join after command 5 before a task buffer runs
 /// a special task (task 0) after which all task buffers fork again.
 /// This simulates the kind of scenario where all tiles must join at
 /// a certain point to execute, say, a filter, and fork again after the filter
 /// has been processed.
 /// The main thread is only blocked when waiting for the completion of the
 /// entire task stream (it doesn't have to wait at the filter's sync points to
 /// orchestrate it).
-void TestSchedulerJoin(uint32_t aNumThreads, uint32_t aNumCmdBuffers) {
+static void TestSchedulerJoin(uint32_t aNumThreads, uint32_t aNumCmdBuffers) {
   JoinTestSanityCheck check(aNumCmdBuffers);
 
   RefPtr<SyncObject> beforeFilter = new SyncObject(aNumCmdBuffers);
   RefPtr<SyncObject> afterFilter = new SyncObject();
   RefPtr<SyncObject> completion = new SyncObject(aNumCmdBuffers);
 
   for (uint32_t i = 0; i < aNumCmdBuffers; ++i) {
     Job* t1 = new TestJob(1, i, &check, nullptr, beforeFilter);
@@ -145,17 +145,17 @@ void TestSchedulerJoin(uint32_t aNumThre
     EXPECT_TRUE(advancement == 2);
   }
 }
 
 /// This test creates several chains of 10 task, tasks of a given chain are
 /// executed sequentially, and chains are exectuted in parallel. This simulates
 /// the typical scenario where we want to process sequences of drawing commands
 /// for several tiles in parallel.
-void TestSchedulerChain(uint32_t aNumThreads, uint32_t aNumCmdBuffers) {
+static void TestSchedulerChain(uint32_t aNumThreads, uint32_t aNumCmdBuffers) {
   SanityChecker check(aNumCmdBuffers);
 
   RefPtr<SyncObject> completion = new SyncObject(aNumCmdBuffers);
 
   uint32_t numJobs = 10;
 
   for (uint32_t i = 0; i < aNumCmdBuffers; ++i) {
     std::vector<RefPtr<SyncObject>> syncs;
--- a/gfx/tests/gtest/TestPolygon.cpp
+++ b/gfx/tests/gtest/TestPolygon.cpp
@@ -39,18 +39,18 @@ TEST(MozPolygon, TriangulatePentagon) {
   const nsTArray<Triangle> expected = {
       Triangle(Point(0.0f, 0.0f), Point(0.0f, 1.0f), Point(0.5f, 1.5f)),
       Triangle(Point(0.0f, 0.0f), Point(0.5f, 1.5f), Point(1.0f, 1.0f)),
       Triangle(Point(0.0f, 0.0f), Point(1.0f, 1.0f), Point(1.0f, 0.0f))};
 
   AssertArrayEQ(triangles, expected);
 }
 
-void TestClipRect(const MozPolygon& aPolygon, const MozPolygon& aExpected,
-                  const Rect& aRect) {
+static void TestClipRect(const MozPolygon& aPolygon,
+                         const MozPolygon& aExpected, const Rect& aRect) {
   const MozPolygon res = aPolygon.ClipPolygon(MozPolygon::FromRect(aRect));
   EXPECT_TRUE(res == aExpected);
 }
 
 TEST(MozPolygon, ClipRectangle) {
   MozPolygon polygon{
       Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(0.0f, 1.0f, 0.0f, 1.0f),
       Point4D(1.0f, 1.0f, 0.0f, 1.0f), Point4D(1.0f, 0.0f, 0.0f, 1.0f)};
--- a/gfx/tests/gtest/TestRegion.cpp
+++ b/gfx/tests/gtest/TestRegion.cpp
@@ -1186,17 +1186,18 @@ struct RegionBitmap {
     }
   }
 
   unsigned char *bitmap;
   int width;
   int height;
 };
 
-void VisitEdge(void *closure, VisitSide side, int x1, int y1, int x2, int y2) {
+static void VisitEdge(void *closure, VisitSide side, int x1, int y1,
+                      int x2, int y2) {
   EXPECT_GE(x2, x1);
   RegionBitmap *visitor = static_cast<RegionBitmap *>(closure);
   unsigned char *bitmap = visitor->bitmap;
   const int width = visitor->width;
 
   if (side == VisitSide::TOP) {
     while (x1 != x2) {
       bitmap[x1 + (y1 - 1) * width] = DILATE_VALUE;
@@ -1215,17 +1216,17 @@ void VisitEdge(void *closure, VisitSide 
   } else if (side == VisitSide::RIGHT) {
     while (y1 != y2) {
       bitmap[x1 + y1 * width] = DILATE_VALUE;
       y1++;
     }
   }
 }
 
-void TestVisit(nsRegion &r) {
+static void TestVisit(nsRegion &r) {
   auto reference = mozilla::MakeUnique<unsigned char[]>(600 * 600);
   auto result = mozilla::MakeUnique<unsigned char[]>(600 * 600);
   RegionBitmap ref(reference.get(), 600, 600);
   RegionBitmap res(result.get(), 600, 600);
 
   ref.set(r);
   ref.dilate();
 
--- a/gfx/tests/gtest/TestTextureCompatibility.cpp
+++ b/gfx/tests/gtest/TestTextureCompatibility.cpp
@@ -62,34 +62,34 @@ static void GetPlatformBackends(nsTArray
   if (aBackends.IsEmpty()) {
     aBackends.AppendElement(LayersBackend::LAYERS_BASIC);
   }
 }
 
 /**
  * This function will return a BasicCompositor to caller.
  */
-already_AddRefed<Compositor> CreateBasicCompositor() {
+static already_AddRefed<Compositor> CreateBasicCompositor() {
   RefPtr<Compositor> compositor;
   // Init the platform.
   if (gfxPlatform::GetPlatform()) {
     RefPtr<MockWidget> widget = new MockWidget(256, 256);
     CompositorOptions options;
     RefPtr<CompositorWidget> proxy =
         new InProcessCompositorWidget(options, widget);
     compositor = new BasicCompositor(nullptr, proxy);
   }
   return compositor.forget();
 }
 
 /**
  * This function checks if the textures react correctly when setting them to
  * BasicCompositor.
  */
-void CheckCompatibilityWithBasicCompositor(
+static void CheckCompatibilityWithBasicCompositor(
     LayersBackend aBackends, nsTArray<RefPtr<TextureHost>>& aTextures) {
   RefPtr<Compositor> compositor = CreateBasicCompositor();
   for (uint32_t i = 0; i < aTextures.Length(); i++) {
     if (!aTextures[i]) {
       continue;
     }
     aTextures[i]->SetTextureSourceProvider(compositor);
 
--- a/gfx/tests/gtest/TestTextures.cpp
+++ b/gfx/tests/gtest/TestTextures.cpp
@@ -36,17 +36,17 @@ using namespace mozilla::layers;
  * This test is run for different combinations of texture types and
  * image formats.
  */
 
 namespace mozilla {
 namespace layers {
 
 // fills the surface with values betwee 0 and 100.
-void SetupSurface(gfxImageSurface* surface) {
+static void SetupSurface(gfxImageSurface* surface) {
   int bpp = gfxASurface::BytePerPixelFromFormat(surface->Format());
   int stride = surface->Stride();
   uint8_t val = 0;
   uint8_t* data = surface->Data();
   for (int y = 0; y < surface->Height(); ++y) {
     for (int x = 0; x < surface->Height(); ++x) {
       for (int b = 0; b < bpp; ++b) {
         data[y * stride + x * bpp + b] = val;
@@ -56,17 +56,18 @@ void SetupSurface(gfxImageSurface* surfa
           ++val;
         }
       }
     }
   }
 }
 
 // return true if two surfaces contain the same data
-void AssertSurfacesEqual(gfxImageSurface* surface1, gfxImageSurface* surface2) {
+static void AssertSurfacesEqual(gfxImageSurface* surface1,
+                                gfxImageSurface* surface2) {
   ASSERT_EQ(surface1->GetSize(), surface2->GetSize());
   ASSERT_EQ(surface1->Format(), surface2->Format());
 
   uint8_t* data1 = surface1->Data();
   uint8_t* data2 = surface2->Data();
   int stride1 = surface1->Stride();
   int stride2 = surface2->Stride();
   int bpp = gfxASurface::BytePerPixelFromFormat(surface1->Format());
@@ -76,17 +77,18 @@ void AssertSurfacesEqual(gfxImageSurface
       for (int b = 0; b < bpp; ++b) {
         ASSERT_EQ(data1[y * stride1 + x * bpp + b],
                   data2[y * stride2 + x * bpp + b]);
       }
     }
   }
 }
 
-void AssertSurfacesEqual(SourceSurface* surface1, SourceSurface* surface2) {
+static void AssertSurfacesEqual(SourceSurface* surface1,
+                                SourceSurface* surface2) {
   ASSERT_EQ(surface1->GetSize(), surface2->GetSize());
   ASSERT_EQ(surface1->GetFormat(), surface2->GetFormat());
 
   RefPtr<DataSourceSurface> dataSurface1 = surface1->GetDataSurface();
   RefPtr<DataSourceSurface> dataSurface2 = surface2->GetDataSurface();
   DataSourceSurface::MappedSurface map1;
   DataSourceSurface::MappedSurface map2;
   if (!dataSurface1->Map(DataSourceSurface::READ, &map1)) {
--- a/gfx/tests/gtest/gfxSurfaceRefCountTest.cpp
+++ b/gfx/tests/gtest/gfxSurfaceRefCountTest.cpp
@@ -8,43 +8,43 @@
 
 #include "gtest/gtest.h"
 
 #include "gfxASurface.h"
 #include "gfxImageSurface.h"
 
 #include "cairo.h"
 
-int GetASurfaceRefCount(gfxASurface *s) {
+static int GetASurfaceRefCount(gfxASurface *s) {
   NS_ADDREF(s);
   return s->Release();
 }
 
-int CheckInt(int value, int expected) {
+static int CheckInt(int value, int expected) {
   if (value != expected) {
     fprintf(stderr, "Expected %d got %d\n", expected, value);
     return 1;
   }
 
   return 0;
 }
 
-int CheckPointer(void *value, void *expected) {
+static int CheckPointer(void *value, void *expected) {
   if (value != expected) {
     fprintf(stderr, "Expected %p got %p\n", expected, value);
     return 1;
   }
 
   return 0;
 }
 
 static cairo_user_data_key_t destruction_key;
-void SurfaceDestroyNotifier(void *data) { *(int *)data = 1; }
+static void SurfaceDestroyNotifier(void *data) { *(int *)data = 1; }
 
-int TestNewSurface() {
+static int TestNewSurface() {
   int failures = 0;
   int destroyed = 0;
 
   RefPtr<gfxASurface> s = new gfxImageSurface(mozilla::gfx::IntSize(10, 10),
                                               SurfaceFormat::A8R8G8B8_UINT32);
   cairo_surface_t *cs = s->CairoSurface();
 
   cairo_surface_set_user_data(cs, &destruction_key, &destroyed,
@@ -82,17 +82,17 @@ int TestNewSurface() {
 
   s = nullptr;
 
   failures += CheckInt(destroyed, 1);
 
   return failures;
 }
 
-int TestExistingSurface() {
+static int TestExistingSurface() {
   int failures = 0;
   int destroyed = 0;
 
   cairo_surface_t *cs = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 10, 10);
 
   cairo_surface_set_user_data(cs, &destruction_key, &destroyed,
                               SurfaceDestroyNotifier);