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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 1618283006: Fix 2D canvas content loss while page is hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 if (m_layer && !m_destructionInProgress) 513 if (m_layer && !m_destructionInProgress)
514 checkSurfaceValid(); // To ensure rate limiter is disabled if context is lost. 514 checkSurfaceValid(); // To ensure rate limiter is disabled if context is lost.
515 return m_contextProvider ? m_contextProvider->context3d() : 0; 515 return m_contextProvider ? m_contextProvider->context3d() : 0;
516 } 516 }
517 517
518 bool Canvas2DLayerBridge::checkSurfaceValid() 518 bool Canvas2DLayerBridge::checkSurfaceValid()
519 { 519 {
520 ASSERT(!m_destructionInProgress); 520 ASSERT(!m_destructionInProgress);
521 if (m_destructionInProgress) 521 if (m_destructionInProgress)
522 return false; 522 return false;
523 if (isHibernating())
524 return true;
523 if (!m_layer) 525 if (!m_layer)
524 return true; 526 return true;
525 if (!m_surface) 527 if (!m_surface)
526 return false; 528 return false;
527 if (m_contextProvider->context3d()->isContextLost()) { 529 if (m_contextProvider->context3d()->isContextLost()) {
528 m_surface.clear(); 530 m_surface.clear();
529 for (auto mailboxInfo = m_mailboxes.begin(); mailboxInfo != m_mailboxes. end(); ++mailboxInfo) { 531 for (auto mailboxInfo = m_mailboxes.begin(); mailboxInfo != m_mailboxes. end(); ++mailboxInfo) {
530 if (mailboxInfo->m_image) 532 if (mailboxInfo->m_image)
531 mailboxInfo->m_image.clear(); 533 mailboxInfo->m_image.clear();
532 } 534 }
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 m_image = other.m_image; 822 m_image = other.m_image;
821 m_parentLayerBridge = other.m_parentLayerBridge; 823 m_parentLayerBridge = other.m_parentLayerBridge;
822 } 824 }
823 825
824 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) 826 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event)
825 { 827 {
826 blink::Platform::current()->histogramEnumeration("Canvas.HibernationEvents", event, HibernationEventCount); 828 blink::Platform::current()->histogramEnumeration("Canvas.HibernationEvents", event, HibernationEventCount);
827 } 829 }
828 830
829 } // namespace blink 831 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698