mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset f74c9326b89c (bug 976247) because I landed the wrong patch :(
This commit is contained in:
parent
5616d30270
commit
a196505a83
@ -14,9 +14,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/RefCountType.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#if defined(MOZILLA_INTERNAL_API)
|
||||
#include "nsTraceRefcnt.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -56,28 +53,6 @@ namespace detail {
|
||||
static const MozRefCountType DEAD = 0xffffdead;
|
||||
#endif
|
||||
|
||||
// When building code that gets compiled into Gecko, try to use the
|
||||
// trace-refcount leak logging facilities.
|
||||
#if defined(MOZILLA_INTERNAL_API) && (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
|
||||
class RefCountLogger
|
||||
{
|
||||
public:
|
||||
static void logAddRef(const void* aPointer, MozRefCountType aRefCount,
|
||||
const char* aTypeName, uint32_t aInstanceSize)
|
||||
{
|
||||
MOZ_ASSERT(aRefCount != DEAD);
|
||||
NS_LogAddRef(const_cast<void*>(aPointer), aRefCount, aTypeName, aInstanceSize);
|
||||
}
|
||||
|
||||
static void logRelease(const void* aPointer, MozRefCountType aRefCount,
|
||||
const char* aTypeName)
|
||||
{
|
||||
MOZ_ASSERT(aRefCount != DEAD);
|
||||
NS_LogRelease(const_cast<void*>(aPointer), aRefCount, aTypeName);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// This is used WeakPtr.h as well as this file.
|
||||
enum RefCountAtomicity
|
||||
{
|
||||
@ -101,20 +76,11 @@ class RefCounted
|
||||
void AddRef() const {
|
||||
MOZ_ASSERT(int32_t(refCnt) >= 0);
|
||||
++refCnt;
|
||||
#if defined(MOZILLA_INTERNAL_API) && (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
|
||||
detail::RefCountLogger::logAddRef(static_cast<const T*>(this), refCnt,
|
||||
static_cast<const T*>(this)->typeName(), sizeof(T));
|
||||
#endif
|
||||
}
|
||||
|
||||
void Release() const {
|
||||
MOZ_ASSERT(int32_t(refCnt) > 0);
|
||||
--refCnt;
|
||||
#if defined(MOZILLA_INTERNAL_API) && (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
|
||||
detail::RefCountLogger::logRelease(static_cast<const T*>(this), refCnt,
|
||||
static_cast<const T*>(this)->typeName());
|
||||
#endif
|
||||
if (0 == refCnt) {
|
||||
if (0 == --refCnt) {
|
||||
#ifdef DEBUG
|
||||
refCnt = detail::DEAD;
|
||||
#endif
|
||||
|
@ -64,14 +64,11 @@
|
||||
#ifndef mozilla_WeakPtr_h
|
||||
#define mozilla_WeakPtr_h
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/NullPtr.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
template <typename T, class WeakReference> class WeakPtrBase;
|
||||
@ -89,20 +86,6 @@ class WeakReference : public ::mozilla::RefCounted<WeakReference<T> >
|
||||
return ptr;
|
||||
}
|
||||
|
||||
const char* typeName() const {
|
||||
static char nameBuffer[1024];
|
||||
const char* innerType = ptr->typeName();
|
||||
// We could do fancier length checks at runtime, but innerType is
|
||||
// controlled by us so we can ensure that this never causes a buffer
|
||||
// overflow by this assertion.
|
||||
MOZ_ASSERT(strlen(innerType) + sizeof("WeakReference<>") < ArrayLength(nameBuffer),
|
||||
"Exceedingly large type name");
|
||||
sprintf(nameBuffer, "WeakReference<%s>", innerType);
|
||||
// This is usually not OK, but here we are returning a pointer to a static
|
||||
// buffer which will immediately be used by the caller.
|
||||
return nameBuffer;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class WeakPtrBase<T, WeakReference<T> >;
|
||||
friend class SupportsWeakPtrBase<T, WeakReference<T> >;
|
||||
|
@ -124,13 +124,6 @@ struct nsTraceRefcntStats {
|
||||
double mRefsOutstandingSquared;
|
||||
double mObjsOutstandingTotal;
|
||||
double mObjsOutstandingSquared;
|
||||
void dump(FILE* out) {
|
||||
fprintf(out, "mAddRefs: %" PRIu64 ", ", mAddRefs);
|
||||
fprintf(out, "mReleases: %" PRIu64 ", ", mReleases);
|
||||
fprintf(out, "mCreates: %" PRIu64 ", ", mCreates);
|
||||
fprintf(out, "mDestroys: %" PRIu64 ", ", mDestroys);
|
||||
fprintf(out, "\n");
|
||||
}
|
||||
};
|
||||
|
||||
// I hope to turn this on for everybody once we hit it a little less.
|
||||
@ -375,7 +368,6 @@ public:
|
||||
stats->mCreates != 0 ||
|
||||
meanObjs != 0 ||
|
||||
stddevObjs != 0) {
|
||||
stats->dump(out);
|
||||
fprintf(out, "%4d %-40.40s %8d %8" PRIu64 " %8" PRIu64 " %8" PRIu64 " (%8.2f +/- %8.2f) %8" PRIu64 " %8" PRIu64 " (%8.2f +/- %8.2f)\n",
|
||||
i+1, mClassName,
|
||||
(int32_t)mClassSize,
|
||||
|
Loading…
Reference in New Issue
Block a user