Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 // impl tree, so we can't draw yet. Determine this before clearing all evict ed backings. | 258 // impl tree, so we can't draw yet. Determine this before clearing all evict ed backings. |
| 259 bool newImplTreeHasNoEvictedResources = !m_contentsTextureManager->linkedEvi ctedBackingsExist(); | 259 bool newImplTreeHasNoEvictedResources = !m_contentsTextureManager->linkedEvi ctedBackingsExist(); |
| 260 | 260 |
| 261 m_contentsTextureManager->updateBackingsInDrawingImplTree(); | 261 m_contentsTextureManager->updateBackingsInDrawingImplTree(); |
| 262 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); | 262 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); |
| 263 | 263 |
| 264 // In impl-side painting, synchronize to the pending tree so that it has | 264 // In impl-side painting, synchronize to the pending tree so that it has |
| 265 // time to raster before being displayed. If no pending tree is needed, | 265 // time to raster before being displayed. If no pending tree is needed, |
| 266 // synchronization can happen directly to the active tree. | 266 // synchronization can happen directly to the active tree. |
| 267 LayerTreeImpl* syncTree; | 267 LayerTreeImpl* syncTree; |
| 268 bool needsFullTreeSync = false; | |
| 269 if (m_settings.implSidePainting) { | 268 if (m_settings.implSidePainting) { |
| 270 // Commits should not occur while there is already a pending tree. | 269 // Commits should not occur while there is already a pending tree. |
| 271 DCHECK(!hostImpl->pendingTree()); | 270 DCHECK(!hostImpl->pendingTree()); |
| 272 hostImpl->createPendingTree(); | 271 hostImpl->createPendingTree(); |
| 273 syncTree = hostImpl->pendingTree(); | 272 syncTree = hostImpl->pendingTree(); |
| 274 // TODO(enne): we could recycle old active trees and keep track for | |
| 275 // multiple main thread frames whether a sync is needed | |
| 276 needsFullTreeSync = true; | |
| 277 } else { | 273 } else { |
| 278 syncTree = hostImpl->activeTree(); | 274 syncTree = hostImpl->activeTree(); |
| 279 needsFullTreeSync = m_needsFullTreeSync; | |
| 280 } | 275 } |
| 281 | 276 |
| 282 if (needsFullTreeSync) | 277 if (m_needsFullTreeSync) |
| 283 syncTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), s yncTree->DetachLayerTree(), syncTree)); | 278 syncTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), s yncTree->DetachLayerTree(), syncTree)); |
| 284 { | 279 { |
| 285 TRACE_EVENT0("cc", "LayerTreeHost::pushProperties"); | 280 TRACE_EVENT0("cc", "LayerTreeHost::pushProperties"); |
| 286 TreeSynchronizer::pushProperties(rootLayer(), syncTree->RootLayer()); | 281 TreeSynchronizer::pushProperties(rootLayer(), syncTree->RootLayer()); |
| 287 } | 282 } |
| 288 | 283 |
| 284 hostImpl->setNeedsFullTreeSync(m_needsFullTreeSync); | |
|
enne (OOO)
2013/02/01 00:13:02
Since we only have two trees this doesn't really m
danakj
2013/02/01 00:17:27
Oh, okay!
| |
| 289 m_needsFullTreeSync = false; | 285 m_needsFullTreeSync = false; |
| 290 | 286 |
| 291 if (m_rootLayer && m_hudLayer) | 287 if (m_rootLayer && m_hudLayer) |
| 292 syncTree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeH ostCommon::findLayerInSubtree(syncTree->RootLayer(), m_hudLayer->id()))); | 288 syncTree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeH ostCommon::findLayerInSubtree(syncTree->RootLayer(), m_hudLayer->id()))); |
| 293 else | 289 else |
| 294 syncTree->set_hud_layer(0); | 290 syncTree->set_hud_layer(0); |
| 295 | 291 |
| 296 syncTree->set_source_frame_number(commitNumber()); | 292 syncTree->set_source_frame_number(commitNumber()); |
| 297 syncTree->set_background_color(m_backgroundColor); | 293 syncTree->set_background_color(m_backgroundColor); |
| 298 syncTree->set_has_transparent_background(m_hasTransparentBackground); | 294 syncTree->set_has_transparent_background(m_hasTransparentBackground); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 862 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
| 867 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 863 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
| 868 } | 864 } |
| 869 | 865 |
| 870 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 866 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
| 871 { | 867 { |
| 872 return m_proxy->capturePicture(); | 868 return m_proxy->capturePicture(); |
| 873 } | 869 } |
| 874 | 870 |
| 875 } // namespace cc | 871 } // namespace cc |
| OLD | NEW |