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/cc/CCLayerTreeHost.cpp

Issue 10702135: Merge 120858 - [chromium] Separate LayerRenderer initialization from updateLayers (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 292 }
293 293
294 // Temporary hack until WebViewImpl context creation gets simplified 294 // Temporary hack until WebViewImpl context creation gets simplified
295 CCGraphicsContext* CCLayerTreeHost::context() 295 CCGraphicsContext* CCLayerTreeHost::context()
296 { 296 {
297 return m_proxy->context(); 297 return m_proxy->context();
298 } 298 }
299 299
300 bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) 300 bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect)
301 { 301 {
302 if (!m_layerRendererInitialized) {
303 initializeLayerRenderer();
304 if (!m_layerRendererInitialized)
305 return false;
306 }
307 if (m_contextLost) {
308 if (recreateContext() != RecreateSucceeded)
309 return false;
310 }
311 m_triggerIdlePaints = false; 302 m_triggerIdlePaints = false;
312 bool ret = m_proxy->compositeAndReadback(pixels, rect); 303 bool ret = m_proxy->compositeAndReadback(pixels, rect);
313 m_triggerIdlePaints = true; 304 m_triggerIdlePaints = true;
314 return ret; 305 return ret;
315 } 306 }
316 307
317 void CCLayerTreeHost::finishAllRendering() 308 void CCLayerTreeHost::finishAllRendering()
318 { 309 {
319 if (!m_layerRendererInitialized) 310 if (!m_layerRendererInitialized)
320 return; 311 return;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 { 450 {
460 ASSERT(!CCThreadProxy::implThread()); 451 ASSERT(!CCThreadProxy::implThread());
461 static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); 452 static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately();
462 } 453 }
463 454
464 void CCLayerTreeHost::scheduleComposite() 455 void CCLayerTreeHost::scheduleComposite()
465 { 456 {
466 m_client->scheduleComposite(); 457 m_client->scheduleComposite();
467 } 458 }
468 459
469 bool CCLayerTreeHost::updateLayers(CCTextureUpdater& updater) 460 bool CCLayerTreeHost::initializeLayerRendererIfNeeded()
470 { 461 {
471 if (!m_layerRendererInitialized) { 462 if (!m_layerRendererInitialized) {
472 initializeLayerRenderer(); 463 initializeLayerRenderer();
473 // If we couldn't initialize, then bail since we're returning to softwar e mode. 464 // If we couldn't initialize, then bail since we're returning to softwar e mode.
474 if (!m_layerRendererInitialized) 465 if (!m_layerRendererInitialized)
475 return false; 466 return false;
476 } 467 }
477 if (m_contextLost) { 468 if (m_contextLost) {
478 if (recreateContext() != RecreateSucceeded) 469 if (recreateContext() != RecreateSucceeded)
479 return false; 470 return false;
480 } 471 }
472 return true;
473 }
481 474
475
476 void CCLayerTreeHost::updateLayers(CCTextureUpdater& updater)
477 {
478 ASSERT(m_layerRendererInitialized);
482 // The visible state and memory allocation are set independently and in 479 // The visible state and memory allocation are set independently and in
483 // arbitrary order, so do not change the memory allocation used for the 480 // arbitrary order, so do not change the memory allocation used for the
484 // current commit until both values match intentions. 481 // current commit until both values match intentions.
485 // FIXME: These two states should be combined into a single action so we 482 // FIXME: These two states should be combined into a single action so we
486 // need a single commit to change visible state, and this can be removed. 483 // need a single commit to change visible state, and this can be removed.
487 bool memoryAllocationStateMatchesVisibility = m_visible == m_memoryAllocatio nIsForDisplay; 484 bool memoryAllocationStateMatchesVisibility = m_visible == m_memoryAllocatio nIsForDisplay;
488 if (memoryAllocationStateMatchesVisibility) { 485 if (memoryAllocationStateMatchesVisibility) {
489 m_contentsTextureManager->setMemoryAllocationLimitBytes(m_memoryAllocati onBytes); 486 m_contentsTextureManager->setMemoryAllocationLimitBytes(m_memoryAllocati onBytes);
490 m_frameIsForDisplay = m_memoryAllocationIsForDisplay; 487 m_frameIsForDisplay = m_memoryAllocationIsForDisplay;
491 } 488 }
492 489
493 if (!rootLayer()) 490 if (!rootLayer())
494 return true; 491 return;
495 492
496 if (viewportSize().isEmpty()) 493 if (viewportSize().isEmpty())
497 return true; 494 return;
498 495
499 updateLayers(rootLayer(), updater); 496 updateLayers(rootLayer(), updater);
500 return true;
501 } 497 }
502 498
503 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u pdater) 499 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u pdater)
504 { 500 {
505 TRACE_EVENT("CCLayerTreeHost::updateLayers", this, 0); 501 TRACE_EVENT("CCLayerTreeHost::updateLayers", this, 0);
506 502
507 if (!rootLayer->renderSurface()) 503 if (!rootLayer->renderSurface())
508 rootLayer->createRenderSurface(); 504 rootLayer->createRenderSurface();
509 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(0, 0), deviceVie wportSize())); 505 rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(0, 0), deviceVie wportSize()));
510 506
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 else 758 else
763 layer->notifyAnimationFinished(wallClockTime); 759 layer->notifyAnimationFinished(wallClockTime);
764 } 760 }
765 } 761 }
766 762
767 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 763 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
768 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 764 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
769 } 765 }
770 766
771 } // namespace WebCore 767 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698