Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 16896019: Replace RenderArena with PartitionAlloc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index da52773b9c681e0a141c09e87d073e96df4c1b23..7e93093a980d379c6f38b401979eaf6baa692d1b 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -40,12 +40,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"
@@ -87,7 +87,6 @@ namespace WebCore {
using namespace HTMLNames;
#ifndef NDEBUG
-static void* baseOfRenderObjectBeingDeleted;
RenderObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(RenderObject* renderObject, bool isForbidden)
: m_renderObject(renderObject)
@@ -117,30 +116,28 @@ bool RenderObject::s_affectsParentBlock = false;
RenderObjectAncestorLineboxDirtySet* RenderObject::s_ancestorLineboxDirtySet = 0;
-void* RenderObject::operator new(size_t sz, RenderArena* renderArena)
+#if ENABLE(PARTITION_ALLOC)
+void* RenderObject::operator new(size_t sz)
{
- return renderArena->allocate(sz);
+ return partitionAlloc(Partitions::getRenderingPartition(), sz);
esprehn 2013/06/20 09:15:44 This is bad, now you don't pack the render tree fo
}
-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);
}
+#endif
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.
@@ -156,56 +153,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;
@@ -2573,10 +2570,10 @@ void RenderObject::destroyAndCleanupAnonymousWrappers()
void RenderObject::destroy()
{
willBeDestroyed();
- arenaDelete(renderArena(), this);
+ postDestroy();
}
-void RenderObject::arenaDelete(RenderArena* arena, void* base)
+void RenderObject::postDestroy()
{
if (m_style) {
for (const FillLayer* bgLayer = m_style->backgroundLayers(); bgLayer; bgLayer = bgLayer->next()) {
@@ -2596,17 +2593,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&)

Powered by Google App Engine
This is Rietveld 408576698