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

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 117703004: Free temporary GPU and memory resources held by inactive or hidden 2D canvases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed upstream git branch Created 7 years 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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 { 429 {
430 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; 430 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque;
431 431
432 *msaaSampleCount = 0; 432 *msaaSampleCount = 0;
433 if (is3D()) 433 if (is3D())
434 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode)); 434 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode));
435 435
436 if (shouldAccelerate(deviceSize)) { 436 if (shouldAccelerate(deviceSize)) {
437 if (document().settings()) 437 if (document().settings())
438 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam pleCount(); 438 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam pleCount();
439 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur face(size(), opacityMode, *msaaSampleCount)); 439 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur face(this, size(), opacityMode, *msaaSampleCount));
440 if (surface->isValid()) 440 if (surface->isValid())
441 return surface.release(); 441 return surface.release();
442 } 442 }
443 443
444 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode)); 444 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode));
445 } 445 }
446 446
447 void HTMLCanvasElement::createImageBuffer() 447 void HTMLCanvasElement::createImageBuffer()
448 { 448 {
449 ASSERT(!m_imageBuffer); 449 ASSERT(!m_imageBuffer);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 m_didClearImageBuffer = false; 554 m_didClearImageBuffer = false;
555 } 555 }
556 556
557 AffineTransform HTMLCanvasElement::baseTransform() const 557 AffineTransform HTMLCanvasElement::baseTransform() const
558 { 558 {
559 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); 559 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer);
560 return m_imageBuffer->baseTransform(); 560 return m_imageBuffer->baseTransform();
561 } 561 }
562 562
563 } 563 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698