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

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

Issue 2063773002: Reland: WTF: Implement explicit RefPtr::operator bool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 if (m_contextProvider->contextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERR OR) { 729 if (m_contextProvider->contextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERR OR) {
730 m_surface.clear(); 730 m_surface.clear();
731 for (auto mailboxInfo = m_mailboxes.begin(); mailboxInfo != m_mailboxes. end(); ++mailboxInfo) { 731 for (auto mailboxInfo = m_mailboxes.begin(); mailboxInfo != m_mailboxes. end(); ++mailboxInfo) {
732 if (mailboxInfo->m_image) 732 if (mailboxInfo->m_image)
733 mailboxInfo->m_image.clear(); 733 mailboxInfo->m_image.clear();
734 } 734 }
735 if (m_imageBuffer) 735 if (m_imageBuffer)
736 m_imageBuffer->notifySurfaceInvalid(); 736 m_imageBuffer->notifySurfaceInvalid();
737 CanvasMetrics::countCanvasContextUsage(CanvasMetrics::Accelerated2DCanva sGPUContextLost); 737 CanvasMetrics::countCanvasContextUsage(CanvasMetrics::Accelerated2DCanva sGPUContextLost);
738 } 738 }
739 return m_surface; 739 return m_surface.get();
740 } 740 }
741 741
742 bool Canvas2DLayerBridge::restoreSurface() 742 bool Canvas2DLayerBridge::restoreSurface()
743 { 743 {
744 ASSERT(!m_destructionInProgress); 744 ASSERT(!m_destructionInProgress);
745 if (m_destructionInProgress) 745 if (m_destructionInProgress)
746 return false; 746 return false;
747 ASSERT(isAccelerated() && !m_surface); 747 ASSERT(isAccelerated() && !m_surface);
748 748
749 gpu::gles2::GLES2Interface* sharedGL = nullptr; 749 gpu::gles2::GLES2Interface* sharedGL = nullptr;
(...skipping 14 matching lines...) Expand all
764 // due to changes to the layer tree, which can only happen at specific t imes during the document lifecycle. 764 // due to changes to the layer tree, which can only happen at specific t imes during the document lifecycle.
765 // Therefore, we can only accept the restored surface if it is accelerat ed. 765 // Therefore, we can only accept the restored surface if it is accelerat ed.
766 if (surface && surfaceIsAccelerated) { 766 if (surface && surfaceIsAccelerated) {
767 m_surface = surface.release(); 767 m_surface = surface.release();
768 // FIXME: draw sad canvas picture into new buffer crbug.com/243842 768 // FIXME: draw sad canvas picture into new buffer crbug.com/243842
769 } 769 }
770 } 770 }
771 if (m_imageBuffer) 771 if (m_imageBuffer)
772 m_imageBuffer->updateGPUMemoryUsage(); 772 m_imageBuffer->updateGPUMemoryUsage();
773 773
774 return m_surface; 774 return m_surface.get();
775 } 775 }
776 776
777 bool Canvas2DLayerBridge::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExternalBitmap* bitmap) 777 bool Canvas2DLayerBridge::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExternalBitmap* bitmap)
778 { 778 {
779 if (m_destructionInProgress) { 779 if (m_destructionInProgress) {
780 // It can be hit in the following sequence. 780 // It can be hit in the following sequence.
781 // 1. Canvas draws something. 781 // 1. Canvas draws something.
782 // 2. The compositor begins the frame. 782 // 2. The compositor begins the frame.
783 // 3. Javascript makes a context be lost. 783 // 3. Javascript makes a context be lost.
784 // 4. Here. 784 // 4. Here.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 #endif // USE_IOSURFACE_FOR_2D_CANVAS 994 #endif // USE_IOSURFACE_FOR_2D_CANVAS
995 } 995 }
996 996
997 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) 997 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event)
998 { 998 {
999 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount)); 999 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount));
1000 hibernationHistogram.count(event); 1000 hibernationHistogram.count(event);
1001 } 1001 }
1002 1002
1003 } // namespace blink 1003 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698