| 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 10 matching lines...) Expand all Loading... |
| 21 #include "cc/layer_tree_host_impl.h" | 21 #include "cc/layer_tree_host_impl.h" |
| 22 #include "cc/layer_tree_impl.h" | 22 #include "cc/layer_tree_impl.h" |
| 23 #include "cc/math_util.h" | 23 #include "cc/math_util.h" |
| 24 #include "cc/occlusion_tracker.h" | 24 #include "cc/occlusion_tracker.h" |
| 25 #include "cc/overdraw_metrics.h" | 25 #include "cc/overdraw_metrics.h" |
| 26 #include "cc/prioritized_resource_manager.h" | 26 #include "cc/prioritized_resource_manager.h" |
| 27 #include "cc/single_thread_proxy.h" | 27 #include "cc/single_thread_proxy.h" |
| 28 #include "cc/switches.h" | 28 #include "cc/switches.h" |
| 29 #include "cc/thread.h" | 29 #include "cc/thread.h" |
| 30 #include "cc/thread_proxy.h" | 30 #include "cc/thread_proxy.h" |
| 31 #include "cc/top_controls_manager.h" |
| 31 #include "cc/tree_synchronizer.h" | 32 #include "cc/tree_synchronizer.h" |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 static int numLayerTreeInstances; | 35 static int numLayerTreeInstances; |
| 35 } | 36 } |
| 36 | 37 |
| 37 namespace cc { | 38 namespace cc { |
| 38 | 39 |
| 39 bool LayerTreeHost::s_needsFilterContext = false; | 40 bool LayerTreeHost::s_needsFilterContext = false; |
| 40 | 41 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 292 |
| 292 syncTree->set_source_frame_number(commitNumber()); | 293 syncTree->set_source_frame_number(commitNumber()); |
| 293 syncTree->set_background_color(m_backgroundColor); | 294 syncTree->set_background_color(m_backgroundColor); |
| 294 syncTree->set_has_transparent_background(m_hasTransparentBackground); | 295 syncTree->set_has_transparent_background(m_hasTransparentBackground); |
| 295 | 296 |
| 296 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); | 297 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); |
| 297 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); | 298 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); |
| 298 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto
r, m_maxPageScaleFactor); | 299 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto
r, m_maxPageScaleFactor); |
| 299 hostImpl->setDebugState(m_debugState); | 300 hostImpl->setDebugState(m_debugState); |
| 300 | 301 |
| 302 if (m_settings.calculateTopControlsPosition && m_topControlsContentLayer &&
hostImpl->topControlsManager()) |
| 303 hostImpl->topControlsManager()->set_content_layer_id(m_topControlsConten
tLayer->id()); |
| 304 |
| 301 m_commitNumber++; | 305 m_commitNumber++; |
| 302 } | 306 } |
| 303 | 307 |
| 304 void LayerTreeHost::willCommit() | 308 void LayerTreeHost::willCommit() |
| 305 { | 309 { |
| 306 m_client->willCommit(); | 310 m_client->willCommit(); |
| 307 | 311 |
| 308 if (m_debugState.showHudInfo()) { | 312 if (m_debugState.showHudInfo()) { |
| 309 if (!m_hudLayer) | 313 if (!m_hudLayer) |
| 310 m_hudLayer = HeadsUpDisplayLayer::create(); | 314 m_hudLayer = HeadsUpDisplayLayer::create(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 return; | 433 return; |
| 430 | 434 |
| 431 if (m_rootLayer) | 435 if (m_rootLayer) |
| 432 m_rootLayer->setLayerTreeHost(0); | 436 m_rootLayer->setLayerTreeHost(0); |
| 433 m_rootLayer = rootLayer; | 437 m_rootLayer = rootLayer; |
| 434 if (m_rootLayer) | 438 if (m_rootLayer) |
| 435 m_rootLayer->setLayerTreeHost(this); | 439 m_rootLayer->setLayerTreeHost(this); |
| 436 | 440 |
| 437 if (m_hudLayer) | 441 if (m_hudLayer) |
| 438 m_hudLayer->removeFromParent(); | 442 m_hudLayer->removeFromParent(); |
| 443 if (m_topControlsContentLayer) |
| 444 m_topControlsContentLayer->removeFromParent(); |
| 439 | 445 |
| 440 setNeedsFullTreeSync(); | 446 setNeedsFullTreeSync(); |
| 441 } | 447 } |
| 442 | 448 |
| 443 void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) | 449 void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) |
| 444 { | 450 { |
| 445 LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.in
itialDebugState, debugState); | 451 LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.in
itialDebugState, debugState); |
| 446 | 452 |
| 447 if (LayerTreeDebugState::equal(m_debugState, newDebugState)) | 453 if (LayerTreeDebugState::equal(m_debugState, newDebugState)) |
| 448 return; | 454 return; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 531 |
| 526 if (!rootLayer()) | 532 if (!rootLayer()) |
| 527 return; | 533 return; |
| 528 | 534 |
| 529 if (layoutViewportSize().IsEmpty()) | 535 if (layoutViewportSize().IsEmpty()) |
| 530 return; | 536 return; |
| 531 | 537 |
| 532 if (memoryAllocationLimitBytes) | 538 if (memoryAllocationLimitBytes) |
| 533 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBy
tes); | 539 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBy
tes); |
| 534 | 540 |
| 541 if (m_settings.calculateTopControlsPosition) { |
| 542 if (!m_topControlsContentLayer) { |
| 543 m_topControlsContentLayer = Layer::create(); |
| 544 m_topControlsContentLayer->setIsDrawable(false); |
| 545 m_topControlsContentLayer->setDebugName("Top Controls Content"); |
| 546 } |
| 547 |
| 548 // Insert a layer that allows the top controls manager to move around |
| 549 // the content without clobbering/being clobbered by other transforms. |
| 550 if (!LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get(), m_topCon
trolsContentLayer->id())) { |
| 551 m_topControlsContentLayer->setLayerTreeHost(m_rootLayer->layerTreeHo
st()); |
| 552 m_topControlsContentLayer->setChildren(m_rootLayer->children()); |
| 553 m_rootLayer->addChild(m_topControlsContentLayer); |
| 554 } |
| 555 } |
| 556 |
| 535 updateLayers(rootLayer(), queue); | 557 updateLayers(rootLayer(), queue); |
| 536 } | 558 } |
| 537 | 559 |
| 538 static Layer* findFirstScrollableLayer(Layer* layer) | 560 static Layer* findFirstScrollableLayer(Layer* layer) |
| 539 { | 561 { |
| 540 if (!layer) | 562 if (!layer) |
| 541 return 0; | 563 return 0; |
| 542 | 564 |
| 543 if (layer->scrollable()) | 565 if (layer->scrollable()) |
| 544 return layer; | 566 return layer; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 874 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 853 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 875 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 854 } | 876 } |
| 855 | 877 |
| 856 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 878 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
| 857 { | 879 { |
| 858 return m_proxy->capturePicture(); | 880 return m_proxy->capturePicture(); |
| 859 } | 881 } |
| 860 | 882 |
| 861 } // namespace cc | 883 } // namespace cc |
| OLD | NEW |