Bug 1216332 - Remove framearena helpers from abstract frame classes and stop them from being instantiated. r=dbaron

This commit is contained in:
Xidorn Quan 2015-11-04 20:57:35 +11:00
parent ee0fc16eba
commit e7d93c6479
18 changed files with 20 additions and 46 deletions

View File

@ -44,8 +44,6 @@ NS_QUERYFRAME_HEAD(nsFormControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame)
NS_IMPL_FRAMEARENA_HELPERS(nsFormControlFrame)
nscoord
nsFormControlFrame::GetIntrinsicISize()
{

View File

@ -35,7 +35,7 @@ public:
}
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_ABSTRACT_FRAME(nsFormControlFrame)
/**
* Respond to a gui event

View File

@ -42,8 +42,6 @@ using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layout;
NS_IMPL_FRAMEARENA_HELPERS(nsContainerFrame)
nsContainerFrame::~nsContainerFrame()
{
}

View File

@ -44,7 +44,7 @@ class FramePropertyTable;
class nsContainerFrame : public nsSplittableFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_ABSTRACT_FRAME(nsContainerFrame)
NS_DECL_QUERYFRAME_TARGET(nsContainerFrame)
NS_DECL_QUERYFRAME

View File

@ -78,11 +78,14 @@
#define NS_FRAME_TRACE_REFLOW_OUT(_method, _status)
#endif
// Frame allocation boilerplate macros. Every subclass of nsFrame
// must define its own operator new and GetFrameId. If they do
// not, the per-frame recycler lists in nsPresArena will not work
// correctly, with potentially catastrophic consequences (not enough
// memory is allocated for a frame object).
// Frame allocation boilerplate macros. Every subclass of nsFrame must
// either use NS_{DECL,IMPL}_FRAMEARENA_HELPERS pair for allocating
// memory correctly, or use NS_DECL_ABSTRACT_FRAME to declare a frame
// class abstract and stop it from being instantiated. If a frame class
// without its own operator new and GetFrameId gets instantiated, the
// per-frame recycler lists in nsPresArena will not work correctly,
// with potentially catastrophic consequences (not enough memory is
// allocated for a frame object).
#define NS_DECL_FRAMEARENA_HELPERS \
void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE; \
@ -94,6 +97,10 @@
nsQueryFrame::FrameIID class::GetFrameId() \
{ return nsQueryFrame::class##_id; }
#define NS_DECL_ABSTRACT_FRAME(class) \
void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE = delete; \
virtual nsQueryFrame::FrameIID GetFrameId() override MOZ_MUST_OVERRIDE = 0;
//----------------------------------------------------------------------
struct nsBoxLayoutMetrics;

View File

@ -14,8 +14,6 @@ nsLeafFrame::~nsLeafFrame()
{
}
NS_IMPL_FRAMEARENA_HELPERS(nsLeafFrame)
/* virtual */ nscoord
nsLeafFrame::GetMinISize(nsRenderingContext *aRenderingContext)
{

View File

@ -20,7 +20,7 @@
*/
class nsLeafFrame : public nsFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_ABSTRACT_FRAME(nsLeafFrame)
// nsIFrame replacements
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,

View File

@ -15,13 +15,6 @@ using namespace mozilla;
//----------------------------------------------------------------------
// Frame class boilerplate
// =======================
NS_IMPL_FRAMEARENA_HELPERS(nsRubyContentFrame)
//----------------------------------------------------------------------
// nsRubyContentFrame Method Implementations
// ======================================

View File

@ -16,7 +16,7 @@ typedef nsInlineFrame nsRubyContentFrameSuper;
class nsRubyContentFrame : public nsRubyContentFrameSuper
{
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_ABSTRACT_FRAME(nsRubyContentFrame)
// nsIFrame overrides
virtual bool IsFrameOfType(uint32_t aFlags) const override;

View File

@ -14,8 +14,6 @@
using namespace mozilla;
NS_IMPL_FRAMEARENA_HELPERS(nsSplittableFrame)
void
nsSplittableFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,

View File

@ -18,7 +18,7 @@
class nsSplittableFrame : public nsFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_ABSTRACT_FRAME(nsSplittableFrame)
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,

View File

@ -30,8 +30,6 @@ using namespace mozilla::gfx;
// nsMathMLContainerFrame implementation
//
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLContainerFrame)
NS_QUERYFRAME_HEAD(nsMathMLContainerFrame)
NS_QUERYFRAME_ENTRY(nsIMathMLFrame)
NS_QUERYFRAME_ENTRY(nsMathMLContainerFrame)

View File

@ -38,7 +38,7 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsMathMLContainerFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_ABSTRACT_FRAME(nsMathMLContainerFrame)
// --------------------------------------------------------------------------
// Overloaded nsMathMLFrame methods -- see documentation in nsIMathMLFrame.h

View File

@ -36,7 +36,6 @@ UNIFIED_SOURCES += [
'nsSVGMarkerFrame.cpp',
'nsSVGMaskFrame.cpp',
'nsSVGOuterSVGFrame.cpp',
'nsSVGPaintServerFrame.cpp',
'nsSVGPathGeometryFrame.cpp',
'nsSVGPatternFrame.cpp',
'nsSVGStopFrame.cpp',

View File

@ -55,8 +55,6 @@ nsSVGGradientFrame::nsSVGGradientFrame(nsStyleContext* aContext) :
{
}
NS_IMPL_FRAMEARENA_HELPERS(nsSVGGradientFrame)
//----------------------------------------------------------------------
// nsIFrame methods:

View File

@ -45,7 +45,7 @@ protected:
explicit nsSVGGradientFrame(nsStyleContext* aContext);
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_ABSTRACT_FRAME(nsSVGGradientFrame)
// nsSVGPaintServerFrame methods:
virtual already_AddRefed<gfxPattern>

View File

@ -1,13 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
// Main header first:
#include "nsSVGPaintServerFrame.h"
// Keep others in (case-insensitive) order:
#include "gfxContext.h"
#include "nsSVGElement.h"
NS_IMPL_FRAMEARENA_HELPERS(nsSVGPaintServerFrame)

View File

@ -40,7 +40,7 @@ protected:
}
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_ABSTRACT_FRAME(nsSVGPaintServerFrame)
/**
* Constructs a gfxPattern of the paint server rendering.