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

Side by Side Diff: Source/core/rendering/RenderWidget.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 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved.
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 22 matching lines...) Expand all
33 #include "core/rendering/RenderLayer.h" 33 #include "core/rendering/RenderLayer.h"
34 #include "core/rendering/RenderView.h" 34 #include "core/rendering/RenderView.h"
35 #include "core/rendering/compositing/CompositedLayerMapping.h" 35 #include "core/rendering/compositing/CompositedLayerMapping.h"
36 #include "core/rendering/compositing/RenderLayerCompositor.h" 36 #include "core/rendering/compositing/RenderLayerCompositor.h"
37 #include "wtf/HashMap.h" 37 #include "wtf/HashMap.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 RenderWidget::RenderWidget(Element* element) 41 RenderWidget::RenderWidget(Element* element)
42 : RenderReplaced(element) 42 : RenderReplaced(element)
43 #if !ENABLE(OILPAN)
43 // Reference counting is used to prevent the widget from being 44 // Reference counting is used to prevent the widget from being
44 // destroyed while inside the Widget code, which might not be 45 // destroyed while inside the Widget code, which might not be
45 // able to handle that. 46 // able to handle that.
46 , m_refCount(1) 47 , m_refCount(1)
48 #endif
47 { 49 {
48 ASSERT(element); 50 ASSERT(element);
49 frameView()->addWidget(this); 51 frameView()->addWidget(this);
50 } 52 }
51 53
52 void RenderWidget::willBeDestroyed() 54 void RenderWidget::willBeDestroyed()
53 { 55 {
54 frameView()->removeWidget(this); 56 frameView()->removeWidget(this);
55 57
56 if (AXObjectCache* cache = document().existingAXObjectCache()) { 58 if (AXObjectCache* cache = document().existingAXObjectCache()) {
57 cache->childrenChanged(this->parent()); 59 cache->childrenChanged(this->parent());
58 cache->remove(this); 60 cache->remove(this);
59 } 61 }
60 62
61 Element* element = toElement(node()); 63 Element* element = toElement(node());
62 if (element && element->isFrameOwnerElement()) 64 if (element && element->isFrameOwnerElement())
63 toHTMLFrameOwnerElement(element)->setWidget(nullptr); 65 toHTMLFrameOwnerElement(element)->setWidget(nullptr);
64 66
65 RenderReplaced::willBeDestroyed(); 67 RenderReplaced::willBeDestroyed();
66 } 68 }
67 69
68 void RenderWidget::destroy() 70 void RenderWidget::destroy()
69 { 71 {
72 #if ENABLE(ASSERT) && ENABLE(OILPAN)
73 m_didCallDestroy = true;
74 #endif
70 willBeDestroyed(); 75 willBeDestroyed();
71 clearNode(); 76 clearNode();
77 #if ENABLE(OILPAN)
78 // In Oilpan, postDestroy doesn't delete |this|. So calling it here is safe
79 // though |this| will be referred in FrameView.
80 postDestroy();
81 #else
72 deref(); 82 deref();
83 #endif
73 } 84 }
74 85
75 RenderWidget::~RenderWidget() 86 RenderWidget::~RenderWidget()
76 { 87 {
88 #if !ENABLE(OILPAN)
77 ASSERT(m_refCount <= 0); 89 ASSERT(m_refCount <= 0);
90 #endif
78 } 91 }
79 92
80 Widget* RenderWidget::widget() const 93 Widget* RenderWidget::widget() const
81 { 94 {
82 // Plugin widgets are stored in their DOM node. This includes HTMLAppletElem ent. 95 // Plugin widgets are stored in their DOM node. This includes HTMLAppletElem ent.
83 Element* element = toElement(node()); 96 Element* element = toElement(node());
84 97
85 if (element && element->isFrameOwnerElement()) 98 if (element && element->isFrameOwnerElement())
86 return toHTMLFrameOwnerElement(element)->ownedWidget(); 99 return toHTMLFrameOwnerElement(element)->ownedWidget();
87 100
(...skipping 14 matching lines...) Expand all
102 return false; 115 return false;
103 116
104 Widget* widget = this->widget(); 117 Widget* widget = this->widget();
105 ASSERT(widget); 118 ASSERT(widget);
106 119
107 IntRect newFrame = roundedIntRect(frame); 120 IntRect newFrame = roundedIntRect(frame);
108 121
109 if (widget->frameRect() == newFrame) 122 if (widget->frameRect() == newFrame)
110 return false; 123 return false;
111 124
112 RefPtr<RenderWidget> protector(this); 125 RefPtrWillBeRawPtr<RenderWidget> protector(this);
113 RefPtrWillBeRawPtr<Node> protectedNode(node()); 126 RefPtrWillBeRawPtr<Node> protectedNode(node());
114 widget->setFrameRect(newFrame); 127 widget->setFrameRect(newFrame);
115 return widget->frameRect().size() != newFrame.size(); 128 return widget->frameRect().size() != newFrame.size();
116 } 129 }
117 130
118 bool RenderWidget::updateWidgetGeometry() 131 bool RenderWidget::updateWidgetGeometry()
119 { 132 {
120 Widget* widget = this->widget(); 133 Widget* widget = this->widget();
121 ASSERT(widget); 134 ASSERT(widget);
122 135
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 254 }
242 255
243 void RenderWidget::setIsOverlapped(bool isOverlapped) 256 void RenderWidget::setIsOverlapped(bool isOverlapped)
244 { 257 {
245 Widget* widget = this->widget(); 258 Widget* widget = this->widget();
246 ASSERT(widget); 259 ASSERT(widget);
247 ASSERT(widget->isFrameView()); 260 ASSERT(widget->isFrameView());
248 toFrameView(widget)->setIsOverlapped(isOverlapped); 261 toFrameView(widget)->setIsOverlapped(isOverlapped);
249 } 262 }
250 263
264 #if !ENABLE(OILPAN)
251 void RenderWidget::deref() 265 void RenderWidget::deref()
252 { 266 {
253 if (--m_refCount <= 0) 267 if (--m_refCount <= 0)
254 postDestroy(); 268 postDestroy();
255 } 269 }
270 #endif
256 271
257 void RenderWidget::updateOnWidgetChange() 272 void RenderWidget::updateOnWidgetChange()
258 { 273 {
259 Widget* widget = this->widget(); 274 Widget* widget = this->widget();
260 if (!widget) 275 if (!widget)
261 return; 276 return;
262 277
263 if (!style()) 278 if (!style())
264 return; 279 return;
265 280
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const 330 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const
316 { 331 {
317 if (widget() && widget()->isPluginView()) { 332 if (widget() && widget()->isPluginView()) {
318 // A plug-in is responsible for setting the cursor when the pointer is o ver it. 333 // A plug-in is responsible for setting the cursor when the pointer is o ver it.
319 return DoNotSetCursor; 334 return DoNotSetCursor;
320 } 335 }
321 return RenderReplaced::getCursor(point, cursor); 336 return RenderReplaced::getCursor(point, cursor);
322 } 337 }
323 338
324 } // namespace blink 339 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698