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

Side by Side Diff: Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

Issue 7866017: If a GraphicsLayerChromium goes away during the middle of paint, its (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 3 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 | no next file » | 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsCo ntext3D::ONE_MINUS_SRC_ALPHA)); 556 GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsCo ntext3D::ONE_MINUS_SRC_ALPHA));
557 GLC(m_context.get(), m_context->enable(GraphicsContext3D::SCISSOR_TEST)); 557 GLC(m_context.get(), m_context->enable(GraphicsContext3D::SCISSOR_TEST));
558 558
559 // Update the contents of the render surfaces. We traverse the array from 559 // Update the contents of the render surfaces. We traverse the array from
560 // back to front to guarantee that nested render surfaces get rendered in th e 560 // back to front to guarantee that nested render surfaces get rendered in th e
561 // correct order. 561 // correct order.
562 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { 562 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
563 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].g et(); 563 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].g et();
564 RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface (); 564 RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface ();
565 ASSERT(renderSurface); 565 ASSERT(renderSurface);
566 if (!renderSurface)
567 continue;
566 568
567 renderSurface->setSkipsDraw(true); 569 renderSurface->setSkipsDraw(true);
568 570
569 // Render surfaces whose drawable area has zero width or height 571 // Render surfaces whose drawable area has zero width or height
570 // will have no layers associated with them and should be skipped. 572 // will have no layers associated with them and should be skipped.
571 if (!renderSurface->layerList().size()) 573 if (!renderSurface->layerList().size())
572 continue; 574 continue;
573 575
574 // Skip completely transparent render surfaces. 576 // Skip completely transparent render surfaces.
575 if (!renderSurface->drawOpacity()) 577 if (!renderSurface->drawOpacity())
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 if (layer->preserves3D() && (!layer->parent() || !layer->parent()->preserves 3D())) 959 if (layer->preserves3D() && (!layer->parent() || !layer->parent()->preserves 3D()))
958 m_layerSorter.sort(&descendants.at(thisLayerIndex), descendants.end()); 960 m_layerSorter.sort(&descendants.at(thisLayerIndex), descendants.end());
959 } 961 }
960 962
961 void LayerRendererChromium::updateCompositorResources(const LayerList& renderSur faceLayerList) 963 void LayerRendererChromium::updateCompositorResources(const LayerList& renderSur faceLayerList)
962 { 964 {
963 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { 965 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
964 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].g et(); 966 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].g et();
965 RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface (); 967 RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface ();
966 ASSERT(renderSurface); 968 ASSERT(renderSurface);
969 if (!renderSurface)
970 continue;
967 971
968 if (!renderSurface->layerList().size() || !renderSurface->drawOpacity()) 972 if (!renderSurface->layerList().size() || !renderSurface->drawOpacity())
969 continue; 973 continue;
970 974
971 const LayerList& layerList = renderSurface->layerList(); 975 const LayerList& layerList = renderSurface->layerList();
972 ASSERT(layerList.size()); 976 ASSERT(layerList.size());
973 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde x) { 977 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde x) {
974 CCLayerImpl* ccLayerImpl = layerList[layerIndex].get(); 978 CCLayerImpl* ccLayerImpl = layerList[layerIndex].get();
979 if (!ccLayerImpl)
nduca 2011/09/09 23:24:09 (drive by) How do we prevent this crap from happen
980 continue;
975 if (ccLayerImpl->renderSurface() && ccLayerImpl->renderSurface() != renderSurface) 981 if (ccLayerImpl->renderSurface() && ccLayerImpl->renderSurface() != renderSurface)
976 continue; 982 continue;
977 983
978 updateCompositorResources(ccLayerImpl); 984 updateCompositorResources(ccLayerImpl);
979 } 985 }
980 } 986 }
981 } 987 }
982 988
983 void LayerRendererChromium::updateCompositorResources(CCLayerImpl* ccLayerImpl) 989 void LayerRendererChromium::updateCompositorResources(CCLayerImpl* ccLayerImpl)
984 { 990 {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 return false; 1066 return false;
1061 } 1067 }
1062 #endif 1068 #endif
1063 1069
1064 setDrawViewportRect(renderSurface->contentRect(), false); 1070 setDrawViewportRect(renderSurface->contentRect(), false);
1065 return true; 1071 return true;
1066 } 1072 }
1067 1073
1068 void LayerRendererChromium::drawLayer(CCLayerImpl* layer, RenderSurfaceChromium* targetSurface) 1074 void LayerRendererChromium::drawLayer(CCLayerImpl* layer, RenderSurfaceChromium* targetSurface)
1069 { 1075 {
1076 if (!layer)
1077 return;
1078
1070 if (layer->renderSurface() && layer->renderSurface() != targetSurface) { 1079 if (layer->renderSurface() && layer->renderSurface() != targetSurface) {
1071 layer->renderSurface()->draw(layer->getDrawRect()); 1080 layer->renderSurface()->draw(layer->getDrawRect());
1072 layer->renderSurface()->releaseContentsTexture(); 1081 layer->renderSurface()->releaseContentsTexture();
1073 return; 1082 return;
1074 } 1083 }
1075 1084
1076 if (!layer->drawsContent()) 1085 if (!layer->drawsContent())
1077 return; 1086 return;
1078 1087
1079 if (!layer->opacity()) 1088 if (!layer->opacity())
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 PassOwnPtr<CCLayerTreeHostImplProxy> LayerRendererChromium::createLayerTreeHostI mplProxy() 1494 PassOwnPtr<CCLayerTreeHostImplProxy> LayerRendererChromium::createLayerTreeHostI mplProxy()
1486 { 1495 {
1487 OwnPtr<CCLayerTreeHostImplProxy> proxy = LayerRendererChromiumImplProxy::cre ate(this); 1496 OwnPtr<CCLayerTreeHostImplProxy> proxy = LayerRendererChromiumImplProxy::cre ate(this);
1488 proxy->start(); 1497 proxy->start();
1489 return proxy.release(); 1498 return proxy.release();
1490 } 1499 }
1491 1500
1492 } // namespace WebCore 1501 } // namespace WebCore
1493 1502
1494 #endif // USE(ACCELERATED_COMPOSITING) 1503 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698