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_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 enforceManagedMemoryPolicy(m_managedMemoryPolicy); | 784 enforceManagedMemoryPolicy(m_managedMemoryPolicy); |
785 } else { | 785 } else { |
786 DCHECK(m_proxy->isImplThread()); | 786 DCHECK(m_proxy->isImplThread()); |
787 enforceManagedMemoryPolicy(m_managedMemoryPolicy); | 787 enforceManagedMemoryPolicy(m_managedMemoryPolicy); |
788 } | 788 } |
789 // We always need to commit after changing the memory policy because the new | 789 // We always need to commit after changing the memory policy because the new |
790 // limit can result in more or less content having texture allocated for it. | 790 // limit can result in more or less content having texture allocated for it. |
791 m_client->setNeedsCommitOnImplThread(); | 791 m_client->setNeedsCommitOnImplThread(); |
792 } | 792 } |
793 | 793 |
794 void LayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, doubl
e intervalInSeconds) | 794 void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, base:
:TimeDelta interval) |
795 { | 795 { |
796 base::TimeTicks timebase = base::TimeTicks::FromInternalValue(monotonicTimeb
ase * base::Time::kMicrosecondsPerSecond); | |
797 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalInSecon
ds * base::Time::kMicrosecondsPerSecond); | |
798 m_client->onVSyncParametersChanged(timebase, interval); | 796 m_client->onVSyncParametersChanged(timebase, interval); |
799 } | 797 } |
800 | 798 |
| 799 void LayerTreeHostImpl::OnSendFrameToParentCompositorAck(const CompositorFrameAc
k&) |
| 800 { |
| 801 // TODO(danakj): Implement this. |
| 802 } |
| 803 |
801 void LayerTreeHostImpl::OnCanDrawStateChangedForTree(LayerTreeImpl*) | 804 void LayerTreeHostImpl::OnCanDrawStateChangedForTree(LayerTreeImpl*) |
802 { | 805 { |
803 m_client->onCanDrawStateChanged(canDraw()); | 806 m_client->onCanDrawStateChanged(canDraw()); |
804 } | 807 } |
805 | 808 |
806 void LayerTreeHostImpl::drawLayers(FrameData& frame) | 809 void LayerTreeHostImpl::drawLayers(FrameData& frame) |
807 { | 810 { |
808 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); | 811 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); |
809 DCHECK(canDraw()); | 812 DCHECK(canDraw()); |
810 DCHECK(!frame.renderPasses.empty()); | 813 DCHECK(!frame.renderPasses.empty()); |
811 | 814 |
812 // FIXME: use the frame begin time from the overall compositor scheduler. | 815 // FIXME: use the frame begin time from the overall compositor scheduler. |
813 // This value is currently inaccessible because it is up in Chromium's | 816 // This value is currently inaccessible because it is up in Chromium's |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 if (rootLayer()) { | 952 if (rootLayer()) { |
950 clearRenderSurfaces(); | 953 clearRenderSurfaces(); |
951 sendDidLoseOutputSurfaceRecursive(rootLayer()); | 954 sendDidLoseOutputSurfaceRecursive(rootLayer()); |
952 } | 955 } |
953 // Note: order is important here. | 956 // Note: order is important here. |
954 m_renderer.reset(); | 957 m_renderer.reset(); |
955 m_tileManager.reset(); | 958 m_tileManager.reset(); |
956 m_resourceProvider.reset(); | 959 m_resourceProvider.reset(); |
957 m_outputSurface.reset(); | 960 m_outputSurface.reset(); |
958 | 961 |
959 if (!outputSurface->bindToClient(this)) | 962 if (!outputSurface->BindToClient(this)) |
960 return false; | 963 return false; |
961 | 964 |
962 scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(out
putSurface.get()); | 965 scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(out
putSurface.get()); |
963 if (!resourceProvider) | 966 if (!resourceProvider) |
964 return false; | 967 return false; |
965 | 968 |
966 if (m_settings.implSidePainting) | 969 if (m_settings.implSidePainting) |
967 m_tileManager.reset(new TileManager(this, resourceProvider.get(), m_settin
gs.numRasterThreads)); | 970 m_tileManager.reset(new TileManager(this, resourceProvider.get(), m_settin
gs.numRasterThreads)); |
968 | 971 |
969 if (outputSurface->context3D()) | 972 if (outputSurface->Context3D()) |
970 m_renderer = GLRenderer::create(this, resourceProvider.get()); | 973 m_renderer = GLRenderer::create(this, resourceProvider.get()); |
971 else if (outputSurface->softwareDevice()) | 974 else if (outputSurface->SoftwareDevice()) |
972 m_renderer = SoftwareRenderer::create(this, resourceProvider.get(), outp
utSurface->softwareDevice()); | 975 m_renderer = SoftwareRenderer::create(this, resourceProvider.get(), outp
utSurface->SoftwareDevice()); |
973 if (!m_renderer) | 976 if (!m_renderer) |
974 return false; | 977 return false; |
975 | 978 |
976 m_resourceProvider = resourceProvider.Pass(); | 979 m_resourceProvider = resourceProvider.Pass(); |
977 m_outputSurface = outputSurface.Pass(); | 980 m_outputSurface = outputSurface.Pass(); |
978 | 981 |
979 if (!m_visible) | 982 if (!m_visible) |
980 m_renderer->setVisible(m_visible); | 983 m_renderer->setVisible(m_visible); |
981 | 984 |
982 m_client->onCanDrawStateChanged(canDraw()); | 985 m_client->onCanDrawStateChanged(canDraw()); |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 | 1617 |
1615 void LayerTreeHostImpl::UnregisterAnimationController(LayerAnimationController*
controller) { | 1618 void LayerTreeHostImpl::UnregisterAnimationController(LayerAnimationController*
controller) { |
1616 #if !defined(NDEBUG) | 1619 #if !defined(NDEBUG) |
1617 if (ContainsKey(m_allAnimationControllers, controller)) | 1620 if (ContainsKey(m_allAnimationControllers, controller)) |
1618 m_allAnimationControllers.erase(controller); | 1621 m_allAnimationControllers.erase(controller); |
1619 #endif | 1622 #endif |
1620 DidDeactivateAnimationController(controller); | 1623 DidDeactivateAnimationController(controller); |
1621 } | 1624 } |
1622 | 1625 |
1623 } // namespace cc | 1626 } // namespace cc |
OLD | NEW |