Skip to content

Commit

Permalink
Bug 1746540 - Move --enable-logrefcnt to python configure. r=nika,fir…
Browse files Browse the repository at this point in the history
…efox-build-system-reviewers,mhentges

And simplify the defines it sets.

Differential Revision: https://phabricator.services.mozilla.com/D134099
  • Loading branch information
glandium committed Dec 17, 2021
1 parent 3e80fee commit 8610010
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 44 deletions.
1 change: 0 additions & 1 deletion build/moz.configure/old.configure
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def old_configure_options(*options):
@old_configure_options(
"--cache-file",
"--datadir",
"--enable-logrefcnt",
"--enable-negotiateauth",
"--enable-official-branding",
"--enable-parental-controls",
Expand Down
3 changes: 1 addition & 2 deletions gfx/2d/FilterNodeSoftware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3350,8 +3350,7 @@ FilterNodeLightingSoftware<LightType, LightingType>::FilterNodeLightingSoftware(
const char* aTypeName)
: mLock("FilterNodeLightingSoftware"),
mSurfaceScale(0)
#if defined(MOZILLA_INTERNAL_API) && \
(defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
#if defined(MOZILLA_INTERNAL_API) && defined(NS_BUILD_REFCNT_LOGGING)
,
mTypeName(aTypeName)
#endif
Expand Down
6 changes: 2 additions & 4 deletions gfx/2d/FilterNodeSoftware.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,7 @@ class FilterNodeOpacitySoftware : public FilterNodeSoftware {
template <typename LightType, typename LightingType>
class FilterNodeLightingSoftware : public FilterNodeSoftware {
public:
#if defined(MOZILLA_INTERNAL_API) && \
(defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
#if defined(MOZILLA_INTERNAL_API) && defined(NS_BUILD_REFCNT_LOGGING)
// Helpers for refcounted
const char* typeName() const override { return mTypeName; }
size_t typeSize() const override { return sizeof(*this); }
Expand Down Expand Up @@ -777,8 +776,7 @@ class FilterNodeLightingSoftware : public FilterNodeSoftware {
Float mSurfaceScale;
Size mKernelUnitLength;
DeviceColor mColor;
#if defined(MOZILLA_INTERNAL_API) && \
(defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
#if defined(MOZILLA_INTERNAL_API) && defined(NS_BUILD_REFCNT_LOGGING)
const char* mTypeName;
#endif
};
Expand Down
3 changes: 1 addition & 2 deletions mfbt/RefCounted.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
# include "nsXPCOM.h"
#endif

#if defined(MOZILLA_INTERNAL_API) && \
(defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
#if defined(MOZILLA_INTERNAL_API) && defined(NS_BUILD_REFCNT_LOGGING)
# define MOZ_REFCOUNTED_LEAK_CHECKING
#endif

Expand Down
20 changes: 0 additions & 20 deletions old-configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1609,26 +1609,6 @@ AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)

dnl ========================================================
dnl = Enable runtime logging
dnl ========================================================
AC_DEFINE(MOZ_LOGGING)
AC_DEFINE(FORCE_PR_LOG)

dnl ========================================================
dnl = This will enable logging of addref, release, ctor, dtor.
dnl ========================================================
_ENABLE_LOGREFCNT=42
MOZ_ARG_ENABLE_BOOL(logrefcnt,
[ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
_ENABLE_LOGREFCNT=1,
_ENABLE_LOGREFCNT= )
if test "$_ENABLE_LOGREFCNT" = "1"; then
AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
elif test -z "$_ENABLE_LOGREFCNT"; then
AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
fi

case "${OS_TARGET}" in
Android|WINNT|Darwin)
MOZ_GLUE_IN_PROGRAM=
Expand Down
16 changes: 16 additions & 0 deletions toolkit/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -2746,3 +2746,19 @@ with only_when(toolkit_gtk):

set_config("MOZ_ENABLE_LIBPROXY", True)
set_define("MOZ_ENABLE_LIBPROXY", True)


# Enable runtime logging
# ==============================================================
set_define("MOZ_LOGGING", True)
set_define("FORCE_PR_LOG", True)

# This will enable logging of addref, release, ctor, dtor.
# ==============================================================
option(
"--enable-logrefcnt",
default=moz_debug,
help="{Enable|Disable} logging of refcounts",
)

set_define("NS_BUILD_REFCNT_LOGGING", True, when="--enable-logrefcnt")
13 changes: 0 additions & 13 deletions xpcom/base/nscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,6 @@

#define XPCOM_API(type) NS_EXTERN_C type

#if (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
/* Make refcnt logging part of the build. This doesn't mean that
* actual logging will occur (that requires a separate enable; see
* nsTraceRefcnt and nsISupportsImpl.h for more information). */
# define NS_BUILD_REFCNT_LOGGING
#endif

/* If NO_BUILD_REFCNT_LOGGING is defined then disable refcnt logging
* in the build. This overrides FORCE_BUILD_REFCNT_LOGGING. */
#if defined(NO_BUILD_REFCNT_LOGGING)
# undef NS_BUILD_REFCNT_LOGGING
#endif

/* If a program allocates memory for the lifetime of the app, it doesn't make
* sense to touch memory pages and free that memory at shutdown,
* unless we are running leak stats.
Expand Down
4 changes: 2 additions & 2 deletions xpcom/string/nsTSubstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -1133,15 +1133,15 @@ class nsTSubstring : public mozilla::detail::nsTStringRepr<T> {
nsTSubstring(char_type* aData, size_type aLength, DataFlags aDataFlags,
ClassFlags aClassFlags)
// XXXbz or can I just include nscore.h and use NS_BUILD_REFCNT_LOGGING?
#if defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING)
#if defined(NS_BUILD_REFCNT_LOGGING)
# define XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE
;
#else
# undef XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE
: base_string_type(aData, aLength, aDataFlags, aClassFlags) {
AssertValid();
}
#endif /* DEBUG || FORCE_BUILD_REFCNT_LOGGING */
#endif /* NS_BUILD_REFCNT_LOGGING */

void SetToEmptyBuffer() {
base_string_type::mData = char_traits::sEmptyBuffer;
Expand Down

0 comments on commit 8610010

Please sign in to comment.