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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2430813002: Switch to shorter names for property tree storage and updates (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 LayoutPoint position; // Stores the previous position from the paint 130 LayoutPoint position; // Stores the previous position from the paint
131 // invalidation container. 131 // invalidation container.
132 }; 132 };
133 133
134 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), 134 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject),
135 "LayoutObject should stay small"); 135 "LayoutObject should stay small");
136 136
137 bool LayoutObject::s_affectsParentBlock = false; 137 bool LayoutObject::s_affectsParentBlock = false;
138 138
139 // The pointer to paint properties is implemented as a global hash map 139 // The pointer to paint properties is implemented as a global hash map
140 // temporarily, 140 // temporarily, to avoid memory regression during the transition towards SPv2.
141 // to avoid memory regression during the transition towards SPv2.
142 typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>> 141 typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>>
143 ObjectPaintPropertiesMap; 142 PaintPropertiesMap;
144 static ObjectPaintPropertiesMap& objectPaintPropertiesMap() { 143 static PaintPropertiesMap& paintPropertiesMap() {
145 DEFINE_STATIC_LOCAL(ObjectPaintPropertiesMap, staticObjectPaintPropertiesMap, 144 DEFINE_STATIC_LOCAL(PaintPropertiesMap, staticPaintPropertiesMap, ());
146 ()); 145 return staticPaintPropertiesMap;
147 return staticObjectPaintPropertiesMap;
148 } 146 }
149 147
150 void* LayoutObject::operator new(size_t sz) { 148 void* LayoutObject::operator new(size_t sz) {
151 ASSERT(isMainThread()); 149 ASSERT(isMainThread());
152 return partitionAlloc(WTF::Partitions::layoutPartition(), sz, 150 return partitionAlloc(WTF::Partitions::layoutPartition(), sz,
153 WTF_HEAP_PROFILER_TYPE_NAME(LayoutObject)); 151 WTF_HEAP_PROFILER_TYPE_NAME(LayoutObject));
154 } 152 }
155 153
156 void LayoutObject::operator delete(void* ptr) { 154 void LayoutObject::operator delete(void* ptr) {
157 ASSERT(isMainThread()); 155 ASSERT(isMainThread());
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 ->contains(node())) 2557 ->contains(node()))
2560 registry.didRemoveEventHandler( 2558 registry.didRemoveEventHandler(
2561 *node(), EventHandlerRegistry::TouchStartOrMoveEventBlocking); 2559 *node(), EventHandlerRegistry::TouchStartOrMoveEventBlocking);
2562 } 2560 }
2563 2561
2564 setAncestorLineBoxDirty(false); 2562 setAncestorLineBoxDirty(false);
2565 2563
2566 ObjectPaintInvalidator::objectWillBeDestroyed(*this); 2564 ObjectPaintInvalidator::objectWillBeDestroyed(*this);
2567 2565
2568 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 2566 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
2569 objectPaintPropertiesMap().remove(this); 2567 paintPropertiesMap().remove(this);
2570 2568
2571 clearLayoutRootIfNeeded(); 2569 clearLayoutRootIfNeeded();
2572 2570
2573 if (m_style) { 2571 if (m_style) {
2574 for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer; 2572 for (const FillLayer* bgLayer = &m_style->backgroundLayers(); bgLayer;
2575 bgLayer = bgLayer->next()) { 2573 bgLayer = bgLayer->next()) {
2576 if (StyleImage* backgroundImage = bgLayer->image()) 2574 if (StyleImage* backgroundImage = bgLayer->image())
2577 backgroundImage->removeClient(this); 2575 backgroundImage->removeClient(this);
2578 } 2576 }
2579 2577
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 isBackgroundAttachmentFixedObject) 3479 isBackgroundAttachmentFixedObject)
3482 return; 3480 return;
3483 m_bitfields.setIsBackgroundAttachmentFixedObject( 3481 m_bitfields.setIsBackgroundAttachmentFixedObject(
3484 isBackgroundAttachmentFixedObject); 3482 isBackgroundAttachmentFixedObject);
3485 if (isBackgroundAttachmentFixedObject) 3483 if (isBackgroundAttachmentFixedObject)
3486 frameView()->addBackgroundAttachmentFixedObject(this); 3484 frameView()->addBackgroundAttachmentFixedObject(this);
3487 else 3485 else
3488 frameView()->removeBackgroundAttachmentFixedObject(this); 3486 frameView()->removeBackgroundAttachmentFixedObject(this);
3489 } 3487 }
3490 3488
3491 const ObjectPaintProperties* LayoutObject::objectPaintProperties() const { 3489 const ObjectPaintProperties* LayoutObject::paintProperties() const {
3492 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 3490 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
3493 return objectPaintPropertiesMap().get(this); 3491 return paintPropertiesMap().get(this);
3494 } 3492 }
3495 3493
3496 ObjectPaintProperties& LayoutObject::ensureObjectPaintProperties() { 3494 ObjectPaintProperties& LayoutObject::ensurePaintProperties() {
3497 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 3495 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
3498 auto addResult = objectPaintPropertiesMap().add(this, nullptr); 3496 auto addResult = paintPropertiesMap().add(this, nullptr);
3499 if (addResult.isNewEntry) 3497 if (addResult.isNewEntry)
3500 addResult.storedValue->value = ObjectPaintProperties::create(); 3498 addResult.storedValue->value = ObjectPaintProperties::create();
3501 3499
3502 return *addResult.storedValue->value; 3500 return *addResult.storedValue->value;
3503 } 3501 }
3504 3502
3505 LayoutRect LayoutObject::debugRect() const { 3503 LayoutRect LayoutObject::debugRect() const {
3506 LayoutRect rect; 3504 LayoutRect rect;
3507 LayoutBlock* block = containingBlock(); 3505 LayoutBlock* block = containingBlock();
3508 if (block) 3506 if (block)
(...skipping 30 matching lines...) Expand all
3539 const blink::LayoutObject* root = object1; 3537 const blink::LayoutObject* root = object1;
3540 while (root->parent()) 3538 while (root->parent())
3541 root = root->parent(); 3539 root = root->parent();
3542 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3540 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3543 } else { 3541 } else {
3544 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3542 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3545 } 3543 }
3546 } 3544 }
3547 3545
3548 #endif 3546 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/api/LayoutItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698