зеркало из https://github.com/mozilla/gecko-dev.git
Bug 654369 - Part 7: Remove OOM checks from nsTextFrameThebes r=bz
--HG-- extra : rebase_source : 2cb5ce4d3f3a6d8d0e3a50c40303f8c1c098dbdf
This commit is contained in:
Родитель
ea484247b0
Коммит
1166c130bf
|
@ -183,11 +183,7 @@ nsLayoutStatics::Initialize()
|
||||||
|
|
||||||
nsCSSRendering::Init();
|
nsCSSRendering::Init();
|
||||||
|
|
||||||
rv = nsTextFrameTextRunCache::Init();
|
nsTextFrameTextRunCache::Init();
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
NS_ERROR("Could not initialize textframe textrun cache");
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = nsHTMLDNSPrefetch::Initialize();
|
rv = nsHTMLDNSPrefetch::Initialize();
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
*/
|
*/
|
||||||
class nsTextFrameTextRunCache {
|
class nsTextFrameTextRunCache {
|
||||||
public:
|
public:
|
||||||
static nsresult Init();
|
static void Init();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -592,10 +592,9 @@ MakeTextRun(const PRUint8 *aText, PRUint32 aLength,
|
||||||
return textRun.forget();
|
return textRun.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
void
|
||||||
nsTextFrameTextRunCache::Init() {
|
nsTextFrameTextRunCache::Init() {
|
||||||
gTextRuns = new FrameTextRunCache();
|
gTextRuns = new FrameTextRunCache();
|
||||||
return gTextRuns ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -3037,8 +3036,8 @@ public:
|
||||||
|
|
||||||
NS_DECL_NSITIMERCALLBACK
|
NS_DECL_NSITIMERCALLBACK
|
||||||
|
|
||||||
static nsresult AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame);
|
static void AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame);
|
||||||
static nsresult RemoveBlinkFrame(nsIFrame* aFrame);
|
static void RemoveBlinkFrame(nsIFrame* aFrame);
|
||||||
|
|
||||||
static PRBool GetBlinkIsOff() { return sState == 3; }
|
static PRBool GetBlinkIsOff() { return sState == 3; }
|
||||||
|
|
||||||
|
@ -3162,33 +3161,28 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer)
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult nsBlinkTimer::AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame)
|
void nsBlinkTimer::AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
if (!sTextBlinker)
|
if (!sTextBlinker)
|
||||||
{
|
{
|
||||||
sTextBlinker = new nsBlinkTimer;
|
sTextBlinker = new nsBlinkTimer;
|
||||||
if (!sTextBlinker) return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ADDREF(sTextBlinker);
|
NS_ADDREF(sTextBlinker);
|
||||||
|
|
||||||
sTextBlinker->AddFrame(aPresContext, aFrame);
|
sTextBlinker->AddFrame(aPresContext, aFrame);
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult nsBlinkTimer::RemoveBlinkFrame(nsIFrame* aFrame)
|
void nsBlinkTimer::RemoveBlinkFrame(nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(sTextBlinker, "Should have blink timer here");
|
NS_ASSERTION(sTextBlinker, "Should have blink timer here");
|
||||||
|
|
||||||
nsBlinkTimer* blinkTimer = sTextBlinker; // copy so we can call NS_RELEASE on it
|
nsBlinkTimer* blinkTimer = sTextBlinker; // copy so we can call NS_RELEASE on it
|
||||||
if (!blinkTimer) return NS_OK;
|
|
||||||
|
|
||||||
blinkTimer->RemoveFrame(aFrame);
|
blinkTimer->RemoveFrame(aFrame);
|
||||||
NS_RELEASE(blinkTimer);
|
NS_RELEASE(blinkTimer);
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -7146,12 +7140,10 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||||
mContentOffset + contentLength <= contentNewLineOffset)) {
|
mContentOffset + contentLength <= contentNewLineOffset)) {
|
||||||
if (!cachedNewlineOffset) {
|
if (!cachedNewlineOffset) {
|
||||||
cachedNewlineOffset = new NewlineProperty;
|
cachedNewlineOffset = new NewlineProperty;
|
||||||
if (cachedNewlineOffset) {
|
if (NS_FAILED(mContent->SetProperty(nsGkAtoms::newline, cachedNewlineOffset,
|
||||||
if (NS_FAILED(mContent->SetProperty(nsGkAtoms::newline, cachedNewlineOffset,
|
NewlineProperty::Destroy))) {
|
||||||
NewlineProperty::Destroy))) {
|
delete cachedNewlineOffset;
|
||||||
delete cachedNewlineOffset;
|
cachedNewlineOffset = nsnull;
|
||||||
cachedNewlineOffset = nsnull;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cachedNewlineOffset) {
|
if (cachedNewlineOffset) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче