Skip to content

Commit

Permalink
Bug 792180 - Replace NS_{UN,}LIKELY with MOZ_{UN,}LIKELY; r=ehsan
Browse files Browse the repository at this point in the history
  • Loading branch information
maligree committed Oct 26, 2012
1 parent a343aa9 commit 8e879ff
Show file tree
Hide file tree
Showing 102 changed files with 533 additions and 451 deletions.
3 changes: 2 additions & 1 deletion accessible/src/atk/AtkSocketAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "InterfaceInitFuncs.h"
#include "nsMai.h"
#include "mozilla/Likely.h"

AtkSocketEmbedType AtkSocketAccessible::g_atk_socket_embed = NULL;
GType AtkSocketAccessible::g_atk_socket_type = G_TYPE_INVALID;
Expand Down Expand Up @@ -105,7 +106,7 @@ void
mai_atk_component_iface_init(AtkComponentIface* aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->ref_accessible_at_point = RefAccessibleAtPoint;
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Accessible-inl.h"
#include "nsMai.h"
#include "Role.h"
#include "mozilla/Likely.h"

#include "nsString.h"

Expand Down Expand Up @@ -116,7 +117,7 @@ void
actionInterfaceInitCB(AtkActionIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->do_action = doActionCB;
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsMai.h"
#include "mozilla/Likely.h"

extern "C" {

Expand Down Expand Up @@ -100,7 +101,7 @@ void
componentInterfaceInitCB(AtkComponentIface* aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if(NS_UNLIKELY(!aIface))
if(MOZ_UNLIKELY(!aIface))
return;

/*
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "AccessibleWrap.h"
#include "DocAccessible.h"
#include "nsMai.h"
#include "mozilla/Likely.h"

static const char* const kDocTypeName = "W3C-doctype";
static const char* const kDocUrlName = "DocURL";
Expand All @@ -26,7 +27,7 @@ void
documentInterfaceInitCB(AtkDocumentIface *aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if(NS_UNLIKELY(!aIface))
if(MOZ_UNLIKELY(!aIface))
return;

/*
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceEditableText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "nsMai.h"

#include "nsString.h"
#include "mozilla/Likely.h"

extern "C" {
static void
Expand Down Expand Up @@ -116,7 +117,7 @@ void
editableTextInterfaceInitCB(AtkEditableTextIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->set_text_contents = setTextContentsCB;
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "InterfaceInitFuncs.h"

#include "nsMaiHyperlink.h"
#include "mozilla/Likely.h"

extern "C" {
static AtkHyperlink*
Expand All @@ -28,7 +29,7 @@ void
hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface)
{
NS_ASSERTION(aIface, "no interface!");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->get_hyperlink = getHyperlinkCB;
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceHypertext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "HyperTextAccessible.h"
#include "nsMai.h"
#include "nsMaiHyperlink.h"
#include "mozilla/Likely.h"

extern "C" {

Expand Down Expand Up @@ -70,7 +71,7 @@ void
hypertextInterfaceInitCB(AtkHypertextIface* aIface)
{
NS_ASSERTION(aIface, "no interface!");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->get_link = getLinkCB;
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "AccessibleWrap.h"
#include "ImageAccessible.h"
#include "mozilla/Likely.h"
#include "nsMai.h"

using namespace mozilla;
Expand Down Expand Up @@ -53,7 +54,7 @@ void
imageInterfaceInitCB(AtkImageIface* aIface)
{
NS_ASSERTION(aIface, "no interface!");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->get_image_position = getImagePositionCB;
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "AccessibleWrap.h"
#include "nsMai.h"
#include "mozilla/Likely.h"

#include <atk/atk.h>

Expand Down Expand Up @@ -96,7 +97,7 @@ void
selectionInterfaceInitCB(AtkSelectionIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->add_selection = addSelectionCB;
Expand Down
4 changes: 3 additions & 1 deletion accessible/src/atk/nsMaiInterfaceTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include "nsArrayUtils.h"

#include "mozilla/Likely.h"

using namespace mozilla::a11y;

extern "C" {
Expand Down Expand Up @@ -293,7 +295,7 @@ void
tableInterfaceInitCB(AtkTableIface* aIface)
{
NS_ASSERTION(aIface, "no interface!");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->ref_at = refAtCB;
Expand Down
4 changes: 3 additions & 1 deletion accessible/src/atk/nsMaiInterfaceText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "nsIPersistentProperties2.h"

#include "mozilla/Likely.h"

using namespace mozilla::a11y;

AtkAttributeSet* ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes);
Expand Down Expand Up @@ -446,7 +448,7 @@ void
textInterfaceInitCB(AtkTextIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->get_text = getTextCB;
Expand Down
3 changes: 2 additions & 1 deletion accessible/src/atk/nsMaiInterfaceValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "InterfaceInitFuncs.h"
#include "mozilla/Likely.h"

#include "AccessibleWrap.h"
#include "nsMai.h"
Expand Down Expand Up @@ -116,7 +117,7 @@ void
valueInterfaceInitCB(AtkValueIface* aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (NS_UNLIKELY(!aIface))
if (MOZ_UNLIKELY(!aIface))
return;

aIface->get_current_value = getCurrentValueCB;
Expand Down
3 changes: 2 additions & 1 deletion content/base/public/nsINode.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define nsINode_h___

#include "mozilla/ErrorResult.h"
#include "mozilla/Likely.h"
#include "nsCOMPtr.h" // for member, local
#include "nsGkAtoms.h" // for nsGkAtoms::baseURIProperty
#include "nsIDOMEventTarget.h" // for base class
Expand Down Expand Up @@ -738,7 +739,7 @@ class nsINode : public nsIDOMEventTarget,
* @return the parent, or null if no parent or the parent is not an nsIContent
*/
nsIContent* GetParent() const {
return NS_LIKELY(GetBoolFlag(ParentIsContent)) ?
return MOZ_LIKELY(GetBoolFlag(ParentIsContent)) ?
reinterpret_cast<nsIContent*>(mParent) : nullptr;
}

Expand Down
3 changes: 2 additions & 1 deletion content/base/src/FragmentOrElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include "mozilla/Util.h"
#include "mozilla/Likely.h"

#include "mozilla/dom/FragmentOrElement.h"

Expand Down Expand Up @@ -1557,7 +1558,7 @@ static const char* kNSURIs[] = {
};

NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
if (NS_UNLIKELY(cb.WantDebugInfo())) {
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
char name[512];
uint32_t nsid = tmp->GetNameSpaceID();
nsAtomCString localName(tmp->NodeInfo()->NameAtom());
Expand Down
3 changes: 2 additions & 1 deletion content/base/src/nsContentList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "nsGkAtoms.h"
#include "mozilla/dom/HTMLCollectionBinding.h"
#include "mozilla/dom/NodeListBinding.h"
#include "mozilla/Likely.h"

// Form related includes
#include "nsIDOMHTMLFormElement.h"
Expand Down Expand Up @@ -48,7 +49,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsBaseContentList)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
if (nsCCUncollectableMarker::sGeneration && tmp->IsBlack() &&
NS_LIKELY(!cb.WantAllTraces())) {
MOZ_LIKELY(!cb.WantAllTraces())) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_OF_NSCOMPTR(mElements)
Expand Down
9 changes: 5 additions & 4 deletions content/base/src/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/* A namespace class for static layout utilities. */

#include "mozilla/Util.h"
#include "mozilla/Likely.h"

#include "jsapi.h"
#include "jsdbgapi.h"
Expand Down Expand Up @@ -5618,7 +5619,7 @@ nsContentUtils::ASCIIToLower(nsAString& aStr)
{
PRUnichar* iter = aStr.BeginWriting();
PRUnichar* end = aStr.EndWriting();
if (NS_UNLIKELY(!iter || !end)) {
if (MOZ_UNLIKELY(!iter || !end)) {
return NS_ERROR_OUT_OF_MEMORY;
}
while (iter != end) {
Expand All @@ -5639,7 +5640,7 @@ nsContentUtils::ASCIIToLower(const nsAString& aSource, nsAString& aDest)
aDest.SetLength(len);
if (aDest.Length() == len) {
PRUnichar* dest = aDest.BeginWriting();
if (NS_UNLIKELY(!dest)) {
if (MOZ_UNLIKELY(!dest)) {
return NS_ERROR_OUT_OF_MEMORY;
}
const PRUnichar* iter = aSource.BeginReading();
Expand All @@ -5662,7 +5663,7 @@ nsContentUtils::ASCIIToUpper(nsAString& aStr)
{
PRUnichar* iter = aStr.BeginWriting();
PRUnichar* end = aStr.EndWriting();
if (NS_UNLIKELY(!iter || !end)) {
if (MOZ_UNLIKELY(!iter || !end)) {
return NS_ERROR_OUT_OF_MEMORY;
}
while (iter != end) {
Expand All @@ -5683,7 +5684,7 @@ nsContentUtils::ASCIIToUpper(const nsAString& aSource, nsAString& aDest)
aDest.SetLength(len);
if (aDest.Length() == len) {
PRUnichar* dest = aDest.BeginWriting();
if (NS_UNLIKELY(!dest)) {
if (MOZ_UNLIKELY(!dest)) {
return NS_ERROR_OUT_OF_MEMORY;
}
const PRUnichar* iter = aSource.BeginReading();
Expand Down
3 changes: 2 additions & 1 deletion content/base/src/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#include "mozilla/Util.h"
#include "mozilla/Likely.h"

#ifdef MOZ_LOGGING
// so we can get logging even in release builds
Expand Down Expand Up @@ -1589,7 +1590,7 @@ static const char* kNSURIs[] = {
};

NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
if (NS_UNLIKELY(cb.WantDebugInfo())) {
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
char name[512];
nsAutoCString loadedAsData;
if (tmp->IsLoadedAsData()) {
Expand Down
3 changes: 2 additions & 1 deletion content/base/src/nsINode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "jsapi.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/CORSMode.h"
#include "mozilla/Likely.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Util.h"
#include "nsAsyncDOMEvent.h"
Expand Down Expand Up @@ -1142,7 +1143,7 @@ nsINode::UnoptimizableCCNode() const
bool
nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
{
if (NS_LIKELY(!cb.WantAllTraces())) {
if (MOZ_LIKELY(!cb.WantAllTraces())) {
nsIDocument *currentDoc = tmp->GetCurrentDoc();
if (currentDoc &&
nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration())) {
Expand Down
3 changes: 2 additions & 1 deletion content/base/src/nsNodeInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

#include "mozilla/Util.h"
#include "mozilla/Likely.h"

#include "nscore.h"
#include "nsNodeInfo.h"
Expand Down Expand Up @@ -164,7 +165,7 @@ static const char* kNSURIs[] = {
};

NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsNodeInfo)
if (NS_UNLIKELY(cb.WantDebugInfo())) {
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
char name[72];
uint32_t nsid = tmp->NamespaceID();
nsAtomCString localName(tmp->NameAtom());
Expand Down
7 changes: 4 additions & 3 deletions content/base/src/nsRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "nsTextFrame.h"
#include "nsFontFaceList.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Likely.h"

using namespace mozilla;

Expand Down Expand Up @@ -395,7 +396,7 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
"mStartOffset is beyond the end of this node");
newStartOffset = static_cast<uint32_t>(mStartOffset) - aInfo->mChangeStart;
newStartNode = aInfo->mDetails->mNextSibling;
if (NS_UNLIKELY(aContent == mRoot)) {
if (MOZ_UNLIKELY(aContent == mRoot)) {
newRoot = IsValidBoundary(newStartNode);
}

Expand Down Expand Up @@ -457,14 +458,14 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
if (removed == mStartParent) {
newStartOffset = static_cast<uint32_t>(mStartOffset) + aInfo->mChangeStart;
newStartNode = aContent;
if (NS_UNLIKELY(removed == mRoot)) {
if (MOZ_UNLIKELY(removed == mRoot)) {
newRoot = IsValidBoundary(newStartNode);
}
}
if (removed == mEndParent) {
newEndOffset = static_cast<uint32_t>(mEndOffset) + aInfo->mChangeStart;
newEndNode = aContent;
if (NS_UNLIKELY(removed == mRoot)) {
if (MOZ_UNLIKELY(removed == mRoot)) {
newRoot = IsValidBoundary(newEndNode);
}
}
Expand Down
Loading

0 comments on commit 8e879ff

Please sign in to comment.