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

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: rebase to ToT Created 6 years, 8 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 } 631 }
632 632
633 AffineTransform HTMLCanvasElement::baseTransform() const 633 AffineTransform HTMLCanvasElement::baseTransform() const
634 { 634 {
635 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); 635 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer);
636 return m_imageBuffer->baseTransform(); 636 return m_imageBuffer->baseTransform();
637 } 637 }
638 638
639 void HTMLCanvasElement::didChangeVisibilityState(PageVisibilityState visibility) 639 void HTMLCanvasElement::didChangeVisibilityState(PageVisibilityState visibility)
640 { 640 {
641 if (hasImageBuffer()) { 641 if (!m_context)
642 bool hidden = visibility != PageVisibilityStateVisible; 642 return;
643 if (hidden) { 643 bool hidden = visibility != PageVisibilityStateVisible;
644 clearCopiedImage(); 644 m_context->setIsHidden(hidden);
645 if (is3D()) { 645 if (hidden) {
646 discardImageBuffer(); 646 clearCopiedImage();
647 } 647 if (is3D()) {
648 } 648 discardImageBuffer();
649 if (hasImageBuffer()) {
650 m_imageBuffer->setIsHidden(hidden);
651 } 649 }
652 } 650 }
653 } 651 }
654 652
655 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument) 653 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument)
656 { 654 {
657 setObservedDocument(document()); 655 setObservedDocument(document());
658 HTMLElement::didMoveToNewDocument(oldDocument); 656 HTMLElement::didMoveToNewDocument(oldDocument);
659 } 657 }
660 658
(...skipping 27 matching lines...) Expand all
688 { 686 {
689 return !originClean(); 687 return !originClean();
690 } 688 }
691 689
692 FloatSize HTMLCanvasElement::sourceSize() const 690 FloatSize HTMLCanvasElement::sourceSize() const
693 { 691 {
694 return FloatSize(width(), height()); 692 return FloatSize(width(), height());
695 } 693 }
696 694
697 } 695 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/canvas/CanvasRenderingContext.h » ('j') | Source/core/html/canvas/WebGLRenderingContextBase.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698