Revert of Revert of Prevent <canvas> destructor from causing nested garbage...

Revert of Revert of Prevent <canvas> destructor from causing nested garbage collection (https://codereview.chromium.org/307013006/)

Reason for revert:
This isn't the right CL, was off-by-one.

Original issue's description:
> Revert of Prevent <canvas> destructor from causing nested garbage collection (https://codereview.chromium.org/303803002/)
> 
> Reason for revert:
> This change is the cause of a
> leak in PhishingDOMFeatureExtractorTest.ScriptAndImageFeatures
> under LSAN. See
> http://build.chromium.org/p/chromium.memory/builders/Linux%20ASan%20LSan%20Tests%20%281%29/builds/2642/steps/browser_tests/logs/ScriptAndImageFeatures
> 
> Original issue's description:
> > Prevent <canvas> destructor from causing nested garbage collection
> > 
> > In the destruction of HTMLCanvasElement, we call
> > HTMLCanvasElement::existingDrawingContext(), whose behavior was changed
> > incorrectly in r162330 and was triggering the allocation of an ImageBuffer
> > during tear-down.  This is not only wasteful, but it can trigger a
> > garbage collection because the creation of an ImageBuffer will increase
> > the amount of externallay allocated memory that is declared to V8.
> > Triggering a GC during the finalization of a garbage collected object
> > is bad.
> > 
> > BUG=378289
> > 
> > Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=174984
> 
> TBR=senorblanco@chromium.org,junov@chromium.org
> NOTREECHECKS=true
> NOTRY=true
> BUG=378289
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=175157

TBR=senorblanco@chromium.org,junov@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=378289

Review URL: https://codereview.chromium.org/301243009

git-svn-id: svn://svn.chromium.org/blink/trunk@175158 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5274275b
...@@ -572,10 +572,8 @@ GraphicsContext* HTMLCanvasElement::drawingContext() const ...@@ -572,10 +572,8 @@ GraphicsContext* HTMLCanvasElement::drawingContext() const
GraphicsContext* HTMLCanvasElement::existingDrawingContext() const GraphicsContext* HTMLCanvasElement::existingDrawingContext() const
{ {
if (m_didFailToCreateImageBuffer) { if (!hasImageBuffer())
ASSERT(!hasImageBuffer());
return 0; return 0;
}
return drawingContext(); return drawingContext();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment