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

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

Issue 2785603002: Add LayoutObject::RarePaintData for rare paint data (Closed)
Patch Set: Use default unique_ptr ctor Created 3 years, 8 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer. 119 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer.
120 void* pointers[5]; 120 void* pointers[5];
121 Member<void*> members[1]; 121 Member<void*> members[1];
122 #if DCHECK_IS_ON() 122 #if DCHECK_IS_ON()
123 unsigned m_debugBitfields : 2; 123 unsigned m_debugBitfields : 2;
124 #endif 124 #endif
125 unsigned m_bitfields; 125 unsigned m_bitfields;
126 unsigned m_bitfields2; 126 unsigned m_bitfields2;
127 LayoutRect m_visualRect; 127 LayoutRect m_visualRect;
128 LayoutPoint m_paintOffset; 128 LayoutPoint m_paintOffset;
129 std::unique_ptr<void*> m_paintProperties; 129 std::unique_ptr<void*> m_rarePaintData;
130 }; 130 };
131 131
132 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), 132 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject),
133 "LayoutObject should stay small"); 133 "LayoutObject should stay small");
134 134
135 bool LayoutObject::s_affectsParentBlock = false; 135 bool LayoutObject::s_affectsParentBlock = false;
136 136
137 void* LayoutObject::operator new(size_t sz) { 137 void* LayoutObject::operator new(size_t sz) {
138 ASSERT(isMainThread()); 138 ASSERT(isMainThread());
139 return PartitionAlloc(WTF::Partitions::layoutPartition(), sz, 139 return PartitionAlloc(WTF::Partitions::layoutPartition(), sz,
(...skipping 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3545 isBackgroundAttachmentFixedObject) 3545 isBackgroundAttachmentFixedObject)
3546 return; 3546 return;
3547 m_bitfields.setIsBackgroundAttachmentFixedObject( 3547 m_bitfields.setIsBackgroundAttachmentFixedObject(
3548 isBackgroundAttachmentFixedObject); 3548 isBackgroundAttachmentFixedObject);
3549 if (isBackgroundAttachmentFixedObject) 3549 if (isBackgroundAttachmentFixedObject)
3550 frameView()->addBackgroundAttachmentFixedObject(this); 3550 frameView()->addBackgroundAttachmentFixedObject(this);
3551 else 3551 else
3552 frameView()->removeBackgroundAttachmentFixedObject(this); 3552 frameView()->removeBackgroundAttachmentFixedObject(this);
3553 } 3553 }
3554 3554
3555 const ObjectPaintProperties* LayoutObject::paintProperties() const { 3555 LayoutObject::RarePaintData::RarePaintData() {}
Xianzhu 2017/03/30 03:11:18 Nit: I think we can just use the default construct
pdr. 2017/03/30 18:57:33 This does have to be here. Windows puts the defaul
3556 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 3556
3557 return m_paintProperties.get(); 3557 LayoutObject::RarePaintData::~RarePaintData() {}
3558
3559 ObjectPaintProperties& LayoutObject::RarePaintData::ensurePaintProperties() {
3560 if (!m_paintProperties)
3561 m_paintProperties = ObjectPaintProperties::create();
3562 return *m_paintProperties.get();
3558 } 3563 }
3559 3564
3560 ObjectPaintProperties& LayoutObject::ensurePaintProperties() { 3565 LayoutObject::RarePaintData& LayoutObject::ensureRarePaintData() {
3561 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 3566 if (!m_rarePaintData)
3562 if (!m_paintProperties) 3567 m_rarePaintData = WTF::makeUnique<RarePaintData>();
3563 m_paintProperties = ObjectPaintProperties::create(); 3568 return *m_rarePaintData.get();
3564 return *m_paintProperties;
3565 } 3569 }
3566 3570
3567 LayoutRect LayoutObject::debugRect() const { 3571 LayoutRect LayoutObject::debugRect() const {
3568 LayoutRect rect; 3572 LayoutRect rect;
3569 LayoutBlock* block = containingBlock(); 3573 LayoutBlock* block = containingBlock();
3570 if (block) 3574 if (block)
3571 block->adjustChildDebugRect(rect); 3575 block->adjustChildDebugRect(rect);
3572 3576
3573 return rect; 3577 return rect;
3574 } 3578 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 const blink::LayoutObject* root = object1; 3630 const blink::LayoutObject* root = object1;
3627 while (root->parent()) 3631 while (root->parent())
3628 root = root->parent(); 3632 root = root->parent();
3629 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3633 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3630 } else { 3634 } else {
3631 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3635 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3632 } 3636 }
3633 } 3637 }
3634 3638
3635 #endif 3639 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698