Bug 959150 part 6 - Move the opening brace to the next line in methods whose body is in non-generated .h files under parser/html/. r=smaug.

This commit is contained in:
Henri Sivonen 2014-03-05 21:38:50 +02:00
parent 5760dcd5b8
commit c23d5f49fa
12 changed files with 163 additions and 81 deletions

View File

@ -19,7 +19,8 @@ class nsHtml5AtomEntry : public nsStringHashKey
nsHtml5AtomEntry(KeyTypePointer aStr);
nsHtml5AtomEntry(const nsHtml5AtomEntry& aOther);
~nsHtml5AtomEntry();
inline nsHtml5Atom* GetAtom() {
inline nsHtml5Atom* GetAtom()
{
return mAtom;
}
private:
@ -84,12 +85,14 @@ class nsHtml5AtomTable
/**
* Empties the table.
*/
void Clear() {
void Clear()
{
mTable.Clear();
}
#ifdef DEBUG
void SetPermittedLookupThread(nsIThread* aThread) {
void SetPermittedLookupThread(nsIThread* aThread)
{
mPermittedLookupThread = aThread;
}
#endif

View File

@ -29,11 +29,13 @@ public:
NS_DECL_ISUPPORTS_INHERITED
inline void HoldElement(nsIContent* aContent) {
inline void HoldElement(nsIContent* aContent)
{
mOwnedElements.AppendElement(aContent);
}
inline bool HaveNotified(nsIContent* aNode) {
inline bool HaveNotified(nsIContent* aNode)
{
NS_PRECONDITION(aNode, "HaveNotified called with null argument.");
const nsHtml5PendingNotification* start = mPendingNotifications.Elements();
const nsHtml5PendingNotification* end = start + mPendingNotifications.Length();
@ -51,7 +53,8 @@ public:
}
}
void PostPendingAppendNotification(nsIContent* aParent, nsIContent* aChild) {
void PostPendingAppendNotification(nsIContent* aParent, nsIContent* aChild)
{
bool newParent = true;
const nsIContentPtr* first = mElementsSeenInThisAppendBatch.Elements();
const nsIContentPtr* last = first + mElementsSeenInThisAppendBatch.Length() - 1;
@ -76,7 +79,8 @@ public:
#endif
}
void FlushPendingAppendNotifications() {
void FlushPendingAppendNotifications()
{
NS_PRECONDITION(mFlushState == eInDocUpdate, "Notifications flushed outside update");
mFlushState = eNotifying;
const nsHtml5PendingNotification* start = mPendingNotifications.Elements();
@ -99,10 +103,13 @@ public:
nsISupports* aContainer, nsIChannel* aChannel);
// Getters and setters for fields from nsContentSink
nsIDocument* GetDocument() {
nsIDocument* GetDocument()
{
return mDocument;
}
nsNodeInfoManager* GetNodeInfoManager() {
nsNodeInfoManager* GetNodeInfoManager()
{
return mNodeInfoManager;
}
@ -118,18 +125,21 @@ public:
* Checks if this parser is broken. Returns a non-NS_OK (i.e. non-0)
* value if broken.
*/
inline nsresult IsBroken() {
inline nsresult IsBroken()
{
return mBroken;
}
inline void BeginDocUpdate() {
inline void BeginDocUpdate()
{
NS_PRECONDITION(mFlushState == eInFlush, "Tried to double-open update.");
NS_PRECONDITION(mParser, "Started update without parser.");
mFlushState = eInDocUpdate;
mDocument->BeginUpdate(UPDATE_CONTENT_MODEL);
}
inline void EndDocUpdate() {
inline void EndDocUpdate()
{
NS_PRECONDITION(mFlushState != eNotifying, "mFlushState out of sync");
if (mFlushState == eInDocUpdate) {
FlushPendingAppendNotifications();
@ -147,7 +157,8 @@ public:
void SetDocumentMode(nsHtml5DocumentMode m);
void SetNodeInfoManager(nsNodeInfoManager* aManager) {
void SetNodeInfoManager(nsNodeInfoManager* aManager)
{
mNodeInfoManager = aManager;
}

View File

@ -4,7 +4,8 @@
private:
nsCString mCharset;
inline int32_t read() {
inline int32_t read()
{
return readable->read();
}
public:

View File

@ -237,7 +237,8 @@ class nsHtml5Parser : public nsIParser,
void InitializeDocWriteParserState(nsAHtml5TreeBuilderState* aState, int32_t aLine);
void DropStreamParser() {
void DropStreamParser()
{
if (mStreamParser) {
mStreamParser->DropTimer();
mStreamParser = nullptr;
@ -248,7 +249,8 @@ class nsHtml5Parser : public nsIParser,
void ContinueAfterFailedCharsetSwitch();
nsHtml5StreamParser* GetStreamParser() {
nsHtml5StreamParser* GetStreamParser()
{
return mStreamParser;
}

View File

@ -19,20 +19,24 @@ class nsHtml5PendingNotification {
MOZ_COUNT_CTOR(nsHtml5PendingNotification);
}
~nsHtml5PendingNotification() {
~nsHtml5PendingNotification()
{
MOZ_COUNT_DTOR(nsHtml5PendingNotification);
}
inline void Fire() {
inline void Fire()
{
nsNodeUtils::ContentAppended(mParent, mParent->GetChildAt(mChildCount),
mChildCount);
}
inline bool Contains(nsIContent* aNode) {
inline bool Contains(nsIContent* aNode)
{
return !!(mParent == aNode);
}
inline bool HaveNotifiedIndex(uint32_t index) {
inline bool HaveNotifiedIndex(uint32_t index)
{
return index < mChildCount;
}

View File

@ -23,19 +23,23 @@ class nsHtml5Speculation MOZ_FINAL : public nsAHtml5TreeOpSink
~nsHtml5Speculation();
nsHtml5OwningUTF16Buffer* GetBuffer() {
nsHtml5OwningUTF16Buffer* GetBuffer()
{
return mBuffer;
}
int32_t GetStart() {
int32_t GetStart()
{
return mStart;
}
int32_t GetStartLineNumber() {
int32_t GetStartLineNumber()
{
return mStartLineNumber;
}
nsAHtml5TreeBuilderState* GetSnapshot() {
nsAHtml5TreeBuilderState* GetSnapshot()
{
return mSnapshot;
}

View File

@ -27,7 +27,8 @@ class nsHtml5SpeculativeLoad {
nsHtml5SpeculativeLoad();
~nsHtml5SpeculativeLoad();
inline void InitBase(const nsAString& aUrl) {
inline void InitBase(const nsAString& aUrl)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
mOpCode = eSpeculativeLoadBase;
@ -35,7 +36,8 @@ class nsHtml5SpeculativeLoad {
}
inline void InitImage(const nsAString& aUrl,
const nsAString& aCrossOrigin) {
const nsAString& aCrossOrigin)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
mOpCode = eSpeculativeLoadImage;
@ -47,7 +49,8 @@ class nsHtml5SpeculativeLoad {
const nsAString& aCharset,
const nsAString& aType,
const nsAString& aCrossOrigin,
bool aParserInHead) {
bool aParserInHead)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
mOpCode = aParserInHead ?
@ -59,7 +62,8 @@ class nsHtml5SpeculativeLoad {
}
inline void InitStyle(const nsAString& aUrl, const nsAString& aCharset,
const nsAString& aCrossOrigin) {
const nsAString& aCrossOrigin)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
mOpCode = eSpeculativeLoadStyle;
@ -79,7 +83,8 @@ class nsHtml5SpeculativeLoad {
* manifests seen by the parser thread have to maintain the queue order
* relative to true speculative loads. See bug 541079.
*/
inline void InitManifest(const nsAString& aUrl) {
inline void InitManifest(const nsAString& aUrl)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
mOpCode = eSpeculativeLoadManifest;
@ -97,7 +102,8 @@ class nsHtml5SpeculativeLoad {
* the queue order relative to true speculative loads. See bug 675499.
*/
inline void InitSetDocumentCharset(nsACString& aCharset,
int32_t aCharsetSource) {
int32_t aCharsetSource)
{
NS_PRECONDITION(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
mOpCode = eSpeculativeLoadSetDocumentCharset;

View File

@ -181,7 +181,8 @@ class nsHtml5StreamParser : public nsIStreamListener,
*/
void ContinueAfterFailedCharsetSwitch();
void Terminate() {
void Terminate()
{
mozilla::MutexAutoLock autoLock(mTerminatedMutex);
mTerminated = true;
}
@ -220,12 +221,14 @@ class nsHtml5StreamParser : public nsIStreamListener,
* avoid having a previous in-flight runnable cancel your Interrupt()
* call on the other thread too soon.
*/
void Interrupt() {
void Interrupt()
{
mozilla::MutexAutoLock autoLock(mTerminatedMutex);
mInterrupted = true;
}
void Uninterrupt() {
void Uninterrupt()
{
NS_ASSERTION(IsParserThread(), "Wrong thread!");
mTokenizerMutex.AssertCurrentThreadOwns();
// Not acquiring mTerminatedMutex because mTokenizerMutex is already
@ -252,12 +255,14 @@ class nsHtml5StreamParser : public nsIStreamListener,
uint32_t aCount,
uint32_t *aWriteCount);
bool IsTerminatedOrInterrupted() {
bool IsTerminatedOrInterrupted()
{
mozilla::MutexAutoLock autoLock(mTerminatedMutex);
return mTerminated || mInterrupted;
}
bool IsTerminated() {
bool IsTerminated()
{
mozilla::MutexAutoLock autoLock(mTerminatedMutex);
return mTerminated;
}
@ -265,7 +270,8 @@ class nsHtml5StreamParser : public nsIStreamListener,
/**
* True when there is a Unicode decoder already
*/
inline bool HasDecoder() {
inline bool HasDecoder()
{
return !!mUnicodeDecoder;
}

View File

@ -15,10 +15,12 @@ struct nsHtml5SilentPolicy
static int32_t transition(nsHtml5Highlighter* aHighlighter,
int32_t aState,
bool aReconsume,
int32_t aPos) {
int32_t aPos)
{
return aState;
}
static void completedNamedCharacterReference(nsHtml5Highlighter* aHighlighter) {
static void completedNamedCharacterReference(nsHtml5Highlighter* aHighlighter)
{
}
};
@ -32,10 +34,12 @@ struct nsHtml5ViewSourcePolicy
static int32_t transition(nsHtml5Highlighter* aHighlighter,
int32_t aState,
bool aReconsume,
int32_t aPos) {
int32_t aPos)
{
return aHighlighter->Transition(aState, aReconsume, aPos);
}
static void completedNamedCharacterReference(nsHtml5Highlighter* aHighlighter) {
static void completedNamedCharacterReference(nsHtml5Highlighter* aHighlighter)
{
aHighlighter->CompletedNamedCharacterReference();
}
};

View File

@ -87,11 +87,13 @@
bool HasScript();
void SetOpSink(nsAHtml5TreeOpSink* aOpSink) {
void SetOpSink(nsAHtml5TreeOpSink* aOpSink)
{
mOpSink = aOpSink;
}
void ClearOps() {
void ClearOps()
{
mOpQueue.Clear();
}
@ -115,11 +117,13 @@
void DropHandles();
void SetPreventScriptExecution(bool aPrevent) {
void SetPreventScriptExecution(bool aPrevent)
{
mPreventScriptExecution = aPrevent;
}
bool HasBuilder() {
bool HasBuilder()
{
return mBuilder;
}

View File

@ -144,17 +144,20 @@ class nsHtml5TreeOpExecutor : public nsHtml5DocumentBuilder,
virtual void ContinueInterruptedParsingAsync();
// XXX Does anyone need this?
nsIDocShell* GetDocShell() {
nsIDocShell* GetDocShell()
{
return mDocShell;
}
bool IsScriptExecuting() {
bool IsScriptExecuting()
{
return IsScriptExecutingImpl();
}
// Not from interface
void SetStreamParser(nsHtml5StreamParser* aStreamParser) {
void SetStreamParser(nsHtml5StreamParser* aStreamParser)
{
mStreamParser = aStreamParser;
}
@ -186,20 +189,24 @@ class nsHtml5TreeOpExecutor : public nsHtml5DocumentBuilder,
void ComplainAboutBogusProtocolCharset(nsIDocument* aDoc);
bool IsComplete() {
bool IsComplete()
{
return !mParser;
}
bool HasStarted() {
bool HasStarted()
{
return mStarted;
}
bool IsFlushing() {
bool IsFlushing()
{
return mFlushState >= eInFlush;
}
#ifdef DEBUG
bool IsInFlushLoop() {
bool IsInFlushLoop()
{
return mRunFlushLoopOnStack;
}
#endif
@ -212,18 +219,21 @@ class nsHtml5TreeOpExecutor : public nsHtml5DocumentBuilder,
*/
virtual void MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue);
nsHtml5TreeOpStage* GetStage() {
nsHtml5TreeOpStage* GetStage()
{
return &mStage;
}
void StartReadingFromStage() {
void StartReadingFromStage()
{
mReadingFromStage = true;
}
void StreamEnded();
#ifdef DEBUG
void AssertStageEmpty() {
void AssertStageEmpty()
{
mStage.AssertEmpty();
}
#endif

View File

@ -73,15 +73,18 @@ class nsHtml5TreeOperationStringPair {
nsHtml5TreeOperationStringPair(const nsAString& aPublicId,
const nsAString& aSystemId)
: mPublicId(aPublicId)
, mSystemId(aSystemId) {
, mSystemId(aSystemId)
{
MOZ_COUNT_CTOR(nsHtml5TreeOperationStringPair);
}
~nsHtml5TreeOperationStringPair() {
~nsHtml5TreeOperationStringPair()
{
MOZ_COUNT_DTOR(nsHtml5TreeOperationStringPair);
}
inline void Get(nsAString& aPublicId, nsAString& aSystemId) {
inline void Get(nsAString& aPublicId, nsAString& aSystemId)
{
aPublicId.Assign(mPublicId);
aSystemId.Assign(mSystemId);
}
@ -188,13 +191,15 @@ class nsHtml5TreeOperation {
~nsHtml5TreeOperation();
inline void Init(eHtml5TreeOperation aOpCode) {
inline void Init(eHtml5TreeOperation aOpCode)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
mOpCode = aOpCode;
}
inline void Init(eHtml5TreeOperation aOpCode, nsIContentHandle* aNode) {
inline void Init(eHtml5TreeOperation aOpCode, nsIContentHandle* aNode)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
@ -204,7 +209,8 @@ class nsHtml5TreeOperation {
inline void Init(eHtml5TreeOperation aOpCode,
nsIContentHandle* aNode,
nsIContentHandle* aParent) {
nsIContentHandle* aParent)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
@ -216,7 +222,8 @@ class nsHtml5TreeOperation {
inline void Init(eHtml5TreeOperation aOpCode,
const nsACString& aString,
int32_t aInt32) {
int32_t aInt32)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
@ -236,7 +243,8 @@ class nsHtml5TreeOperation {
inline void Init(eHtml5TreeOperation aOpCode,
const nsACString& aString,
int32_t aInt32,
int32_t aLineNumber) {
int32_t aLineNumber)
{
Init(aOpCode, aString, aInt32);
mTwo.integer = aLineNumber;
}
@ -244,7 +252,8 @@ class nsHtml5TreeOperation {
inline void Init(eHtml5TreeOperation aOpCode,
nsIContentHandle* aNode,
nsIContentHandle* aParent,
nsIContentHandle* aTable) {
nsIContentHandle* aTable)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
@ -256,14 +265,16 @@ class nsHtml5TreeOperation {
mThree.node = static_cast<nsIContent**>(aTable);
}
inline void Init(nsHtml5DocumentMode aMode) {
inline void Init(nsHtml5DocumentMode aMode)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
mOpCode = eTreeOpDocumentMode;
mOne.mode = aMode;
}
inline void InitScript(nsIContentHandle* aNode) {
inline void InitScript(nsIContentHandle* aNode)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
@ -276,7 +287,8 @@ class nsHtml5TreeOperation {
nsIAtom* aName,
nsHtml5HtmlAttributes* aAttributes,
nsIContentHandle* aTarget,
bool aFromNetwork) {
bool aFromNetwork)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aName, "Initialized tree op with null name.");
@ -298,7 +310,8 @@ class nsHtml5TreeOperation {
char16_t* aBuffer,
int32_t aLength,
nsIContentHandle* aStackParent,
nsIContentHandle* aTable) {
nsIContentHandle* aTable)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer.");
@ -312,7 +325,8 @@ class nsHtml5TreeOperation {
inline void Init(eHtml5TreeOperation aOpCode,
char16_t* aBuffer,
int32_t aLength,
nsIContentHandle* aParent) {
nsIContentHandle* aParent)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer.");
@ -324,7 +338,8 @@ class nsHtml5TreeOperation {
inline void Init(eHtml5TreeOperation aOpCode,
char16_t* aBuffer,
int32_t aLength) {
int32_t aLength)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer.");
@ -334,7 +349,8 @@ class nsHtml5TreeOperation {
}
inline void Init(nsIContentHandle* aElement,
nsHtml5HtmlAttributes* aAttributes) {
nsHtml5HtmlAttributes* aAttributes)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aElement, "Initialized tree op with null element.");
@ -345,7 +361,8 @@ class nsHtml5TreeOperation {
inline void Init(nsIAtom* aName,
const nsAString& aPublicId,
const nsAString& aSystemId) {
const nsAString& aSystemId)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
mOpCode = eTreeOpAppendDoctypeToDocument;
@ -356,7 +373,8 @@ class nsHtml5TreeOperation {
inline void Init(nsIContentHandle* aElement,
const char* aMsgId,
nsIAtom* aAtom,
nsIAtom* aOtherAtom) {
nsIAtom* aOtherAtom)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
mOpCode = eTreeOpAddError;
@ -368,18 +386,21 @@ class nsHtml5TreeOperation {
inline void Init(nsIContentHandle* aElement,
const char* aMsgId,
nsIAtom* aAtom) {
nsIAtom* aAtom)
{
Init(aElement, aMsgId, aAtom, nullptr);
}
inline void Init(nsIContentHandle* aElement,
const char* aMsgId) {
const char* aMsgId)
{
Init(aElement, aMsgId, nullptr, nullptr);
}
inline void Init(const char* aMsgId,
bool aError,
int32_t aLineNumber) {
int32_t aLineNumber)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
mOpCode = eTreeOpMaybeComplainAboutCharset;
@ -388,7 +409,8 @@ class nsHtml5TreeOperation {
mThree.integer = aLineNumber;
}
inline void Init(eHtml5TreeOperation aOpCode, const nsAString& aString) {
inline void Init(eHtml5TreeOperation aOpCode, const nsAString& aString)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
@ -399,7 +421,8 @@ class nsHtml5TreeOperation {
inline void Init(eHtml5TreeOperation aOpCode,
nsIContentHandle* aNode,
int32_t aInt) {
int32_t aInt)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
@ -408,7 +431,8 @@ class nsHtml5TreeOperation {
mFour.integer = aInt;
}
inline void InitAddClass(nsIContentHandle* aNode, const char16_t* aClass) {
inline void InitAddClass(nsIContentHandle* aNode, const char16_t* aClass)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
@ -420,7 +444,8 @@ class nsHtml5TreeOperation {
}
inline void InitAddLineNumberId(nsIContentHandle* aNode,
const int32_t aLineNumber) {
const int32_t aLineNumber)
{
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
@ -431,11 +456,13 @@ class nsHtml5TreeOperation {
mFour.integer = aLineNumber;
}
inline bool IsRunScript() {
inline bool IsRunScript()
{
return mOpCode == eTreeOpRunScript;
}
inline void SetSnapshot(nsAHtml5TreeBuilderState* aSnapshot, int32_t aLine) {
inline void SetSnapshot(nsAHtml5TreeBuilderState* aSnapshot, int32_t aLine)
{
NS_ASSERTION(IsRunScript(),
"Setting a snapshot for a tree operation other than eTreeOpRunScript!");
NS_PRECONDITION(aSnapshot, "Initialized tree op with null snapshot.");