| 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 size_t LayerTreeHostImpl::memory_allocation_limit_bytes() const { | 1799 size_t LayerTreeHostImpl::memory_allocation_limit_bytes() const { |
| 1800 return ActualManagedMemoryPolicy().bytes_limit_when_visible; | 1800 return ActualManagedMemoryPolicy().bytes_limit_when_visible; |
| 1801 } | 1801 } |
| 1802 | 1802 |
| 1803 int LayerTreeHostImpl::memory_allocation_priority_cutoff() const { | 1803 int LayerTreeHostImpl::memory_allocation_priority_cutoff() const { |
| 1804 return ManagedMemoryPolicy::PriorityCutoffToValue( | 1804 return ManagedMemoryPolicy::PriorityCutoffToValue( |
| 1805 ActualManagedMemoryPolicy().priority_cutoff_when_visible); | 1805 ActualManagedMemoryPolicy().priority_cutoff_when_visible); |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 void LayerTreeHostImpl::ReleaseTreeResources() { | 1808 void LayerTreeHostImpl::ReleaseTreeResources() { |
| 1809 if (active_tree_->root_layer()) | 1809 active_tree_->ReleaseResources(); |
| 1810 SendReleaseResourcesRecursive(active_tree_->root_layer()); | 1810 if (pending_tree_) |
| 1811 if (pending_tree_ && pending_tree_->root_layer()) | 1811 pending_tree_->ReleaseResources(); |
| 1812 SendReleaseResourcesRecursive(pending_tree_->root_layer()); | 1812 if (recycle_tree_) |
| 1813 if (recycle_tree_ && recycle_tree_->root_layer()) | 1813 recycle_tree_->ReleaseResources(); |
| 1814 SendReleaseResourcesRecursive(recycle_tree_->root_layer()); | |
| 1815 | 1814 |
| 1816 EvictAllUIResources(); | 1815 EvictAllUIResources(); |
| 1817 } | 1816 } |
| 1818 | 1817 |
| 1819 void LayerTreeHostImpl::CreateAndSetRenderer( | 1818 void LayerTreeHostImpl::CreateAndSetRenderer( |
| 1820 OutputSurface* output_surface, | 1819 OutputSurface* output_surface, |
| 1821 ResourceProvider* resource_provider, | 1820 ResourceProvider* resource_provider, |
| 1822 bool skip_gl_renderer) { | 1821 bool skip_gl_renderer) { |
| 1823 DCHECK(!renderer_); | 1822 DCHECK(!renderer_); |
| 1824 if (output_surface->capabilities().delegated_rendering) { | 1823 if (output_surface->capabilities().delegated_rendering) { |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2876 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); | 2875 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); |
| 2877 iter != copy.end(); | 2876 iter != copy.end(); |
| 2878 ++iter) | 2877 ++iter) |
| 2879 (*iter).second->ActivateAnimations(); | 2878 (*iter).second->ActivateAnimations(); |
| 2880 } | 2879 } |
| 2881 | 2880 |
| 2882 base::TimeDelta LayerTreeHostImpl::LowFrequencyAnimationInterval() const { | 2881 base::TimeDelta LayerTreeHostImpl::LowFrequencyAnimationInterval() const { |
| 2883 return base::TimeDelta::FromSeconds(1); | 2882 return base::TimeDelta::FromSeconds(1); |
| 2884 } | 2883 } |
| 2885 | 2884 |
| 2886 void LayerTreeHostImpl::SendReleaseResourcesRecursive(LayerImpl* current) { | |
| 2887 DCHECK(current); | |
| 2888 current->ReleaseResources(); | |
| 2889 if (current->mask_layer()) | |
| 2890 SendReleaseResourcesRecursive(current->mask_layer()); | |
| 2891 if (current->replica_layer()) | |
| 2892 SendReleaseResourcesRecursive(current->replica_layer()); | |
| 2893 for (size_t i = 0; i < current->children().size(); ++i) | |
| 2894 SendReleaseResourcesRecursive(current->children()[i]); | |
| 2895 } | |
| 2896 | |
| 2897 std::string LayerTreeHostImpl::LayerTreeAsJson() const { | 2885 std::string LayerTreeHostImpl::LayerTreeAsJson() const { |
| 2898 std::string str; | 2886 std::string str; |
| 2899 if (active_tree_->root_layer()) { | 2887 if (active_tree_->root_layer()) { |
| 2900 scoped_ptr<base::Value> json(active_tree_->root_layer()->LayerTreeAsJson()); | 2888 scoped_ptr<base::Value> json(active_tree_->root_layer()->LayerTreeAsJson()); |
| 2901 base::JSONWriter::WriteWithOptions( | 2889 base::JSONWriter::WriteWithOptions( |
| 2902 json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); | 2890 json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); |
| 2903 } | 2891 } |
| 2904 return str; | 2892 return str; |
| 2905 } | 2893 } |
| 2906 | 2894 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3146 swap_promise_monitor_.erase(monitor); | 3134 swap_promise_monitor_.erase(monitor); |
| 3147 } | 3135 } |
| 3148 | 3136 |
| 3149 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3137 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
| 3150 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3138 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 3151 for (; it != swap_promise_monitor_.end(); it++) | 3139 for (; it != swap_promise_monitor_.end(); it++) |
| 3152 (*it)->OnSetNeedsRedrawOnImpl(); | 3140 (*it)->OnSetNeedsRedrawOnImpl(); |
| 3153 } | 3141 } |
| 3154 | 3142 |
| 3155 } // namespace cc | 3143 } // namespace cc |
| OLD | NEW |