Index: Source/core/rendering/RenderObject.cpp |
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp |
index 376a739140520cab245ee520d644e3c46b0efdc8..c60e8fba8c2910031fffbd970a1f440680f253a3 100644 |
--- a/Source/core/rendering/RenderObject.cpp |
+++ b/Source/core/rendering/RenderObject.cpp |
@@ -44,12 +44,12 @@ |
#include "core/page/Page.h" |
#include "core/page/Settings.h" |
#include "core/page/animation/AnimationController.h" |
+#include "core/platform/Partitions.h" |
#include "core/platform/graphics/FloatQuad.h" |
#include "core/platform/graphics/GraphicsContext.h" |
#include "core/platform/graphics/transforms/TransformState.h" |
#include "core/rendering/FlowThreadController.h" |
#include "core/rendering/HitTestResult.h" |
-#include "core/rendering/RenderArena.h" |
#include "core/rendering/RenderCounter.h" |
#include "core/rendering/RenderDeprecatedFlexibleBox.h" |
#include "core/rendering/RenderFlexibleBox.h" |
@@ -91,7 +91,6 @@ namespace WebCore { |
using namespace HTMLNames; |
#ifndef NDEBUG |
-static void* baseOfRenderObjectBeingDeleted; |
RenderObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(RenderObject* renderObject, bool isForbidden) |
: m_renderObject(renderObject) |
@@ -121,30 +120,26 @@ bool RenderObject::s_affectsParentBlock = false; |
RenderObjectAncestorLineboxDirtySet* RenderObject::s_ancestorLineboxDirtySet = 0; |
-void* RenderObject::operator new(size_t sz, RenderArena* renderArena) |
+void* RenderObject::operator new(size_t sz) |
{ |
- return renderArena->allocate(sz); |
+ return partitionAlloc(Partitions::getRenderingPartition(), sz); |
} |
-void RenderObject::operator delete(void* ptr, size_t sz) |
+void RenderObject::operator delete(void* ptr) |
{ |
- ASSERT(baseOfRenderObjectBeingDeleted == ptr); |
- |
- // Stash size where destroy can find it. |
- *(size_t *)ptr = sz; |
+ partitionFree(ptr); |
} |
RenderObject* RenderObject::createObject(Element* element, RenderStyle* style) |
{ |
Document* doc = element->document(); |
- RenderArena* arena = doc->renderArena(); |
// Minimal support for content properties replacing an entire element. |
// Works only if we have exactly one piece of content and it's a URL. |
// Otherwise acts as if we didn't support this feature. |
const ContentData* contentData = style->contentData(); |
if (contentData && !contentData->next() && contentData->isImage() && !element->isPseudoElement()) { |
- RenderImage* image = new (arena) RenderImage(element); |
+ RenderImage* image = new RenderImage(element); |
// RenderImageResourceStyleImage requires a style being present on the image but we don't want to |
// trigger a style change now as the node is not fully attached. Moving this code to style change |
// doesn't make sense as it should be run once at renderer creation. |
@@ -160,56 +155,56 @@ RenderObject* RenderObject::createObject(Element* element, RenderStyle* style) |
if (element->hasTagName(rubyTag)) { |
if (style->display() == INLINE) |
- return new (arena) RenderRubyAsInline(element); |
+ return new RenderRubyAsInline(element); |
else if (style->display() == BLOCK) |
- return new (arena) RenderRubyAsBlock(element); |
+ return new RenderRubyAsBlock(element); |
} |
// treat <rt> as ruby text ONLY if it still has its default treatment of block |
if (element->hasTagName(rtTag) && style->display() == BLOCK) |
- return new (arena) RenderRubyText(element); |
+ return new RenderRubyText(element); |
if (RuntimeEnabledFeatures::cssRegionsEnabled() && style->isDisplayRegionType() && !style->regionThread().isEmpty() && doc->renderView()) |
- return new (arena) RenderRegion(element, 0); |
+ return new RenderRegion(element, 0); |
switch (style->display()) { |
case NONE: |
return 0; |
case INLINE: |
- return new (arena) RenderInline(element); |
+ return new RenderInline(element); |
case BLOCK: |
case INLINE_BLOCK: |
case RUN_IN: |
case COMPACT: |
if ((!style->hasAutoColumnCount() || !style->hasAutoColumnWidth()) && doc->regionBasedColumnsEnabled()) |
- return new (arena) RenderMultiColumnBlock(element); |
- return new (arena) RenderBlock(element); |
+ return new RenderMultiColumnBlock(element); |
+ return new RenderBlock(element); |
case LIST_ITEM: |
- return new (arena) RenderListItem(element); |
+ return new RenderListItem(element); |
case TABLE: |
case INLINE_TABLE: |
- return new (arena) RenderTable(element); |
+ return new RenderTable(element); |
case TABLE_ROW_GROUP: |
case TABLE_HEADER_GROUP: |
case TABLE_FOOTER_GROUP: |
- return new (arena) RenderTableSection(element); |
+ return new RenderTableSection(element); |
case TABLE_ROW: |
- return new (arena) RenderTableRow(element); |
+ return new RenderTableRow(element); |
case TABLE_COLUMN_GROUP: |
case TABLE_COLUMN: |
- return new (arena) RenderTableCol(element); |
+ return new RenderTableCol(element); |
case TABLE_CELL: |
- return new (arena) RenderTableCell(element); |
+ return new RenderTableCell(element); |
case TABLE_CAPTION: |
- return new (arena) RenderTableCaption(element); |
+ return new RenderTableCaption(element); |
case BOX: |
case INLINE_BOX: |
- return new (arena) RenderDeprecatedFlexibleBox(element); |
+ return new RenderDeprecatedFlexibleBox(element); |
case FLEX: |
case INLINE_FLEX: |
- return new (arena) RenderFlexibleBox(element); |
+ return new RenderFlexibleBox(element); |
case GRID: |
case INLINE_GRID: |
- return new (arena) RenderGrid(element); |
+ return new RenderGrid(element); |
case LAZY_BLOCK: |
- return new (arena) RenderLazyBlock(element); |
+ return new RenderLazyBlock(element); |
} |
return 0; |
@@ -2634,11 +2629,12 @@ void RenderObject::destroyAndCleanupAnonymousWrappers() |
void RenderObject::destroy() |
{ |
willBeDestroyed(); |
- arenaDelete(renderArena(), this); |
+ postDestroy(); |
} |
-void RenderObject::arenaDelete(RenderArena* arena, void* base) |
+void RenderObject::postDestroy() |
{ |
+ // It seems ugly that this is not in willBeDestroyed(). |
if (m_style) { |
for (const FillLayer* bgLayer = m_style->backgroundLayers(); bgLayer; bgLayer = bgLayer->next()) { |
if (StyleImage* backgroundImage = bgLayer->image()) |
@@ -2657,17 +2653,7 @@ void RenderObject::arenaDelete(RenderArena* arena, void* base) |
maskBoxImage->removeClient(this); |
} |
-#ifndef NDEBUG |
- void* savedBase = baseOfRenderObjectBeingDeleted; |
- baseOfRenderObjectBeingDeleted = base; |
-#endif |
delete this; |
-#ifndef NDEBUG |
- baseOfRenderObjectBeingDeleted = savedBase; |
-#endif |
- |
- // Recover the size left there for us by operator delete and free the memory. |
- arena->free(*(size_t*)base, base); |
} |
VisiblePosition RenderObject::positionForPoint(const LayoutPoint&) |