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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 | 329 |
329 syncTree->set_source_frame_number(commitNumber()); | 330 syncTree->set_source_frame_number(commitNumber()); |
330 syncTree->set_background_color(m_backgroundColor); | 331 syncTree->set_background_color(m_backgroundColor); |
331 syncTree->set_has_transparent_background(m_hasTransparentBackground); | 332 syncTree->set_has_transparent_background(m_hasTransparentBackground); |
332 | 333 |
333 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); | 334 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); |
334 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); | 335 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); |
335 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); | 336 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); |
336 hostImpl->setDebugState(m_debugState); | 337 hostImpl->setDebugState(m_debugState); |
337 | 338 |
339 if (m_settings.calculateTopControlsPosition && m_topControlsContentLayer && hostImpl->topControlsManager()) | |
340 hostImpl->topControlsManager()->set_content_layer_id(m_topControlsConten tLayer->id()); | |
341 | |
338 m_commitNumber++; | 342 m_commitNumber++; |
339 } | 343 } |
340 | 344 |
341 void LayerTreeHost::willCommit() | 345 void LayerTreeHost::willCommit() |
342 { | 346 { |
343 m_client->willCommit(); | 347 m_client->willCommit(); |
344 | 348 |
345 if (m_debugState.showHudInfo()) { | 349 if (m_debugState.showHudInfo()) { |
346 if (!m_hudLayer) | 350 if (!m_hudLayer) |
347 m_hudLayer = HeadsUpDisplayLayer::create(); | 351 m_hudLayer = HeadsUpDisplayLayer::create(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
466 return; | 470 return; |
467 | 471 |
468 if (m_rootLayer) | 472 if (m_rootLayer) |
469 m_rootLayer->setLayerTreeHost(0); | 473 m_rootLayer->setLayerTreeHost(0); |
470 m_rootLayer = rootLayer; | 474 m_rootLayer = rootLayer; |
471 if (m_rootLayer) | 475 if (m_rootLayer) |
472 m_rootLayer->setLayerTreeHost(this); | 476 m_rootLayer->setLayerTreeHost(this); |
473 | 477 |
474 if (m_hudLayer) | 478 if (m_hudLayer) |
475 m_hudLayer->removeFromParent(); | 479 m_hudLayer->removeFromParent(); |
480 if (m_topControlsContentLayer) | |
481 m_topControlsContentLayer->removeFromParent(); | |
476 | 482 |
477 setNeedsFullTreeSync(); | 483 setNeedsFullTreeSync(); |
478 } | 484 } |
479 | 485 |
480 void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) | 486 void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) |
481 { | 487 { |
482 LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.in itialDebugState, debugState); | 488 LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.in itialDebugState, debugState); |
483 | 489 |
484 if (LayerTreeDebugState::equal(m_debugState, newDebugState)) | 490 if (LayerTreeDebugState::equal(m_debugState, newDebugState)) |
485 return; | 491 return; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 | 568 |
563 if (!rootLayer()) | 569 if (!rootLayer()) |
564 return; | 570 return; |
565 | 571 |
566 if (layoutViewportSize().IsEmpty()) | 572 if (layoutViewportSize().IsEmpty()) |
567 return; | 573 return; |
568 | 574 |
569 if (memoryAllocationLimitBytes) | 575 if (memoryAllocationLimitBytes) |
570 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBy tes); | 576 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBy tes); |
571 | 577 |
578 if (m_settings.calculateTopControlsPosition) { | |
579 if (!m_topControlsContentLayer) { | |
580 m_topControlsContentLayer = Layer::create(); | |
581 m_topControlsContentLayer->setIsDrawable(false); | |
enne (OOO)
2013/01/12 00:15:00
Can you add a setDebugName("Top Controls Content")
Ted C
2013/01/12 01:23:05
Done.
| |
582 } | |
583 | |
584 // Insert a layer that allows the top controls manager to move around | |
585 // the content without clobbering/being clobbered by other transforms. | |
586 if (!LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get(), m_topCon trolsContentLayer->id())) { | |
587 m_topControlsContentLayer->setLayerTreeHost(m_rootLayer->layerTreeHo st()); | |
588 m_topControlsContentLayer->setChildren(m_rootLayer->children()); | |
589 m_rootLayer->addChild(m_topControlsContentLayer); | |
590 } | |
591 } | |
592 | |
572 updateLayers(rootLayer(), queue); | 593 updateLayers(rootLayer(), queue); |
573 } | 594 } |
574 | 595 |
575 static Layer* findFirstScrollableLayer(Layer* layer) | 596 static Layer* findFirstScrollableLayer(Layer* layer) |
576 { | 597 { |
577 if (!layer) | 598 if (!layer) |
578 return 0; | 599 return 0; |
579 | 600 |
580 if (layer->scrollable()) | 601 if (layer->scrollable()) |
581 return layer; | 602 return layer; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
889 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 910 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
890 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 911 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
891 } | 912 } |
892 | 913 |
893 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 914 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
894 { | 915 { |
895 return m_proxy->capturePicture(); | 916 return m_proxy->capturePicture(); |
896 } | 917 } |
897 | 918 |
898 } // namespace cc | 919 } // namespace cc |
OLD | NEW |