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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 423093002: Oilpan: Prepare to move RenderObject and RenderObjectChildList to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add more trace Created 6 years, 4 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 | Annotate | Revision Log
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. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 { 114 {
115 m_renderObject.setNeedsLayoutIsForbidden(m_preexistingForbidden); 115 m_renderObject.setNeedsLayoutIsForbidden(m_preexistingForbidden);
116 } 116 }
117 #endif 117 #endif
118 118
119 struct SameSizeAsRenderObject { 119 struct SameSizeAsRenderObject {
120 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. 120 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer.
121 void* pointers[5]; 121 void* pointers[5];
122 #if ENABLE(ASSERT) 122 #if ENABLE(ASSERT)
123 unsigned m_debugBitfields : 2; 123 unsigned m_debugBitfields : 2;
124 #if ENABLE(OILPAN)
125 unsigned m_oilpanBitfields : 1;
126 #endif
124 #endif 127 #endif
125 unsigned m_bitfields; 128 unsigned m_bitfields;
126 unsigned m_bitfields2; 129 unsigned m_bitfields2;
127 LayoutRect rect; // Stores the previous paint invalidation rect. 130 LayoutRect rect; // Stores the previous paint invalidation rect.
128 LayoutPoint position; // Stores the previous position from the paint invalid ation container. 131 LayoutPoint position; // Stores the previous position from the paint invalid ation container.
129 }; 132 };
130 133
131 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj ect_should_stay_small); 134 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj ect_should_stay_small);
132 135
133 bool RenderObject::s_affectsParentBlock = false; 136 bool RenderObject::s_affectsParentBlock = false;
134 137
138 #if !ENABLE(OILPAN)
135 void* RenderObject::operator new(size_t sz) 139 void* RenderObject::operator new(size_t sz)
136 { 140 {
137 ASSERT(isMainThread()); 141 ASSERT(isMainThread());
138 return partitionAlloc(Partitions::getRenderingPartition(), sz); 142 return partitionAlloc(Partitions::getRenderingPartition(), sz);
139 } 143 }
140 144
141 void RenderObject::operator delete(void* ptr) 145 void RenderObject::operator delete(void* ptr)
142 { 146 {
143 ASSERT(isMainThread()); 147 ASSERT(isMainThread());
144 partitionFree(ptr); 148 partitionFree(ptr);
145 } 149 }
150 #endif
146 151
147 RenderObject* RenderObject::createObject(Element* element, RenderStyle* style) 152 RenderObject* RenderObject::createObject(Element* element, RenderStyle* style)
148 { 153 {
149 ASSERT(isAllowedToModifyRenderTreeStructure(element->document())); 154 ASSERT(isAllowedToModifyRenderTreeStructure(element->document()));
150 155
151 // Minimal support for content properties replacing an entire element. 156 // Minimal support for content properties replacing an entire element.
152 // Works only if we have exactly one piece of content and it's a URL. 157 // Works only if we have exactly one piece of content and it's a URL.
153 // Otherwise acts as if we didn't support this feature. 158 // Otherwise acts as if we didn't support this feature.
154 const ContentData* contentData = style->contentData(); 159 const ContentData* contentData = style->contentData();
155 if (contentData && !contentData->next() && contentData->isImage() && !elemen t->isPseudoElement()) { 160 if (contentData && !contentData->next() && contentData->isImage() && !elemen t->isPseudoElement()) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 211
207 return 0; 212 return 0;
208 } 213 }
209 214
210 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, renderObjectCounter, ("Rend erObject")); 215 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, renderObjectCounter, ("Rend erObject"));
211 216
212 RenderObject::RenderObject(Node* node) 217 RenderObject::RenderObject(Node* node)
213 : ImageResourceClient() 218 : ImageResourceClient()
214 , m_style(nullptr) 219 , m_style(nullptr)
215 , m_node(node) 220 , m_node(node)
216 , m_parent(0) 221 , m_parent(nullptr)
217 , m_previous(0) 222 , m_previous(nullptr)
218 , m_next(0) 223 , m_next(nullptr)
219 #if ENABLE(ASSERT) 224 #if ENABLE(ASSERT)
220 , m_hasAXObject(false) 225 , m_hasAXObject(false)
221 , m_setNeedsLayoutForbidden(false) 226 , m_setNeedsLayoutForbidden(false)
227 #if ENABLE(OILPAN)
228 , m_didCallDestroy(false)
229 #endif
222 #endif 230 #endif
223 , m_bitfields(node) 231 , m_bitfields(node)
224 { 232 {
225 #ifndef NDEBUG 233 #ifndef NDEBUG
226 renderObjectCounter.increment(); 234 renderObjectCounter.increment();
227 #endif 235 #endif
228 } 236 }
229 237
230 RenderObject::~RenderObject() 238 RenderObject::~RenderObject()
231 { 239 {
232 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRender Object(this); 240 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeRender Object(this);
233 ASSERT(!m_hasAXObject); 241 ASSERT(!m_hasAXObject);
242 #if ENABLE(OILPAN)
243 ASSERT(m_didCallDestroy);
244 #endif
234 #ifndef NDEBUG 245 #ifndef NDEBUG
235 renderObjectCounter.decrement(); 246 renderObjectCounter.decrement();
236 #endif 247 #endif
237 } 248 }
238 249
250 void RenderObject::trace(Visitor* visitor)
251 {
252 visitor->trace(m_node);
253 visitor->trace(m_parent);
254 visitor->trace(m_previous);
255 visitor->trace(m_next);
256 }
257
239 String RenderObject::debugName() const 258 String RenderObject::debugName() const
240 { 259 {
241 StringBuilder name; 260 StringBuilder name;
242 name.append(renderName()); 261 name.append(renderName());
243 262
244 if (Node* node = this->node()) { 263 if (Node* node = this->node()) {
245 name.append(' '); 264 name.append(' ');
246 name.append(node->debugName()); 265 name.append(node->debugName());
247 } 266 }
248 267
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 break; 2818 break;
2800 } 2819 }
2801 2820
2802 destroyRoot->destroy(); 2821 destroyRoot->destroy();
2803 2822
2804 // WARNING: |this| is deleted here. 2823 // WARNING: |this| is deleted here.
2805 } 2824 }
2806 2825
2807 void RenderObject::destroy() 2826 void RenderObject::destroy()
2808 { 2827 {
2828 #if ENABLE(ASSERT) && ENABLE(OILPAN)
2829 m_didCallDestroy = true;
2830 #endif
2809 willBeDestroyed(); 2831 willBeDestroyed();
2810 postDestroy(); 2832 postDestroy();
2811 } 2833 }
2812 2834
2813 void RenderObject::removeShapeImageClient(ShapeValue* shapeValue) 2835 void RenderObject::removeShapeImageClient(ShapeValue* shapeValue)
2814 { 2836 {
2815 if (!shapeValue) 2837 if (!shapeValue)
2816 return; 2838 return;
2817 if (StyleImage* shapeImage = shapeValue->image()) 2839 if (StyleImage* shapeImage = shapeValue->image())
2818 shapeImage->removeClient(this); 2840 shapeImage->removeClient(this);
(...skipping 14 matching lines...) Expand all
2833 } 2855 }
2834 2856
2835 if (StyleImage* borderImage = m_style->borderImage().image()) 2857 if (StyleImage* borderImage = m_style->borderImage().image())
2836 borderImage->removeClient(this); 2858 borderImage->removeClient(this);
2837 2859
2838 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) 2860 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image())
2839 maskBoxImage->removeClient(this); 2861 maskBoxImage->removeClient(this);
2840 2862
2841 removeShapeImageClient(m_style->shapeOutside()); 2863 removeShapeImageClient(m_style->shapeOutside());
2842 } 2864 }
2843 2865 #if !ENABLE(OILPAN)
2844 delete this; 2866 delete this;
2867 #endif
2845 } 2868 }
2846 2869
2847 PositionWithAffinity RenderObject::positionForPoint(const LayoutPoint&) 2870 PositionWithAffinity RenderObject::positionForPoint(const LayoutPoint&)
2848 { 2871 {
2849 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); 2872 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM);
2850 } 2873 }
2851 2874
2852 void RenderObject::updateDragState(bool dragOn) 2875 void RenderObject::updateDragState(bool dragOn)
2853 { 2876 {
2854 bool valueChanged = (dragOn != isDragging()); 2877 bool valueChanged = (dragOn != isDragging());
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 { 3476 {
3454 if (object1) { 3477 if (object1) {
3455 const blink::RenderObject* root = object1; 3478 const blink::RenderObject* root = object1;
3456 while (root->parent()) 3479 while (root->parent())
3457 root = root->parent(); 3480 root = root->parent();
3458 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3481 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3459 } 3482 }
3460 } 3483 }
3461 3484
3462 #endif 3485 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698