| 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <stack> | 8 #include <stack> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 size_t contents_texture_bytes = 0; | 884 size_t contents_texture_bytes = 0; |
| 885 | 885 |
| 886 // Start iteration at 1 to skip the root surface as it does not have a texture | 886 // Start iteration at 1 to skip the root surface as it does not have a texture |
| 887 // cost. | 887 // cost. |
| 888 for (size_t i = 1; i < update_list.size(); ++i) { | 888 for (size_t i = 1; i < update_list.size(); ++i) { |
| 889 Layer* render_surface_layer = update_list.at(i); | 889 Layer* render_surface_layer = update_list.at(i); |
| 890 RenderSurface* render_surface = render_surface_layer->render_surface(); | 890 RenderSurface* render_surface = render_surface_layer->render_surface(); |
| 891 | 891 |
| 892 size_t bytes = | 892 size_t bytes = |
| 893 Resource::MemorySizeBytes(render_surface->content_rect().size(), | 893 Resource::MemorySizeBytes(render_surface->content_rect().size(), |
| 894 GL_RGBA); | 894 GL_RGBA, |
| 895 false); |
| 895 contents_texture_bytes += bytes; | 896 contents_texture_bytes += bytes; |
| 896 | 897 |
| 897 if (render_surface_layer->background_filters().IsEmpty()) | 898 if (render_surface_layer->background_filters().IsEmpty()) |
| 898 continue; | 899 continue; |
| 899 | 900 |
| 900 if (bytes > max_background_texture_bytes) | 901 if (bytes > max_background_texture_bytes) |
| 901 max_background_texture_bytes = bytes; | 902 max_background_texture_bytes = bytes; |
| 902 if (!readback_bytes) { | 903 if (!readback_bytes) { |
| 903 readback_bytes = Resource::MemorySizeBytes(device_viewport_size_, | 904 readback_bytes = Resource::MemorySizeBytes(device_viewport_size_, |
| 904 GL_RGBA); | 905 GL_RGBA, |
| 906 false); |
| 905 } | 907 } |
| 906 } | 908 } |
| 907 return readback_bytes + max_background_texture_bytes + contents_texture_bytes; | 909 return readback_bytes + max_background_texture_bytes + contents_texture_bytes; |
| 908 } | 910 } |
| 909 | 911 |
| 910 void LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer, | 912 void LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer, |
| 911 ResourceUpdateQueue* queue, | 913 ResourceUpdateQueue* queue, |
| 912 bool* did_paint_content, | 914 bool* did_paint_content, |
| 913 bool* need_more_updates) { | 915 bool* need_more_updates) { |
| 914 // Note: Masks and replicas only exist for layers that own render surfaces. If | 916 // Note: Masks and replicas only exist for layers that own render surfaces. If |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 void LayerTreeHost::DidLoseUIResources() { | 1169 void LayerTreeHost::DidLoseUIResources() { |
| 1168 // When output surface is lost, we need to recreate the resource. | 1170 // When output surface is lost, we need to recreate the resource. |
| 1169 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); | 1171 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); |
| 1170 iter != ui_resource_client_map_.end(); | 1172 iter != ui_resource_client_map_.end(); |
| 1171 ++iter) { | 1173 ++iter) { |
| 1172 UIResourceLost(iter->first); | 1174 UIResourceLost(iter->first); |
| 1173 } | 1175 } |
| 1174 } | 1176 } |
| 1175 | 1177 |
| 1176 } // namespace cc | 1178 } // namespace cc |
| OLD | NEW |