| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 TRACE_EVENT0("cc", "LayerTreeHost::initializeForReal"); | 114 TRACE_EVENT0("cc", "LayerTreeHost::initializeForReal"); |
| 115 | 115 |
| 116 m_proxy = proxy.Pass(); | 116 m_proxy = proxy.Pass(); |
| 117 m_proxy->Start(); | 117 m_proxy->Start(); |
| 118 return m_proxy->InitializeOutputSurface(); | 118 return m_proxy->InitializeOutputSurface(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 LayerTreeHost::~LayerTreeHost() | 121 LayerTreeHost::~LayerTreeHost() |
| 122 { | 122 { |
| 123 if (m_rootLayer) | 123 if (m_rootLayer) |
| 124 m_rootLayer->setLayerTreeHost(0); | 124 m_rootLayer->SetLayerTreeHost(0); |
| 125 DCHECK(m_proxy); | 125 DCHECK(m_proxy); |
| 126 DCHECK(m_proxy->IsMainThread()); | 126 DCHECK(m_proxy->IsMainThread()); |
| 127 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 127 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
| 128 m_proxy->Stop(); | 128 m_proxy->Stop(); |
| 129 numLayerTreeInstances--; | 129 numLayerTreeInstances--; |
| 130 RateLimiterMap::iterator it = m_rateLimiters.begin(); | 130 RateLimiterMap::iterator it = m_rateLimiters.begin(); |
| 131 if (it != m_rateLimiters.end()) | 131 if (it != m_rateLimiters.end()) |
| 132 it->second->stop(); | 132 it->second->stop(); |
| 133 | 133 |
| 134 if (m_rootLayer) { | 134 if (m_rootLayer) { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 341 |
| 342 void LayerTreeHost::willCommit() | 342 void LayerTreeHost::willCommit() |
| 343 { | 343 { |
| 344 m_client->willCommit(); | 344 m_client->willCommit(); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void LayerTreeHost::updateHudLayer() | 347 void LayerTreeHost::updateHudLayer() |
| 348 { | 348 { |
| 349 if (m_debugState.showHudInfo()) { | 349 if (m_debugState.showHudInfo()) { |
| 350 if (!m_hudLayer) | 350 if (!m_hudLayer) |
| 351 m_hudLayer = HeadsUpDisplayLayer::create(); | 351 m_hudLayer = HeadsUpDisplayLayer::Create(); |
| 352 | 352 |
| 353 if (m_rootLayer && !m_hudLayer->parent()) | 353 if (m_rootLayer && !m_hudLayer->parent()) |
| 354 m_rootLayer->addChild(m_hudLayer); | 354 m_rootLayer->AddChild(m_hudLayer); |
| 355 } else if (m_hudLayer) { | 355 } else if (m_hudLayer) { |
| 356 m_hudLayer->removeFromParent(); | 356 m_hudLayer->RemoveFromParent(); |
| 357 m_hudLayer = 0; | 357 m_hudLayer = 0; |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 void LayerTreeHost::commitComplete() | 361 void LayerTreeHost::commitComplete() |
| 362 { | 362 { |
| 363 m_client->didCommit(); | 363 m_client->didCommit(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 scoped_ptr<OutputSurface> LayerTreeHost::createOutputSurface() | 366 scoped_ptr<OutputSurface> LayerTreeHost::createOutputSurface() |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 DCHECK(m_proxy->IsMainThread()); | 465 DCHECK(m_proxy->IsMainThread()); |
| 466 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime)
; | 466 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime)
; |
| 467 } | 467 } |
| 468 | 468 |
| 469 void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer) | 469 void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer) |
| 470 { | 470 { |
| 471 if (m_rootLayer == rootLayer) | 471 if (m_rootLayer == rootLayer) |
| 472 return; | 472 return; |
| 473 | 473 |
| 474 if (m_rootLayer) | 474 if (m_rootLayer) |
| 475 m_rootLayer->setLayerTreeHost(0); | 475 m_rootLayer->SetLayerTreeHost(0); |
| 476 m_rootLayer = rootLayer; | 476 m_rootLayer = rootLayer; |
| 477 if (m_rootLayer) | 477 if (m_rootLayer) |
| 478 m_rootLayer->setLayerTreeHost(this); | 478 m_rootLayer->SetLayerTreeHost(this); |
| 479 | 479 |
| 480 if (m_hudLayer) | 480 if (m_hudLayer) |
| 481 m_hudLayer->removeFromParent(); | 481 m_hudLayer->RemoveFromParent(); |
| 482 | 482 |
| 483 setNeedsFullTreeSync(); | 483 setNeedsFullTreeSync(); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) | 486 void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) |
| 487 { | 487 { |
| 488 LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.in
itialDebugState, debugState); | 488 LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.in
itialDebugState, debugState); |
| 489 | 489 |
| 490 if (LayerTreeDebugState::equal(m_debugState, newDebugState)) | 490 if (LayerTreeDebugState::equal(m_debugState, newDebugState)) |
| 491 return; | 491 return; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 597 |
| 598 void LayerTreeHost::updateLayers(Layer* rootLayer, ResourceUpdateQueue& queue) | 598 void LayerTreeHost::updateLayers(Layer* rootLayer, ResourceUpdateQueue& queue) |
| 599 { | 599 { |
| 600 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers"); | 600 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers"); |
| 601 | 601 |
| 602 LayerList updateList; | 602 LayerList updateList; |
| 603 | 603 |
| 604 { | 604 { |
| 605 Layer* rootScroll = findFirstScrollableLayer(rootLayer); | 605 Layer* rootScroll = findFirstScrollableLayer(rootLayer); |
| 606 if (rootScroll) | 606 if (rootScroll) |
| 607 rootScroll->setImplTransform(m_implTransform); | 607 rootScroll->SetImplTransform(m_implTransform); |
| 608 | 608 |
| 609 updateHudLayer(); | 609 updateHudLayer(); |
| 610 | 610 |
| 611 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); | 611 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); |
| 612 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSi
ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS
ize, m_settings.canUseLCDText, updateList); | 612 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSi
ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS
ize, m_settings.canUseLCDText, updateList); |
| 613 } | 613 } |
| 614 | 614 |
| 615 // Reset partial texture update requests. | 615 // Reset partial texture update requests. |
| 616 m_partialTextureUpdateRequests = 0; | 616 m_partialTextureUpdateRequests = 0; |
| 617 | 617 |
| 618 bool needMoreUpdates = paintLayerContents(updateList, queue); | 618 bool needMoreUpdates = paintLayerContents(updateList, queue); |
| 619 if (m_triggerIdleUpdates && needMoreUpdates) { | 619 if (m_triggerIdleUpdates && needMoreUpdates) { |
| 620 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::posting prepaint task")
; | 620 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::posting prepaint task")
; |
| 621 m_prepaintCallback.Reset(base::Bind(&LayerTreeHost::triggerPrepaint, bas
e::Unretained(this))); | 621 m_prepaintCallback.Reset(base::Bind(&LayerTreeHost::triggerPrepaint, bas
e::Unretained(this))); |
| 622 static base::TimeDelta prepaintDelay = base::TimeDelta::FromMilliseconds
(100); | 622 static base::TimeDelta prepaintDelay = base::TimeDelta::FromMilliseconds
(100); |
| 623 MessageLoop::current()->PostDelayedTask(FROM_HERE, m_prepaintCallback.ca
llback(), prepaintDelay); | 623 MessageLoop::current()->PostDelayedTask(FROM_HERE, m_prepaintCallback.ca
llback(), prepaintDelay); |
| 624 } | 624 } |
| 625 | 625 |
| 626 for (size_t i = 0; i < updateList.size(); ++i) | 626 for (size_t i = 0; i < updateList.size(); ++i) |
| 627 updateList[i]->clearRenderSurface(); | 627 updateList[i]->ClearRenderSurface(); |
| 628 } | 628 } |
| 629 | 629 |
| 630 void LayerTreeHost::triggerPrepaint() | 630 void LayerTreeHost::triggerPrepaint() |
| 631 { | 631 { |
| 632 m_prepaintCallback.Cancel(); | 632 m_prepaintCallback.Cancel(); |
| 633 TRACE_EVENT0("cc", "LayerTreeHost::triggerPrepaint"); | 633 TRACE_EVENT0("cc", "LayerTreeHost::triggerPrepaint"); |
| 634 setNeedsCommit(); | 634 setNeedsCommit(); |
| 635 } | 635 } |
| 636 | 636 |
| 637 void LayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) | 637 void LayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) |
| 638 { | 638 { |
| 639 // Surfaces have a place holder for their memory since they are managed | 639 // Surfaces have a place holder for their memory since they are managed |
| 640 // independantly but should still be tracked and reduce other memory usage. | 640 // independantly but should still be tracked and reduce other memory usage. |
| 641 m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get()
); | 641 m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get()
); |
| 642 m_surfaceMemoryPlaceholder->setRequestPriority(PriorityCalculator::renderSur
facePriority()); | 642 m_surfaceMemoryPlaceholder->setRequestPriority(PriorityCalculator::renderSur
facePriority()); |
| 643 m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryB
ytes); | 643 m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryB
ytes); |
| 644 } | 644 } |
| 645 | 645 |
| 646 void LayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) | 646 void LayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) |
| 647 { | 647 { |
| 648 // Use BackToFront since it's cheap and this isn't order-dependent. | 648 // Use BackToFront since it's cheap and this isn't order-dependent. |
| 649 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions:
:BackToFront> LayerIteratorType; | 649 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions:
:BackToFront> LayerIteratorType; |
| 650 | 650 |
| 651 PriorityCalculator calculator; | 651 PriorityCalculator calculator; |
| 652 LayerIteratorType end = LayerIteratorType::end(&updateList); | 652 LayerIteratorType end = LayerIteratorType::end(&updateList); |
| 653 for (LayerIteratorType it = LayerIteratorType::begin(&updateList); it != end
; ++it) { | 653 for (LayerIteratorType it = LayerIteratorType::begin(&updateList); it != end
; ++it) { |
| 654 if (it.representsItself()) | 654 if (it.representsItself()) |
| 655 it->setTexturePriorities(calculator); | 655 it->SetTexturePriorities(calculator); |
| 656 else if (it.representsTargetRenderSurface()) { | 656 else if (it.representsTargetRenderSurface()) { |
| 657 if (it->maskLayer()) | 657 if (it->mask_layer()) |
| 658 it->maskLayer()->setTexturePriorities(calculator); | 658 it->mask_layer()->SetTexturePriorities(calculator); |
| 659 if (it->replicaLayer() && it->replicaLayer()->maskLayer()) | 659 if (it->replica_layer() && it->replica_layer()->mask_layer()) |
| 660 it->replicaLayer()->maskLayer()->setTexturePriorities(calculator
); | 660 it->replica_layer()->mask_layer()->SetTexturePriorities(calculat
or); |
| 661 } | 661 } |
| 662 } | 662 } |
| 663 } | 663 } |
| 664 | 664 |
| 665 void LayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList,
OverdrawMetrics& metrics) | 665 void LayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList,
OverdrawMetrics& metrics) |
| 666 { | 666 { |
| 667 m_contentsTextureManager->clearPriorities(); | 667 m_contentsTextureManager->clearPriorities(); |
| 668 | 668 |
| 669 size_t memoryForRenderSurfacesMetric = calculateMemoryForRenderSurfaces(rend
erSurfaceLayerList); | 669 size_t memoryForRenderSurfacesMetric = calculateMemoryForRenderSurfaces(rend
erSurfaceLayerList); |
| 670 | 670 |
| 671 setPrioritiesForLayers(renderSurfaceLayerList); | 671 setPrioritiesForLayers(renderSurfaceLayerList); |
| 672 setPrioritiesForSurfaces(memoryForRenderSurfacesMetric); | 672 setPrioritiesForSurfaces(memoryForRenderSurfacesMetric); |
| 673 | 673 |
| 674 metrics.DidUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAbo
veCutoffBytes()); | 674 metrics.DidUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAbo
veCutoffBytes()); |
| 675 metrics.DidUseRenderSurfaceTextureMemoryBytes(memoryForRenderSurfacesMetric)
; | 675 metrics.DidUseRenderSurfaceTextureMemoryBytes(memoryForRenderSurfacesMetric)
; |
| 676 | 676 |
| 677 m_contentsTextureManager->prioritizeTextures(); | 677 m_contentsTextureManager->prioritizeTextures(); |
| 678 } | 678 } |
| 679 | 679 |
| 680 size_t LayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateLi
st) | 680 size_t LayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateLi
st) |
| 681 { | 681 { |
| 682 size_t readbackBytes = 0; | 682 size_t readbackBytes = 0; |
| 683 size_t maxBackgroundTextureBytes = 0; | 683 size_t maxBackgroundTextureBytes = 0; |
| 684 size_t contentsTextureBytes = 0; | 684 size_t contentsTextureBytes = 0; |
| 685 | 685 |
| 686 // Start iteration at 1 to skip the root surface as it does not have a textu
re cost. | 686 // Start iteration at 1 to skip the root surface as it does not have a textu
re cost. |
| 687 for (size_t i = 1; i < updateList.size(); ++i) { | 687 for (size_t i = 1; i < updateList.size(); ++i) { |
| 688 Layer* renderSurfaceLayer = updateList[i].get(); | 688 Layer* renderSurfaceLayer = updateList[i].get(); |
| 689 RenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); | 689 RenderSurface* renderSurface = renderSurfaceLayer->render_surface(); |
| 690 | 690 |
| 691 size_t bytes = Resource::MemorySizeBytes(renderSurface->content_rect().s
ize(), GL_RGBA); | 691 size_t bytes = Resource::MemorySizeBytes(renderSurface->content_rect().s
ize(), GL_RGBA); |
| 692 contentsTextureBytes += bytes; | 692 contentsTextureBytes += bytes; |
| 693 | 693 |
| 694 if (renderSurfaceLayer->backgroundFilters().isEmpty()) | 694 if (renderSurfaceLayer->background_filters().isEmpty()) |
| 695 continue; | 695 continue; |
| 696 | 696 |
| 697 if (bytes > maxBackgroundTextureBytes) | 697 if (bytes > maxBackgroundTextureBytes) |
| 698 maxBackgroundTextureBytes = bytes; | 698 maxBackgroundTextureBytes = bytes; |
| 699 if (!readbackBytes) | 699 if (!readbackBytes) |
| 700 readbackBytes = Resource::MemorySizeBytes(m_deviceViewportSize, GL_R
GBA); | 700 readbackBytes = Resource::MemorySizeBytes(m_deviceViewportSize, GL_R
GBA); |
| 701 } | 701 } |
| 702 return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; | 702 return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; |
| 703 } | 703 } |
| 704 | 704 |
| 705 bool LayerTreeHost::paintMasksForRenderSurface(Layer* renderSurfaceLayer, Resour
ceUpdateQueue& queue) | 705 bool LayerTreeHost::paintMasksForRenderSurface(Layer* renderSurfaceLayer, Resour
ceUpdateQueue& queue) |
| 706 { | 706 { |
| 707 // Note: Masks and replicas only exist for layers that own render surfaces.
If we reach this point | 707 // Note: Masks and replicas only exist for layers that own render surfaces.
If we reach this point |
| 708 // in code, we already know that at least something will be drawn into this
render surface, so the | 708 // in code, we already know that at least something will be drawn into this
render surface, so the |
| 709 // mask and replica should be painted. | 709 // mask and replica should be painted. |
| 710 | 710 |
| 711 RenderingStats* stats = m_debugState.recordRenderingStats() ? &m_renderingSt
ats : NULL; | 711 RenderingStats* stats = m_debugState.recordRenderingStats() ? &m_renderingSt
ats : NULL; |
| 712 | 712 |
| 713 bool needMoreUpdates = false; | 713 bool needMoreUpdates = false; |
| 714 Layer* maskLayer = renderSurfaceLayer->maskLayer(); | 714 Layer* maskLayer = renderSurfaceLayer->mask_layer(); |
| 715 if (maskLayer) { | 715 if (maskLayer) { |
| 716 maskLayer->update(queue, 0, stats); | 716 maskLayer->Update(&queue, 0, stats); |
| 717 needMoreUpdates |= maskLayer->needMoreUpdates(); | 717 needMoreUpdates |= maskLayer->NeedMoreUpdates(); |
| 718 } | 718 } |
| 719 | 719 |
| 720 Layer* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurface
Layer->replicaLayer()->maskLayer() : 0; | 720 Layer* replicaMaskLayer = renderSurfaceLayer->replica_layer() ? renderSurfac
eLayer->replica_layer()->mask_layer() : 0; |
| 721 if (replicaMaskLayer) { | 721 if (replicaMaskLayer) { |
| 722 replicaMaskLayer->update(queue, 0, stats); | 722 replicaMaskLayer->Update(&queue, 0, stats); |
| 723 needMoreUpdates |= replicaMaskLayer->needMoreUpdates(); | 723 needMoreUpdates |= replicaMaskLayer->NeedMoreUpdates(); |
| 724 } | 724 } |
| 725 return needMoreUpdates; | 725 return needMoreUpdates; |
| 726 } | 726 } |
| 727 | 727 |
| 728 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList,
ResourceUpdateQueue& queue) | 728 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList,
ResourceUpdateQueue& queue) |
| 729 { | 729 { |
| 730 // Use FrontToBack to allow for testing occlusion and performing culling dur
ing the tree walk. | 730 // Use FrontToBack to allow for testing occlusion and performing culling dur
ing the tree walk. |
| 731 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions:
:FrontToBack> LayerIteratorType; | 731 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions:
:FrontToBack> LayerIteratorType; |
| 732 | 732 |
| 733 bool needMoreUpdates = false; | 733 bool needMoreUpdates = false; |
| 734 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug
::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); | 734 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug
::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); |
| 735 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->content_rect
(), recordMetricsForFrame); | 735 OcclusionTracker occlusionTracker(m_rootLayer->render_surface()->content_rec
t(), recordMetricsForFrame); |
| 736 occlusionTracker.set_minimum_tracking_size(m_settings.minimumOcclusionTracki
ngSize); | 736 occlusionTracker.set_minimum_tracking_size(m_settings.minimumOcclusionTracki
ngSize); |
| 737 | 737 |
| 738 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.OverdrawMetrics(
)); | 738 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.OverdrawMetrics(
)); |
| 739 | 739 |
| 740 RenderingStats* stats = m_debugState.recordRenderingStats() ? &m_renderingSt
ats : NULL; | 740 RenderingStats* stats = m_debugState.recordRenderingStats() ? &m_renderingSt
ats : NULL; |
| 741 | 741 |
| 742 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); | 742 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); |
| 743 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList
); it != end; ++it) { | 743 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList
); it != end; ++it) { |
| 744 occlusionTracker.EnterLayer(it); | 744 occlusionTracker.EnterLayer(it); |
| 745 | 745 |
| 746 if (it.representsTargetRenderSurface()) { | 746 if (it.representsTargetRenderSurface()) { |
| 747 DCHECK(it->renderSurface()->draw_opacity() || it->renderSurface()->d
raw_opacity_is_animating()); | 747 DCHECK(it->render_surface()->draw_opacity() || it->render_surface()-
>draw_opacity_is_animating()); |
| 748 needMoreUpdates |= paintMasksForRenderSurface(*it, queue); | 748 needMoreUpdates |= paintMasksForRenderSurface(*it, queue); |
| 749 } else if (it.representsItself()) { | 749 } else if (it.representsItself()) { |
| 750 DCHECK(!it->bounds().IsEmpty()); | 750 DCHECK(!it->bounds().IsEmpty()); |
| 751 it->update(queue, &occlusionTracker, stats); | 751 it->Update(&queue, &occlusionTracker, stats); |
| 752 needMoreUpdates |= it->needMoreUpdates(); | 752 needMoreUpdates |= it->NeedMoreUpdates(); |
| 753 } | 753 } |
| 754 | 754 |
| 755 occlusionTracker.LeaveLayer(it); | 755 occlusionTracker.LeaveLayer(it); |
| 756 } | 756 } |
| 757 | 757 |
| 758 occlusionTracker.OverdrawMetrics().RecordMetrics(this); | 758 occlusionTracker.OverdrawMetrics().RecordMetrics(this); |
| 759 | 759 |
| 760 return needMoreUpdates; | 760 return needMoreUpdates; |
| 761 } | 761 } |
| 762 | 762 |
| 763 void LayerTreeHost::applyScrollAndScale(const ScrollAndScaleSet& info) | 763 void LayerTreeHost::applyScrollAndScale(const ScrollAndScaleSet& info) |
| 764 { | 764 { |
| 765 if (!m_rootLayer) | 765 if (!m_rootLayer) |
| 766 return; | 766 return; |
| 767 | 767 |
| 768 Layer* rootScrollLayer = findFirstScrollableLayer(m_rootLayer.get()); | 768 Layer* rootScrollLayer = findFirstScrollableLayer(m_rootLayer.get()); |
| 769 gfx::Vector2d rootScrollDelta; | 769 gfx::Vector2d rootScrollDelta; |
| 770 | 770 |
| 771 for (size_t i = 0; i < info.scrolls.size(); ++i) { | 771 for (size_t i = 0; i < info.scrolls.size(); ++i) { |
| 772 Layer* layer = LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get()
, info.scrolls[i].layerId); | 772 Layer* layer = LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get()
, info.scrolls[i].layerId); |
| 773 if (!layer) | 773 if (!layer) |
| 774 continue; | 774 continue; |
| 775 if (layer == rootScrollLayer) | 775 if (layer == rootScrollLayer) |
| 776 rootScrollDelta += info.scrolls[i].scrollDelta; | 776 rootScrollDelta += info.scrolls[i].scrollDelta; |
| 777 else | 777 else |
| 778 layer->setScrollOffset(layer->scrollOffset() + info.scrolls[i].scrol
lDelta); | 778 layer->SetScrollOffset(layer->scroll_offset() + info.scrolls[i].scro
llDelta); |
| 779 } | 779 } |
| 780 if (!rootScrollDelta.IsZero() || info.pageScaleDelta != 1) | 780 if (!rootScrollDelta.IsZero() || info.pageScaleDelta != 1) |
| 781 m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); | 781 m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); |
| 782 } | 782 } |
| 783 | 783 |
| 784 void LayerTreeHost::setImplTransform(const gfx::Transform& transform) | 784 void LayerTreeHost::setImplTransform(const gfx::Transform& transform) |
| 785 { | 785 { |
| 786 m_implTransform = transform; | 786 m_implTransform = transform; |
| 787 } | 787 } |
| 788 | 788 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 | 848 |
| 849 m_proxy->ImplThread()->postTask( | 849 m_proxy->ImplThread()->postTask( |
| 850 base::Bind(&TopControlsManager::enable_hiding_top_controls, | 850 base::Bind(&TopControlsManager::enable_hiding_top_controls, |
| 851 m_topControlsManagerWeakPtr, enable)); | 851 m_topControlsManagerWeakPtr, enable)); |
| 852 } | 852 } |
| 853 | 853 |
| 854 bool LayerTreeHost::blocksPendingCommit() const | 854 bool LayerTreeHost::blocksPendingCommit() const |
| 855 { | 855 { |
| 856 if (!m_rootLayer) | 856 if (!m_rootLayer) |
| 857 return false; | 857 return false; |
| 858 return m_rootLayer->blocksPendingCommitRecursive(); | 858 return m_rootLayer->BlocksPendingCommitRecursive(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 scoped_ptr<base::Value> LayerTreeHost::asValue() const | 861 scoped_ptr<base::Value> LayerTreeHost::asValue() const |
| 862 { | 862 { |
| 863 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 863 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 864 state->Set("proxy", m_proxy->AsValue().release()); | 864 state->Set("proxy", m_proxy->AsValue().release()); |
| 865 return state.PassAs<base::Value>(); | 865 return state.PassAs<base::Value>(); |
| 866 } | 866 } |
| 867 | 867 |
| 868 void LayerTreeHost::animateLayers(base::TimeTicks time) | 868 void LayerTreeHost::animateLayers(base::TimeTicks time) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 883 | 883 |
| 884 void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& eve
nts, Layer* layer, base::Time wallClockTime) | 884 void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& eve
nts, Layer* layer, base::Time wallClockTime) |
| 885 { | 885 { |
| 886 if (!layer) | 886 if (!layer) |
| 887 return; | 887 return; |
| 888 | 888 |
| 889 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { | 889 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { |
| 890 if (layer->id() == events[eventIndex].layer_id) { | 890 if (layer->id() == events[eventIndex].layer_id) { |
| 891 switch (events[eventIndex].type) { | 891 switch (events[eventIndex].type) { |
| 892 case AnimationEvent::Started: | 892 case AnimationEvent::Started: |
| 893 layer->notifyAnimationStarted(events[eventIndex], wallClockTime.
ToDoubleT()); | 893 layer->NotifyAnimationStarted(events[eventIndex], wallClockTime.
ToDoubleT()); |
| 894 break; | 894 break; |
| 895 | 895 |
| 896 case AnimationEvent::Finished: | 896 case AnimationEvent::Finished: |
| 897 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 897 layer->NotifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 898 break; | 898 break; |
| 899 | 899 |
| 900 case AnimationEvent::PropertyUpdate: | 900 case AnimationEvent::PropertyUpdate: |
| 901 layer->notifyAnimationPropertyUpdate(events[eventIndex]); | 901 layer->NotifyAnimationPropertyUpdate(events[eventIndex]); |
| 902 break; | 902 break; |
| 903 | 903 |
| 904 default: | 904 default: |
| 905 NOTREACHED(); | 905 NOTREACHED(); |
| 906 } | 906 } |
| 907 } | 907 } |
| 908 } | 908 } |
| 909 | 909 |
| 910 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 910 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 911 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 911 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 912 } | 912 } |
| 913 | 913 |
| 914 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 914 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
| 915 { | 915 { |
| 916 return m_proxy->CapturePicture(); | 916 return m_proxy->CapturePicture(); |
| 917 } | 917 } |
| 918 | 918 |
| 919 } // namespace cc | 919 } // namespace cc |
| OLD | NEW |