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

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

Issue 2492073002: Store paint properties directly on LayoutObject (Closed)
Patch Set: rebase Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index a23fb37c132ecd3600fe51a9c70cc3bbea488fe6..da487f6d549f2634cc1ee0e63bf9756d02b07eee 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -128,6 +128,7 @@ struct SameSizeAsLayoutObject : DisplayItemClient {
unsigned m_bitfields2;
LayoutRect m_visualRect;
LayoutPoint m_paintOffset;
+ std::unique_ptr<void*> m_paintProperties;
};
static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject),
@@ -135,15 +136,6 @@ static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject),
bool LayoutObject::s_affectsParentBlock = false;
-// The pointer to paint properties is implemented as a global hash map
-// temporarily, to avoid memory regression during the transition towards SPv2.
-typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>>
- PaintPropertiesMap;
-static PaintPropertiesMap& paintPropertiesMap() {
- DEFINE_STATIC_LOCAL(PaintPropertiesMap, staticPaintPropertiesMap, ());
- return staticPaintPropertiesMap;
-}
-
void* LayoutObject::operator new(size_t sz) {
ASSERT(isMainThread());
return partitionAlloc(WTF::Partitions::layoutPartition(), sz,
@@ -2578,9 +2570,6 @@ void LayoutObject::willBeDestroyed() {
ObjectPaintInvalidator::objectWillBeDestroyed(*this);
- if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
- paintPropertiesMap().remove(this);
-
clearLayoutRootIfNeeded();
if (m_style) {
@@ -3498,16 +3487,14 @@ void LayoutObject::setIsBackgroundAttachmentFixedObject(
const ObjectPaintProperties* LayoutObject::paintProperties() const {
DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
- return paintPropertiesMap().get(this);
+ return m_paintProperties.get();
}
ObjectPaintProperties& LayoutObject::ensurePaintProperties() {
DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
- auto addResult = paintPropertiesMap().add(this, nullptr);
- if (addResult.isNewEntry)
- addResult.storedValue->value = ObjectPaintProperties::create();
-
- return *addResult.storedValue->value;
+ if (!m_paintProperties)
+ m_paintProperties = ObjectPaintProperties::create();
+ return *m_paintProperties;
}
LayoutRect LayoutObject::debugRect() const {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698