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

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

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

Powered by Google App Engine
This is Rietveld 408576698