Bug 1528881 - Part 1: gfx/thebes: Make some global functions static. r=jrmuizel
authorChris Peterson <cpeterson@mozilla.com>
Sun, 17 Feb 2019 01:18:01 -0800
changeset 461610 0573c6c669be0434b630bb90051298aaa5159ccc
parent 461609 37097e092a93f25cce13409780607a372164d0f0
child 461611 d87672a996677236c209cc6a067a84b9fb92e0e5
push id35626
push usercsabou@mozilla.com
push dateThu, 28 Feb 2019 11:31:08 +0000
treeherdermozilla-central@2ea0c1db7e60 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
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 1: gfx/thebes: Make some global functions static. r=jrmuizel 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/thebes/gfxBlur.cpp:444:6 [-Wmissing-prototypes] no previous prototype for function 'CacheBlur' gfx/thebes/gfxPlatform.cpp:1087:6 [-Wmissing-prototypes] no previous prototype for function 'IsFeatureSupported' gfx/thebes/gfxPlatform.cpp:1355:6 [-Wmissing-prototypes] no previous prototype for function 'SourceBufferDestroy' gfx/thebes/gfxPlatform.cpp:1365:6 [-Wmissing-prototypes] no previous prototype for function 'SourceSurfaceDestroyed' gfx/thebes/gfxPlatform.cpp:2422:6 [-Wmissing-prototypes] no previous prototype for function 'VideoDecodingFailedChangedCallback' gfx/thebes/gfxPlatform.cpp:559:6 [-Wmissing-prototypes] no previous prototype for function 'WebRenderDebugPrefChangeCallback' widget/GfxInfoBase.cpp:82:6 [-Wmissing-prototypes] no previous prototype for function 'InitGfxDriverInfoShutdownObserver' Differential Revision: https://phabricator.services.mozilla.com/D20260
gfx/thebes/gfxBlur.cpp
gfx/thebes/gfxPlatform.cpp
widget/GfxInfoBase.cpp
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -436,20 +436,21 @@ static IntSize ComputeMinSizeForShadowSh
     aOutSlice.bottom = 0;
   }
 
   MOZ_ASSERT(aOutSlice.LeftRight() <= minSize.width);
   MOZ_ASSERT(aOutSlice.TopBottom() <= minSize.height);
   return minSize;
 }
 
-void CacheBlur(DrawTarget* aDT, const IntSize& aMinSize,
-               const IntSize& aBlurRadius, const RectCornerRadii* aCornerRadii,
-               const Color& aShadowColor, const IntMargin& aBlurMargin,
-               SourceSurface* aBoxShadow) {
+static void CacheBlur(DrawTarget* aDT, const IntSize& aMinSize,
+                      const IntSize& aBlurRadius,
+                      const RectCornerRadii* aCornerRadii,
+                      const Color& aShadowColor, const IntMargin& aBlurMargin,
+                      SourceSurface* aBoxShadow) {
   BlurCacheKey key(aMinSize, aBlurRadius, aCornerRadii, aShadowColor,
                    aDT->GetBackendType());
   BlurCacheData* data =
       new BlurCacheData(aBoxShadow, aBlurMargin, std::move(key));
   if (!gBlurCache->RegisterEntry(data)) {
     delete data;
   }
 }
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -551,17 +551,17 @@ void RecordingPrefChanged(const char* aP
     Factory::SetGlobalEventRecorder(gPlatform->mRecorder);
   } else {
     Factory::SetGlobalEventRecorder(nullptr);
   }
 }
 
 #define WR_DEBUG_PREF "gfx.webrender.debug"
 
-void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
+static void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
   int32_t flags = 0;
 #define GFX_WEBRENDER_DEBUG(suffix, bit)                   \
   if (Preferences::GetBool(WR_DEBUG_PREF suffix, false)) { \
     flags |= (bit);                                        \
   }
 
   // TODO: It would be nice to get the bit patterns directly from the rust code.
   GFX_WEBRENDER_DEBUG(".profiler", 1 << 0)
@@ -1079,17 +1079,17 @@ void gfxPlatform::Init() {
   }
 
   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
   if (obs) {
     obs->NotifyObservers(nullptr, "gfx-features-ready", nullptr);
   }
 }
 
-bool IsFeatureSupported(long aFeature) {
+static bool IsFeatureSupported(long aFeature) {
   nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
   nsCString blockId;
   int32_t status;
   if (!NS_SUCCEEDED(gfxInfo->GetFeatureStatus(aFeature, blockId, &status))) {
     return true;
   }
   return status != nsIGfxInfo::FEATURE_STATUS_OK;
 }
@@ -1347,27 +1347,27 @@ cairo_user_data_key_t kSourceSurface;
  * for the cached SourceSurface, and only use it if they match. This
  * can avoid expensive and unnecessary readbacks.
  */
 struct SourceSurfaceUserData {
   RefPtr<SourceSurface> mSrcSurface;
   BackendType mBackendType;
 };
 
-void SourceBufferDestroy(void* srcSurfUD) {
+static void SourceBufferDestroy(void* srcSurfUD) {
   delete static_cast<SourceSurfaceUserData*>(srcSurfUD);
 }
 
 UserDataKey kThebesSurface;
 
 struct DependentSourceSurfaceUserData {
   RefPtr<gfxASurface> mSurface;
 };
 
-void SourceSurfaceDestroyed(void* aData) {
+static void SourceSurfaceDestroyed(void* aData) {
   delete static_cast<DependentSourceSurfaceUserData*>(aData);
 }
 
 void gfxPlatform::ClearSourceSurfaceForSurface(gfxASurface* aSurface) {
   aSurface->SetData(&kSourceSurface, nullptr, nullptr);
 }
 
 /* static */ already_AddRefed<SourceSurface>
@@ -2427,17 +2427,17 @@ gfxImageFormat gfxPlatform::OptimalForma
  * not have any effect until we restart.
  */
 static mozilla::Atomic<bool> sLayersSupportsHardwareVideoDecoding(false);
 static bool sLayersHardwareVideoDecodingFailed = false;
 static bool sBufferRotationCheckPref = true;
 
 static mozilla::Atomic<bool> sLayersAccelerationPrefsInitialized(false);
 
-void VideoDecodingFailedChangedCallback(const char* aPref, void*) {
+static void VideoDecodingFailedChangedCallback(const char* aPref, void*) {
   sLayersHardwareVideoDecodingFailed = Preferences::GetBool(aPref, false);
   gfxPlatform::GetPlatform()->UpdateCanUseHardwareVideoDecoding();
 }
 
 void gfxPlatform::UpdateCanUseHardwareVideoDecoding() {
   if (XRE_IsParentProcess()) {
     gfxVars::SetCanUseHardwareVideoDecoding(CanUseHardwareVideoDecoding());
   }
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -74,17 +74,17 @@ class ShutdownObserver : public nsIObser
     GfxInfoBase::sShutdownOccurred = true;
 
     return NS_OK;
   }
 };
 
 NS_IMPL_ISUPPORTS(ShutdownObserver, nsIObserver)
 
-void InitGfxDriverInfoShutdownObserver() {
+static void InitGfxDriverInfoShutdownObserver() {
   if (GfxInfoBase::sDriverInfoObserverInitialized) return;
 
   GfxInfoBase::sDriverInfoObserverInitialized = true;
 
   nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
   if (!observerService) {
     NS_WARNING("Could not get observer service!");
     return;