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 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 m_renderer->setVisible(visible); | 959 m_renderer->setVisible(visible); |
960 | 960 |
961 setBackgroundTickingEnabled(!m_visible && !m_animationRegistrar->active_anim
ation_controllers().empty()); | 961 setBackgroundTickingEnabled(!m_visible && !m_animationRegistrar->active_anim
ation_controllers().empty()); |
962 } | 962 } |
963 | 963 |
964 bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<OutputSurface> outputSurfa
ce) | 964 bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<OutputSurface> outputSurfa
ce) |
965 { | 965 { |
966 // Since we will create a new resource provider, we cannot continue to use | 966 // Since we will create a new resource provider, we cannot continue to use |
967 // the old resources (i.e. renderSurfaces and texture IDs). Clear them | 967 // the old resources (i.e. renderSurfaces and texture IDs). Clear them |
968 // before we destroy the old resource provider. | 968 // before we destroy the old resource provider. |
969 if (rootLayer()) { | 969 if (rootLayer()) |
970 clearRenderSurfaces(); | 970 clearRenderSurfaces(); |
971 sendDidLoseOutputSurfaceRecursive(rootLayer()); | 971 if (activeTree()->RootLayer()) |
972 } | 972 sendDidLoseOutputSurfaceRecursive(activeTree()->RootLayer()); |
| 973 if (pendingTree() && pendingTree()->RootLayer()) |
| 974 sendDidLoseOutputSurfaceRecursive(pendingTree()->RootLayer()); |
| 975 |
973 // Note: order is important here. | 976 // Note: order is important here. |
974 m_renderer.reset(); | 977 m_renderer.reset(); |
975 m_tileManager.reset(); | 978 m_tileManager.reset(); |
976 m_resourceProvider.reset(); | 979 m_resourceProvider.reset(); |
977 m_outputSurface.reset(); | 980 m_outputSurface.reset(); |
978 | 981 |
979 if (!outputSurface->BindToClient(this)) | 982 if (!outputSurface->BindToClient(this)) |
980 return false; | 983 return false; |
981 | 984 |
982 scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(out
putSurface.get()); | 985 scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::create(out
putSurface.get()); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 } | 1642 } |
1640 | 1643 |
1641 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture() | 1644 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture() |
1642 { | 1645 { |
1643 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); | 1646 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); |
1644 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1647 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
1645 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); | 1648 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
1646 } | 1649 } |
1647 | 1650 |
1648 } // namespace cc | 1651 } // namespace cc |
OLD | NEW |