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

Unified Diff: third_party/WebKit/Source/core/layout/FloatingObjects.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 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: third_party/WebKit/Source/core/layout/FloatingObjects.cpp
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
index eff3aae9290e1e506abc86def572d67ae95ae4c9..3972c9d69f9998cf7847d98fbe07c521be9995a0 100644
--- a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
+++ b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
@@ -29,8 +29,9 @@
#include "core/layout/shapes/ShapeOutsideInfo.h"
#include "core/paint/PaintLayer.h"
#include "platform/RuntimeEnabledFeatures.h"
-
+#include "wtf/PtrUtil.h"
#include <algorithm>
+#include <memory>
using namespace WTF;
@@ -88,9 +89,9 @@ bool FloatingObject::shouldPaintForCompositedLayoutPart()
return m_layoutObject->layer() && m_layoutObject->layer()->isSelfPaintingOnlyBecauseIsCompositedPart() && !RuntimeEnabledFeatures::slimmingPaintV2Enabled();
}
-PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject)
+std::unique_ptr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject)
{
- OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(layoutObject));
+ std::unique_ptr<FloatingObject> newObj = wrapUnique(new FloatingObject(layoutObject));
// If a layer exists, the float will paint itself. Otherwise someone else will.
newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() || newObj->shouldPaintForCompositedLayoutPart());
@@ -105,14 +106,14 @@ bool FloatingObject::shouldPaint() const
return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer();
}
-PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const
+std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const
{
- return adoptPtr(new FloatingObject(layoutObject(), getType(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild()));
+ return wrapUnique(new FloatingObject(layoutObject(), getType(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild()));
}
-PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const
+std::unique_ptr<FloatingObject> FloatingObject::unsafeClone() const
{
- OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(layoutObject(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false));
+ std::unique_ptr<FloatingObject> cloneObject = wrapUnique(new FloatingObject(layoutObject(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false));
cloneObject->m_isPlaced = m_isPlaced;
return cloneObject;
}
@@ -406,7 +407,7 @@ void FloatingObjects::markLowestFloatLogicalBottomCacheAsDirty()
void FloatingObjects::moveAllToFloatInfoMap(LayoutBoxToFloatInfoMap& map)
{
while (!m_set.isEmpty()) {
- OwnPtr<FloatingObject> floatingObject = m_set.takeFirst();
+ std::unique_ptr<FloatingObject> floatingObject = m_set.takeFirst();
LayoutBox* layoutObject = floatingObject->layoutObject();
map.add(layoutObject, std::move(floatingObject));
}
@@ -466,11 +467,11 @@ void FloatingObjects::removePlacedObject(FloatingObject& floatingObject)
markLowestFloatLogicalBottomCacheAsDirty();
}
-FloatingObject* FloatingObjects::add(PassOwnPtr<FloatingObject> floatingObject)
+FloatingObject* FloatingObjects::add(std::unique_ptr<FloatingObject> floatingObject)
{
- FloatingObject* newObject = floatingObject.leakPtr();
+ FloatingObject* newObject = floatingObject.release();
increaseObjectsCount(newObject->getType());
- m_set.add(adoptPtr(newObject));
+ m_set.add(wrapUnique(newObject));
if (newObject->isPlaced())
addPlacedObject(*newObject);
markLowestFloatLogicalBottomCacheAsDirty();
@@ -480,7 +481,7 @@ FloatingObject* FloatingObjects::add(PassOwnPtr<FloatingObject> floatingObject)
void FloatingObjects::remove(FloatingObject* toBeRemoved)
{
decreaseObjectsCount(toBeRemoved->getType());
- OwnPtr<FloatingObject> floatingObject = m_set.take(toBeRemoved);
+ std::unique_ptr<FloatingObject> floatingObject = m_set.take(toBeRemoved);
ASSERT(floatingObject->isPlaced() || !floatingObject->isInPlacedTree());
if (floatingObject->isPlaced())
removePlacedObject(*floatingObject);
« no previous file with comments | « third_party/WebKit/Source/core/layout/FloatingObjects.h ('k') | third_party/WebKit/Source/core/layout/HitTestLocation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698