Bug 1514104 - Remove vpx_mem_set_functions support. r=jya
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 14 Dec 2018 09:07:18 +0000
changeset 450597 8160b9f376eefdfba360fb8d1a851c6dcf4bcd93
parent 450596 ed2f754410ed822c5a1e2496a59eb1679346dda5
child 450598 8d89b44a16de1138fee1ca2ed5737611c4de5097
push id35207
push useraciure@mozilla.com
push dateSat, 15 Dec 2018 02:27:37 +0000
treeherdermozilla-central@d8a944c012a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1514104
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 1514104 - Remove vpx_mem_set_functions support. r=jya vpx_mem_set_functions support is only enabled when MOZ_VPX_NO_MEM_REPORTING is not set. It is currently set unconditionally when building with the in-tree libvpx. When building with system libvpx, it is set when the vpx_mem_set_functions can't be found in the system libvpx library. Upstream removed the vpx_mem_set_functions function in version 1.5, and we require at least that version, meaning, in practice, MOZ_VPX_NO_MEM_REPORTING is now always set. We might as well remove the define and the code that's conditional to not being defined. Differential Revision: https://phabricator.services.mozilla.com/D14517
old-configure.in
xpcom/build/XPCOMInit.cpp
--- a/old-configure.in
+++ b/old-configure.in
@@ -2301,23 +2301,16 @@ if test -n "$MOZ_SYSTEM_LIBVPX"; then
     CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
     LIBS="$LIBS $MOZ_LIBVPX_LIBS"
 
     MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
      [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
 
     AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
      [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
-
-    MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
-     [AC_CHECK_FUNC(vpx_mem_set_functions)])
-    if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
-            "$ac_cv_func_vpx_mem_set_functions" = no; then
-        AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
-    fi
 fi
 CFLAGS=$_SAVE_CFLAGS
 LIBS=$_SAVE_LIBS
 
 AC_SUBST(MOZ_SYSTEM_LIBVPX)
 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
 
@@ -2403,19 +2396,16 @@ if test -z "$MOZ_SYSTEM_LIBVPX"; then
 
     if test -n "$VPX_X86_ASM"; then
       AC_DEFINE(VPX_X86_ASM)
     elif test -n "$VPX_ARM_ASM"; then
       AC_DEFINE(VPX_ARM_ASM)
     else
       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
     fi
-
-    dnl native libvpx no longer has vpx_mem_set_functions
-    AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
 fi
 
 dnl ========================================================
 dnl = Handle dependent MEDIA defines
 dnl ========================================================
 
 MOZ_WEBM_ENCODER=1
 AC_DEFINE(MOZ_WEBM_ENCODER)
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -127,25 +127,16 @@ extern nsresult nsStringInputStreamConst
 #include "mozilla/AvailableMemoryTracker.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/CountingAllocatorBase.h"
 #include "mozilla/UniquePtr.h"
 
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 
 #include "ogg/ogg.h"
-#if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
-#if defined(HAVE_STDINT_H)
-// mozilla-config.h defines HAVE_STDINT_H, and then it's defined *again* in
-// vpx_config.h (which we include via vpx_mem.h, below). This redefinition
-// triggers a build warning on MSVC, so we have to #undef it first.
-#undef HAVE_STDINT_H
-#endif
-#include "vpx_mem/vpx_mem.h"
-#endif
 
 #include "GeckoProfiler.h"
 
 #include "jsapi.h"
 #include "js/Initialization.h"
 
 #include "gfxPlatform.h"
 
@@ -388,42 +379,16 @@ class OggReporter final : public nsIMemo
 };
 
 NS_IMPL_ISUPPORTS(OggReporter, nsIMemoryReporter)
 
 /* static */ template <>
 CountingAllocatorBase<OggReporter>::AmountType
     CountingAllocatorBase<OggReporter>::sAmount(0);
 
-#ifdef MOZ_VPX
-class VPXReporter final : public nsIMemoryReporter,
-                          public CountingAllocatorBase<VPXReporter> {
- public:
-  NS_DECL_ISUPPORTS
-
- private:
-  NS_IMETHOD
-  CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                 bool aAnonymize) override {
-    MOZ_COLLECT_REPORT("explicit/media/libvpx", KIND_HEAP, UNITS_BYTES,
-                       MemoryAllocated(),
-                       "Memory allocated through libvpx for WebM media files.");
-
-    return NS_OK;
-  }
-
-  ~VPXReporter() {}
-};
-
-NS_IMPL_ISUPPORTS(VPXReporter, nsIMemoryReporter)
-
-/* static */ template <>
-Atomic<size_t> CountingAllocatorBase<VPXReporter>::sAmount(0);
-#endif /* MOZ_VPX */
-
 #ifdef ENABLE_BIGINT
 class GMPReporter final : public nsIMemoryReporter,
                           public CountingAllocatorBase<GMPReporter> {
  public:
   NS_DECL_ISUPPORTS
 
   static void* Alloc(size_t size) { return CountingMalloc(size); }
 
@@ -640,24 +605,16 @@ NS_InitXPCOM2(nsIServiceManager** aResul
   // this oddness.
   mozilla::SetICUMemoryFunctions();
 
   // Do the same for libogg.
   ogg_set_mem_functions(
       OggReporter::CountingMalloc, OggReporter::CountingCalloc,
       OggReporter::CountingRealloc, OggReporter::CountingFree);
 
-#if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
-  // And for VPX.
-  vpx_mem_set_functions(VPXReporter::CountingMalloc,
-                        VPXReporter::CountingCalloc,
-                        VPXReporter::CountingRealloc, VPXReporter::CountingFree,
-                        memcpy, memset, memmove);
-#endif
-
 #ifdef ENABLE_BIGINT
   // And for libgmp.
   mozilla::SetGMPMemoryFunctions();
 #endif
 
   // Initialize the JS engine.
   const char* jsInitFailureReason = JS_InitWithFailureDiagnostic();
   if (jsInitFailureReason) {
@@ -692,19 +649,16 @@ NS_InitXPCOM2(nsIServiceManager** aResul
                                 NS_XPCOM_STARTUP_OBSERVER_ID);
 #ifdef XP_WIN
   CreateAnonTempFileRemover();
 #endif
 
   // The memory reporter manager is up and running -- register our reporters.
   RegisterStrongMemoryReporter(new ICUReporter());
   RegisterStrongMemoryReporter(new OggReporter());
-#ifdef MOZ_VPX
-  RegisterStrongMemoryReporter(new VPXReporter());
-#endif
 
   mozilla::Telemetry::Init();
 
   mozilla::BackgroundHangMonitor::Startup();
 
   const MessageLoop* const loop = MessageLoop::current();
   sMainHangMonitor = new mozilla::BackgroundHangMonitor(
       loop->thread_name().c_str(), loop->transient_hang_timeout(),