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

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

Issue 869323003: Oilpan: move RenderObjects off heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review-induced improvements Created 5 years, 10 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
« no previous file with comments | « Source/core/rendering/RenderPart.h ('k') | Source/core/rendering/RenderQuote.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 3 * (C) 2000 Simon Hausmann <hausmann@kde.org>
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 23 matching lines...) Expand all
34 #include "core/plugins/PluginView.h" 34 #include "core/plugins/PluginView.h"
35 #include "core/rendering/HitTestResult.h" 35 #include "core/rendering/HitTestResult.h"
36 #include "core/rendering/RenderLayer.h" 36 #include "core/rendering/RenderLayer.h"
37 #include "core/rendering/RenderView.h" 37 #include "core/rendering/RenderView.h"
38 #include "core/rendering/svg/RenderSVGRoot.h" 38 #include "core/rendering/svg/RenderSVGRoot.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 RenderPart::RenderPart(Element* element) 42 RenderPart::RenderPart(Element* element)
43 : RenderReplaced(element) 43 : RenderReplaced(element)
44 #if !ENABLE(OILPAN)
45 // Reference counting is used to prevent the part from being destroyed 44 // Reference counting is used to prevent the part from being destroyed
46 // while inside the Widget code, which might not be able to handle that. 45 // while inside the Widget code, which might not be able to handle that.
47 , m_refCount(1) 46 , m_refCount(1)
48 #endif
49 { 47 {
50 ASSERT(element); 48 ASSERT(element);
51 frameView()->addPart(this); 49 frameView()->addPart(this);
52 setInline(false); 50 setInline(false);
53 } 51 }
54 52
55 #if !ENABLE(OILPAN)
56 void RenderPart::deref() 53 void RenderPart::deref()
57 { 54 {
58 if (--m_refCount <= 0) 55 if (--m_refCount <= 0)
59 postDestroy(); 56 postDestroy();
60 } 57 }
61 #endif
62 58
63 void RenderPart::willBeDestroyed() 59 void RenderPart::willBeDestroyed()
64 { 60 {
65 frameView()->removePart(this); 61 frameView()->removePart(this);
66 62
67 if (AXObjectCache* cache = document().existingAXObjectCache()) { 63 if (AXObjectCache* cache = document().existingAXObjectCache()) {
68 cache->childrenChanged(this->parent()); 64 cache->childrenChanged(this->parent());
69 cache->remove(this); 65 cache->remove(this);
70 } 66 }
71 67
72 Element* element = toElement(node()); 68 Element* element = toElement(node());
73 if (element && element->isFrameOwnerElement()) 69 if (element && element->isFrameOwnerElement())
74 toHTMLFrameOwnerElement(element)->setWidget(nullptr); 70 toHTMLFrameOwnerElement(element)->setWidget(nullptr);
75 71
76 RenderReplaced::willBeDestroyed(); 72 RenderReplaced::willBeDestroyed();
77 } 73 }
78 74
79 void RenderPart::destroy() 75 void RenderPart::destroy()
80 { 76 {
81 #if ENABLE(ASSERT) && ENABLE(OILPAN)
82 ASSERT(!m_didCallDestroy);
83 m_didCallDestroy = true;
84 #endif
85 willBeDestroyed(); 77 willBeDestroyed();
86 clearNode(); 78 clearNode();
87 #if ENABLE(OILPAN)
88 // In Oilpan, postDestroy doesn't delete |this|. So calling it here is safe
89 // though |this| will be referred in FrameView.
90 postDestroy();
91 #else
92 deref(); 79 deref();
93 #endif
94 } 80 }
95 81
96 RenderPart::~RenderPart() 82 RenderPart::~RenderPart()
97 { 83 {
98 #if !ENABLE(OILPAN)
99 ASSERT(m_refCount <= 0); 84 ASSERT(m_refCount <= 0);
100 #endif
101 } 85 }
102 86
103 Widget* RenderPart::widget() const 87 Widget* RenderPart::widget() const
104 { 88 {
105 // Plugin widgets are stored in their DOM node. This includes HTMLAppletElem ent. 89 // Plugin widgets are stored in their DOM node. This includes HTMLAppletElem ent.
106 Element* element = toElement(node()); 90 Element* element = toElement(node());
107 91
108 if (element && element->isFrameOwnerElement()) 92 if (element && element->isFrameOwnerElement())
109 return toHTMLFrameOwnerElement(element)->ownedWidget(); 93 return toHTMLFrameOwnerElement(element)->ownedWidget();
110 94
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 if (widget->frameRect() == newFrame) 313 if (widget->frameRect() == newFrame)
330 return false; 314 return false;
331 315
332 RefPtrWillBeRawPtr<RenderPart> protector(this); 316 RefPtrWillBeRawPtr<RenderPart> protector(this);
333 RefPtrWillBeRawPtr<Node> protectedNode(node()); 317 RefPtrWillBeRawPtr<Node> protectedNode(node());
334 widget->setFrameRect(newFrame); 318 widget->setFrameRect(newFrame);
335 return widget->frameRect().size() != newFrame.size(); 319 return widget->frameRect().size() != newFrame.size();
336 } 320 }
337 321
338 } 322 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderPart.h ('k') | Source/core/rendering/RenderQuote.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698