Bug 1384669: Reduce refcount churn in BidiParagraphData by using non-refcounted pointer hash keys. r?jfkthame
We don't need to bother with refcounting for these pointers, because they're
pointing to DOM elements, and the DOM is basically immutable during reflow.
And BidiParagraphData is a stack-only class which only lives for a short period
of reflow - so it can assume these pointers' targets will stick around for its
whole life.
MozReview-Commit-ID: J3SfRYoRweX
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -11,16 +11,17 @@
#include "nsFontMetrics.h"
#include "nsGkAtoms.h"
#include "nsPresContext.h"
#include "nsBidiUtils.h"
#include "nsCSSFrameConstructor.h"
#include "nsContainerFrame.h"
#include "nsInlineFrame.h"
#include "nsPlaceholderFrame.h"
+#include "nsPointerHashKeys.h"
#include "nsFirstLetterFrame.h"
#include "nsUnicodeProperties.h"
#include "nsTextFrame.h"
#include "nsBlockFrame.h"
#include "nsIFrameInlines.h"
#include "nsStyleStructInlines.h"
#include "RubyUtils.h"
#include "nsRubyFrame.h"
@@ -127,17 +128,18 @@ GetBidiControl(nsStyleContext* aStyleCon
}
struct MOZ_STACK_CLASS BidiParagraphData
{
nsAutoString mBuffer;
AutoTArray<char16_t, 16> mEmbeddingStack;
AutoTArray<nsIFrame*, 16> mLogicalFrames;
AutoTArray<nsLineBox*, 16> mLinePerFrame;
- nsDataHashtable<nsISupportsHashKey, int32_t> mContentToFrameIndex;
+ nsDataHashtable<nsPtrHashKey<const nsIContent>, int32_t>
+ mContentToFrameIndex;
// Cached presentation context for the frames we're processing.
nsPresContext* mPresContext;
bool mIsVisual;
bool mRequiresBidi;
nsBidiLevel mParaLevel;
nsIContent* mPrevContent;
nsIFrame* mPrevFrame;
#ifdef DEBUG