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

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

Issue 251023004: WebGL: Free temporary GPU resources held by inactive or hidden WebGL. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use ASSERT instead of 'if' in prepareMailbox() Created 6 years, 5 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) 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 644
645 AffineTransform HTMLCanvasElement::baseTransform() const 645 AffineTransform HTMLCanvasElement::baseTransform() const
646 { 646 {
647 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); 647 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer);
648 return m_imageBuffer->baseTransform(); 648 return m_imageBuffer->baseTransform();
649 } 649 }
650 650
651 void HTMLCanvasElement::didChangeVisibilityState(PageVisibilityState visibility) 651 void HTMLCanvasElement::didChangeVisibilityState(PageVisibilityState visibility)
652 { 652 {
653 if (hasImageBuffer()) { 653 if (!m_context)
654 bool hidden = visibility != PageVisibilityStateVisible; 654 return;
655 if (hidden) { 655 bool hidden = visibility != PageVisibilityStateVisible;
656 clearCopiedImage(); 656 m_context->setIsHidden(hidden);
657 if (is3D()) { 657 if (hidden) {
658 discardImageBuffer(); 658 clearCopiedImage();
659 } 659 if (is3D()) {
660 } 660 discardImageBuffer();
661 if (hasImageBuffer()) {
662 m_imageBuffer->setIsHidden(hidden);
663 } 661 }
664 } 662 }
665 } 663 }
666 664
667 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) 665 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument)
668 { 666 {
669 setObservedDocument(document()); 667 setObservedDocument(document());
670 HTMLElement::didMoveToNewDocument(oldDocument); 668 HTMLElement::didMoveToNewDocument(oldDocument);
671 } 669 }
672 670
(...skipping 27 matching lines...) Expand all
700 { 698 {
701 return !originClean(); 699 return !originClean();
702 } 700 }
703 701
704 FloatSize HTMLCanvasElement::sourceSize() const 702 FloatSize HTMLCanvasElement::sourceSize() const
705 { 703 {
706 return FloatSize(width(), height()); 704 return FloatSize(width(), height());
707 } 705 }
708 706
709 } 707 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698