mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
Bug 792180 - Replace NS_{UN,}LIKELY with MOZ_{UN,}LIKELY; r=ehsan
This commit is contained in:
parent
046c7a9a82
commit
761b11160f
@ -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;
|
||||
@ -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;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "Accessible-inl.h"
|
||||
#include "nsMai.h"
|
||||
#include "Role.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
@ -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;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsMai.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -100,7 +101,7 @@ void
|
||||
componentInterfaceInitCB(AtkComponentIface* aIface)
|
||||
{
|
||||
NS_ASSERTION(aIface, "Invalid Interface");
|
||||
if(NS_UNLIKELY(!aIface))
|
||||
if(MOZ_UNLIKELY(!aIface))
|
||||
return;
|
||||
|
||||
/*
|
||||
|
@ -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";
|
||||
@ -26,7 +27,7 @@ void
|
||||
documentInterfaceInitCB(AtkDocumentIface *aIface)
|
||||
{
|
||||
NS_ASSERTION(aIface, "Invalid Interface");
|
||||
if(NS_UNLIKELY(!aIface))
|
||||
if(MOZ_UNLIKELY(!aIface))
|
||||
return;
|
||||
|
||||
/*
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsMai.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
extern "C" {
|
||||
static void
|
||||
@ -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;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "InterfaceInitFuncs.h"
|
||||
|
||||
#include "nsMaiHyperlink.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
extern "C" {
|
||||
static AtkHyperlink*
|
||||
@ -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;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "HyperTextAccessible.h"
|
||||
#include "nsMai.h"
|
||||
#include "nsMaiHyperlink.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -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;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "ImageAccessible.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "nsMai.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -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;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "nsMai.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include <atk/atk.h>
|
||||
|
||||
@ -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;
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
extern "C" {
|
||||
@ -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;
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
AtkAttributeSet* ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes);
|
||||
@ -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;
|
||||
|
@ -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"
|
||||
@ -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;
|
||||
|
@ -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
|
||||
@ -738,7 +739,7 @@ public:
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "mozilla/dom/FragmentOrElement.h"
|
||||
|
||||
@ -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());
|
||||
|
@ -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"
|
||||
@ -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)
|
||||
|
@ -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"
|
||||
@ -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) {
|
||||
@ -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();
|
||||
@ -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) {
|
||||
@ -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();
|
||||
|
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
// so we can get logging even in release builds
|
||||
@ -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()) {
|
||||
|
@ -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"
|
||||
@ -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())) {
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsNodeInfo.h"
|
||||
@ -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());
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsTextFrame.h"
|
||||
#include "nsFontFaceList.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "prprf.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMEventTargetHelper)
|
||||
|
||||
@ -21,7 +22,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMEventTargetHelper)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDOMEventTargetHelper)
|
||||
if (NS_UNLIKELY(cb.WantDebugInfo())) {
|
||||
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
|
||||
char name[512];
|
||||
nsAutoString uri;
|
||||
if (tmp->mOwner && tmp->mOwner->GetExtantDocument()) {
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
@ -1037,7 +1038,7 @@ StartElement(Element* aContent, StringBuilder& aBuilder)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NS_LIKELY(attNs == kNameSpaceID_None) ||
|
||||
if (MOZ_LIKELY(attNs == kNameSpaceID_None) ||
|
||||
(attNs == kNameSpaceID_XMLNS &&
|
||||
attName == nsGkAtoms::xmlns)) {
|
||||
aBuilder.Append(" ");
|
||||
@ -2158,7 +2159,7 @@ nsGenericHTMLElement::ParseBackgroundAttribute(int32_t aNamespaceID,
|
||||
|
||||
nsString value(aValue);
|
||||
nsRefPtr<nsStringBuffer> buffer = nsCSSValue::BufferFromString(value);
|
||||
if (NS_UNLIKELY(!buffer)) {
|
||||
if (MOZ_UNLIKELY(!buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "mozilla/StandardInteger.h"
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
@ -1329,7 +1330,7 @@ nsSVGSVGElement::
|
||||
NS_ABORT_IF_FALSE(rv != NS_PROPTABLE_PROP_OVERWRITTEN,
|
||||
"Setting override value when it's already set...?");
|
||||
|
||||
if (NS_UNLIKELY(NS_FAILED(rv))) {
|
||||
if (MOZ_UNLIKELY(NS_FAILED(rv))) {
|
||||
// property-insertion failed (e.g. OOM in property-table code)
|
||||
delete pAROverridePtr;
|
||||
return false;
|
||||
@ -1443,7 +1444,7 @@ nsSVGSVGElement::SetViewBoxProperty(const nsSVGViewBoxRect& aViewBox)
|
||||
NS_ABORT_IF_FALSE(rv != NS_PROPTABLE_PROP_OVERWRITTEN,
|
||||
"Setting override value when it's already set...?");
|
||||
|
||||
if (NS_UNLIKELY(NS_FAILED(rv))) {
|
||||
if (MOZ_UNLIKELY(NS_FAILED(rv))) {
|
||||
// property-insertion failed (e.g. OOM in property-table code)
|
||||
delete pViewBoxOverridePtr;
|
||||
return false;
|
||||
|
@ -553,6 +553,7 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
|
||||
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/HTMLCollectionBinding.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -9177,7 +9178,7 @@ nsHTMLDocumentSH::DocumentAllTagsNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (NS_UNLIKELY(!proto)) {
|
||||
if (MOZ_UNLIKELY(!proto)) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@ -9881,7 +9882,7 @@ nsHTMLPluginObjElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
if (!::JS_GetPrototype(cx, obj, &pi_obj)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (NS_UNLIKELY(!pi_obj)) {
|
||||
if (MOZ_UNLIKELY(!pi_obj)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -9913,7 +9914,7 @@ nsHTMLPluginObjElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
if (!::JS_GetPrototype(cx, obj, &pi_obj)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (NS_UNLIKELY(!pi_obj)) {
|
||||
if (MOZ_UNLIKELY(!pi_obj)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "nsCharSeparatedTokenizer.h" // for Accept-Language parsing
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
// Other Classes
|
||||
#include "nsEventListenerManager.h"
|
||||
@ -1286,7 +1287,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsGlobalWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
|
||||
if (NS_UNLIKELY(cb.WantDebugInfo())) {
|
||||
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
|
||||
char name[512];
|
||||
PR_snprintf(name, sizeof(name), "nsGlobalWindow #%ld", tmp->mWindowID);
|
||||
cb.DescribeRefCountedNode(tmp->mRefCnt.get(), name);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
static const char kSetIntervalStr[] = "setInterval";
|
||||
static const char kSetTimeoutStr[] = "setTimeout";
|
||||
@ -76,7 +77,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSScriptTimeoutHandler)
|
||||
tmp->ReleaseJSObjects();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSScriptTimeoutHandler)
|
||||
if (NS_UNLIKELY(cb.WantDebugInfo())) {
|
||||
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
|
||||
nsAutoCString name("nsJSScriptTimeoutHandler");
|
||||
if (tmp->mExpr) {
|
||||
name.AppendLiteral(" [");
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
static nsresult
|
||||
GetDocumentCharacterSetForURI(const nsAString& aHref, nsACString& aCharset)
|
||||
@ -939,7 +940,7 @@ nsLocation::CallerSubsumes()
|
||||
{
|
||||
// Get the principal associated with the location object.
|
||||
nsCOMPtr<nsIDOMWindow> outer = do_QueryReferent(mOuter);
|
||||
if (NS_UNLIKELY(!outer))
|
||||
if (MOZ_UNLIKELY(!outer))
|
||||
return false;
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(outer);
|
||||
bool subsumes = false;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "xpcpublic.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#ifdef DEBUG
|
||||
|
||||
#include "nspr.h" // PR_fprintf
|
||||
@ -71,7 +72,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSEventListener)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSEventListener)
|
||||
if (NS_UNLIKELY(cb.WantDebugInfo()) && tmp->mEventName) {
|
||||
if (MOZ_UNLIKELY(cb.WantDebugInfo()) && tmp->mEventName) {
|
||||
nsAutoCString name;
|
||||
name.AppendLiteral("nsJSEventListener handlerName=");
|
||||
name.Append(
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
@ -3678,7 +3679,7 @@ WorkerPrivate::SetTimeout(JSContext* aCx, unsigned aArgc, jsval* aVp,
|
||||
newInfo->mIsInterval = aIsInterval;
|
||||
newInfo->mId = timerId;
|
||||
|
||||
if (NS_UNLIKELY(timerId == UINT32_MAX)) {
|
||||
if (MOZ_UNLIKELY(timerId == UINT32_MAX)) {
|
||||
NS_WARNING("Timeout ids overflowed!");
|
||||
mNextTimeoutId = 1;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "nsITransactionManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
static int32_t sConstructorCount = 0;
|
||||
static int32_t sDestructorCount = 0;
|
||||
@ -4446,7 +4447,7 @@ stress_test(TestTransactionFactory *factory, int32_t iterations)
|
||||
}
|
||||
|
||||
// Trivial feedback not to let the user think the test is stuck.
|
||||
if (NS_UNLIKELY(j % 100 == 0))
|
||||
if (MOZ_UNLIKELY(j % 100 == 0))
|
||||
printf("%i ", j);
|
||||
} // for, iterations.
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
#include "prnetdb.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@ -275,7 +276,7 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne
|
||||
|
||||
// allocate a buffer sizeof("Negotiate" + " " + b64output_token + "\0")
|
||||
*creds = (char *) nsMemory::Alloc(kNegotiateLen + 1 + strlen(encoded_token) + 1);
|
||||
if (NS_UNLIKELY(!*creds))
|
||||
if (MOZ_UNLIKELY(!*creds))
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
sprintf(*creds, "%s %s", kNegotiate, encoded_token);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsUnicharUtilCIID.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsCRT.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(mozEnglishWordUtils)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(mozEnglishWordUtils)
|
||||
@ -247,7 +248,7 @@ NS_IMETHODIMP mozEnglishWordUtils::FromRootForm(const PRUnichar *aWord, const PR
|
||||
for(uint32_t i = 0; i < icount; ++i) {
|
||||
length = NS_strlen(iwords[i]);
|
||||
tmpPtr[i] = (PRUnichar *) nsMemory::Alloc(sizeof(PRUnichar) * (length + 1));
|
||||
if (NS_UNLIKELY(!tmpPtr[i])) {
|
||||
if (MOZ_UNLIKELY(!tmpPtr[i])) {
|
||||
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, tmpPtr);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "gfxCore.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "mozilla/gfx/BaseRect.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
struct nsIntRect;
|
||||
|
||||
@ -59,7 +60,7 @@ struct NS_GFX nsRect :
|
||||
#else
|
||||
int64_t nx = int64_t(x) - aMargin.left;
|
||||
int64_t w = int64_t(width) + int64_t(aMargin.left) + aMargin.right;
|
||||
if (NS_UNLIKELY(w > nscoord_MAX)) {
|
||||
if (MOZ_UNLIKELY(w > nscoord_MAX)) {
|
||||
NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord width");
|
||||
int64_t xdiff = nx - nscoord_MIN / 2;
|
||||
if (xdiff < 0) {
|
||||
@ -67,12 +68,12 @@ struct NS_GFX nsRect :
|
||||
nx = nscoord_MIN / 2;
|
||||
w += xdiff;
|
||||
}
|
||||
if (NS_UNLIKELY(w > nscoord_MAX)) {
|
||||
if (MOZ_UNLIKELY(w > nscoord_MAX)) {
|
||||
w = nscoord_MAX;
|
||||
}
|
||||
}
|
||||
width = nscoord(w);
|
||||
if (NS_UNLIKELY(nx < nscoord_MIN)) {
|
||||
if (MOZ_UNLIKELY(nx < nscoord_MIN)) {
|
||||
NS_WARNING("Underflowed nscoord_MIN in conversion to nscoord x");
|
||||
nx = nscoord_MIN;
|
||||
}
|
||||
@ -80,7 +81,7 @@ struct NS_GFX nsRect :
|
||||
|
||||
int64_t ny = int64_t(y) - aMargin.top;
|
||||
int64_t h = int64_t(height) + int64_t(aMargin.top) + aMargin.bottom;
|
||||
if (NS_UNLIKELY(h > nscoord_MAX)) {
|
||||
if (MOZ_UNLIKELY(h > nscoord_MAX)) {
|
||||
NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord height");
|
||||
int64_t ydiff = ny - nscoord_MIN / 2;
|
||||
if (ydiff < 0) {
|
||||
@ -88,12 +89,12 @@ struct NS_GFX nsRect :
|
||||
ny = nscoord_MIN / 2;
|
||||
h += ydiff;
|
||||
}
|
||||
if (NS_UNLIKELY(h > nscoord_MAX)) {
|
||||
if (MOZ_UNLIKELY(h > nscoord_MAX)) {
|
||||
h = nscoord_MAX;
|
||||
}
|
||||
}
|
||||
height = nscoord(h);
|
||||
if (NS_UNLIKELY(ny < nscoord_MIN)) {
|
||||
if (MOZ_UNLIKELY(ny < nscoord_MIN)) {
|
||||
NS_WARNING("Underflowed nscoord_MIN in conversion to nscoord y");
|
||||
ny = nscoord_MIN;
|
||||
}
|
||||
@ -124,12 +125,12 @@ struct NS_GFX nsRect :
|
||||
nsRect result;
|
||||
result.x = NS_MIN(aRect.x, x);
|
||||
int64_t w = NS_MAX(int64_t(aRect.x) + aRect.width, int64_t(x) + width) - result.x;
|
||||
if (NS_UNLIKELY(w > nscoord_MAX)) {
|
||||
if (MOZ_UNLIKELY(w > nscoord_MAX)) {
|
||||
NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord width");
|
||||
// Clamp huge negative x to nscoord_MIN / 2 and try again.
|
||||
result.x = NS_MAX(result.x, nscoord_MIN / 2);
|
||||
w = NS_MAX(int64_t(aRect.x) + aRect.width, int64_t(x) + width) - result.x;
|
||||
if (NS_UNLIKELY(w > nscoord_MAX)) {
|
||||
if (MOZ_UNLIKELY(w > nscoord_MAX)) {
|
||||
w = nscoord_MAX;
|
||||
}
|
||||
}
|
||||
@ -137,12 +138,12 @@ struct NS_GFX nsRect :
|
||||
|
||||
result.y = NS_MIN(aRect.y, y);
|
||||
int64_t h = NS_MAX(int64_t(aRect.y) + aRect.height, int64_t(y) + height) - result.y;
|
||||
if (NS_UNLIKELY(h > nscoord_MAX)) {
|
||||
if (MOZ_UNLIKELY(h > nscoord_MAX)) {
|
||||
NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord height");
|
||||
// Clamp huge negative y to nscoord_MIN / 2 and try again.
|
||||
result.y = NS_MAX(result.y, nscoord_MIN / 2);
|
||||
h = NS_MAX(int64_t(aRect.y) + aRect.height, int64_t(y) + height) - result.y;
|
||||
if (NS_UNLIKELY(h > nscoord_MAX)) {
|
||||
if (MOZ_UNLIKELY(h > nscoord_MAX)) {
|
||||
h = nscoord_MAX;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "gfxFT2FontBase.h"
|
||||
#include "gfxFT2Utils.h"
|
||||
#include "harfbuzz/hb.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
@ -110,7 +111,7 @@ gfxFT2FontBase::GetMetrics()
|
||||
if (mHasMetrics)
|
||||
return mMetrics;
|
||||
|
||||
if (NS_UNLIKELY(GetStyle()->size <= 0.0)) {
|
||||
if (MOZ_UNLIKELY(GetStyle()->size <= 0.0)) {
|
||||
new(&mMetrics) gfxFont::Metrics(); // zero initialize
|
||||
mSpaceGlyph = 0;
|
||||
} else {
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "gfxFT2FontBase.h"
|
||||
#include "gfxFT2Utils.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include FT_TRUETYPE_TAGS_H
|
||||
#include FT_TRUETYPE_TABLES_H
|
||||
|
||||
@ -48,7 +49,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
||||
NS_PRECONDITION(aMetrics != NULL, "aMetrics must not be NULL");
|
||||
NS_PRECONDITION(aSpaceGlyph != NULL, "aSpaceGlyph must not be NULL");
|
||||
|
||||
if (NS_UNLIKELY(!mFace)) {
|
||||
if (MOZ_UNLIKELY(!mFace)) {
|
||||
// No face. This unfortunate situation might happen if the font
|
||||
// file is (re)moved at the wrong time.
|
||||
aMetrics->emHeight = mGfxFont->GetStyle()->size;
|
||||
@ -267,7 +268,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
||||
uint32_t
|
||||
gfxFT2LockedFace::GetGlyph(uint32_t aCharCode)
|
||||
{
|
||||
if (NS_UNLIKELY(!mFace))
|
||||
if (MOZ_UNLIKELY(!mFace))
|
||||
return 0;
|
||||
|
||||
#ifdef HAVE_FONTCONFIG_FCFREETYPE_H
|
||||
@ -297,7 +298,7 @@ gfxFT2LockedFace::GetUVSGlyph(uint32_t aCharCode, uint32_t aVariantSelector)
|
||||
{
|
||||
NS_PRECONDITION(aVariantSelector, "aVariantSelector should not be NULL");
|
||||
|
||||
if (NS_UNLIKELY(!mFace))
|
||||
if (MOZ_UNLIKELY(!mFace))
|
||||
return 0;
|
||||
|
||||
// This function is available from FreeType 2.3.6 (June 2008).
|
||||
@ -328,12 +329,12 @@ gfxFT2LockedFace::GetFontTable(uint32_t aTag, FallibleTArray<uint8_t>& aBuffer)
|
||||
if (error != 0)
|
||||
return false;
|
||||
|
||||
if (NS_UNLIKELY(length > static_cast<FallibleTArray<uint8_t>::size_type>(-1))
|
||||
|| NS_UNLIKELY(!aBuffer.SetLength(length)))
|
||||
if (MOZ_UNLIKELY(length > static_cast<FallibleTArray<uint8_t>::size_type>(-1))
|
||||
|| MOZ_UNLIKELY(!aBuffer.SetLength(length)))
|
||||
return false;
|
||||
|
||||
error = FT_Load_Sfnt_Table(mFace, aTag, 0, aBuffer.Elements(), &length);
|
||||
if (NS_UNLIKELY(error != 0)) {
|
||||
if (MOZ_UNLIKELY(error != 0)) {
|
||||
aBuffer.Clear();
|
||||
return false;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "cairo-ft.h"
|
||||
#include "gfxFT2FontBase.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
// Rounding and truncation functions for a FreeType fixed point number
|
||||
// (FT26Dot6) stored in a 32bit integer with high 26 bits for the integer
|
||||
@ -53,7 +54,7 @@ public:
|
||||
// to pixels.
|
||||
gfxFloat XScale()
|
||||
{
|
||||
if (NS_UNLIKELY(!mFace))
|
||||
if (MOZ_UNLIKELY(!mFace))
|
||||
return 0.0;
|
||||
|
||||
const FT_Size_Metrics& ftMetrics = mFace->size->metrics;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nsUnicodeRange.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
@ -424,14 +425,14 @@ hb_blob_t *
|
||||
gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag,
|
||||
FallibleTArray<uint8_t>* aBuffer)
|
||||
{
|
||||
if (NS_UNLIKELY(!mFontTableCache.IsInitialized())) {
|
||||
if (MOZ_UNLIKELY(!mFontTableCache.IsInitialized())) {
|
||||
// we do this here rather than on fontEntry construction
|
||||
// because not all shapers will access the table cache at all
|
||||
mFontTableCache.Init(10);
|
||||
}
|
||||
|
||||
FontTableHashEntry *entry = mFontTableCache.PutEntry(aTag);
|
||||
if (NS_UNLIKELY(!entry)) { // OOM
|
||||
if (MOZ_UNLIKELY(!entry)) { // OOM
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -843,7 +844,7 @@ gfxFontFamily::FindFontForChar(GlobalFontMatch *aMatchData)
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun);
|
||||
|
||||
if (NS_UNLIKELY(log)) {
|
||||
if (MOZ_UNLIKELY(log)) {
|
||||
uint32_t charRange = gfxFontUtils::CharRangeBit(aMatchData->mCh);
|
||||
uint32_t unicodeRange = FindCharUnicodeRange(aMatchData->mCh);
|
||||
uint32_t script = GetScriptCode(aMatchData->mCh);
|
||||
@ -1755,7 +1756,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
||||
|
||||
if (aContext->IsCairo()) {
|
||||
bool success = SetupCairoFont(aContext);
|
||||
if (NS_UNLIKELY(!success))
|
||||
if (MOZ_UNLIKELY(!success))
|
||||
return;
|
||||
|
||||
::GlyphBuffer glyphs;
|
||||
@ -3478,7 +3479,7 @@ gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams, uint32_t aFlags)
|
||||
}
|
||||
|
||||
gfxFont *font = GetFontAt(0);
|
||||
if (NS_UNLIKELY(GetStyle()->size == 0)) {
|
||||
if (MOZ_UNLIKELY(GetStyle()->size == 0)) {
|
||||
// Short-circuit for size-0 fonts, as Windows and ATSUI can't handle
|
||||
// them, and always create at least size 1 fonts, i.e. they still
|
||||
// render something for size 0 fonts.
|
||||
@ -3639,7 +3640,7 @@ gfxFontGroup::InitTextRun(gfxContext *aContext,
|
||||
while (scriptRuns.Next(runStart, runLimit, runScript)) {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (NS_UNLIKELY(log)) {
|
||||
if (MOZ_UNLIKELY(log)) {
|
||||
nsAutoCString lang;
|
||||
mStyle.language->ToUTF8String(lang);
|
||||
uint32_t runLen = runLimit - runStart;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIStreamBufferAccess.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
@ -154,7 +155,7 @@ public:
|
||||
uint32_t blockIndex = aIndex/BLOCK_SIZE_BITS;
|
||||
if (blockIndex >= mBlocks.Length()) {
|
||||
nsAutoPtr<Block> *blocks = mBlocks.AppendElements(blockIndex + 1 - mBlocks.Length());
|
||||
if (NS_UNLIKELY(!blocks)) // OOM
|
||||
if (MOZ_UNLIKELY(!blocks)) // OOM
|
||||
return;
|
||||
}
|
||||
Block *block = mBlocks[blockIndex];
|
||||
@ -179,7 +180,7 @@ public:
|
||||
if (endIndex >= mBlocks.Length()) {
|
||||
uint32_t numNewBlocks = endIndex + 1 - mBlocks.Length();
|
||||
nsAutoPtr<Block> *blocks = mBlocks.AppendElements(numNewBlocks);
|
||||
if (NS_UNLIKELY(!blocks)) // OOM
|
||||
if (MOZ_UNLIKELY(!blocks)) // OOM
|
||||
return;
|
||||
}
|
||||
|
||||
@ -213,7 +214,7 @@ public:
|
||||
uint32_t blockIndex = aIndex/BLOCK_SIZE_BITS;
|
||||
if (blockIndex >= mBlocks.Length()) {
|
||||
nsAutoPtr<Block> *blocks = mBlocks.AppendElements(blockIndex + 1 - mBlocks.Length());
|
||||
if (NS_UNLIKELY(!blocks)) // OOM
|
||||
if (MOZ_UNLIKELY(!blocks)) // OOM
|
||||
return;
|
||||
}
|
||||
Block *block = mBlocks[blockIndex];
|
||||
@ -230,7 +231,7 @@ public:
|
||||
if (endIndex >= mBlocks.Length()) {
|
||||
uint32_t numNewBlocks = endIndex + 1 - mBlocks.Length();
|
||||
nsAutoPtr<Block> *blocks = mBlocks.AppendElements(numNewBlocks);
|
||||
if (NS_UNLIKELY(!blocks)) // OOM
|
||||
if (MOZ_UNLIKELY(!blocks)) // OOM
|
||||
return;
|
||||
}
|
||||
|
||||
@ -281,7 +282,7 @@ public:
|
||||
if (blockCount > mBlocks.Length()) {
|
||||
uint32_t needed = blockCount - mBlocks.Length();
|
||||
nsAutoPtr<Block> *blocks = mBlocks.AppendElements(needed);
|
||||
if (NS_UNLIKELY(!blocks)) { // OOM
|
||||
if (MOZ_UNLIKELY(!blocks)) { // OOM
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,11 @@
|
||||
#include "nsUnicodeRange.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -421,7 +422,7 @@ gfxPlatformFontList::SystemFindFontForChar(const uint32_t aCh,
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun);
|
||||
|
||||
if (NS_UNLIKELY(log)) {
|
||||
if (MOZ_UNLIKELY(log)) {
|
||||
uint32_t charRange = gfxFontUtils::CharRangeBit(aCh);
|
||||
uint32_t unicodeRange = FindCharUnicodeRange(aCh);
|
||||
int32_t script = mozilla::unicode::GetScriptCode(aCh);
|
||||
|
@ -18,6 +18,7 @@ static bool gDisableOptimize = false;
|
||||
|
||||
#include "cairo.h"
|
||||
#include "sampler.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
||||
@ -42,30 +43,30 @@ static bool AllowedImageSize(int32_t aWidth, int32_t aHeight)
|
||||
{
|
||||
// reject over-wide or over-tall images
|
||||
const int32_t k64KLimit = 0x0000FFFF;
|
||||
if (NS_UNLIKELY(aWidth > k64KLimit || aHeight > k64KLimit )) {
|
||||
if (MOZ_UNLIKELY(aWidth > k64KLimit || aHeight > k64KLimit )) {
|
||||
NS_WARNING("image too big");
|
||||
return false;
|
||||
}
|
||||
|
||||
// protect against invalid sizes
|
||||
if (NS_UNLIKELY(aHeight <= 0 || aWidth <= 0)) {
|
||||
if (MOZ_UNLIKELY(aHeight <= 0 || aWidth <= 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check to make sure we don't overflow a 32-bit
|
||||
int32_t tmp = aWidth * aHeight;
|
||||
if (NS_UNLIKELY(tmp / aHeight != aWidth)) {
|
||||
if (MOZ_UNLIKELY(tmp / aHeight != aWidth)) {
|
||||
NS_WARNING("width or height too large");
|
||||
return false;
|
||||
}
|
||||
tmp = tmp * 4;
|
||||
if (NS_UNLIKELY(tmp / 4 != aWidth * aHeight)) {
|
||||
if (MOZ_UNLIKELY(tmp / 4 != aWidth * aHeight)) {
|
||||
NS_WARNING("width or height too large");
|
||||
return false;
|
||||
}
|
||||
#if defined(XP_MACOSX)
|
||||
// CoreGraphics is limited to images < 32K in *height*, so clamp all surfaces on the Mac to that height
|
||||
if (NS_UNLIKELY(aHeight > SHRT_MAX)) {
|
||||
if (MOZ_UNLIKELY(aHeight > SHRT_MAX)) {
|
||||
NS_WARNING("image too big");
|
||||
return false;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "nsIProtocolHandler.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "DiscardTracker.h"
|
||||
#include "nsAsyncRedirectVerifyHelper.h"
|
||||
@ -91,7 +92,7 @@ imgRequest::imgRequest(imgLoader* aLoader)
|
||||
, mResniffMimeType(false)
|
||||
{
|
||||
// Register our pref observers if we haven't yet.
|
||||
if (NS_UNLIKELY(!gInitializedPrefCaches)) {
|
||||
if (MOZ_UNLIKELY(!gInitializedPrefCaches)) {
|
||||
InitPrefCaches();
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsUTF8Utils.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
// We map x -> x, except for upper-case letters,
|
||||
// which we map to their lower-case equivalents.
|
||||
@ -283,7 +284,7 @@ GetLowerUTF8Codepoint(const char* aStr, const char* aEnd, const char **aNext)
|
||||
*aNext = aStr + 1;
|
||||
return gASCIIToLower[*str];
|
||||
}
|
||||
if (UTF8traits::is2byte(str[0]) && NS_LIKELY(aStr + 1 < aEnd)) {
|
||||
if (UTF8traits::is2byte(str[0]) && MOZ_LIKELY(aStr + 1 < aEnd)) {
|
||||
// It's a two-byte sequence, so it looks like
|
||||
// 110XXXXX 10XXXXXX.
|
||||
// This is definitely in the BMP, so we can store straightaway into a
|
||||
@ -300,7 +301,7 @@ GetLowerUTF8Codepoint(const char* aStr, const char* aEnd, const char **aNext)
|
||||
*aNext = aStr + 2;
|
||||
return c;
|
||||
}
|
||||
if (UTF8traits::is3byte(str[0]) && NS_LIKELY(aStr + 2 < aEnd)) {
|
||||
if (UTF8traits::is3byte(str[0]) && MOZ_LIKELY(aStr + 2 < aEnd)) {
|
||||
// It's a three-byte sequence, so it looks like
|
||||
// 1110XXXX 10XXXXXX 10XXXXXX.
|
||||
// This will just barely fit into 16-bits, so store into a uint16_t.
|
||||
@ -315,7 +316,7 @@ GetLowerUTF8Codepoint(const char* aStr, const char* aEnd, const char **aNext)
|
||||
*aNext = aStr + 3;
|
||||
return c;
|
||||
}
|
||||
if (UTF8traits::is4byte(str[0]) && NS_LIKELY(aStr + 3 < aEnd)) {
|
||||
if (UTF8traits::is4byte(str[0]) && MOZ_LIKELY(aStr + 3 < aEnd)) {
|
||||
// It's a four-byte sequence, so it looks like
|
||||
// 11110XXX 10XXXXXX 10XXXXXX 10XXXXXX.
|
||||
|
||||
@ -345,11 +346,11 @@ int32_t CaseInsensitiveCompare(const char *aLeft,
|
||||
|
||||
while (aLeft < leftEnd && aRight < rightEnd) {
|
||||
uint32_t leftChar = GetLowerUTF8Codepoint(aLeft, leftEnd, &aLeft);
|
||||
if (NS_UNLIKELY(leftChar == uint32_t(-1)))
|
||||
if (MOZ_UNLIKELY(leftChar == uint32_t(-1)))
|
||||
return -1;
|
||||
|
||||
uint32_t rightChar = GetLowerUTF8Codepoint(aRight, rightEnd, &aRight);
|
||||
if (NS_UNLIKELY(rightChar == uint32_t(-1)))
|
||||
if (MOZ_UNLIKELY(rightChar == uint32_t(-1)))
|
||||
return -1;
|
||||
|
||||
// Now leftChar and rightChar are lower-case, so we can compare them.
|
||||
@ -383,13 +384,13 @@ CaseInsensitiveUTF8CharsEqual(const char* aLeft, const char* aRight,
|
||||
NS_ASSERTION(aRight < aRightEnd, "aRight must be less than aRightEnd.");
|
||||
|
||||
uint32_t leftChar = GetLowerUTF8Codepoint(aLeft, aLeftEnd, aLeftNext);
|
||||
if (NS_UNLIKELY(leftChar == uint32_t(-1))) {
|
||||
if (MOZ_UNLIKELY(leftChar == uint32_t(-1))) {
|
||||
*aErr = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t rightChar = GetLowerUTF8Codepoint(aRight, aRightEnd, aRightNext);
|
||||
if (NS_UNLIKELY(rightChar == uint32_t(-1))) {
|
||||
if (MOZ_UNLIKELY(rightChar == uint32_t(-1))) {
|
||||
*aErr = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ NS_CYCLE_COLLECTION_CLASSNAME(XPCWrappedNative)::TraverseImpl
|
||||
if (!tmp->IsValid())
|
||||
return NS_OK;
|
||||
|
||||
if (NS_UNLIKELY(cb.WantDebugInfo())) {
|
||||
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
|
||||
char name[72];
|
||||
XPCNativeScriptableInfo* si = tmp->GetScriptableInfo();
|
||||
if (si)
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "xpcprivate.h"
|
||||
@ -136,7 +137,7 @@ nsXPConnect::GetXPConnect()
|
||||
// Do a release-mode assert that we're not doing anything significant in
|
||||
// XPConnect off the main thread. If you're an extension developer hitting
|
||||
// this, you need to change your code. See bug 716167.
|
||||
if (!NS_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
|
||||
if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
|
||||
MOZ_CRASH();
|
||||
|
||||
if (!gSelf) {
|
||||
@ -695,7 +696,7 @@ NoteJSChild(JSTracer *trc, void *thing, JSGCTraceKind kind)
|
||||
* parent pointers iteratively, rather than recursively, to avoid overflow.
|
||||
*/
|
||||
if (AddToCCKind(kind)) {
|
||||
if (NS_UNLIKELY(tracer->cb.WantDebugInfo())) {
|
||||
if (MOZ_UNLIKELY(tracer->cb.WantDebugInfo())) {
|
||||
// based on DumpNotify in jsapi.c
|
||||
if (tracer->debugPrinter) {
|
||||
char buffer[200];
|
||||
@ -1997,7 +1998,7 @@ nsXPConnect::AfterProcessNextEvent(nsIThreadInternal *aThread,
|
||||
uint32_t aRecursionDepth)
|
||||
{
|
||||
// Watch out for unpaired events during observer registration.
|
||||
if (NS_UNLIKELY(mEventDepth == 0))
|
||||
if (MOZ_UNLIKELY(mEventDepth == 0))
|
||||
return NS_OK;
|
||||
mEventDepth--;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsCRT.h"
|
||||
@ -1122,7 +1123,7 @@ nsFrameConstructorState::AddChild(nsIFrame* aNewFrame,
|
||||
nsFrameState placeholderType;
|
||||
nsFrameItems* frameItems = &aFrameItems;
|
||||
#ifdef MOZ_XUL
|
||||
if (NS_UNLIKELY(aIsOutOfFlowPopup)) {
|
||||
if (MOZ_UNLIKELY(aIsOutOfFlowPopup)) {
|
||||
NS_ASSERTION(aNewFrame->GetParent() == mPopupItems.containingBlock,
|
||||
"Popup whose parent is not the popup containing block?");
|
||||
NS_ASSERTION(mPopupItems.containingBlock, "Must have a popup set frame!");
|
||||
@ -1989,7 +1990,7 @@ nsCSSFrameConstructor::ConstructTableRow(nsFrameConstructorState& aState,
|
||||
else
|
||||
newFrame = NS_NewTableRowFrame(mPresShell, styleContext);
|
||||
|
||||
if (NS_UNLIKELY(!newFrame)) {
|
||||
if (MOZ_UNLIKELY(!newFrame)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
InitAndRestoreFrame(aState, content, aParentFrame, nullptr, newFrame);
|
||||
@ -2024,7 +2025,7 @@ nsCSSFrameConstructor::ConstructTableCol(nsFrameConstructorState& aState,
|
||||
nsStyleContext* const styleContext = aItem.mStyleContext;
|
||||
|
||||
nsTableColFrame* colFrame = NS_NewTableColFrame(mPresShell, styleContext);
|
||||
if (NS_UNLIKELY(!colFrame)) {
|
||||
if (MOZ_UNLIKELY(!colFrame)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
InitAndRestoreFrame(aState, content, aParentFrame, nullptr, colFrame);
|
||||
@ -2039,7 +2040,7 @@ nsCSSFrameConstructor::ConstructTableCol(nsFrameConstructorState& aState,
|
||||
int32_t span = colFrame->GetSpan();
|
||||
for (int32_t spanX = 1; spanX < span; spanX++) {
|
||||
nsTableColFrame* newCol = NS_NewTableColFrame(mPresShell, styleContext);
|
||||
if (NS_UNLIKELY(!newCol)) {
|
||||
if (MOZ_UNLIKELY(!newCol)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
InitAndRestoreFrame(aState, content, aParentFrame, nullptr, newCol,
|
||||
@ -2085,7 +2086,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
|
||||
// See IsInAutoWidthTableCellForQuirk() in nsImageFrame.cpp.
|
||||
newFrame = NS_NewTableCellFrame(mPresShell, styleContext, borderCollapse);
|
||||
|
||||
if (NS_UNLIKELY(!newFrame)) {
|
||||
if (MOZ_UNLIKELY(!newFrame)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -2108,7 +2109,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
|
||||
isBlock = true;
|
||||
}
|
||||
|
||||
if (NS_UNLIKELY(!cellInnerFrame)) {
|
||||
if (MOZ_UNLIKELY(!cellInnerFrame)) {
|
||||
newFrame->Destroy();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -2371,7 +2372,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
|
||||
"Scrollbars should have been propagated to the viewport");
|
||||
#endif
|
||||
|
||||
if (NS_UNLIKELY(display->mDisplay == NS_STYLE_DISPLAY_NONE)) {
|
||||
if (MOZ_UNLIKELY(display->mDisplay == NS_STYLE_DISPLAY_NONE)) {
|
||||
SetUndisplayedContent(aDocElement, styleContext);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2409,7 +2410,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
|
||||
#ifdef MOZ_XUL
|
||||
if (aDocElement->IsXUL()) {
|
||||
contentFrame = NS_NewDocElementBoxFrame(mPresShell, styleContext);
|
||||
if (NS_UNLIKELY(!contentFrame)) {
|
||||
if (MOZ_UNLIKELY(!contentFrame)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock, nullptr,
|
||||
@ -2816,7 +2817,7 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
|
||||
parentStyleContext);
|
||||
|
||||
aPageFrame = NS_NewPageFrame(aPresShell, pagePseudoStyle);
|
||||
if (NS_UNLIKELY(!aPageFrame))
|
||||
if (MOZ_UNLIKELY(!aPageFrame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// Initialize the page frame and force it to have a view. This makes printing of
|
||||
@ -2829,7 +2830,7 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
|
||||
pagePseudoStyle);
|
||||
|
||||
nsIFrame* pageContentFrame = NS_NewPageContentFrame(aPresShell, pageContentPseudoStyle);
|
||||
if (NS_UNLIKELY(!pageContentFrame))
|
||||
if (MOZ_UNLIKELY(!pageContentFrame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// Initialize the page content frame and force it to have a view. Also make it the
|
||||
@ -2850,7 +2851,7 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
|
||||
pageContentPseudoStyle);
|
||||
|
||||
aCanvasFrame = NS_NewCanvasFrame(aPresShell, canvasPseudoStyle);
|
||||
if (NS_UNLIKELY(!aCanvasFrame))
|
||||
if (MOZ_UNLIKELY(!aCanvasFrame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsIFrame* prevCanvasFrame = nullptr;
|
||||
@ -3120,7 +3121,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
|
||||
nsStyleContext* const styleContext = aItem.mStyleContext;
|
||||
|
||||
nsIFrame* newFrame = NS_NewFieldSetFrame(mPresShell, styleContext);
|
||||
if (NS_UNLIKELY(!newFrame)) {
|
||||
if (MOZ_UNLIKELY(!newFrame)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -3241,7 +3242,7 @@ nsCSSFrameConstructor::ConstructTextFrame(const FrameConstructionData* aData,
|
||||
|
||||
nsIFrame* newFrame = (*aData->mFunc.mCreationFunc)(mPresShell, aStyleContext);
|
||||
|
||||
if (NS_UNLIKELY(!newFrame))
|
||||
if (MOZ_UNLIKELY(!newFrame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = InitAndRestoreFrame(aState, aContent, aParentFrame,
|
||||
@ -3673,7 +3674,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
||||
styleContext);
|
||||
nsIFrame* blockFrame =
|
||||
NS_NewBlockFormattingContext(mPresShell, blockContext);
|
||||
if (NS_UNLIKELY(!blockFrame)) {
|
||||
if (MOZ_UNLIKELY(!blockFrame)) {
|
||||
primaryFrame->Destroy();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -4475,7 +4476,7 @@ nsCSSFrameConstructor::ConstructScrollableBlock(nsFrameConstructorState& aState,
|
||||
&scrolledFrame, blockItem,
|
||||
aDisplay->IsPositioned(scrolledFrame),
|
||||
aItem.mPendingBinding);
|
||||
if (NS_UNLIKELY(NS_FAILED(rv))) {
|
||||
if (MOZ_UNLIKELY(NS_FAILED(rv))) {
|
||||
// XXXbz any cleanup needed here?
|
||||
return rv;
|
||||
}
|
||||
@ -4640,7 +4641,7 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
|
||||
nsIFrame* blockFrame =
|
||||
NS_NewMathMLmathBlockFrame(mPresShell, blockContext,
|
||||
NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
if (NS_UNLIKELY(!blockFrame))
|
||||
if (MOZ_UNLIKELY(!blockFrame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
InitAndRestoreFrame(aState, aContent, aParentFrame, nullptr, blockFrame);
|
||||
@ -10804,7 +10805,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
||||
return NS_OK;
|
||||
}
|
||||
nsIFrame* newTextFrame = NS_NewTextFrame(aPresShell, newSC);
|
||||
if (NS_UNLIKELY(!newTextFrame)) {
|
||||
if (MOZ_UNLIKELY(!newTextFrame)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;;
|
||||
}
|
||||
newTextFrame->Init(textContent, parentFrame, nullptr);
|
||||
@ -12219,7 +12220,7 @@ nsCSSFrameConstructor::PostRestyleEventCommon(Element* aElement,
|
||||
nsChangeHint aMinChangeHint,
|
||||
bool aForAnimation)
|
||||
{
|
||||
if (NS_UNLIKELY(mPresShell->IsDestroying())) {
|
||||
if (MOZ_UNLIKELY(mPresShell->IsDestroying())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsBulletFrame.h" // legacy location for list style type to text code
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
bool
|
||||
nsCounterUseNode::InitTextFrame(nsGenConList* aList,
|
||||
@ -229,7 +230,7 @@ nsCounterManager::AddResetOrIncrement(nsIFrame *aFrame, int32_t aIndex,
|
||||
|
||||
// Don't call Calc() if the list is already dirty -- it'll be recalculated
|
||||
// anyway, and trying to calculate with a dirty list doesn't work.
|
||||
if (NS_LIKELY(!counterList->IsDirty())) {
|
||||
if (MOZ_LIKELY(!counterList->IsDirty())) {
|
||||
node->Calc(counterList);
|
||||
}
|
||||
return false;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "nsGenConList.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
class nsCounterList;
|
||||
struct nsCounterUseNode;
|
||||
@ -166,7 +167,7 @@ public:
|
||||
nsGenConList::Insert(aNode);
|
||||
// Don't SetScope if we're dirty -- we'll reset all the scopes anyway,
|
||||
// and we can't usefully compute scopes right now.
|
||||
if (NS_LIKELY(!IsDirty())) {
|
||||
if (MOZ_LIKELY(!IsDirty())) {
|
||||
SetScope(aNode);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "mozilla/dom/PBrowserChild.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
@ -1746,7 +1747,7 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
|
||||
|
||||
// Note: when the frame was created above it had the NS_FRAME_IS_DIRTY bit
|
||||
// set, but XBL processing could have caused a reflow which clears it.
|
||||
if (NS_LIKELY(rootFrame->GetStateBits() & NS_FRAME_IS_DIRTY)) {
|
||||
if (MOZ_LIKELY(rootFrame->GetStateBits() & NS_FRAME_IS_DIRTY)) {
|
||||
// Unset the DIRTY bits so that FrameNeedsReflow() will work right.
|
||||
rootFrame->RemoveStateBits(NS_FRAME_IS_DIRTY |
|
||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
@ -3300,7 +3301,7 @@ PresShell::DoScrollContentIntoView()
|
||||
|
||||
ScrollIntoViewData* data = static_cast<ScrollIntoViewData*>(
|
||||
mContentToScrollTo->GetProperty(nsGkAtoms::scrolling));
|
||||
if (NS_UNLIKELY(!data)) {
|
||||
if (MOZ_UNLIKELY(!data)) {
|
||||
mContentToScrollTo = nullptr;
|
||||
return;
|
||||
}
|
||||
@ -3650,7 +3651,7 @@ nsresult
|
||||
PresShell::PostReflowCallback(nsIReflowCallback* aCallback)
|
||||
{
|
||||
void* result = AllocateMisc(sizeof(nsCallbackEventRequest));
|
||||
if (NS_UNLIKELY(!result)) {
|
||||
if (MOZ_UNLIKELY(!result)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsCallbackEventRequest* request = (nsCallbackEventRequest*)result;
|
||||
@ -5398,7 +5399,7 @@ nsIPresShell::SetCapturingContent(nsIContent* aContent, uint8_t aFlags)
|
||||
nsIFrame*
|
||||
PresShell::GetCurrentEventFrame()
|
||||
{
|
||||
if (NS_UNLIKELY(mIsDestroying)) {
|
||||
if (MOZ_UNLIKELY(mIsDestroying)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "nsRenderingContext.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsContentList.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -779,7 +780,7 @@ nsComboboxControlFrame::GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
|
||||
}
|
||||
|
||||
nscoord displayWidth = 0;
|
||||
if (NS_LIKELY(mDisplayFrame)) {
|
||||
if (MOZ_LIKELY(mDisplayFrame)) {
|
||||
displayWidth = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mDisplayFrame,
|
||||
aType);
|
||||
@ -1394,19 +1395,19 @@ nsComboboxControlFrame::CreateFrameFor(nsIContent* aContent)
|
||||
styleContext = styleSet->
|
||||
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
if (NS_UNLIKELY(!styleContext)) {
|
||||
if (MOZ_UNLIKELY(!styleContext)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = styleSet->ResolveStyleForNonElement(mStyleContext);
|
||||
if (NS_UNLIKELY(!textStyleContext)) {
|
||||
if (MOZ_UNLIKELY(!textStyleContext)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Start by by creating our anonymous block frame
|
||||
mDisplayFrame = new (shell) nsComboboxDisplayFrame(styleContext, this);
|
||||
if (NS_UNLIKELY(!mDisplayFrame)) {
|
||||
if (MOZ_UNLIKELY(!mDisplayFrame)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1419,7 +1420,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIContent* aContent)
|
||||
|
||||
// Create a text frame and put it inside the block frame
|
||||
nsIFrame* textFrame = NS_NewTextFrame(shell, textStyleContext);
|
||||
if (NS_UNLIKELY(!textFrame)) {
|
||||
if (MOZ_UNLIKELY(!textFrame)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layout;
|
||||
@ -613,7 +614,7 @@ nsFieldSetFrame::InsertFrames(ChildListID aListID,
|
||||
|
||||
// aFrameList is not allowed to contain "the legend" for this fieldset
|
||||
ReparentFrameList(aFrameList);
|
||||
if (NS_UNLIKELY(aPrevFrame == mLegendFrame)) {
|
||||
if (MOZ_UNLIKELY(aPrevFrame == mLegendFrame)) {
|
||||
aPrevFrame = nullptr;
|
||||
}
|
||||
return mContentFrame->InsertFrames(aListID, aPrevFrame, aFrameList);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsTextFrame.h"
|
||||
#include "nsStyleStructInlines.h"
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
@ -624,7 +625,7 @@ TextOverflow::PruneDisplayListContents(nsDisplayList* aList,
|
||||
itemFrame->GetOffsetTo(mBlock);
|
||||
if (mLeft.IsNeeded() && rect.x < aInsideMarkersArea.x) {
|
||||
nscoord left = aInsideMarkersArea.x - rect.x;
|
||||
if (NS_UNLIKELY(left < 0)) {
|
||||
if (MOZ_UNLIKELY(left < 0)) {
|
||||
item->~nsDisplayItem();
|
||||
continue;
|
||||
}
|
||||
@ -632,7 +633,7 @@ TextOverflow::PruneDisplayListContents(nsDisplayList* aList,
|
||||
}
|
||||
if (mRight.IsNeeded() && rect.XMost() > aInsideMarkersArea.XMost()) {
|
||||
nscoord right = rect.XMost() - aInsideMarkersArea.XMost();
|
||||
if (NS_UNLIKELY(right < 0)) {
|
||||
if (MOZ_UNLIKELY(right < 0)) {
|
||||
item->~nsDisplayItem();
|
||||
continue;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsLineBox.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "mozilla/Likely.h"
|
||||
class nsIScrollableFrame;
|
||||
|
||||
namespace mozilla {
|
||||
@ -59,7 +60,7 @@ class TextOverflow {
|
||||
struct AlignmentEdges {
|
||||
AlignmentEdges() : mAssigned(false) {}
|
||||
void Accumulate(const nsRect& aRect) {
|
||||
if (NS_LIKELY(mAssigned)) {
|
||||
if (MOZ_LIKELY(mAssigned)) {
|
||||
x = NS_MIN(x, aRect.X());
|
||||
xmost = NS_MAX(xmost, aRect.XMost());
|
||||
} else {
|
||||
@ -77,7 +78,7 @@ class TextOverflow {
|
||||
struct InnerClipEdges {
|
||||
InnerClipEdges() : mAssignedLeft(false), mAssignedRight(false) {}
|
||||
void AccumulateLeft(const nsRect& aRect) {
|
||||
if (NS_LIKELY(mAssignedLeft)) {
|
||||
if (MOZ_LIKELY(mAssignedLeft)) {
|
||||
mLeft = NS_MAX(mLeft, aRect.X());
|
||||
} else {
|
||||
mLeft = aRect.X();
|
||||
@ -85,7 +86,7 @@ class TextOverflow {
|
||||
}
|
||||
}
|
||||
void AccumulateRight(const nsRect& aRect) {
|
||||
if (NS_LIKELY(mAssignedRight)) {
|
||||
if (MOZ_LIKELY(mAssignedRight)) {
|
||||
mRight = NS_MIN(mRight, aRect.XMost());
|
||||
} else {
|
||||
mRight = aRect.XMost();
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "TextOverflow.h"
|
||||
#include "nsStyleStructInlines.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsBidiPresUtils.h"
|
||||
@ -2543,7 +2544,7 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
|
||||
"mPrevChild should be the LastChild of the line we are adding to");
|
||||
// The frame is being pulled from a next-in-flow; therefore we
|
||||
// need to add it to our sibling list.
|
||||
if (NS_LIKELY(!aFromOverflowLine)) {
|
||||
if (MOZ_LIKELY(!aFromOverflowLine)) {
|
||||
NS_ASSERTION(&aFromFrameList == &aFromContainer->mFrames,
|
||||
"must be normal flow if not overflow line");
|
||||
NS_ASSERTION(aFromLine == aFromContainer->mLines.begin(),
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define nsFrame_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "nsBox.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsString.h"
|
||||
@ -578,7 +579,7 @@ public:
|
||||
const nsStyleDisplay* aDisp)
|
||||
{
|
||||
// clip overflow:-moz-hidden-unscrollable ...
|
||||
if (NS_UNLIKELY(aDisp->mOverflowX == NS_STYLE_OVERFLOW_CLIP)) {
|
||||
if (MOZ_UNLIKELY(aDisp->mOverflowX == NS_STYLE_OVERFLOW_CLIP)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsHTMLFrameSetElement.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -367,7 +368,7 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
|
||||
mStyleContext);
|
||||
if (tag == nsGkAtoms::frameset) {
|
||||
frame = NS_NewHTMLFramesetFrame(shell, kidSC);
|
||||
if (NS_UNLIKELY(!frame))
|
||||
if (MOZ_UNLIKELY(!frame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mChildTypes[mChildCount] = FRAMESET;
|
||||
@ -384,7 +385,7 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
|
||||
mChildBorderColors[mChildCount].Set(childFrame->GetBorderColor());
|
||||
} else { // frame
|
||||
frame = NS_NewSubDocumentFrame(shell, kidSC);
|
||||
if (NS_UNLIKELY(!frame))
|
||||
if (MOZ_UNLIKELY(!frame))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
result = frame->Init(child, this, nullptr);
|
||||
@ -528,7 +529,7 @@ void nsHTMLFramesetFrame::CalculateRowCol(nsPresContext* aPresContext,
|
||||
int32_t numRelative = 0;
|
||||
nsAutoArrayPtr<int32_t> relative(new int32_t[aNumSpecs]);
|
||||
|
||||
if (NS_UNLIKELY(!fixed || !percent || !relative)) {
|
||||
if (MOZ_UNLIKELY(!fixed || !percent || !relative)) {
|
||||
return; // NS_ERROR_OUT_OF_MEMORY
|
||||
}
|
||||
|
||||
@ -1036,7 +1037,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
||||
borderWidth,
|
||||
false,
|
||||
false);
|
||||
if (NS_LIKELY(borderFrame != nullptr)) {
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
borderFrame->Init(mContent, this, nullptr);
|
||||
mChildCount++;
|
||||
mFrames.AppendFrame(nullptr, borderFrame);
|
||||
@ -1047,12 +1048,12 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
} else {
|
||||
borderFrame = (nsHTMLFramesetBorderFrame*)mFrames.FrameAt(borderChildX);
|
||||
if (NS_LIKELY(borderFrame != nullptr)) {
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
borderFrame->mWidth = borderWidth;
|
||||
borderChildX++;
|
||||
}
|
||||
}
|
||||
if (NS_LIKELY(borderFrame != nullptr)) {
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
nsSize borderSize(aDesiredSize.width, borderWidth);
|
||||
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
|
||||
borderFrame = nullptr;
|
||||
@ -1072,7 +1073,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
||||
borderWidth,
|
||||
true,
|
||||
false);
|
||||
if (NS_LIKELY(borderFrame != nullptr)) {
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
borderFrame->Init(mContent, this, nullptr);
|
||||
mChildCount++;
|
||||
mFrames.AppendFrame(nullptr, borderFrame);
|
||||
@ -1083,12 +1084,12 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
} else {
|
||||
borderFrame = (nsHTMLFramesetBorderFrame*)mFrames.FrameAt(borderChildX);
|
||||
if (NS_LIKELY(borderFrame != nullptr)) {
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
borderFrame->mWidth = borderWidth;
|
||||
borderChildX++;
|
||||
}
|
||||
}
|
||||
if (NS_LIKELY(borderFrame != nullptr)) {
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
nsSize borderSize(borderWidth, aDesiredSize.height);
|
||||
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
|
||||
borderFrame = nullptr;
|
||||
@ -1328,7 +1329,7 @@ nsHTMLFramesetFrame::RecalculateBorderResize()
|
||||
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT
|
||||
< UINT_MAX / sizeof(int32_t) / NS_MAX_FRAMESET_SPEC_COUNT);
|
||||
nsAutoArrayPtr<int32_t> childTypes(new int32_t[numCells]);
|
||||
if (NS_UNLIKELY(!childTypes)) {
|
||||
if (MOZ_UNLIKELY(!childTypes)) {
|
||||
return;
|
||||
}
|
||||
int32_t childTypeIndex = 0;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef NOISY_PUSHING
|
||||
@ -506,7 +507,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
||||
// This scenario doesn't happen often, but it can happen.
|
||||
nsIFrame* nextSibling = child->GetNextSibling();
|
||||
child = child->GetNextInFlow();
|
||||
if (NS_UNLIKELY(child)) {
|
||||
if (MOZ_UNLIKELY(child)) {
|
||||
while (child != nextSibling && nextSibling) {
|
||||
nextSibling = nextSibling->GetNextSibling();
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsBidiPresUtils.h"
|
||||
#endif
|
||||
#include "nsStyleStructInlines.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
static int32_t ctorCount;
|
||||
@ -53,7 +54,7 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, int32_t aCount, bool aIsBlock)
|
||||
nsLineBox::~nsLineBox()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsLineBox);
|
||||
if (NS_UNLIKELY(mFlags.mHasHashedFrames)) {
|
||||
if (MOZ_UNLIKELY(mFlags.mHasHashedFrames)) {
|
||||
delete mFrames;
|
||||
}
|
||||
Cleanup();
|
||||
@ -99,7 +100,7 @@ nsLineBox::NoteFramesMovedFrom(nsLineBox* aFromLine)
|
||||
uint32_t toCount = GetChildCount();
|
||||
MOZ_ASSERT(toCount <= fromCount, "moved more frames than aFromLine has");
|
||||
uint32_t fromNewCount = fromCount - toCount;
|
||||
if (NS_LIKELY(!aFromLine->mFlags.mHasHashedFrames)) {
|
||||
if (MOZ_LIKELY(!aFromLine->mFlags.mHasHashedFrames)) {
|
||||
aFromLine->mChildCount = fromNewCount;
|
||||
MOZ_ASSERT(toCount < kMinChildCountForHashtable);
|
||||
} else if (fromNewCount < kMinChildCountForHashtable) {
|
||||
@ -362,7 +363,7 @@ nsLineBox::DeleteLineList(nsPresContext* aPresContext, nsLineList& aLines,
|
||||
// frame tree while we're destroying.
|
||||
while (!aLines.empty()) {
|
||||
nsLineBox* line = aLines.front();
|
||||
if (NS_UNLIKELY(line->mFlags.mHasHashedFrames)) {
|
||||
if (MOZ_UNLIKELY(line->mFlags.mHasHashedFrames)) {
|
||||
line->SwitchToCounter(); // Avoid expensive has table removals.
|
||||
}
|
||||
while (line->GetChildCount() > 0) {
|
||||
@ -391,7 +392,7 @@ nsLineBox::RFindLineContaining(nsIFrame* aFrame,
|
||||
while (aBegin != aEnd) {
|
||||
--aEnd;
|
||||
NS_ASSERTION(aEnd->LastChild() == curFrame, "Unexpected curFrame");
|
||||
if (NS_UNLIKELY(aEnd->mFlags.mHasHashedFrames) &&
|
||||
if (MOZ_UNLIKELY(aEnd->mFlags.mHasHashedFrames) &&
|
||||
!aEnd->Contains(aFrame)) {
|
||||
if (aEnd->mFirstChild) {
|
||||
curFrame = aEnd->mFirstChild->GetPrevSibling();
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define nsLineBox_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "nsILineIterator.h"
|
||||
#include "nsIFrame.h"
|
||||
@ -361,14 +362,14 @@ private:
|
||||
|
||||
public:
|
||||
int32_t GetChildCount() const {
|
||||
return NS_UNLIKELY(mFlags.mHasHashedFrames) ? mFrames->Count() : mChildCount;
|
||||
return MOZ_UNLIKELY(mFlags.mHasHashedFrames) ? mFrames->Count() : mChildCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register that aFrame is now on this line.
|
||||
*/
|
||||
void NoteFrameAdded(nsIFrame* aFrame) {
|
||||
if (NS_UNLIKELY(mFlags.mHasHashedFrames)) {
|
||||
if (MOZ_UNLIKELY(mFlags.mHasHashedFrames)) {
|
||||
mFrames->PutEntry(aFrame);
|
||||
} else {
|
||||
if (++mChildCount >= kMinChildCountForHashtable) {
|
||||
@ -382,7 +383,7 @@ public:
|
||||
*/
|
||||
void NoteFrameRemoved(nsIFrame* aFrame) {
|
||||
MOZ_ASSERT(GetChildCount() > 0);
|
||||
if (NS_UNLIKELY(mFlags.mHasHashedFrames)) {
|
||||
if (MOZ_UNLIKELY(mFlags.mHasHashedFrames)) {
|
||||
mFrames->RemoveEntry(aFrame);
|
||||
if (mFrames->Count() < kMinChildCountForHashtable) {
|
||||
SwitchToCounter();
|
||||
@ -510,7 +511,7 @@ private:
|
||||
public:
|
||||
|
||||
bool Contains(nsIFrame* aFrame) const {
|
||||
return NS_UNLIKELY(mFlags.mHasHashedFrames) ? mFrames->Contains(aFrame)
|
||||
return MOZ_UNLIKELY(mFlags.mHasHashedFrames) ? mFrames->Contains(aFrame)
|
||||
: IndexOf(aFrame) >= 0;
|
||||
}
|
||||
|
||||
|
@ -70,10 +70,11 @@
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
|
||||
#include "sampler.h"
|
||||
|
||||
@ -2395,7 +2396,7 @@ BuildTextRunsScanner::AssignTextRun(gfxTextRun* aTextRun, float aInflation)
|
||||
else {
|
||||
TextRunUserData* userData = static_cast<TextRunUserData*>(oldTextRun->GetUserData());
|
||||
firstFrame = userData->mMappedFlows[0].mStartFrame;
|
||||
if (NS_UNLIKELY(f != firstFrame)) {
|
||||
if (MOZ_UNLIKELY(f != firstFrame)) {
|
||||
TextRunMappedFlow* flow = FindFlowForContent(userData, f->GetContent());
|
||||
if (flow) {
|
||||
startOffset = flow->mDOMOffsetToBeforeTransformOffset;
|
||||
@ -2409,7 +2410,7 @@ BuildTextRunsScanner::AssignTextRun(gfxTextRun* aTextRun, float aInflation)
|
||||
// Optimization: if |f| is the first frame in the flow then there are no
|
||||
// prev-continuations that use |oldTextRun|.
|
||||
nsTextFrame* clearFrom = nullptr;
|
||||
if (NS_UNLIKELY(f != firstFrame)) {
|
||||
if (MOZ_UNLIKELY(f != firstFrame)) {
|
||||
// If all the frames in the mapped flow starting at |f| (inclusive)
|
||||
// are empty then we let the prev-continuations keep the old text run.
|
||||
gfxSkipCharsIterator iter(oldTextRun->GetSkipChars(), startOffset, f->GetContentOffset());
|
||||
@ -7690,7 +7691,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||
offset += whitespaceCount;
|
||||
length -= whitespaceCount;
|
||||
// Make sure this frame maps the trimmable whitespace.
|
||||
if (NS_UNLIKELY(offset > GetContentEnd())) {
|
||||
if (MOZ_UNLIKELY(offset > GetContentEnd())) {
|
||||
SetLength(offset - GetContentOffset(), &aLineLayout,
|
||||
ALLOW_FRAME_CREATION_AND_DESTRUCTION);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsIReflowCallback.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -1390,7 +1391,7 @@ nsMathMLContainerFrame::FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize)
|
||||
{
|
||||
nscoord gap = 0;
|
||||
nsIContent* parentContent = mParent->GetContent();
|
||||
if (NS_UNLIKELY(!parentContent)) {
|
||||
if (MOZ_UNLIKELY(!parentContent)) {
|
||||
return 0;
|
||||
}
|
||||
nsIAtom *parentTag = parentContent->Tag();
|
||||
@ -1423,7 +1424,7 @@ nsMathMLContainerFrame::FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize)
|
||||
nsMathMLContainerFrame::DidReflowChildren(nsIFrame* aFirst, nsIFrame* aStop)
|
||||
|
||||
{
|
||||
if (NS_UNLIKELY(!aFirst))
|
||||
if (MOZ_UNLIKELY(!aFirst))
|
||||
return;
|
||||
|
||||
for (nsIFrame* frame = aFirst;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsMathMLChar.h"
|
||||
#include "nsMathMLFrame.h"
|
||||
#include "nsMathMLParts.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
/*
|
||||
* Base class for MathML container frames. It acts like an inferred
|
||||
@ -397,7 +398,7 @@ public:
|
||||
NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
|
||||
"unexpected frame list");
|
||||
nsresult rv = nsBlockFrame::AppendFrames(aListID, aFrameList);
|
||||
if (NS_LIKELY(aListID == kPrincipalList))
|
||||
if (MOZ_LIKELY(aListID == kPrincipalList))
|
||||
nsMathMLContainerFrame::ReLayoutChildren(this);
|
||||
return rv;
|
||||
}
|
||||
@ -410,7 +411,7 @@ public:
|
||||
NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
|
||||
"unexpected frame list");
|
||||
nsresult rv = nsBlockFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
|
||||
if (NS_LIKELY(aListID == kPrincipalList))
|
||||
if (MOZ_LIKELY(aListID == kPrincipalList))
|
||||
nsMathMLContainerFrame::ReLayoutChildren(this);
|
||||
return rv;
|
||||
}
|
||||
@ -422,7 +423,7 @@ public:
|
||||
NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
|
||||
"unexpected frame list");
|
||||
nsresult rv = nsBlockFrame::RemoveFrame(aListID, aOldFrame);
|
||||
if (NS_LIKELY(aListID == kPrincipalList))
|
||||
if (MOZ_LIKELY(aListID == kPrincipalList))
|
||||
nsMathMLContainerFrame::ReLayoutChildren(this);
|
||||
return rv;
|
||||
}
|
||||
@ -467,7 +468,7 @@ public:
|
||||
NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
|
||||
"unexpected frame list");
|
||||
nsresult rv = nsInlineFrame::AppendFrames(aListID, aFrameList);
|
||||
if (NS_LIKELY(aListID == kPrincipalList))
|
||||
if (MOZ_LIKELY(aListID == kPrincipalList))
|
||||
nsMathMLContainerFrame::ReLayoutChildren(this);
|
||||
return rv;
|
||||
}
|
||||
@ -480,7 +481,7 @@ public:
|
||||
NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
|
||||
"unexpected frame list");
|
||||
nsresult rv = nsInlineFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
|
||||
if (NS_LIKELY(aListID == kPrincipalList))
|
||||
if (MOZ_LIKELY(aListID == kPrincipalList))
|
||||
nsMathMLContainerFrame::ReLayoutChildren(this);
|
||||
return rv;
|
||||
}
|
||||
@ -492,7 +493,7 @@ public:
|
||||
NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
|
||||
"unexpected frame list");
|
||||
nsresult rv = nsInlineFrame::RemoveFrame(aListID, aOldFrame);
|
||||
if (NS_LIKELY(aListID == kPrincipalList))
|
||||
if (MOZ_LIKELY(aListID == kPrincipalList))
|
||||
nsMathMLContainerFrame::ReLayoutChildren(this);
|
||||
return rv;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include "nsNthIndexCache.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -2843,7 +2844,7 @@ AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
|
||||
|
||||
// Build the rule hash.
|
||||
nsCSSPseudoElements::Type pseudoType = aRuleInfo->mSelector->PseudoType();
|
||||
if (NS_LIKELY(pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement)) {
|
||||
if (MOZ_LIKELY(pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement)) {
|
||||
cascade->mRuleHash.AppendRule(*aRuleInfo);
|
||||
} else if (pseudoType < nsCSSPseudoElements::ePseudo_PseudoElementCount) {
|
||||
RuleHash*& ruleHash = cascade->mPseudoElementRuleHashes[pseudoType];
|
||||
@ -3246,7 +3247,7 @@ AncestorFilter::Init(Element *aElement)
|
||||
|
||||
mFilter = new Filter();
|
||||
|
||||
if (NS_LIKELY(aElement)) {
|
||||
if (MOZ_LIKELY(aElement)) {
|
||||
MOZ_ASSERT(aElement->IsInDoc(),
|
||||
"aElement must be in the document for the assumption that "
|
||||
"GetParentNode() is non-null on all element ancestors of "
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "nsCSSStyleSheet.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -913,7 +914,7 @@ nsCSSScanner::NextURL(nsCSSToken& aToken)
|
||||
NS_ABORT_IF_FALSE(aToken.mType == eCSSToken_String ||
|
||||
aToken.mType == eCSSToken_Bad_String,
|
||||
"unexpected token type");
|
||||
if (NS_LIKELY(aToken.mType == eCSSToken_String)) {
|
||||
if (MOZ_LIKELY(aToken.mType == eCSSToken_String)) {
|
||||
EatWhiteSpace();
|
||||
if (LookAheadOrEOF(')')) {
|
||||
aToken.mType = eCSSToken_URL;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsMediaFeatures.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -1489,7 +1490,7 @@ nsCSSStyleSheet::ReplaceStyleRule(css::Rule* aOld, css::Rule* aNew)
|
||||
|
||||
if (NS_SUCCEEDED(WillDirty())) {
|
||||
int32_t index = mInner->mOrderedRules.IndexOf(aOld);
|
||||
if (NS_UNLIKELY(index == -1)) {
|
||||
if (MOZ_UNLIKELY(index == -1)) {
|
||||
NS_NOTREACHED("Couldn't find old rule");
|
||||
return;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "CSSCalc.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "mozilla/css/ImageLoader.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
namespace css = mozilla::css;
|
||||
|
||||
@ -54,7 +55,7 @@ nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit)
|
||||
NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string value");
|
||||
if (UnitHasStringValue()) {
|
||||
mValue.mString = BufferFromString(aValue).get();
|
||||
if (NS_UNLIKELY(!mValue.mString)) {
|
||||
if (MOZ_UNLIKELY(!mValue.mString)) {
|
||||
// XXXbz not much we can do here; just make sure that our promise of a
|
||||
// non-null mValue.mString holds for string units.
|
||||
mUnit = eCSSUnit_Null;
|
||||
@ -343,7 +344,7 @@ void nsCSSValue::SetStringValue(const nsString& aValue,
|
||||
NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string unit");
|
||||
if (UnitHasStringValue()) {
|
||||
mValue.mString = BufferFromString(aValue).get();
|
||||
if (NS_UNLIKELY(!mValue.mString)) {
|
||||
if (MOZ_UNLIKELY(!mValue.mString)) {
|
||||
// XXXbz not much we can do here; just make sure that our promise of a
|
||||
// non-null mValue.mString holds for string units.
|
||||
mUnit = eCSSUnit_Null;
|
||||
@ -633,7 +634,7 @@ nsCSSValue::BufferFromString(const nsString& aValue)
|
||||
// NOTE: Alloc prouduces a new, already-addref'd (refcnt = 1) buffer.
|
||||
// NOTE: String buffer allocation is currently fallible.
|
||||
buffer = nsStringBuffer::Alloc((length + 1) * sizeof(PRUnichar));
|
||||
if (NS_UNLIKELY(!buffer)) {
|
||||
if (MOZ_UNLIKELY(!buffer)) {
|
||||
NS_RUNTIMEABORT("out of memory");
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
@ -2027,7 +2028,7 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
|
||||
#undef STYLE_STRUCT_TEST
|
||||
|
||||
// If we have a post-resolve callback, handle that now.
|
||||
if (ruleData.mPostResolveCallback && (NS_LIKELY(res != nullptr)))
|
||||
if (ruleData.mPostResolveCallback && (MOZ_LIKELY(res != nullptr)))
|
||||
(*ruleData.mPostResolveCallback)(const_cast<void*>(res), &ruleData);
|
||||
|
||||
// Now return the result.
|
||||
@ -2041,7 +2042,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Font:
|
||||
{
|
||||
nsStyleFont* fontData = new (mPresContext) nsStyleFont(mPresContext);
|
||||
if (NS_LIKELY(fontData != nullptr)) {
|
||||
if (MOZ_LIKELY(fontData != nullptr)) {
|
||||
nscoord minimumFontSize = mPresContext->MinFontSize(fontData->mLanguage);
|
||||
|
||||
if (minimumFontSize > 0 && !mPresContext->IsChrome()) {
|
||||
@ -2057,7 +2058,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Display:
|
||||
{
|
||||
nsStyleDisplay* disp = new (mPresContext) nsStyleDisplay();
|
||||
if (NS_LIKELY(disp != nullptr)) {
|
||||
if (MOZ_LIKELY(disp != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Display, disp);
|
||||
}
|
||||
return disp;
|
||||
@ -2065,7 +2066,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Visibility:
|
||||
{
|
||||
nsStyleVisibility* vis = new (mPresContext) nsStyleVisibility(mPresContext);
|
||||
if (NS_LIKELY(vis != nullptr)) {
|
||||
if (MOZ_LIKELY(vis != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Visibility, vis);
|
||||
}
|
||||
return vis;
|
||||
@ -2073,7 +2074,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Text:
|
||||
{
|
||||
nsStyleText* text = new (mPresContext) nsStyleText();
|
||||
if (NS_LIKELY(text != nullptr)) {
|
||||
if (MOZ_LIKELY(text != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Text, text);
|
||||
}
|
||||
return text;
|
||||
@ -2081,7 +2082,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_TextReset:
|
||||
{
|
||||
nsStyleTextReset* text = new (mPresContext) nsStyleTextReset();
|
||||
if (NS_LIKELY(text != nullptr)) {
|
||||
if (MOZ_LIKELY(text != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_TextReset, text);
|
||||
}
|
||||
return text;
|
||||
@ -2089,7 +2090,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Color:
|
||||
{
|
||||
nsStyleColor* color = new (mPresContext) nsStyleColor(mPresContext);
|
||||
if (NS_LIKELY(color != nullptr)) {
|
||||
if (MOZ_LIKELY(color != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Color, color);
|
||||
}
|
||||
return color;
|
||||
@ -2097,7 +2098,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Background:
|
||||
{
|
||||
nsStyleBackground* bg = new (mPresContext) nsStyleBackground();
|
||||
if (NS_LIKELY(bg != nullptr)) {
|
||||
if (MOZ_LIKELY(bg != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Background, bg);
|
||||
}
|
||||
return bg;
|
||||
@ -2105,7 +2106,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Margin:
|
||||
{
|
||||
nsStyleMargin* margin = new (mPresContext) nsStyleMargin();
|
||||
if (NS_LIKELY(margin != nullptr)) {
|
||||
if (MOZ_LIKELY(margin != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Margin, margin);
|
||||
}
|
||||
return margin;
|
||||
@ -2113,7 +2114,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Border:
|
||||
{
|
||||
nsStyleBorder* border = new (mPresContext) nsStyleBorder(mPresContext);
|
||||
if (NS_LIKELY(border != nullptr)) {
|
||||
if (MOZ_LIKELY(border != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Border, border);
|
||||
}
|
||||
return border;
|
||||
@ -2121,7 +2122,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Padding:
|
||||
{
|
||||
nsStylePadding* padding = new (mPresContext) nsStylePadding();
|
||||
if (NS_LIKELY(padding != nullptr)) {
|
||||
if (MOZ_LIKELY(padding != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Padding, padding);
|
||||
}
|
||||
return padding;
|
||||
@ -2129,7 +2130,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Outline:
|
||||
{
|
||||
nsStyleOutline* outline = new (mPresContext) nsStyleOutline(mPresContext);
|
||||
if (NS_LIKELY(outline != nullptr)) {
|
||||
if (MOZ_LIKELY(outline != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Outline, outline);
|
||||
}
|
||||
return outline;
|
||||
@ -2137,7 +2138,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_List:
|
||||
{
|
||||
nsStyleList* list = new (mPresContext) nsStyleList();
|
||||
if (NS_LIKELY(list != nullptr)) {
|
||||
if (MOZ_LIKELY(list != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_List, list);
|
||||
}
|
||||
return list;
|
||||
@ -2145,7 +2146,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Position:
|
||||
{
|
||||
nsStylePosition* pos = new (mPresContext) nsStylePosition();
|
||||
if (NS_LIKELY(pos != nullptr)) {
|
||||
if (MOZ_LIKELY(pos != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Position, pos);
|
||||
}
|
||||
return pos;
|
||||
@ -2153,7 +2154,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Table:
|
||||
{
|
||||
nsStyleTable* table = new (mPresContext) nsStyleTable();
|
||||
if (NS_LIKELY(table != nullptr)) {
|
||||
if (MOZ_LIKELY(table != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Table, table);
|
||||
}
|
||||
return table;
|
||||
@ -2161,7 +2162,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_TableBorder:
|
||||
{
|
||||
nsStyleTableBorder* table = new (mPresContext) nsStyleTableBorder(mPresContext);
|
||||
if (NS_LIKELY(table != nullptr)) {
|
||||
if (MOZ_LIKELY(table != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_TableBorder, table);
|
||||
}
|
||||
return table;
|
||||
@ -2169,7 +2170,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Content:
|
||||
{
|
||||
nsStyleContent* content = new (mPresContext) nsStyleContent();
|
||||
if (NS_LIKELY(content != nullptr)) {
|
||||
if (MOZ_LIKELY(content != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Content, content);
|
||||
}
|
||||
return content;
|
||||
@ -2177,7 +2178,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Quotes:
|
||||
{
|
||||
nsStyleQuotes* quotes = new (mPresContext) nsStyleQuotes();
|
||||
if (NS_LIKELY(quotes != nullptr)) {
|
||||
if (MOZ_LIKELY(quotes != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Quotes, quotes);
|
||||
}
|
||||
return quotes;
|
||||
@ -2185,7 +2186,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_UserInterface:
|
||||
{
|
||||
nsStyleUserInterface* ui = new (mPresContext) nsStyleUserInterface();
|
||||
if (NS_LIKELY(ui != nullptr)) {
|
||||
if (MOZ_LIKELY(ui != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_UserInterface, ui);
|
||||
}
|
||||
return ui;
|
||||
@ -2193,7 +2194,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_UIReset:
|
||||
{
|
||||
nsStyleUIReset* ui = new (mPresContext) nsStyleUIReset();
|
||||
if (NS_LIKELY(ui != nullptr)) {
|
||||
if (MOZ_LIKELY(ui != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_UIReset, ui);
|
||||
}
|
||||
return ui;
|
||||
@ -2202,7 +2203,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_XUL:
|
||||
{
|
||||
nsStyleXUL* xul = new (mPresContext) nsStyleXUL();
|
||||
if (NS_LIKELY(xul != nullptr)) {
|
||||
if (MOZ_LIKELY(xul != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_XUL, xul);
|
||||
}
|
||||
return xul;
|
||||
@ -2211,7 +2212,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_Column:
|
||||
{
|
||||
nsStyleColumn* column = new (mPresContext) nsStyleColumn(mPresContext);
|
||||
if (NS_LIKELY(column != nullptr)) {
|
||||
if (MOZ_LIKELY(column != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_Column, column);
|
||||
}
|
||||
return column;
|
||||
@ -2220,7 +2221,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_SVG:
|
||||
{
|
||||
nsStyleSVG* svg = new (mPresContext) nsStyleSVG();
|
||||
if (NS_LIKELY(svg != nullptr)) {
|
||||
if (MOZ_LIKELY(svg != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_SVG, svg);
|
||||
}
|
||||
return svg;
|
||||
@ -2229,7 +2230,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
||||
case eStyleStruct_SVGReset:
|
||||
{
|
||||
nsStyleSVGReset* svgReset = new (mPresContext) nsStyleSVGReset();
|
||||
if (NS_LIKELY(svgReset != nullptr)) {
|
||||
if (MOZ_LIKELY(svgReset != nullptr)) {
|
||||
aContext->SetStyle(eStyleStruct_SVGReset, svgReset);
|
||||
}
|
||||
return svgReset;
|
||||
@ -2349,8 +2350,8 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
||||
data_ = new (mPresContext) nsStyle##type_ ctorargs_; \
|
||||
} \
|
||||
\
|
||||
if (NS_UNLIKELY(!data_)) \
|
||||
return nullptr; /* Out Of Memory */ \
|
||||
if (MOZ_UNLIKELY(!data_)) \
|
||||
return nullptr; /* Out Of Memory */ \
|
||||
if (!parentdata_) \
|
||||
parentdata_ = data_;
|
||||
|
||||
@ -2385,8 +2386,8 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
||||
else \
|
||||
data_ = new (mPresContext) nsStyle##type_ ctorargs_; \
|
||||
\
|
||||
if (NS_UNLIKELY(!data_)) \
|
||||
return nullptr; /* Out Of Memory */ \
|
||||
if (MOZ_UNLIKELY(!data_)) \
|
||||
return nullptr; /* Out Of Memory */ \
|
||||
\
|
||||
/* If |canStoreInRuleTree| might be true by the time we're done, we */ \
|
||||
/* can't call parentContext->GetStyle##type_() since it could recur into */ \
|
||||
@ -2417,9 +2418,9 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
||||
if (!aHighestNode->mStyleData.mInheritedData) { \
|
||||
aHighestNode->mStyleData.mInheritedData = \
|
||||
new (mPresContext) nsInheritedStyleData; \
|
||||
if (NS_UNLIKELY(!aHighestNode->mStyleData.mInheritedData)) { \
|
||||
if (MOZ_UNLIKELY(!aHighestNode->mStyleData.mInheritedData)) { \
|
||||
data_->Destroy(mPresContext); \
|
||||
return nullptr; \
|
||||
return nullptr; \
|
||||
} \
|
||||
} \
|
||||
NS_ASSERTION(!aHighestNode->mStyleData.mInheritedData-> \
|
||||
@ -2461,9 +2462,9 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
||||
if (!aHighestNode->mStyleData.mResetData) { \
|
||||
aHighestNode->mStyleData.mResetData = \
|
||||
new (mPresContext) nsResetStyleData; \
|
||||
if (NS_UNLIKELY(!aHighestNode->mStyleData.mResetData)) { \
|
||||
if (MOZ_UNLIKELY(!aHighestNode->mStyleData.mResetData)) { \
|
||||
data_->Destroy(mPresContext); \
|
||||
return nullptr; \
|
||||
return nullptr; \
|
||||
} \
|
||||
} \
|
||||
NS_ASSERTION(!aHighestNode->mStyleData.mResetData-> \
|
||||
@ -4715,7 +4716,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
|
||||
mozilla::css::URLValue* url = bindingValue->GetURLStructValue();
|
||||
NS_ASSERTION(url, "What's going on here?");
|
||||
|
||||
if (NS_LIKELY(url->GetURI())) {
|
||||
if (MOZ_LIKELY(url->GetURI())) {
|
||||
display->mBinding = url;
|
||||
} else {
|
||||
display->mBinding = nullptr;
|
||||
@ -7680,16 +7681,16 @@ nsRuleNode::GetStyleData(nsStyleStructID aSID,
|
||||
}
|
||||
|
||||
data = mStyleData.GetStyleData(aSID);
|
||||
if (NS_LIKELY(data != nullptr))
|
||||
if (MOZ_LIKELY(data != nullptr))
|
||||
return data; // We have a fully specified struct. Just return it.
|
||||
|
||||
if (NS_UNLIKELY(!aComputeData))
|
||||
if (MOZ_UNLIKELY(!aComputeData))
|
||||
return nullptr;
|
||||
|
||||
// Nothing is cached. We'll have to delve further and examine our rules.
|
||||
data = WalkRuleTree(aSID, aContext);
|
||||
|
||||
if (NS_LIKELY(data != nullptr))
|
||||
if (MOZ_LIKELY(data != nullptr))
|
||||
return data;
|
||||
|
||||
NS_NOTREACHED("could not create style struct");
|
||||
@ -7718,16 +7719,16 @@ nsRuleNode::GetStyle##name_(nsStyleContext* aContext, bool aComputeData) \
|
||||
} \
|
||||
\
|
||||
data = mStyleData.GetStyle##name_(); \
|
||||
if (NS_LIKELY(data != nullptr)) \
|
||||
if (MOZ_LIKELY(data != nullptr)) \
|
||||
return data; \
|
||||
\
|
||||
if (NS_UNLIKELY(!aComputeData)) \
|
||||
return nullptr; \
|
||||
if (MOZ_UNLIKELY(!aComputeData)) \
|
||||
return nullptr; \
|
||||
\
|
||||
data = static_cast<const nsStyle##name_ *> \
|
||||
(WalkRuleTree(eStyleStruct_##name_, aContext)); \
|
||||
\
|
||||
if (NS_LIKELY(data != nullptr)) \
|
||||
if (MOZ_LIKELY(data != nullptr)) \
|
||||
return data; \
|
||||
\
|
||||
NS_NOTREACHED("could not create style struct"); \
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "prlog.h"
|
||||
#include <math.h>
|
||||
#include "gfxMatrix.h"
|
||||
@ -878,13 +879,13 @@ MOZ_ALWAYS_INLINE float
|
||||
EnsureNotNan(float aValue)
|
||||
{
|
||||
// This would benefit from a MOZ_FLOAT_IS_NaN if we had one.
|
||||
return NS_LIKELY(!MOZ_DOUBLE_IS_NaN(aValue)) ? aValue : 0;
|
||||
return MOZ_LIKELY(!MOZ_DOUBLE_IS_NaN(aValue)) ? aValue : 0;
|
||||
}
|
||||
template<>
|
||||
MOZ_ALWAYS_INLINE double
|
||||
EnsureNotNan(double aValue)
|
||||
{
|
||||
return NS_LIKELY(!MOZ_DOUBLE_IS_NaN(aValue)) ? aValue : 0;
|
||||
return MOZ_LIKELY(!MOZ_DOUBLE_IS_NaN(aValue)) ? aValue : 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -3379,7 +3380,7 @@ nsStyleAnimation::Value::SetUnparsedStringValue(const nsString& aString)
|
||||
FreeValue();
|
||||
mUnit = eUnit_UnparsedString;
|
||||
mValue.mString = nsCSSValue::BufferFromString(aString).get();
|
||||
if (NS_UNLIKELY(!mValue.mString)) {
|
||||
if (MOZ_UNLIKELY(!mValue.mString)) {
|
||||
// not much we can do here; just make sure that our promise of a
|
||||
// non-null mValue.mString holds for string units.
|
||||
mUnit = eUnit_Null;
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "imgIContainer.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
MOZ_STATIC_ASSERT((((1 << nsStyleStructID_Length) - 1) &
|
||||
~(NS_STYLE_INHERIT_MASK)) == 0,
|
||||
"Not enough bits in NS_STYLE_INHERIT_MASK");
|
||||
@ -384,7 +386,7 @@ nsBorderColors*
|
||||
nsBorderColors::Clone(bool aDeep) const
|
||||
{
|
||||
nsBorderColors* result = new nsBorderColors(mColor);
|
||||
if (NS_UNLIKELY(!result))
|
||||
if (MOZ_UNLIKELY(!result))
|
||||
return result;
|
||||
if (aDeep)
|
||||
NS_CSS_CLONE_LIST_MEMBER(nsBorderColors, this, mNext, result, (false));
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layout;
|
||||
@ -1406,7 +1407,7 @@ nsTableFrame::ProcessRowInserted(nscoord aNewHeight)
|
||||
nsTableFrame::MarkIntrinsicWidthsDirty()
|
||||
{
|
||||
nsITableLayoutStrategy* tls = LayoutStrategy();
|
||||
if (NS_UNLIKELY(!tls)) {
|
||||
if (MOZ_UNLIKELY(!tls)) {
|
||||
// This is a FrameNeedsReflow() from nsBlockFrame::RemoveFrame()
|
||||
// walking up the ancestor chain in a table next-in-flow. In this case
|
||||
// our original first-in-flow (which owns the TableLayoutStrategy) has
|
||||
@ -2191,7 +2192,7 @@ nsTableFrame::HomogenousInsertFrames(ChildListID aListID,
|
||||
pseudoFrame = pseudoFrame->GetFirstPrincipalChild();
|
||||
}
|
||||
nsCOMPtr<nsIContent> container = content->GetParent();
|
||||
if (NS_LIKELY(container)) { // XXX need this null-check, see bug 411823.
|
||||
if (MOZ_LIKELY(container)) { // XXX need this null-check, see bug 411823.
|
||||
int32_t newIndex = container->IndexOf(content);
|
||||
nsIFrame* kidFrame;
|
||||
bool isColGroup = (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP ==
|
||||
|
@ -37,10 +37,11 @@
|
||||
#include "nsISound.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -251,7 +252,7 @@ nsMenuFrame::Init(nsIContent* aContent,
|
||||
|
||||
// Set up a mediator which can be used for callbacks on this frame.
|
||||
mTimerMediator = new nsMenuTimerMediator(this);
|
||||
if (NS_UNLIKELY(!mTimerMediator))
|
||||
if (MOZ_UNLIKELY(!mTimerMediator))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
InitMenuParent(aParent);
|
||||
@ -1300,7 +1301,7 @@ nsMenuFrame::InsertFrames(ChildListID aListID,
|
||||
if (aFrameList.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
if (NS_UNLIKELY(aPrevFrame && aPrevFrame == GetPopup())) {
|
||||
if (MOZ_UNLIKELY(aPrevFrame && aPrevFrame == GetPopup())) {
|
||||
aPrevFrame = nullptr;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsBoxFrame.h"
|
||||
#include "StackArena.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
nsBoxLayout* nsSprocketLayout::gInstance = nullptr;
|
||||
|
||||
@ -837,7 +838,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIFrame* aBox, nsBoxLayoutState& aState, nsB
|
||||
if (childCount > 0) {
|
||||
nscoord maxAllowedFlex = nscoord_MAX / childCount;
|
||||
|
||||
if (NS_UNLIKELY(maxFlex > maxAllowedFlex)) {
|
||||
if (MOZ_UNLIKELY(maxFlex > maxAllowedFlex)) {
|
||||
// clamp all the flexes
|
||||
currentBox = aBoxSizes;
|
||||
while (currentBox) {
|
||||
|
@ -58,6 +58,8 @@
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsIScriptableRegion.h"
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsAccessibilityService.h"
|
||||
#endif
|
||||
@ -181,7 +183,7 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
|
||||
nsSize min(0,0);
|
||||
int32_t desiredRows;
|
||||
if (NS_UNLIKELY(!baseElement)) {
|
||||
if (MOZ_UNLIKELY(!baseElement)) {
|
||||
desiredRows = 0;
|
||||
}
|
||||
else if (baseElement->Tag() == nsGkAtoms::select &&
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "prmem.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
@ -114,7 +115,7 @@ NS_ReadLine (StreamType* aStream, nsLineBuffer<CharT> * aBuffer,
|
||||
if (aBuffer->start == aBuffer->end) { // buffer is empty. Read into it.
|
||||
uint32_t bytesRead;
|
||||
nsresult rv = aStream->Read(aBuffer->buf, kLineBufferSize, &bytesRead);
|
||||
if (NS_FAILED(rv) || NS_UNLIKELY(bytesRead == 0)) {
|
||||
if (NS_FAILED(rv) || MOZ_UNLIKELY(bytesRead == 0)) {
|
||||
*more = false;
|
||||
return rv;
|
||||
}
|
||||
@ -134,7 +135,7 @@ NS_ReadLine (StreamType* aStream, nsLineBuffer<CharT> * aBuffer,
|
||||
* more char after the end-of-line to set |more| correctly.
|
||||
*/
|
||||
CharT* current = aBuffer->start;
|
||||
if (NS_LIKELY(eolchar == 0)) {
|
||||
if (MOZ_LIKELY(eolchar == 0)) {
|
||||
for ( ; current < aBuffer->end; ++current) {
|
||||
if (*current == '\n' || *current == '\r') {
|
||||
eolchar = *current;
|
||||
@ -144,7 +145,7 @@ NS_ReadLine (StreamType* aStream, nsLineBuffer<CharT> * aBuffer,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NS_LIKELY(eolchar != 0)) {
|
||||
if (MOZ_LIKELY(eolchar != 0)) {
|
||||
for ( ; current < aBuffer->end; ++current) {
|
||||
if ((eolchar == '\r' && *current == '\n') ||
|
||||
(eolchar == '\n' && *current == '\r')) {
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
|
||||
// XXX: There is no good header file to put these in. :(
|
||||
@ -794,7 +795,7 @@ nsSocketTransportService::DoPollIteration(bool wait)
|
||||
// here -- otherwise, some compilers will treat it as signed,
|
||||
// which makes them fire signed/unsigned-comparison build
|
||||
// warnings for the comparison against 'pollInterval'.)
|
||||
if (NS_UNLIKELY(pollInterval >
|
||||
if (MOZ_UNLIKELY(pollInterval >
|
||||
static_cast<uint32_t>(UINT16_MAX) -
|
||||
s.mElapsedTime))
|
||||
s.mElapsedTime = UINT16_MAX;
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "mozilla/storage.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "mozIApplication.h"
|
||||
|
||||
@ -2072,11 +2073,11 @@ nsCookieService::EnsureReadDomain(const nsCookieKey &aKey)
|
||||
"not in default db state");
|
||||
|
||||
// Fast path 1: nothing to read, or we've already finished reading.
|
||||
if (NS_LIKELY(!mDBState->dbConn || !mDefaultDBState->pendingRead))
|
||||
if (MOZ_LIKELY(!mDBState->dbConn || !mDefaultDBState->pendingRead))
|
||||
return;
|
||||
|
||||
// Fast path 2: already read in this particular domain.
|
||||
if (NS_LIKELY(mDefaultDBState->readSet.GetEntry(aKey)))
|
||||
if (MOZ_LIKELY(mDefaultDBState->readSet.GetEntry(aKey)))
|
||||
return;
|
||||
|
||||
// Read in the data synchronously.
|
||||
@ -2167,7 +2168,7 @@ nsCookieService::EnsureReadComplete()
|
||||
"not in default db state");
|
||||
|
||||
// Fast path 1: nothing to read, or we've already finished reading.
|
||||
if (NS_LIKELY(!mDBState->dbConn || !mDefaultDBState->pendingRead))
|
||||
if (MOZ_LIKELY(!mDBState->dbConn || !mDefaultDBState->pendingRead))
|
||||
return;
|
||||
|
||||
// Cancel the pending read, so we don't get any more results.
|
||||
|
@ -2,6 +2,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
void
|
||||
nsHtml5Tokenizer::StartPlainText()
|
||||
{
|
||||
@ -37,12 +39,12 @@ nsHtml5Tokenizer::errWarnLtSlashInRcdata()
|
||||
{
|
||||
}
|
||||
|
||||
// The null checks below annotated NS_LIKELY are not actually necessary.
|
||||
// The null checks below annotated MOZ_LIKELY are not actually necessary.
|
||||
|
||||
void
|
||||
nsHtml5Tokenizer::errUnquotedAttributeValOrNull(PRUnichar c)
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
switch (c) {
|
||||
case '<':
|
||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeLt");
|
||||
@ -64,7 +66,7 @@ nsHtml5Tokenizer::errUnquotedAttributeValOrNull(PRUnichar c)
|
||||
void
|
||||
nsHtml5Tokenizer::errLtOrEqualsOrGraveInUnquotedAttributeOrNull(PRUnichar c)
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
switch (c) {
|
||||
case '=':
|
||||
mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartEquals");
|
||||
@ -82,7 +84,7 @@ nsHtml5Tokenizer::errLtOrEqualsOrGraveInUnquotedAttributeOrNull(PRUnichar c)
|
||||
void
|
||||
nsHtml5Tokenizer::errBadCharBeforeAttributeNameOrNull(PRUnichar c)
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
if (c == '<') {
|
||||
mViewSource->AddErrorToCurrentNode("errBadCharBeforeAttributeNameLt");
|
||||
} else if (c == '=') {
|
||||
@ -96,7 +98,7 @@ nsHtml5Tokenizer::errBadCharBeforeAttributeNameOrNull(PRUnichar c)
|
||||
void
|
||||
nsHtml5Tokenizer::errBadCharAfterLt(PRUnichar c)
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errBadCharAfterLt");
|
||||
}
|
||||
}
|
||||
@ -104,7 +106,7 @@ nsHtml5Tokenizer::errBadCharAfterLt(PRUnichar c)
|
||||
void
|
||||
nsHtml5Tokenizer::errQuoteOrLtInAttributeNameOrNull(PRUnichar c)
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
if (c == '<') {
|
||||
mViewSource->AddErrorToCurrentNode("errLtInAttributeName");
|
||||
} else if (c != 0xFFFD) {
|
||||
@ -136,7 +138,7 @@ nsHtml5Tokenizer::maybeErrSlashInEndTag(bool selfClosing)
|
||||
PRUnichar
|
||||
nsHtml5Tokenizer::errNcrNonCharacter(PRUnichar ch)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrNonCharacter");
|
||||
}
|
||||
return ch;
|
||||
@ -145,7 +147,7 @@ nsHtml5Tokenizer::errNcrNonCharacter(PRUnichar ch)
|
||||
void
|
||||
nsHtml5Tokenizer::errAstralNonCharacter(int32_t ch)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrNonCharacter");
|
||||
}
|
||||
}
|
||||
@ -153,7 +155,7 @@ nsHtml5Tokenizer::errAstralNonCharacter(int32_t ch)
|
||||
PRUnichar
|
||||
nsHtml5Tokenizer::errNcrControlChar(PRUnichar ch)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrControlChar");
|
||||
}
|
||||
return ch;
|
||||
@ -162,7 +164,7 @@ nsHtml5Tokenizer::errNcrControlChar(PRUnichar ch)
|
||||
void
|
||||
nsHtml5Tokenizer::errGarbageAfterLtSlash()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errGarbageAfterLtSlash");
|
||||
}
|
||||
}
|
||||
@ -170,7 +172,7 @@ nsHtml5Tokenizer::errGarbageAfterLtSlash()
|
||||
void
|
||||
nsHtml5Tokenizer::errLtSlashGt()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errLtSlashGt");
|
||||
}
|
||||
}
|
||||
@ -178,7 +180,7 @@ nsHtml5Tokenizer::errLtSlashGt()
|
||||
void
|
||||
nsHtml5Tokenizer::errCharRefLacksSemicolon()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errCharRefLacksSemicolon");
|
||||
}
|
||||
}
|
||||
@ -186,7 +188,7 @@ nsHtml5Tokenizer::errCharRefLacksSemicolon()
|
||||
void
|
||||
nsHtml5Tokenizer::errNoDigitsInNCR()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNoDigitsInNCR");
|
||||
}
|
||||
}
|
||||
@ -194,7 +196,7 @@ nsHtml5Tokenizer::errNoDigitsInNCR()
|
||||
void
|
||||
nsHtml5Tokenizer::errGtInSystemId()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errGtInSystemId");
|
||||
}
|
||||
}
|
||||
@ -202,7 +204,7 @@ nsHtml5Tokenizer::errGtInSystemId()
|
||||
void
|
||||
nsHtml5Tokenizer::errGtInPublicId()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errGtInPublicId");
|
||||
}
|
||||
}
|
||||
@ -210,7 +212,7 @@ nsHtml5Tokenizer::errGtInPublicId()
|
||||
void
|
||||
nsHtml5Tokenizer::errNamelessDoctype()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNamelessDoctype");
|
||||
}
|
||||
}
|
||||
@ -218,7 +220,7 @@ nsHtml5Tokenizer::errNamelessDoctype()
|
||||
void
|
||||
nsHtml5Tokenizer::errConsecutiveHyphens()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errConsecutiveHyphens");
|
||||
}
|
||||
}
|
||||
@ -226,7 +228,7 @@ nsHtml5Tokenizer::errConsecutiveHyphens()
|
||||
void
|
||||
nsHtml5Tokenizer::errPrematureEndOfComment()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errPrematureEndOfComment");
|
||||
}
|
||||
}
|
||||
@ -234,7 +236,7 @@ nsHtml5Tokenizer::errPrematureEndOfComment()
|
||||
void
|
||||
nsHtml5Tokenizer::errBogusComment()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errBogusComment");
|
||||
}
|
||||
}
|
||||
@ -242,7 +244,7 @@ nsHtml5Tokenizer::errBogusComment()
|
||||
void
|
||||
nsHtml5Tokenizer::errSlashNotFollowedByGt()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentSlash("errSlashNotFollowedByGt");
|
||||
}
|
||||
}
|
||||
@ -250,7 +252,7 @@ nsHtml5Tokenizer::errSlashNotFollowedByGt()
|
||||
void
|
||||
nsHtml5Tokenizer::errNoSpaceBetweenAttributes()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenAttributes");
|
||||
}
|
||||
}
|
||||
@ -258,7 +260,7 @@ nsHtml5Tokenizer::errNoSpaceBetweenAttributes()
|
||||
void
|
||||
nsHtml5Tokenizer::errAttributeValueMissing()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errAttributeValueMissing");
|
||||
}
|
||||
}
|
||||
@ -266,7 +268,7 @@ nsHtml5Tokenizer::errAttributeValueMissing()
|
||||
void
|
||||
nsHtml5Tokenizer::errEqualsSignBeforeAttributeName()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errEqualsSignBeforeAttributeName");
|
||||
}
|
||||
}
|
||||
@ -274,7 +276,7 @@ nsHtml5Tokenizer::errEqualsSignBeforeAttributeName()
|
||||
void
|
||||
nsHtml5Tokenizer::errLtGt()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errLtGt");
|
||||
}
|
||||
}
|
||||
@ -282,7 +284,7 @@ nsHtml5Tokenizer::errLtGt()
|
||||
void
|
||||
nsHtml5Tokenizer::errProcessingInstruction()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errProcessingInstruction");
|
||||
}
|
||||
}
|
||||
@ -290,7 +292,7 @@ nsHtml5Tokenizer::errProcessingInstruction()
|
||||
void
|
||||
nsHtml5Tokenizer::errUnescapedAmpersandInterpretedAsCharacterReference()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentAmpersand("errUnescapedAmpersandInterpretedAsCharacterReference");
|
||||
}
|
||||
}
|
||||
@ -298,7 +300,7 @@ nsHtml5Tokenizer::errUnescapedAmpersandInterpretedAsCharacterReference()
|
||||
void
|
||||
nsHtml5Tokenizer::errNotSemicolonTerminated()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNotSemicolonTerminated");
|
||||
}
|
||||
}
|
||||
@ -306,7 +308,7 @@ nsHtml5Tokenizer::errNotSemicolonTerminated()
|
||||
void
|
||||
nsHtml5Tokenizer::errNoNamedCharacterMatch()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentAmpersand("errNoNamedCharacterMatch");
|
||||
}
|
||||
}
|
||||
@ -314,7 +316,7 @@ nsHtml5Tokenizer::errNoNamedCharacterMatch()
|
||||
void
|
||||
nsHtml5Tokenizer::errQuoteBeforeAttributeName(PRUnichar c)
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errQuoteBeforeAttributeName");
|
||||
}
|
||||
}
|
||||
@ -322,7 +324,7 @@ nsHtml5Tokenizer::errQuoteBeforeAttributeName(PRUnichar c)
|
||||
void
|
||||
nsHtml5Tokenizer::errExpectedPublicId()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errExpectedPublicId");
|
||||
}
|
||||
}
|
||||
@ -330,7 +332,7 @@ nsHtml5Tokenizer::errExpectedPublicId()
|
||||
void
|
||||
nsHtml5Tokenizer::errBogusDoctype()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errBogusDoctype");
|
||||
}
|
||||
}
|
||||
@ -338,7 +340,7 @@ nsHtml5Tokenizer::errBogusDoctype()
|
||||
void
|
||||
nsHtml5Tokenizer::errNcrSurrogate()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrSurrogate");
|
||||
}
|
||||
}
|
||||
@ -346,7 +348,7 @@ nsHtml5Tokenizer::errNcrSurrogate()
|
||||
void
|
||||
nsHtml5Tokenizer::errNcrCr()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrCr");
|
||||
}
|
||||
}
|
||||
@ -354,7 +356,7 @@ nsHtml5Tokenizer::errNcrCr()
|
||||
void
|
||||
nsHtml5Tokenizer::errNcrInC1Range()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrInC1Range");
|
||||
}
|
||||
}
|
||||
@ -362,7 +364,7 @@ nsHtml5Tokenizer::errNcrInC1Range()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofInPublicId()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofInPublicId");
|
||||
}
|
||||
}
|
||||
@ -370,7 +372,7 @@ nsHtml5Tokenizer::errEofInPublicId()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofInComment()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofInComment");
|
||||
}
|
||||
}
|
||||
@ -378,7 +380,7 @@ nsHtml5Tokenizer::errEofInComment()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofInDoctype()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofInDoctype");
|
||||
}
|
||||
}
|
||||
@ -386,7 +388,7 @@ nsHtml5Tokenizer::errEofInDoctype()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofInAttributeValue()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofInAttributeValue");
|
||||
}
|
||||
}
|
||||
@ -394,7 +396,7 @@ nsHtml5Tokenizer::errEofInAttributeValue()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofInAttributeName()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofInAttributeName");
|
||||
}
|
||||
}
|
||||
@ -402,7 +404,7 @@ nsHtml5Tokenizer::errEofInAttributeName()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofWithoutGt()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofWithoutGt");
|
||||
}
|
||||
}
|
||||
@ -410,7 +412,7 @@ nsHtml5Tokenizer::errEofWithoutGt()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofInTagName()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofInTagName");
|
||||
}
|
||||
}
|
||||
@ -418,7 +420,7 @@ nsHtml5Tokenizer::errEofInTagName()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofInEndTag()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofInEndTag");
|
||||
}
|
||||
}
|
||||
@ -426,7 +428,7 @@ nsHtml5Tokenizer::errEofInEndTag()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofAfterLt()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofAfterLt");
|
||||
}
|
||||
}
|
||||
@ -434,7 +436,7 @@ nsHtml5Tokenizer::errEofAfterLt()
|
||||
void
|
||||
nsHtml5Tokenizer::errNcrOutOfRange()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrOutOfRange");
|
||||
}
|
||||
}
|
||||
@ -442,7 +444,7 @@ nsHtml5Tokenizer::errNcrOutOfRange()
|
||||
void
|
||||
nsHtml5Tokenizer::errNcrUnassigned()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrUnassigned");
|
||||
}
|
||||
}
|
||||
@ -450,7 +452,7 @@ nsHtml5Tokenizer::errNcrUnassigned()
|
||||
void
|
||||
nsHtml5Tokenizer::errDuplicateAttribute()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errDuplicateAttribute");
|
||||
}
|
||||
}
|
||||
@ -458,7 +460,7 @@ nsHtml5Tokenizer::errDuplicateAttribute()
|
||||
void
|
||||
nsHtml5Tokenizer::errEofInSystemId()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEofInSystemId");
|
||||
}
|
||||
}
|
||||
@ -466,7 +468,7 @@ nsHtml5Tokenizer::errEofInSystemId()
|
||||
void
|
||||
nsHtml5Tokenizer::errExpectedSystemId()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errExpectedSystemId");
|
||||
}
|
||||
}
|
||||
@ -474,7 +476,7 @@ nsHtml5Tokenizer::errExpectedSystemId()
|
||||
void
|
||||
nsHtml5Tokenizer::errMissingSpaceBeforeDoctypeName()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errMissingSpaceBeforeDoctypeName");
|
||||
}
|
||||
}
|
||||
@ -482,7 +484,7 @@ nsHtml5Tokenizer::errMissingSpaceBeforeDoctypeName()
|
||||
void
|
||||
nsHtml5Tokenizer::errHyphenHyphenBang()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errHyphenHyphenBang");
|
||||
}
|
||||
}
|
||||
@ -490,7 +492,7 @@ nsHtml5Tokenizer::errHyphenHyphenBang()
|
||||
void
|
||||
nsHtml5Tokenizer::errNcrControlChar()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrControlChar");
|
||||
}
|
||||
}
|
||||
@ -498,7 +500,7 @@ nsHtml5Tokenizer::errNcrControlChar()
|
||||
void
|
||||
nsHtml5Tokenizer::errNcrZero()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNcrZero");
|
||||
}
|
||||
}
|
||||
@ -506,7 +508,7 @@ nsHtml5Tokenizer::errNcrZero()
|
||||
void
|
||||
nsHtml5Tokenizer::errNoSpaceBetweenDoctypeSystemKeywordAndQuote()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenDoctypeSystemKeywordAndQuote");
|
||||
}
|
||||
}
|
||||
@ -514,7 +516,7 @@ nsHtml5Tokenizer::errNoSpaceBetweenDoctypeSystemKeywordAndQuote()
|
||||
void
|
||||
nsHtml5Tokenizer::errNoSpaceBetweenPublicAndSystemIds()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenPublicAndSystemIds");
|
||||
}
|
||||
}
|
||||
@ -522,7 +524,7 @@ nsHtml5Tokenizer::errNoSpaceBetweenPublicAndSystemIds()
|
||||
void
|
||||
nsHtml5Tokenizer::errNoSpaceBetweenDoctypePublicKeywordAndQuote()
|
||||
{
|
||||
if (NS_LIKELY(mViewSource)) {
|
||||
if (MOZ_LIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenDoctypePublicKeywordAndQuote");
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,8 @@
|
||||
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
PRUnichar nsHtml5TreeBuilder::REPLACEMENT_CHARACTER[] = { 0xfffd };
|
||||
static const char* const QUIRKY_PUBLIC_IDS_DATA[] = { "+//silmaril//dtd html pro v0r11 19970101//", "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", "-//as//dtd html 3.0 aswedit + extensions//", "-//ietf//dtd html 2.0 level 1//", "-//ietf//dtd html 2.0 level 2//", "-//ietf//dtd html 2.0 strict level 1//", "-//ietf//dtd html 2.0 strict level 2//", "-//ietf//dtd html 2.0 strict//", "-//ietf//dtd html 2.0//", "-//ietf//dtd html 2.1e//", "-//ietf//dtd html 3.0//", "-//ietf//dtd html 3.2 final//", "-//ietf//dtd html 3.2//", "-//ietf//dtd html 3//", "-//ietf//dtd html level 0//", "-//ietf//dtd html level 1//", "-//ietf//dtd html level 2//", "-//ietf//dtd html level 3//", "-//ietf//dtd html strict level 0//", "-//ietf//dtd html strict level 1//", "-//ietf//dtd html strict level 2//", "-//ietf//dtd html strict level 3//", "-//ietf//dtd html strict//", "-//ietf//dtd html//", "-//metrius//dtd metrius presentational//", "-//microsoft//dtd internet explorer 2.0 html strict//", "-//microsoft//dtd internet explorer 2.0 html//", "-//microsoft//dtd internet explorer 2.0 tables//", "-//microsoft//dtd internet explorer 3.0 html strict//", "-//microsoft//dtd internet explorer 3.0 html//", "-//microsoft//dtd internet explorer 3.0 tables//", "-//netscape comm. corp.//dtd html//", "-//netscape comm. corp.//dtd strict html//", "-//o'reilly and associates//dtd html 2.0//", "-//o'reilly and associates//dtd html extended 1.0//", "-//o'reilly and associates//dtd html extended relaxed 1.0//", "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//", "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//", "-//spyglass//dtd html 2.0 extended//", "-//sq//dtd html 2.0 hotmetal + extensions//", "-//sun microsystems corp.//dtd hotjava html//", "-//sun microsystems corp.//dtd hotjava strict html//", "-//w3c//dtd html 3 1995-03-24//", "-//w3c//dtd html 3.2 draft//", "-//w3c//dtd html 3.2 final//", "-//w3c//dtd html 3.2//", "-//w3c//dtd html 3.2s draft//", "-//w3c//dtd html 4.0 frameset//", "-//w3c//dtd html 4.0 transitional//", "-//w3c//dtd html experimental 19960712//", "-//w3c//dtd html experimental 970421//", "-//w3c//dtd w3 html//", "-//w3o//dtd w3 html 3.0//", "-//webtechs//dtd mozilla html 2.0//", "-//webtechs//dtd mozilla html//" };
|
||||
staticJArray<const char*,int32_t> nsHtml5TreeBuilder::QUIRKY_PUBLIC_IDS = { QUIRKY_PUBLIC_IDS_DATA, NS_ARRAY_LENGTH(QUIRKY_PUBLIC_IDS_DATA) };
|
||||
@ -746,7 +748,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
|
||||
NS_HTML5_BREAK(starttagloop);
|
||||
}
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && !isCurrent(nsHtml5Atoms::table)) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(nsHtml5Atoms::table)) {
|
||||
errNoCheckUnclosedElementsOnStack();
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -813,7 +815,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
|
||||
NS_HTML5_BREAK(starttagloop);
|
||||
}
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && currentPtr != eltPos) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && currentPtr != eltPos) {
|
||||
errNoCheckUnclosedElementsOnStack();
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -984,7 +986,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
|
||||
nsHtml5StackNode* node = stack[eltPos];
|
||||
if (node->getGroup() == group) {
|
||||
generateImpliedEndTagsExceptFor(node->name);
|
||||
if (!!NS_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
errUnclosedElementsImplied(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -1051,7 +1053,7 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
|
||||
if (eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK) {
|
||||
errFooSeenWhenFooOpen(name);
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
errUnclosedElementsImplied(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2191,7 +2193,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
NS_HTML5_BREAK(endtagloop);
|
||||
}
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && currentPtr != eltPos) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && currentPtr != eltPos) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2208,7 +2210,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
NS_HTML5_BREAK(endtagloop);
|
||||
}
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && currentPtr != eltPos) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && currentPtr != eltPos) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2241,7 +2243,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
NS_HTML5_BREAK(endtagloop);
|
||||
}
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2283,7 +2285,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
NS_HTML5_BREAK(endtagloop);
|
||||
}
|
||||
MOZ_ASSERT(currentPtr >= 1);
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
for (int32_t i = 2; i <= currentPtr; i++) {
|
||||
switch(stack[i]->getGroup()) {
|
||||
case NS_HTML5TREE_BUILDER_DD_OR_DT:
|
||||
@ -2313,7 +2315,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
errStrayEndTag(name);
|
||||
NS_HTML5_BREAK(endtagloop);
|
||||
}
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
for (int32_t i = 0; i <= currentPtr; i++) {
|
||||
switch(stack[i]->getGroup()) {
|
||||
case NS_HTML5TREE_BUILDER_DD_OR_DT:
|
||||
@ -2347,7 +2349,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
errStrayEndTag(name);
|
||||
} else {
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2368,7 +2370,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
NS_HTML5_BREAK(endtagloop);
|
||||
}
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
removeFromStack(eltPos);
|
||||
@ -2389,7 +2391,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
}
|
||||
generateImpliedEndTagsExceptFor(nsHtml5Atoms::p);
|
||||
MOZ_ASSERT(eltPos != NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK);
|
||||
if (!!NS_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2403,7 +2405,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
errNoElementToCloseButEndTagSeen(name);
|
||||
} else {
|
||||
generateImpliedEndTagsExceptFor(name);
|
||||
if (!!NS_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2418,7 +2420,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
errNoElementToCloseButEndTagSeen(name);
|
||||
} else {
|
||||
generateImpliedEndTagsExceptFor(name);
|
||||
if (!!NS_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2433,7 +2435,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
errStrayEndTag(name);
|
||||
} else {
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2449,7 +2451,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
errStrayEndTag(name);
|
||||
} else {
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2516,7 +2518,7 @@ nsHtml5TreeBuilder::endTag(nsHtml5ElementName* elementName)
|
||||
nsHtml5StackNode* node = stack[eltPos];
|
||||
if (node->name == name) {
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && !isCurrent(name)) {
|
||||
errUnclosedElements(eltPos, name);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -2996,7 +2998,7 @@ void
|
||||
nsHtml5TreeBuilder::closeTheCell(int32_t eltPos)
|
||||
{
|
||||
generateImpliedEndTags();
|
||||
if (!!NS_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
errUnclosedElementsCell(eltPos);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
@ -3103,7 +3105,7 @@ nsHtml5TreeBuilder::implicitlyCloseP()
|
||||
return;
|
||||
}
|
||||
generateImpliedEndTagsExceptFor(nsHtml5Atoms::p);
|
||||
if (!!NS_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
if (!!MOZ_UNLIKELY(mViewSource) && eltPos != currentPtr) {
|
||||
errUnclosedElementsImplied(eltPos, nsHtml5Atoms::p);
|
||||
}
|
||||
while (currentPtr >= eltPos) {
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
class nsPresContext;
|
||||
|
||||
@ -751,7 +752,7 @@ nsHtml5TreeBuilder::EnableViewSource(nsHtml5Highlighter* aHighlighter)
|
||||
void
|
||||
nsHtml5TreeBuilder::errStrayStartTag(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errStrayStartTag2", aName);
|
||||
}
|
||||
}
|
||||
@ -759,7 +760,7 @@ nsHtml5TreeBuilder::errStrayStartTag(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errStrayEndTag(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errStrayEndTag", aName);
|
||||
}
|
||||
}
|
||||
@ -767,7 +768,7 @@ nsHtml5TreeBuilder::errStrayEndTag(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errUnclosedElements(int32_t aIndex, nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errUnclosedElements", aName);
|
||||
}
|
||||
}
|
||||
@ -775,7 +776,7 @@ nsHtml5TreeBuilder::errUnclosedElements(int32_t aIndex, nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errUnclosedElementsImplied(int32_t aIndex, nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errUnclosedElementsImplied",
|
||||
aName);
|
||||
}
|
||||
@ -784,7 +785,7 @@ nsHtml5TreeBuilder::errUnclosedElementsImplied(int32_t aIndex, nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errUnclosedElementsCell(int32_t aIndex)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errUnclosedElementsCell");
|
||||
}
|
||||
}
|
||||
@ -792,7 +793,7 @@ nsHtml5TreeBuilder::errUnclosedElementsCell(int32_t aIndex)
|
||||
void
|
||||
nsHtml5TreeBuilder::errStrayDoctype()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errStrayDoctype");
|
||||
}
|
||||
}
|
||||
@ -800,7 +801,7 @@ nsHtml5TreeBuilder::errStrayDoctype()
|
||||
void
|
||||
nsHtml5TreeBuilder::errAlmostStandardsDoctype()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errAlmostStandardsDoctype");
|
||||
}
|
||||
}
|
||||
@ -808,7 +809,7 @@ nsHtml5TreeBuilder::errAlmostStandardsDoctype()
|
||||
void
|
||||
nsHtml5TreeBuilder::errQuirkyDoctype()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errQuirkyDoctype");
|
||||
}
|
||||
}
|
||||
@ -816,7 +817,7 @@ nsHtml5TreeBuilder::errQuirkyDoctype()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNonSpaceInTrailer()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNonSpaceInTrailer");
|
||||
}
|
||||
}
|
||||
@ -824,7 +825,7 @@ nsHtml5TreeBuilder::errNonSpaceInTrailer()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNonSpaceAfterFrameset()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNonSpaceAfterFrameset");
|
||||
}
|
||||
}
|
||||
@ -832,7 +833,7 @@ nsHtml5TreeBuilder::errNonSpaceAfterFrameset()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNonSpaceInFrameset()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNonSpaceInFrameset");
|
||||
}
|
||||
}
|
||||
@ -840,7 +841,7 @@ nsHtml5TreeBuilder::errNonSpaceInFrameset()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNonSpaceAfterBody()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNonSpaceAfterBody");
|
||||
}
|
||||
}
|
||||
@ -848,7 +849,7 @@ nsHtml5TreeBuilder::errNonSpaceAfterBody()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNonSpaceInColgroupInFragment()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNonSpaceInColgroupInFragment");
|
||||
}
|
||||
}
|
||||
@ -856,7 +857,7 @@ nsHtml5TreeBuilder::errNonSpaceInColgroupInFragment()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNonSpaceInNoscriptInHead()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNonSpaceInNoscriptInHead");
|
||||
}
|
||||
}
|
||||
@ -864,7 +865,7 @@ nsHtml5TreeBuilder::errNonSpaceInNoscriptInHead()
|
||||
void
|
||||
nsHtml5TreeBuilder::errFooBetweenHeadAndBody(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errFooBetweenHeadAndBody", aName);
|
||||
}
|
||||
}
|
||||
@ -872,7 +873,7 @@ nsHtml5TreeBuilder::errFooBetweenHeadAndBody(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errStartTagWithoutDoctype()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errStartTagWithoutDoctype");
|
||||
}
|
||||
}
|
||||
@ -880,7 +881,7 @@ nsHtml5TreeBuilder::errStartTagWithoutDoctype()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNoSelectInTableScope()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNoSelectInTableScope");
|
||||
}
|
||||
}
|
||||
@ -888,7 +889,7 @@ nsHtml5TreeBuilder::errNoSelectInTableScope()
|
||||
void
|
||||
nsHtml5TreeBuilder::errStartSelectWhereEndSelectExpected()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun(
|
||||
"errStartSelectWhereEndSelectExpected");
|
||||
}
|
||||
@ -897,7 +898,7 @@ nsHtml5TreeBuilder::errStartSelectWhereEndSelectExpected()
|
||||
void
|
||||
nsHtml5TreeBuilder::errStartTagWithSelectOpen(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errStartTagWithSelectOpen", aName);
|
||||
}
|
||||
}
|
||||
@ -905,7 +906,7 @@ nsHtml5TreeBuilder::errStartTagWithSelectOpen(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errBadStartTagInHead(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errBadStartTagInHead2", aName);
|
||||
}
|
||||
}
|
||||
@ -913,7 +914,7 @@ nsHtml5TreeBuilder::errBadStartTagInHead(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errImage()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errImage");
|
||||
}
|
||||
}
|
||||
@ -921,7 +922,7 @@ nsHtml5TreeBuilder::errImage()
|
||||
void
|
||||
nsHtml5TreeBuilder::errIsindex()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errIsindex");
|
||||
}
|
||||
}
|
||||
@ -929,7 +930,7 @@ nsHtml5TreeBuilder::errIsindex()
|
||||
void
|
||||
nsHtml5TreeBuilder::errFooSeenWhenFooOpen(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errFooSeenWhenFooOpen", aName);
|
||||
}
|
||||
}
|
||||
@ -937,7 +938,7 @@ nsHtml5TreeBuilder::errFooSeenWhenFooOpen(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errHeadingWhenHeadingOpen()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errHeadingWhenHeadingOpen");
|
||||
}
|
||||
}
|
||||
@ -945,7 +946,7 @@ nsHtml5TreeBuilder::errHeadingWhenHeadingOpen()
|
||||
void
|
||||
nsHtml5TreeBuilder::errFramesetStart()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errFramesetStart");
|
||||
}
|
||||
}
|
||||
@ -953,7 +954,7 @@ nsHtml5TreeBuilder::errFramesetStart()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNoCellToClose()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNoCellToClose");
|
||||
}
|
||||
}
|
||||
@ -961,7 +962,7 @@ nsHtml5TreeBuilder::errNoCellToClose()
|
||||
void
|
||||
nsHtml5TreeBuilder::errStartTagInTable(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errStartTagInTable", aName);
|
||||
}
|
||||
}
|
||||
@ -969,7 +970,7 @@ nsHtml5TreeBuilder::errStartTagInTable(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errFormWhenFormOpen()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errFormWhenFormOpen");
|
||||
}
|
||||
}
|
||||
@ -977,7 +978,7 @@ nsHtml5TreeBuilder::errFormWhenFormOpen()
|
||||
void
|
||||
nsHtml5TreeBuilder::errTableSeenWhileTableOpen()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errTableSeenWhileTableOpen");
|
||||
}
|
||||
}
|
||||
@ -985,7 +986,7 @@ nsHtml5TreeBuilder::errTableSeenWhileTableOpen()
|
||||
void
|
||||
nsHtml5TreeBuilder::errStartTagInTableBody(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errStartTagInTableBody", aName);
|
||||
}
|
||||
}
|
||||
@ -993,7 +994,7 @@ nsHtml5TreeBuilder::errStartTagInTableBody(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errEndTagSeenWithoutDoctype()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEndTagSeenWithoutDoctype");
|
||||
}
|
||||
}
|
||||
@ -1001,7 +1002,7 @@ nsHtml5TreeBuilder::errEndTagSeenWithoutDoctype()
|
||||
void
|
||||
nsHtml5TreeBuilder::errEndTagAfterBody()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEndTagAfterBody");
|
||||
}
|
||||
}
|
||||
@ -1009,7 +1010,7 @@ nsHtml5TreeBuilder::errEndTagAfterBody()
|
||||
void
|
||||
nsHtml5TreeBuilder::errEndTagSeenWithSelectOpen(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEndTagSeenWithSelectOpen",
|
||||
aName);
|
||||
}
|
||||
@ -1018,7 +1019,7 @@ nsHtml5TreeBuilder::errEndTagSeenWithSelectOpen(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errGarbageInColgroup()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errGarbageInColgroup");
|
||||
}
|
||||
}
|
||||
@ -1026,7 +1027,7 @@ nsHtml5TreeBuilder::errGarbageInColgroup()
|
||||
void
|
||||
nsHtml5TreeBuilder::errEndTagBr()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEndTagBr");
|
||||
}
|
||||
}
|
||||
@ -1034,7 +1035,7 @@ nsHtml5TreeBuilder::errEndTagBr()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNoElementToCloseButEndTagSeen(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun(
|
||||
"errNoElementToCloseButEndTagSeen", aName);
|
||||
}
|
||||
@ -1043,7 +1044,7 @@ nsHtml5TreeBuilder::errNoElementToCloseButEndTagSeen(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errHtmlStartTagInForeignContext(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errHtmlStartTagInForeignContext",
|
||||
aName);
|
||||
}
|
||||
@ -1052,7 +1053,7 @@ nsHtml5TreeBuilder::errHtmlStartTagInForeignContext(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errTableClosedWhileCaptionOpen()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errTableClosedWhileCaptionOpen");
|
||||
}
|
||||
}
|
||||
@ -1060,7 +1061,7 @@ nsHtml5TreeBuilder::errTableClosedWhileCaptionOpen()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNoTableRowToClose()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNoTableRowToClose");
|
||||
}
|
||||
}
|
||||
@ -1068,7 +1069,7 @@ nsHtml5TreeBuilder::errNoTableRowToClose()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNonSpaceInTable()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errNonSpaceInTable");
|
||||
}
|
||||
}
|
||||
@ -1076,7 +1077,7 @@ nsHtml5TreeBuilder::errNonSpaceInTable()
|
||||
void
|
||||
nsHtml5TreeBuilder::errUnclosedChildrenInRuby()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errUnclosedChildrenInRuby");
|
||||
}
|
||||
}
|
||||
@ -1084,7 +1085,7 @@ nsHtml5TreeBuilder::errUnclosedChildrenInRuby()
|
||||
void
|
||||
nsHtml5TreeBuilder::errStartTagSeenWithoutRuby(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errStartTagSeenWithoutRuby",
|
||||
aName);
|
||||
}
|
||||
@ -1093,7 +1094,7 @@ nsHtml5TreeBuilder::errStartTagSeenWithoutRuby(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errSelfClosing()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentSlash("errSelfClosing");
|
||||
}
|
||||
}
|
||||
@ -1101,7 +1102,7 @@ nsHtml5TreeBuilder::errSelfClosing()
|
||||
void
|
||||
nsHtml5TreeBuilder::errNoCheckUnclosedElementsOnStack()
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun(
|
||||
"errNoCheckUnclosedElementsOnStack");
|
||||
}
|
||||
@ -1111,7 +1112,7 @@ void
|
||||
nsHtml5TreeBuilder::errEndTagDidNotMatchCurrentOpenElement(nsIAtom* aName,
|
||||
nsIAtom* aOther)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun(
|
||||
"errEndTagDidNotMatchCurrentOpenElement", aName, aOther);
|
||||
}
|
||||
@ -1120,7 +1121,7 @@ nsHtml5TreeBuilder::errEndTagDidNotMatchCurrentOpenElement(nsIAtom* aName,
|
||||
void
|
||||
nsHtml5TreeBuilder::errEndTagViolatesNestingRules(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEndTagViolatesNestingRules", aName);
|
||||
}
|
||||
}
|
||||
@ -1128,7 +1129,7 @@ nsHtml5TreeBuilder::errEndTagViolatesNestingRules(nsIAtom* aName)
|
||||
void
|
||||
nsHtml5TreeBuilder::errEndWithUnclosedElements(nsIAtom* aName)
|
||||
{
|
||||
if (NS_UNLIKELY(mViewSource)) {
|
||||
if (MOZ_UNLIKELY(mViewSource)) {
|
||||
mViewSource->AddErrorToCurrentRun("errEndWithUnclosedElements", aName);
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nsIScriptContext.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -354,7 +355,7 @@ nsHtml5TreeOpExecutor::UpdateStyleSheet(nsIContent* aElement)
|
||||
// waiting to call UpdateStyleSheet without the right observer
|
||||
EndDocUpdate();
|
||||
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// EndDocUpdate ran stuff that called nsIParser::Terminate()
|
||||
return;
|
||||
}
|
||||
@ -412,7 +413,7 @@ nsHtml5TreeOpExecutor::FlushSpeculativeLoads()
|
||||
for (nsHtml5SpeculativeLoad* iter = const_cast<nsHtml5SpeculativeLoad*>(start);
|
||||
iter < end;
|
||||
++iter) {
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// An extension terminated the parser from a HTTP observer.
|
||||
return;
|
||||
}
|
||||
@ -512,7 +513,7 @@ nsHtml5TreeOpExecutor::RunFlushLoop()
|
||||
iter < end;
|
||||
++iter) {
|
||||
iter->Perform(this);
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// An extension terminated the parser from a HTTP observer.
|
||||
mOpQueue.Clear(); // clear in order to be able to assert in destructor
|
||||
return;
|
||||
@ -522,7 +523,7 @@ nsHtml5TreeOpExecutor::RunFlushLoop()
|
||||
FlushSpeculativeLoads(); // Make sure speculative loads never start after
|
||||
// the corresponding normal loads for the same
|
||||
// URLs.
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// An extension terminated the parser from a HTTP observer.
|
||||
mOpQueue.Clear(); // clear in order to be able to assert in destructor
|
||||
return;
|
||||
@ -555,7 +556,7 @@ nsHtml5TreeOpExecutor::RunFlushLoop()
|
||||
const nsHtml5TreeOperation* first = mOpQueue.Elements();
|
||||
const nsHtml5TreeOperation* last = first + numberOfOpsToFlush - 1;
|
||||
for (nsHtml5TreeOperation* iter = const_cast<nsHtml5TreeOperation*>(first);;) {
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// The previous tree op caused a call to nsIParser::Terminate().
|
||||
break;
|
||||
}
|
||||
@ -564,10 +565,10 @@ nsHtml5TreeOpExecutor::RunFlushLoop()
|
||||
iter->Perform(this, &scriptElement);
|
||||
|
||||
// Be sure not to check the deadline if the last op was just performed.
|
||||
if (NS_UNLIKELY(iter == last)) {
|
||||
if (MOZ_UNLIKELY(iter == last)) {
|
||||
break;
|
||||
} else if (NS_UNLIKELY(nsContentSink::DidProcessATokenImpl() ==
|
||||
NS_ERROR_HTMLPARSER_INTERRUPTED)) {
|
||||
} else if (MOZ_UNLIKELY(nsContentSink::DidProcessATokenImpl() ==
|
||||
NS_ERROR_HTMLPARSER_INTERRUPTED)) {
|
||||
mOpQueue.RemoveElementsAt(0, (iter - first) + 1);
|
||||
|
||||
EndDocUpdate();
|
||||
@ -590,7 +591,7 @@ nsHtml5TreeOpExecutor::RunFlushLoop()
|
||||
|
||||
mFlushState = eNotFlushing;
|
||||
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// The parse ended already.
|
||||
return;
|
||||
}
|
||||
@ -620,7 +621,7 @@ nsHtml5TreeOpExecutor::FlushDocumentWrite()
|
||||
FlushSpeculativeLoads(); // Make sure speculative loads never start after the
|
||||
// corresponding normal loads for the same URLs.
|
||||
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// The parse has ended.
|
||||
mOpQueue.Clear(); // clear in order to be able to assert in destructor
|
||||
return;
|
||||
@ -657,7 +658,7 @@ nsHtml5TreeOpExecutor::FlushDocumentWrite()
|
||||
for (nsHtml5TreeOperation* iter = const_cast<nsHtml5TreeOperation*>(start);
|
||||
iter < end;
|
||||
++iter) {
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// The previous tree op caused a call to nsIParser::Terminate().
|
||||
break;
|
||||
}
|
||||
@ -672,7 +673,7 @@ nsHtml5TreeOpExecutor::FlushDocumentWrite()
|
||||
|
||||
mFlushState = eNotFlushing;
|
||||
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// Ending the doc update caused a call to nsIParser::Terminate().
|
||||
return;
|
||||
}
|
||||
@ -736,7 +737,7 @@ nsHtml5TreeOpExecutor::StartLayout() {
|
||||
|
||||
EndDocUpdate();
|
||||
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// got terminate
|
||||
return;
|
||||
}
|
||||
@ -833,7 +834,7 @@ nsHtml5TreeOpExecutor::NeedsCharsetSwitchTo(const char* aEncoding,
|
||||
{
|
||||
EndDocUpdate();
|
||||
|
||||
if (NS_UNLIKELY(!mParser)) {
|
||||
if (MOZ_UNLIKELY(!mParser)) {
|
||||
// got terminate
|
||||
return;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
||||
@ -50,7 +51,7 @@ class NS_STACK_CLASS nsHtml5OtherDocUpdate {
|
||||
{
|
||||
NS_PRECONDITION(aCurrentDoc, "Node has no doc?");
|
||||
NS_PRECONDITION(aExecutorDoc, "Executor has no doc?");
|
||||
if (NS_LIKELY(aCurrentDoc == aExecutorDoc)) {
|
||||
if (MOZ_LIKELY(aCurrentDoc == aExecutorDoc)) {
|
||||
mDocument = nullptr;
|
||||
} else {
|
||||
mDocument = aCurrentDoc;
|
||||
@ -60,7 +61,7 @@ class NS_STACK_CLASS nsHtml5OtherDocUpdate {
|
||||
|
||||
~nsHtml5OtherDocUpdate()
|
||||
{
|
||||
if (NS_UNLIKELY(mDocument)) {
|
||||
if (MOZ_UNLIKELY(mDocument)) {
|
||||
mDocument->EndUpdate(UPDATE_CONTENT_MODEL);
|
||||
}
|
||||
}
|
||||
@ -179,7 +180,7 @@ nsHtml5TreeOperation::Append(nsIContent* aNode,
|
||||
nsIDocument* parentDoc = aParent->OwnerDoc();
|
||||
NS_ASSERTION(parentDoc, "Null owner doc on old node.");
|
||||
|
||||
if (NS_LIKELY(executorDoc == parentDoc)) {
|
||||
if (MOZ_LIKELY(executorDoc == parentDoc)) {
|
||||
// the usual case. the parent is in the parser's doc
|
||||
rv = aParent->AppendChildTo(aNode, false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
@ -330,7 +331,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
nsHtml5HtmlAttributes* attributes = mThree.attributes;
|
||||
|
||||
bool isKeygen = (name == nsHtml5Atoms::keygen && ns == kNameSpaceID_XHTML);
|
||||
if (NS_UNLIKELY(isKeygen)) {
|
||||
if (MOZ_UNLIKELY(isKeygen)) {
|
||||
name = nsHtml5Atoms::select;
|
||||
}
|
||||
|
||||
@ -349,13 +350,13 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
|
||||
aBuilder->HoldElement(*target = newContent);
|
||||
|
||||
if (NS_UNLIKELY(name == nsHtml5Atoms::style || name == nsHtml5Atoms::link)) {
|
||||
if (MOZ_UNLIKELY(name == nsHtml5Atoms::style || name == nsHtml5Atoms::link)) {
|
||||
nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(newContent));
|
||||
if (ssle) {
|
||||
ssle->InitStyleLinkElement(false);
|
||||
ssle->SetEnableUpdates(false);
|
||||
}
|
||||
} else if (NS_UNLIKELY(isKeygen)) {
|
||||
} else if (MOZ_UNLIKELY(isKeygen)) {
|
||||
// Adapted from CNavDTD
|
||||
nsCOMPtr<nsIFormProcessor> theFormProcessor =
|
||||
do_GetService(kFormProcessorCID, &rv);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsParserConstants.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
/************************************************************************
|
||||
And now for the main class -- nsHTMLTokenizer...
|
||||
@ -631,7 +632,7 @@ nsHTMLTokenizer::ConsumeAttributes(PRUnichar aChar,
|
||||
static_cast<CAttributeToken*>
|
||||
(theAllocator->CreateTokenOfType(eToken_attribute,
|
||||
eHTMLTag_unknown));
|
||||
if (NS_LIKELY(theToken != nullptr)) {
|
||||
if (MOZ_LIKELY(theToken != nullptr)) {
|
||||
// Tell the new token to finish consuming text...
|
||||
result = theToken->Consume(aChar, aScanner, mFlags);
|
||||
|
||||
@ -837,7 +838,7 @@ nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,
|
||||
endToken = theAllocator->CreateTokenOfType(eToken_end, theTag,
|
||||
endTagName);
|
||||
AddToken(endToken, result, &mTokenDeque, theAllocator);
|
||||
if (NS_LIKELY(endToken != nullptr)) {
|
||||
if (MOZ_LIKELY(endToken != nullptr)) {
|
||||
endToken->SetInError(true);
|
||||
}
|
||||
else {
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nss.h"
|
||||
#include "pk11func.h"
|
||||
#include "md4.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo *gNTLMLog = PR_NewLogModule("NTLM");
|
||||
@ -520,7 +521,7 @@ ParseType2Msg(const void *inBuf, uint32_t inLen, Type2Msg *msg)
|
||||
uint32_t offset = ReadUint32(cursor);
|
||||
// Check the offset / length combo is in range of the input buffer, including
|
||||
// integer overflow checking.
|
||||
if (NS_LIKELY(offset < offset + targetLen && offset + targetLen <= inLen)) {
|
||||
if (MOZ_LIKELY(offset < offset + targetLen && offset + targetLen <= inLen)) {
|
||||
msg->targetLen = targetLen;
|
||||
msg->target = ((const uint8_t *) inBuf) + offset;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsIRandomGenerator.h"
|
||||
#endif
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla::storage;
|
||||
|
||||
@ -151,7 +152,7 @@ namespace {
|
||||
}
|
||||
|
||||
// If something went wrong above, get out of here!
|
||||
if (NS_UNLIKELY(error)) {
|
||||
if (MOZ_UNLIKELY(error)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -667,7 +668,7 @@ TelemetryImpl::GetHistogramEnumId(const char *name, Telemetry::ID *id)
|
||||
if (!map->Count()) {
|
||||
for (uint32_t i = 0; i < Telemetry::HistogramCount; i++) {
|
||||
CharPtrEntryType *entry = map->PutEntry(gHistograms[i].id());
|
||||
if (NS_UNLIKELY(!entry)) {
|
||||
if (MOZ_UNLIKELY(!entry)) {
|
||||
map->Clear();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -812,7 +813,7 @@ TelemetryImpl::RegisterAddonHistogram(const nsACString &id,
|
||||
AddonEntryType *addonEntry = mAddonMap.GetEntry(id);
|
||||
if (!addonEntry) {
|
||||
addonEntry = mAddonMap.PutEntry(id);
|
||||
if (NS_UNLIKELY(!addonEntry)) {
|
||||
if (MOZ_UNLIKELY(!addonEntry)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
addonEntry->mData = new AddonHistogramMapType();
|
||||
@ -826,7 +827,7 @@ TelemetryImpl::RegisterAddonHistogram(const nsACString &id,
|
||||
}
|
||||
|
||||
histogramEntry = histogramMap->PutEntry(name);
|
||||
if (NS_UNLIKELY(!histogramEntry)) {
|
||||
if (MOZ_UNLIKELY(!histogramEntry)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@ -1319,7 +1320,7 @@ TelemetryImpl::StoreSlowSQL(const nsACString &sql, uint32_t delay,
|
||||
SlowSQLEntryType *entry = slowSQLMap->GetEntry(sql);
|
||||
if (!entry) {
|
||||
entry = slowSQLMap->PutEntry(sql);
|
||||
if (NS_UNLIKELY(!entry))
|
||||
if (MOZ_UNLIKELY(!entry))
|
||||
return;
|
||||
entry->mData.mainThread.hitCount = 0;
|
||||
entry->mData.mainThread.totalTime = 0;
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "nsAppRunner.h"
|
||||
#include "mozilla/AppData.h"
|
||||
@ -1061,9 +1062,9 @@ bool gLogConsoleErrors
|
||||
|
||||
#define NS_ENSURE_TRUE_LOG(x, ret) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (NS_UNLIKELY(!(x))) { \
|
||||
if (MOZ_UNLIKELY(!(x))) { \
|
||||
NS_WARNING("NS_ENSURE_TRUE(" #x ") failed"); \
|
||||
gLogConsoleErrors = true; \
|
||||
gLogConsoleErrors = true; \
|
||||
return ret; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "nsXULPopupManager.h"
|
||||
#include "nsIWidgetListener.h"
|
||||
|
||||
@ -713,7 +714,7 @@ void nsView::SetZIndex(bool aAuto, int32_t aZIndex, bool aTopMost)
|
||||
void nsView::AssertNoWindow()
|
||||
{
|
||||
// XXX: it would be nice to make this a strong assert
|
||||
if (NS_UNLIKELY(mWindow)) {
|
||||
if (MOZ_UNLIKELY(mWindow)) {
|
||||
NS_ERROR("We already have a window for this view? BAD");
|
||||
mWindow->SetWidgetListener(nullptr);
|
||||
mWindow->Destroy();
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include "nsIAndroidBridge.h"
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
// Some debug #defines
|
||||
// #define DEBUG_ANDROID_EVENTS
|
||||
// #define DEBUG_ANDROID_WIDGET
|
||||
@ -115,13 +117,13 @@ public:
|
||||
}
|
||||
|
||||
static JavaVM *GetVM() {
|
||||
if (NS_LIKELY(sBridge))
|
||||
if (MOZ_LIKELY(sBridge))
|
||||
return sBridge->mJavaVM;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static JNIEnv *GetJNIEnv() {
|
||||
if (NS_LIKELY(sBridge)) {
|
||||
if (MOZ_LIKELY(sBridge)) {
|
||||
if ((void*)pthread_self() != sBridge->mThread) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "AndroidBridge",
|
||||
"###!!!!!!! Something's grabbing the JNIEnv from the wrong thread! (thr %p should be %p)",
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nsGtkIMModule.h"
|
||||
#include "nsWindow.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef MOZ_PLATFORM_MAEMO
|
||||
#include "nsServiceManagerUtils.h"
|
||||
@ -307,7 +308,7 @@ nsGtkIMModule::PrepareToDestroyContext(GtkIMContext *aContext)
|
||||
void
|
||||
nsGtkIMModule::OnFocusWindow(nsWindow* aWindow)
|
||||
{
|
||||
if (NS_UNLIKELY(IsDestroyed())) {
|
||||
if (MOZ_UNLIKELY(IsDestroyed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -321,7 +322,7 @@ nsGtkIMModule::OnFocusWindow(nsWindow* aWindow)
|
||||
void
|
||||
nsGtkIMModule::OnBlurWindow(nsWindow* aWindow)
|
||||
{
|
||||
if (NS_UNLIKELY(IsDestroyed())) {
|
||||
if (MOZ_UNLIKELY(IsDestroyed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -342,7 +343,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent,
|
||||
{
|
||||
NS_PRECONDITION(aEvent, "aEvent must be non-null");
|
||||
|
||||
if (!IsEditable() || NS_UNLIKELY(IsDestroyed())) {
|
||||
if (!IsEditable() || MOZ_UNLIKELY(IsDestroyed())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -364,7 +365,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent,
|
||||
}
|
||||
|
||||
GtkIMContext* im = GetContext();
|
||||
if (NS_UNLIKELY(!im)) {
|
||||
if (MOZ_UNLIKELY(!im)) {
|
||||
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
|
||||
(" FAILED, there are no context"));
|
||||
return false;
|
||||
@ -444,7 +445,7 @@ nsGtkIMModule::ResetIME()
|
||||
this, GetCompositionStateName(), mIsIMFocused ? "YES" : "NO"));
|
||||
|
||||
GtkIMContext *im = GetContext();
|
||||
if (NS_UNLIKELY(!im)) {
|
||||
if (MOZ_UNLIKELY(!im)) {
|
||||
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
|
||||
(" FAILED, there are no context"));
|
||||
return;
|
||||
@ -457,7 +458,7 @@ nsGtkIMModule::ResetIME()
|
||||
nsresult
|
||||
nsGtkIMModule::ResetInputState(nsWindow* aCaller)
|
||||
{
|
||||
if (NS_UNLIKELY(IsDestroyed())) {
|
||||
if (MOZ_UNLIKELY(IsDestroyed())) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -486,7 +487,7 @@ nsGtkIMModule::ResetInputState(nsWindow* aCaller)
|
||||
nsresult
|
||||
nsGtkIMModule::CancelIMEComposition(nsWindow* aCaller)
|
||||
{
|
||||
if (NS_UNLIKELY(IsDestroyed())) {
|
||||
if (MOZ_UNLIKELY(IsDestroyed())) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -506,7 +507,7 @@ nsGtkIMModule::CancelIMEComposition(nsWindow* aCaller)
|
||||
}
|
||||
|
||||
GtkIMContext *im = GetContext();
|
||||
if (NS_UNLIKELY(!im)) {
|
||||
if (MOZ_UNLIKELY(!im)) {
|
||||
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
|
||||
(" FAILED, there are no context"));
|
||||
return NS_OK;
|
||||
@ -523,7 +524,7 @@ nsGtkIMModule::SetInputContext(nsWindow* aCaller,
|
||||
const InputContext* aContext,
|
||||
const InputContextAction* aAction)
|
||||
{
|
||||
if (NS_UNLIKELY(IsDestroyed())) {
|
||||
if (MOZ_UNLIKELY(IsDestroyed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include <startup-notification-1.0/libsn/sn.h>
|
||||
#endif
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIGConfService.h"
|
||||
@ -2027,7 +2028,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
GdkRectangle *rects;
|
||||
gint nrects;
|
||||
gdk_region_get_rectangles(aEvent->region, &rects, &nrects);
|
||||
if (NS_UNLIKELY(!rects)) // OOM
|
||||
if (MOZ_UNLIKELY(!rects)) // OOM
|
||||
return FALSE;
|
||||
#else
|
||||
#ifdef cairo_copy_clip_rectangle_list
|
||||
@ -2035,7 +2036,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
#else
|
||||
cairo_rectangle_list_t *rects;
|
||||
rects = cairo_copy_clip_rectangle_list(cr);
|
||||
if (NS_UNLIKELY(rects->status != CAIRO_STATUS_SUCCESS)) {
|
||||
if (MOZ_UNLIKELY(rects->status != CAIRO_STATUS_SUCCESS)) {
|
||||
NS_WARNING("Failed to obtain cairo rectangle list.");
|
||||
return FALSE;
|
||||
}
|
||||
@ -2207,7 +2208,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
// PaintWindow can Destroy us (bug 378273), avoid doing any paint
|
||||
// operations below if that happened - it will lead to XError and exit().
|
||||
if (shaped) {
|
||||
if (NS_LIKELY(!mIsDestroyed)) {
|
||||
if (MOZ_LIKELY(!mIsDestroyed)) {
|
||||
if (painted) {
|
||||
nsRefPtr<gfxPattern> pattern = ctx->PopGroup();
|
||||
|
||||
@ -2236,7 +2237,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
}
|
||||
}
|
||||
# ifdef MOZ_HAVE_SHMIMAGE
|
||||
if (nsShmImage::UseShm() && NS_LIKELY(!mIsDestroyed)) {
|
||||
if (nsShmImage::UseShm() && MOZ_LIKELY(!mIsDestroyed)) {
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
mShmImage->Put(mGdkWindow, rects, r_end);
|
||||
#else
|
||||
@ -2734,7 +2735,7 @@ nsWindow::OnButtonPressEvent(GdkEventButton *aEvent)
|
||||
|
||||
// right menu click on linux should also pop up a context menu
|
||||
if (domButton == nsMouseEvent::eRightButton &&
|
||||
NS_LIKELY(!mIsDestroyed)) {
|
||||
MOZ_LIKELY(!mIsDestroyed)) {
|
||||
nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
|
||||
nsMouseEvent::eReal);
|
||||
InitButtonEvent(contextMenuEvent, aEvent);
|
||||
@ -2940,7 +2941,7 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent)
|
||||
|
||||
bool isKeyDownCancelled = false;
|
||||
if (DispatchKeyDownEvent(aEvent, &isKeyDownCancelled) &&
|
||||
NS_UNLIKELY(mIsDestroyed)) {
|
||||
MOZ_UNLIKELY(mIsDestroyed)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -3224,7 +3225,7 @@ nsWindow::ThemeChanged()
|
||||
{
|
||||
NotifyThemeChanged();
|
||||
|
||||
if (!mGdkWindow || NS_UNLIKELY(mIsDestroyed))
|
||||
if (!mGdkWindow || MOZ_UNLIKELY(mIsDestroyed))
|
||||
return;
|
||||
|
||||
// Dispatch theme change notification to all child windows
|
||||
|
@ -64,6 +64,7 @@ using namespace QtMobility;
|
||||
#include "nsQtKeyUtils.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "nsIWidgetListener.h"
|
||||
|
||||
#include "nsIStringBundle.h"
|
||||
@ -1056,7 +1057,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
|
||||
targetSurface = gBufferSurface;
|
||||
}
|
||||
|
||||
if (NS_UNLIKELY(!targetSurface))
|
||||
if (MOZ_UNLIKELY(!targetSurface))
|
||||
return false;
|
||||
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
|
||||
@ -1091,7 +1092,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
|
||||
|
||||
// DispatchEvent can Destroy us (bug 378273), avoid doing any paint
|
||||
// operations below if that happened - it will lead to XError and exit().
|
||||
if (NS_UNLIKELY(mIsDestroyed))
|
||||
if (MOZ_UNLIKELY(mIsDestroyed))
|
||||
return painted;
|
||||
|
||||
if (!painted)
|
||||
@ -1324,7 +1325,7 @@ nsWindow::OnButtonPressEvent(QGraphicsSceneMouseEvent *aEvent)
|
||||
|
||||
// right menu click on linux should also pop up a context menu
|
||||
if (domButton == nsMouseEvent::eRightButton &&
|
||||
NS_LIKELY(!mIsDestroyed)) {
|
||||
MOZ_LIKELY(!mIsDestroyed)) {
|
||||
nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
|
||||
nsMouseEvent::eReal);
|
||||
InitButtonEvent(contextMenuEvent, aEvent, 1);
|
||||
@ -1574,7 +1575,7 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEvent)
|
||||
nsEventStatus status = DispatchEvent(&downEvent);
|
||||
|
||||
// DispatchEvent can Destroy us (bug 378273)
|
||||
if (NS_UNLIKELY(mIsDestroyed)) {
|
||||
if (MOZ_UNLIKELY(mIsDestroyed)) {
|
||||
qWarning() << "Returning[" << __LINE__ << "]: " << "Window destroyed";
|
||||
return status;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
# include "nsIPlatformCharset.h"
|
||||
#include "nsISaveAsCharset.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
|
||||
//
|
||||
@ -67,7 +68,7 @@ nsPrimitiveHelpers :: CreatePrimitiveForData ( const char* aFlavor, void* aDataB
|
||||
if (primitive ) {
|
||||
if (aDataLen % 2) {
|
||||
nsAutoArrayPtr<char> buffer(new char[aDataLen + 1]);
|
||||
if (!NS_LIKELY(buffer))
|
||||
if (!MOZ_LIKELY(buffer))
|
||||
return;
|
||||
|
||||
memcpy(buffer, aDataBuff, aDataLen);
|
||||
|
@ -137,8 +137,9 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/CondVar.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/StandardInteger.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
@ -1688,7 +1689,7 @@ private:
|
||||
MOZ_ASSERT(root);
|
||||
MOZ_ASSERT(participant);
|
||||
|
||||
if (!participant->CanSkipInCC(root) || NS_UNLIKELY(WantAllTraces())) {
|
||||
if (!participant->CanSkipInCC(root) || MOZ_UNLIKELY(WantAllTraces())) {
|
||||
AddNode(root, participant);
|
||||
}
|
||||
}
|
||||
@ -1754,7 +1755,7 @@ GCGraphBuilder::GCGraphBuilder(GCGraph &aGraph,
|
||||
|
||||
mFlags |= flags;
|
||||
|
||||
mMergeCompartments = mMergeCompartments && NS_LIKELY(!WantAllTraces());
|
||||
mMergeCompartments = mMergeCompartments && MOZ_LIKELY(!WantAllTraces());
|
||||
}
|
||||
|
||||
GCGraphBuilder::~GCGraphBuilder()
|
||||
@ -1931,12 +1932,12 @@ GCGraphBuilder::NoteJSChild(void *child)
|
||||
}
|
||||
|
||||
nsCString edgeName;
|
||||
if (NS_UNLIKELY(WantDebugInfo())) {
|
||||
if (MOZ_UNLIKELY(WantDebugInfo())) {
|
||||
edgeName.Assign(mNextEdgeName);
|
||||
mNextEdgeName.Truncate();
|
||||
}
|
||||
|
||||
if (xpc_GCThingIsGrayCCThing(child) || NS_UNLIKELY(WantAllTraces())) {
|
||||
if (xpc_GCThingIsGrayCCThing(child) || MOZ_UNLIKELY(WantAllTraces())) {
|
||||
if (JSCompartment *comp = MergeCompartment(child)) {
|
||||
NoteChild(comp, mJSCompParticipant, edgeName);
|
||||
} else {
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nscore.h" /* needed for nsresult */
|
||||
#endif
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
/*
|
||||
* To add error code to your module, you need to do the following:
|
||||
@ -153,12 +154,12 @@
|
||||
inline uint32_t NS_FAILED_impl(nsresult _nsresult) {
|
||||
return static_cast<uint32_t>(_nsresult) & 0x80000000;
|
||||
}
|
||||
#define NS_FAILED(_nsresult) ((bool)NS_UNLIKELY(NS_FAILED_impl(_nsresult)))
|
||||
#define NS_SUCCEEDED(_nsresult) ((bool)NS_LIKELY(!NS_FAILED_impl(_nsresult)))
|
||||
#define NS_FAILED(_nsresult) ((bool)MOZ_UNLIKELY(NS_FAILED_impl(_nsresult)))
|
||||
#define NS_SUCCEEDED(_nsresult) ((bool)MOZ_LIKELY(!NS_FAILED_impl(_nsresult)))
|
||||
#else
|
||||
#define NS_FAILED_impl(_nsresult) ((_nsresult) & 0x80000000)
|
||||
#define NS_FAILED(_nsresult) (NS_UNLIKELY(NS_FAILED_impl(_nsresult)))
|
||||
#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!NS_FAILED_impl(_nsresult)))
|
||||
#define NS_FAILED(_nsresult) (MOZ_UNLIKELY(NS_FAILED_impl(_nsresult)))
|
||||
#define NS_SUCCEEDED(_nsresult) (MOZ_LIKELY(!NS_FAILED_impl(_nsresult)))
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -363,31 +363,6 @@ typedef uint32_t nsrefcnt;
|
||||
#define NS_STRINGIFY_HELPER(x_) #x_
|
||||
#define NS_STRINGIFY(x_) NS_STRINGIFY_HELPER(x_)
|
||||
|
||||
/*
|
||||
* These macros allow you to give a hint to the compiler about branch
|
||||
* probability so that it can better optimize. Use them like this:
|
||||
*
|
||||
* if (NS_LIKELY(v == 1)) {
|
||||
* ... expected code path ...
|
||||
* }
|
||||
*
|
||||
* if (NS_UNLIKELY(v == 0)) {
|
||||
* ... non-expected code path ...
|
||||
* }
|
||||
*
|
||||
* These macros are guaranteed to always return 0 or 1.
|
||||
* The NS_FAILED/NS_SUCCEEDED macros depends on this.
|
||||
* @return 0 or 1
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2)
|
||||
#define NS_LIKELY(x) (__builtin_expect(!!(x), 1))
|
||||
#define NS_UNLIKELY(x) (__builtin_expect(!!(x), 0))
|
||||
#else
|
||||
#define NS_LIKELY(x) (!!(x))
|
||||
#define NS_UNLIKELY(x) (!!(x))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we're being linked as standalone glue, we don't want a dynamic
|
||||
* dependency on NSPR libs, so we skip the debug thread-safety
|
||||
|
@ -6,6 +6,7 @@
|
||||
#ifndef nsCycleCollectionParticipant_h__
|
||||
#define nsCycleCollectionParticipant_h__
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
@ -517,7 +518,7 @@ public:
|
||||
|
||||
#define NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(_cb, _name) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (NS_UNLIKELY((_cb).WantDebugInfo())) { \
|
||||
if (MOZ_UNLIKELY((_cb).WantDebugInfo())) { \
|
||||
(_cb).NoteNextEdgeName(_name); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
@ -888,7 +889,7 @@ struct Skippable
|
||||
static NS_METHOD_(void) UnmarkIfPurpleImpl(void *p) \
|
||||
{ \
|
||||
_class *tmp = static_cast<_class *>(p); \
|
||||
if (NS_LIKELY(tmp->mRefCnt.HasPurpleBufferEntry())) \
|
||||
if (MOZ_LIKELY(tmp->mRefCnt.HasPurpleBufferEntry())) \
|
||||
tmp->mRefCnt.ReleasePurpleBufferEntry(); \
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "prprf.h"
|
||||
@ -248,7 +249,7 @@
|
||||
|
||||
#define NS_ENSURE_TRUE(x, ret) \
|
||||
do { \
|
||||
if (NS_UNLIKELY(!(x))) { \
|
||||
if (MOZ_UNLIKELY(!(x))) { \
|
||||
NS_WARNING("NS_ENSURE_TRUE(" #x ") failed"); \
|
||||
return ret; \
|
||||
} \
|
||||
@ -259,7 +260,7 @@
|
||||
|
||||
#define NS_ENSURE_TRUE_VOID(x) \
|
||||
do { \
|
||||
if (NS_UNLIKELY(!(x))) { \
|
||||
if (MOZ_UNLIKELY(!(x))) { \
|
||||
NS_WARNING("NS_ENSURE_TRUE(" #x ") failed"); \
|
||||
return; \
|
||||
} \
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nsCycleCollectorUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Macros to help detect thread-safety:
|
||||
@ -116,7 +117,7 @@ public:
|
||||
|
||||
MOZ_ALWAYS_INLINE nsrefcnt incr(void *owner)
|
||||
{
|
||||
if (NS_UNLIKELY(mTagged == NS_CCAR_TAGGED_STABILIZED_REFCNT)) {
|
||||
if (MOZ_UNLIKELY(mTagged == NS_CCAR_TAGGED_STABILIZED_REFCNT)) {
|
||||
// The sentinel value "purple bit alone, refcount 0" means
|
||||
// that we're stabilized, during finalization. In this
|
||||
// state we lie about our actual refcount if anyone asks
|
||||
@ -160,7 +161,7 @@ public:
|
||||
|
||||
MOZ_ALWAYS_INLINE nsrefcnt decr(void *owner, nsCycleCollectionParticipant *p)
|
||||
{
|
||||
if (NS_UNLIKELY(mTagged == NS_CCAR_TAGGED_STABILIZED_REFCNT))
|
||||
if (MOZ_UNLIKELY(mTagged == NS_CCAR_TAGGED_STABILIZED_REFCNT))
|
||||
return 1;
|
||||
|
||||
nsrefcnt refcount;
|
||||
@ -168,7 +169,7 @@ public:
|
||||
nsPurpleBufferEntry *e = NS_CCAR_TAGGED_TO_PURPLE_ENTRY(mTagged);
|
||||
NS_ASSERTION(e->mObject == owner, "wrong entry");
|
||||
refcount = --(e->mRefCnt);
|
||||
if (NS_UNLIKELY(refcount == 0)) {
|
||||
if (MOZ_UNLIKELY(refcount == 0)) {
|
||||
#ifdef DEBUG_CC
|
||||
nsCycleCollector_logPurpleRemoval(
|
||||
NS_CCAR_TAGGED_TO_PURPLE_ENTRY(mTagged)->mObject);
|
||||
@ -189,7 +190,7 @@ public:
|
||||
--refcount;
|
||||
|
||||
nsPurpleBufferEntry *e;
|
||||
if (NS_LIKELY(refcount > 0) &&
|
||||
if (MOZ_LIKELY(refcount > 0) &&
|
||||
((e = NS_CycleCollectorSuspect2(owner, p)))) {
|
||||
e->mRefCnt = refcount;
|
||||
mTagged = NS_CCAR_PURPLE_ENTRY_TO_TAGGED(e);
|
||||
@ -235,10 +236,10 @@ public:
|
||||
|
||||
MOZ_ALWAYS_INLINE nsrefcnt get() const
|
||||
{
|
||||
if (NS_UNLIKELY(mTagged == NS_CCAR_TAGGED_STABILIZED_REFCNT))
|
||||
if (MOZ_UNLIKELY(mTagged == NS_CCAR_TAGGED_STABILIZED_REFCNT))
|
||||
return 1;
|
||||
|
||||
return NS_UNLIKELY(HasPurpleBufferEntry())
|
||||
return MOZ_UNLIKELY(HasPurpleBufferEntry())
|
||||
? NS_CCAR_TAGGED_TO_PURPLE_ENTRY(mTagged)->mRefCnt
|
||||
: NS_CCAR_TAGGED_TO_REFCNT(mTagged);
|
||||
}
|
||||
@ -298,7 +299,7 @@ public: \
|
||||
NS_IMETHOD_(nsrefcnt) Release(void); \
|
||||
void UnmarkIfPurple() \
|
||||
{ \
|
||||
if (NS_LIKELY(mRefCnt.HasPurpleBufferEntry())) \
|
||||
if (MOZ_LIKELY(mRefCnt.HasPurpleBufferEntry())) \
|
||||
mRefCnt.ReleasePurpleBufferEntry(); \
|
||||
} \
|
||||
protected: \
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef XPCOM_GLUE_AVOID_NSPR
|
||||
#error NS_ProxyRelease implementation depends on NSPR.
|
||||
@ -128,7 +129,7 @@ public:
|
||||
|
||||
T* get() {
|
||||
// Nobody should be touching the raw pointer off-main-thread.
|
||||
if (NS_UNLIKELY(!NS_IsMainThread()))
|
||||
if (MOZ_UNLIKELY(!NS_IsMainThread()))
|
||||
MOZ_CRASH();
|
||||
return mRawPtr;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
# include "nsThreadManager.h"
|
||||
@ -314,12 +315,12 @@ nsAutoLowPriorityIO::nsAutoLowPriorityIO()
|
||||
nsAutoLowPriorityIO::~nsAutoLowPriorityIO()
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
if (NS_LIKELY(lowIOPrioritySet)) {
|
||||
if (MOZ_LIKELY(lowIOPrioritySet)) {
|
||||
// On Windows the old thread priority is automatically restored
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_END);
|
||||
}
|
||||
#elif defined(XP_MACOSX)
|
||||
if (NS_LIKELY(lowIOPrioritySet)) {
|
||||
if (MOZ_LIKELY(lowIOPrioritySet)) {
|
||||
setiopolicy_np(IOPOL_TYPE_DISK, IOPOL_SCOPE_THREAD, oldPriority);
|
||||
}
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/threads/nsThreadIDs.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
// This is needed on some systems to prevent collisions between the symbols
|
||||
// appearing in xpcom_core and xpcomglue. It may be unnecessary in the future
|
||||
@ -345,7 +346,7 @@ public:
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run() {
|
||||
if (NS_LIKELY(mReceiver.mObj))
|
||||
if (MOZ_LIKELY(mReceiver.mObj))
|
||||
((*mReceiver.mObj).*mMethod)();
|
||||
return NS_OK;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user