Bug 1508818, part 3 - Shrink comments so they don't get poorly reflowed by clang-format. r=froydnj

Clang format does not always reflow comments correctly to get them
within 80 columns.

The major categories of failures I have noticed in xpcom/ are:

- Comments that are lists. I fixed these by manually getting them so
  they'll be within 80 columns after clang-format runs.

- Comments intermixed with lists of things like enums, initializers,
  or even fields in a class. It doesn't seem to associate the comment
  with the item in the list correctly. The worst cases of these happen
  when it changes initializer lists from having commas at the start of
  each item to having them at the end. In the initializer comma cases,
  I fixed them by making the commas at the end, so clang-format won't
  mix things up. For other cases, I often moved the comment for an
  item onto its own line, because it was not possible to have both the
  comment and the item on the same line and stay within 80 columns.

- One odd case is nsEnumeratorUtils.cpp, where the end of line comment
  after a NS_DECL macro confused clang-format and made it stop
  realizing that the NS_DECL thing was a complete statement. I also
  added a blank line to that file before a declaration because I think
  that is better.

Depends on D13183

Differential Revision: https://phabricator.services.mozilla.com/D13184

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2018-11-28 21:06:09 +00:00
parent a22e686056
commit 68a1d4dad7
7 changed files with 46 additions and 29 deletions

View File

@ -64,7 +64,8 @@ struct CycleCollectorResults
bool mForcedGC;
bool mMergedZones;
bool mAnyManual; // true if any slice of the CC was manually triggered, or at shutdown.
// mAnyManual is true if any slice was manually triggered, and at shutdown.
bool mAnyManual;
uint32_t mVisitedRefCounted;
uint32_t mVisitedGCed;
uint32_t mFreedRefCounted;

View File

@ -1159,8 +1159,8 @@ public:
void SelectPointers(CCGraphBuilder& aBuilder);
// RemoveSkippable removes entries from the purple buffer synchronously
// (1) if aAsyncSnowWhiteFreeing is false and nsPurpleBufferEntry::mRefCnt is 0 or
// (2) if the object's nsXPCOMCycleCollectionParticipant::CanSkip() returns true or
// (1) if !aAsyncSnowWhiteFreeing and nsPurpleBufferEntry::mRefCnt is 0 or
// (2) if nsXPCOMCycleCollectionParticipant::CanSkip() for the obj or
// (3) if nsPurpleBufferEntry::mRefCnt->IsPurple() is false.
// (4) If removeChildlessNodes is true, then any nodes in the purple buffer
// that will have no children in the cycle collector graph will also be
@ -1248,7 +1248,8 @@ enum ccPhase
enum ccType
{
SliceCC, /* If a CC is in progress, continue it. Otherwise, start a new one. */
SliceCC, /* If a CC is in progress, continue it.
Otherwise, start a new one. */
ManualCC, /* Explicitly triggered. */
ShutdownCC /* Shutdown CC, used for finding leaks. */
};

View File

@ -2243,18 +2243,18 @@ nsMemoryReporterManager::PendingProcessesState::PendingProcessesState(
nsIFinishReportingCallback* aFinishReporting,
nsISupports* aFinishReportingData,
const nsAString& aDMDDumpIdent)
: mGeneration(aGeneration)
, mAnonymize(aAnonymize)
, mMinimize(aMinimize)
, mChildrenPending()
, mNumProcessesRunning(1) // reporting starts with the parent
, mNumProcessesCompleted(0)
, mConcurrencyLimit(aConcurrencyLimit)
, mHandleReport(aHandleReport)
, mHandleReportData(aHandleReportData)
, mFinishReporting(aFinishReporting)
, mFinishReportingData(aFinishReportingData)
, mDMDDumpIdent(aDMDDumpIdent)
: mGeneration(aGeneration),
mAnonymize(aAnonymize),
mMinimize(aMinimize),
mChildrenPending(),
mNumProcessesRunning(1), // reporting starts with the parent
mNumProcessesCompleted(0),
mConcurrencyLimit(aConcurrencyLimit),
mHandleReport(aHandleReport),
mHandleReportData(aHandleReportData),
mFinishReporting(aFinishReporting),
mFinishReportingData(aFinishReportingData),
mDMDDumpIdent(aDMDDumpIdent)
{
}

View File

@ -351,8 +351,11 @@ public:
protected:
char* mClassName;
double mClassSize; // This is stored as a double because of the way we compute the avg class size for total bloat.
int64_t mTotalLeaked; // Used only for TOTAL entry.
// mClassSize is stored as a double because of the way we compute the avg
// class size for total bloat.
double mClassSize;
// mTotalLeaked is only used for the TOTAL entry.
int64_t mTotalLeaked;
nsTraceRefcntStats mStats;
};

View File

@ -22,8 +22,8 @@ class EmptyEnumeratorImpl
public:
EmptyEnumeratorImpl() {}
// nsISupports interface
NS_DECL_ISUPPORTS_INHERITED // not really inherited, but no mRefCnt
// nsISupports interface. Not really inherited, but no mRefCnt.
NS_DECL_ISUPPORTS_INHERITED
// nsISimpleEnumerator
NS_DECL_NSISIMPLEENUMERATOR
@ -31,6 +31,7 @@ public:
NS_DECL_NSISTRINGENUMERATORBASE
// can't use NS_DECL_NSISTRINGENUMERATOR because they share the
// HasMore() signature
NS_IMETHOD GetNext(nsAString& aResult) override;
static EmptyEnumeratorImpl* GetInstance()

View File

@ -52,12 +52,23 @@ enum class StringDataFlags : uint16_t
// points to char_traits::sEmptyBuffer. Therefore, VOIDED is
// mutually exclusive with REFCOUNTED, OWNED, and INLINE.
TERMINATED = 1 << 0, // IsTerminated returns true
VOIDED = 1 << 1, // IsVoid returns true
REFCOUNTED = 1 << 2, // mData points to a heap-allocated, shareable, refcounted buffer
OWNED = 1 << 3, // mData points to a heap-allocated, raw buffer
INLINE = 1 << 4, // mData points to a writable, inline buffer
LITERAL = 1 << 5 // mData points to a string literal; DataFlags::TERMINATED will also be set
// IsTerminated returns true
TERMINATED = 1 << 0,
// IsVoid returns true
VOIDED = 1 << 1,
// mData points to a heap-allocated, shareable, refcounted buffer
REFCOUNTED = 1 << 2,
// mData points to a heap-allocated, raw buffer
OWNED = 1 << 3,
// mData points to a writable, inline buffer
INLINE = 1 << 4,
// mData points to a string literal; DataFlags::TERMINATED will also be set
LITERAL = 1 << 5
};
// bits for mClassFlags

View File

@ -115,11 +115,11 @@ private:
public:
TimerEventAllocator()
: mPool()
, mFirstFree(nullptr)
: mPool(),
mFirstFree(nullptr),
// Timer thread state may be accessed during GC, so uses of this monitor
// are not preserved when recording/replaying.
, mMonitor("TimerEventAllocator", recordreplay::Behavior::DontPreserve)
mMonitor("TimerEventAllocator", recordreplay::Behavior::DontPreserve)
{
}