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

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

Issue 7739008: Fix crash in updateCompositorResources due to null root layer (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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 { 191 {
192 for (size_t i = 0; i < layer->children().size(); ++i) 192 for (size_t i = 0; i < layer->children().size(); ++i)
193 clearRenderSurfacesOnCCLayerImplRecursive(layer->children()[i].get()); 193 clearRenderSurfacesOnCCLayerImplRecursive(layer->children()[i].get());
194 layer->clearRenderSurface(); 194 layer->clearRenderSurface();
195 } 195 }
196 196
197 void LayerRendererChromium::clearRootCCLayerImpl() 197 void LayerRendererChromium::clearRootCCLayerImpl()
198 { 198 {
199 if (m_rootCCLayerImpl) 199 if (m_rootCCLayerImpl)
200 clearRenderSurfacesOnCCLayerImplRecursive(m_rootCCLayerImpl.get()); 200 clearRenderSurfacesOnCCLayerImplRecursive(m_rootCCLayerImpl.get());
201 m_computedRenderSurfaceLayerList.clear(); 201 m_computedRenderSurfaceLayerList = adoptPtr(new LayerList());
202 m_rootCCLayerImpl.clear(); 202 m_rootCCLayerImpl.clear();
203 } 203 }
204 204
205 GraphicsContext3D* LayerRendererChromium::context() 205 GraphicsContext3D* LayerRendererChromium::context()
206 { 206 {
207 return m_context.get(); 207 return m_context.get();
208 } 208 }
209 209
210 #if USE(SKIA) 210 #if USE(SKIA)
211 GrContext* LayerRendererChromium::skiaContext() 211 GrContext* LayerRendererChromium::skiaContext()
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // Recheck that we still have a root layer. This may become null if 297 // Recheck that we still have a root layer. This may become null if
298 // compositing gets turned off during a paint operation. 298 // compositing gets turned off during a paint operation.
299 if (!m_rootLayer) 299 if (!m_rootLayer)
300 return; 300 return;
301 301
302 { 302 {
303 TRACE_EVENT("LayerRendererChromium::synchronizeTrees", this, 0); 303 TRACE_EVENT("LayerRendererChromium::synchronizeTrees", this, 0);
304 m_rootCCLayerImpl = TreeSynchronizer::synchronizeTrees(m_rootLayer.get() , m_rootCCLayerImpl.get()); 304 m_rootCCLayerImpl = TreeSynchronizer::synchronizeTrees(m_rootLayer.get() , m_rootCCLayerImpl.get());
305 } 305 }
306 306
307 m_computedRenderSurfaceLayerList = adoptPtr(new LayerList()); 307 OwnPtr<LayerList> temporaryLayerList = adoptPtr(new LayerList());
308 updateLayers(*m_computedRenderSurfaceLayerList); 308 updateLayers(*temporaryLayerList);
309
310 if (m_rootLayer)
311 m_computedRenderSurfaceLayerList = temporaryLayerList.release();
312 else
313 m_computedRenderSurfaceLayerList = adoptPtr(new LayerList());
309 } 314 }
310 315
311 void LayerRendererChromium::drawLayers() 316 void LayerRendererChromium::drawLayers()
312 { 317 {
313 ASSERT(m_hardwareCompositing); 318 ASSERT(m_hardwareCompositing);
314 ASSERT(m_computedRenderSurfaceLayerList); 319 ASSERT(m_computedRenderSurfaceLayerList);
315 // Before drawLayers: 320 // Before drawLayers:
316 if (hardwareCompositing()) { 321 if (hardwareCompositing()) {
317 // FIXME: The multithreaded compositor case will not work as long as 322 // FIXME: The multithreaded compositor case will not work as long as
318 // copyTexImage2D resolves to the parent texture, because the main 323 // copyTexImage2D resolves to the parent texture, because the main
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 paintLayerContents(renderSurfaceLayerList); 379 paintLayerContents(renderSurfaceLayerList);
375 #ifndef NDEBUG 380 #ifndef NDEBUG
376 s_inPaintLayerContents = false; 381 s_inPaintLayerContents = false;
377 #endif 382 #endif
378 // Update compositor resources for root layer. 383 // Update compositor resources for root layer.
379 { 384 {
380 TRACE_EVENT("LayerRendererChromium::updateLayer::updateRoot", this, 0); 385 TRACE_EVENT("LayerRendererChromium::updateLayer::updateRoot", this, 0);
381 m_rootLayerContentTiler->updateRect(m_rootLayerTextureUpdater.get()); 386 m_rootLayerContentTiler->updateRect(m_rootLayerTextureUpdater.get());
382 } 387 }
383 388
389 // Painting could turn off compositing, so check for the root layer.
390 if (!m_rootLayer)
391 return;
392
384 m_contentsTextureManager->reduceMemoryToLimit(textureMemoryReclaimLimitBytes ); 393 m_contentsTextureManager->reduceMemoryToLimit(textureMemoryReclaimLimitBytes );
385 updateCompositorResources(renderSurfaceLayerList); 394 updateCompositorResources(renderSurfaceLayerList);
386 } 395 }
387 396
388 static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntR ect& layerBoundRect, const TransformationMatrix& transform) 397 static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntR ect& layerBoundRect, const TransformationMatrix& transform)
389 { 398 {
390 // Is this layer fully contained within the target surface? 399 // Is this layer fully contained within the target surface?
391 IntRect layerInSurfaceSpace = transform.mapRect(layerBoundRect); 400 IntRect layerInSurfaceSpace = transform.mapRect(layerBoundRect);
392 if (targetSurfaceRect.contains(layerInSurfaceSpace)) 401 if (targetSurfaceRect.contains(layerInSurfaceSpace))
393 return layerBoundRect; 402 return layerBoundRect;
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 PassOwnPtr<CCLayerTreeHostImplProxy> LayerRendererChromium::createLayerTreeHostI mplProxy() 1485 PassOwnPtr<CCLayerTreeHostImplProxy> LayerRendererChromium::createLayerTreeHostI mplProxy()
1477 { 1486 {
1478 OwnPtr<CCLayerTreeHostImplProxy> proxy = LayerRendererChromiumImplProxy::cre ate(this); 1487 OwnPtr<CCLayerTreeHostImplProxy> proxy = LayerRendererChromiumImplProxy::cre ate(this);
1479 proxy->start(); 1488 proxy->start();
1480 return proxy.release(); 1489 return proxy.release();
1481 } 1490 }
1482 1491
1483 } // namespace WebCore 1492 } // namespace WebCore
1484 1493
1485 #endif // USE(ACCELERATED_COMPOSITING) 1494 #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