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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerReflectionInfo.cpp

Issue 1657883002: Fix leak PaintLayerReflectionInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 PaintLayerReflectionInfo::PaintLayerReflectionInfo(LayoutBox& layoutObject) 58 PaintLayerReflectionInfo::PaintLayerReflectionInfo(LayoutBox& layoutObject)
59 : m_box(&layoutObject) 59 : m_box(&layoutObject)
60 , m_isPaintingInsideReflection(false) 60 , m_isPaintingInsideReflection(false)
61 { 61 {
62 UseCounter::count(box().document(), UseCounter::Reflection); 62 UseCounter::count(box().document(), UseCounter::Reflection);
63 63
64 m_reflection = LayoutReplica::createAnonymous(&box().document()); 64 m_reflection = LayoutReplica::createAnonymous(&box().document());
65 m_reflection->setDangerousOneWayParent(m_box); 65 m_reflection->setDangerousOneWayParent(m_box);
66 } 66 }
67 67
68 void PaintLayerReflectionInfo::destroy() 68 PaintLayerReflectionInfo::~PaintLayerReflectionInfo()
69 { 69 {
70 if (!m_reflection->documentBeingDestroyed()) 70 if (!m_reflection->documentBeingDestroyed())
71 m_reflection->removeLayers(box().layer()); 71 m_reflection->removeLayers(box().layer());
72 72
73 m_reflection->setDangerousOneWayParent(nullptr); 73 m_reflection->setDangerousOneWayParent(nullptr);
74 m_reflection->destroy(); 74 m_reflection->destroy();
75 m_reflection = nullptr; 75 m_reflection = nullptr;
76 } 76 }
77 77
78 PaintLayer* PaintLayerReflectionInfo::reflectionLayer() const 78 PaintLayer* PaintLayerReflectionInfo::reflectionLayer() const
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return PaintLayerPainter::FullyPainted; 134 return PaintLayerPainter::FullyPainted;
135 135
136 // Mark that we are now inside replica painting. 136 // Mark that we are now inside replica painting.
137 m_isPaintingInsideReflection = true; 137 m_isPaintingInsideReflection = true;
138 PaintLayerPainter::PaintResult result = PaintLayerPainter(*reflectionLayer() ).paintLayer(context, paintingInfo, flags | PaintLayerPaintingReflection); 138 PaintLayerPainter::PaintResult result = PaintLayerPainter(*reflectionLayer() ).paintLayer(context, paintingInfo, flags | PaintLayerPaintingReflection);
139 m_isPaintingInsideReflection = false; 139 m_isPaintingInsideReflection = false;
140 return result; 140 return result;
141 } 141 }
142 142
143 } // namespace blink 143 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698