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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 292 |
293 syncTree->set_source_frame_number(commitNumber()); | 293 syncTree->set_source_frame_number(commitNumber()); |
294 syncTree->set_background_color(m_backgroundColor); | 294 syncTree->set_background_color(m_backgroundColor); |
295 syncTree->set_has_transparent_background(m_hasTransparentBackground); | 295 syncTree->set_has_transparent_background(m_hasTransparentBackground); |
296 | 296 |
297 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); | 297 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); |
298 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); | 298 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); |
299 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto
r, m_maxPageScaleFactor); | 299 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto
r, m_maxPageScaleFactor); |
300 hostImpl->setDebugState(m_debugState); | 300 hostImpl->setDebugState(m_debugState); |
301 | 301 |
302 if (m_settings.calculateTopControlsPosition && m_topControlsContentLayer &&
hostImpl->topControlsManager()) | |
303 hostImpl->topControlsManager()->set_content_layer_id(m_topControlsConten
tLayer->id()); | |
304 | |
305 m_commitNumber++; | 302 m_commitNumber++; |
306 } | 303 } |
307 | 304 |
308 void LayerTreeHost::willCommit() | 305 void LayerTreeHost::willCommit() |
309 { | 306 { |
310 m_client->willCommit(); | 307 m_client->willCommit(); |
311 | 308 |
312 if (m_debugState.showHudInfo()) { | 309 if (m_debugState.showHudInfo()) { |
313 if (!m_hudLayer) | 310 if (!m_hudLayer) |
314 m_hudLayer = HeadsUpDisplayLayer::create(); | 311 m_hudLayer = HeadsUpDisplayLayer::create(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 return; | 430 return; |
434 | 431 |
435 if (m_rootLayer) | 432 if (m_rootLayer) |
436 m_rootLayer->setLayerTreeHost(0); | 433 m_rootLayer->setLayerTreeHost(0); |
437 m_rootLayer = rootLayer; | 434 m_rootLayer = rootLayer; |
438 if (m_rootLayer) | 435 if (m_rootLayer) |
439 m_rootLayer->setLayerTreeHost(this); | 436 m_rootLayer->setLayerTreeHost(this); |
440 | 437 |
441 if (m_hudLayer) | 438 if (m_hudLayer) |
442 m_hudLayer->removeFromParent(); | 439 m_hudLayer->removeFromParent(); |
443 if (m_topControlsContentLayer) | |
444 m_topControlsContentLayer->removeFromParent(); | |
445 | 440 |
446 setNeedsFullTreeSync(); | 441 setNeedsFullTreeSync(); |
447 } | 442 } |
448 | 443 |
449 void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) | 444 void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) |
450 { | 445 { |
451 LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.in
itialDebugState, debugState); | 446 LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.in
itialDebugState, debugState); |
452 | 447 |
453 if (LayerTreeDebugState::equal(m_debugState, newDebugState)) | 448 if (LayerTreeDebugState::equal(m_debugState, newDebugState)) |
454 return; | 449 return; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 526 |
532 if (!rootLayer()) | 527 if (!rootLayer()) |
533 return; | 528 return; |
534 | 529 |
535 if (layoutViewportSize().IsEmpty()) | 530 if (layoutViewportSize().IsEmpty()) |
536 return; | 531 return; |
537 | 532 |
538 if (memoryAllocationLimitBytes) | 533 if (memoryAllocationLimitBytes) |
539 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBy
tes); | 534 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBy
tes); |
540 | 535 |
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 | |
557 updateLayers(rootLayer(), queue); | 536 updateLayers(rootLayer(), queue); |
558 } | 537 } |
559 | 538 |
560 static Layer* findFirstScrollableLayer(Layer* layer) | 539 static Layer* findFirstScrollableLayer(Layer* layer) |
561 { | 540 { |
562 if (!layer) | 541 if (!layer) |
563 return 0; | 542 return 0; |
564 | 543 |
565 if (layer->scrollable()) | 544 if (layer->scrollable()) |
566 return layer; | 545 return layer; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 853 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
875 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 854 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
876 } | 855 } |
877 | 856 |
878 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 857 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
879 { | 858 { |
880 return m_proxy->capturePicture(); | 859 return m_proxy->capturePicture(); |
881 } | 860 } |
882 | 861 |
883 } // namespace cc | 862 } // namespace cc |
OLD | NEW |