| 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 <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include <algorithm> | 10 #include <algorithm> |
| 8 #include <limits> | 11 #include <limits> |
| 9 #include <map> | 12 #include <map> |
| 10 #include <set> | 13 #include <set> |
| 11 | 14 |
| 12 #include "base/auto_reset.h" | 15 #include "base/auto_reset.h" |
| 13 #include "base/basictypes.h" | |
| 14 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 15 #include "base/containers/small_map.h" | 17 #include "base/containers/small_map.h" |
| 16 #include "base/json/json_writer.h" | 18 #include "base/json/json_writer.h" |
| 17 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 18 #include "base/numerics/safe_conversions.h" | 20 #include "base/numerics/safe_conversions.h" |
| 19 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
| 20 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 21 #include "base/trace_event/trace_event_argument.h" | 23 #include "base/trace_event/trace_event_argument.h" |
| 22 #include "cc/animation/animation_host.h" | 24 #include "cc/animation/animation_host.h" |
| 23 #include "cc/animation/animation_id_provider.h" | 25 #include "cc/animation/animation_id_provider.h" |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 TRACE_EVENT0("cc", | 818 TRACE_EVENT0("cc", |
| 817 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); | 819 "LayerTreeHostImpl::CalculateRenderPasses::EmptyDamageRect"); |
| 818 frame->has_no_damage = true; | 820 frame->has_no_damage = true; |
| 819 DCHECK(!resourceless_software_draw_); | 821 DCHECK(!resourceless_software_draw_); |
| 820 return DRAW_SUCCESS; | 822 return DRAW_SUCCESS; |
| 821 } | 823 } |
| 822 | 824 |
| 823 TRACE_EVENT_BEGIN2( | 825 TRACE_EVENT_BEGIN2( |
| 824 "cc", "LayerTreeHostImpl::CalculateRenderPasses", | 826 "cc", "LayerTreeHostImpl::CalculateRenderPasses", |
| 825 "render_surface_layer_list.size()", | 827 "render_surface_layer_list.size()", |
| 826 static_cast<uint64>(frame->render_surface_layer_list->size()), | 828 static_cast<uint64_t>(frame->render_surface_layer_list->size()), |
| 827 "RequiresHighResToDraw", RequiresHighResToDraw()); | 829 "RequiresHighResToDraw", RequiresHighResToDraw()); |
| 828 | 830 |
| 829 // Create the render passes in dependency order. | 831 // Create the render passes in dependency order. |
| 830 size_t render_surface_layer_list_size = | 832 size_t render_surface_layer_list_size = |
| 831 frame->render_surface_layer_list->size(); | 833 frame->render_surface_layer_list->size(); |
| 832 for (size_t i = 0; i < render_surface_layer_list_size; ++i) { | 834 for (size_t i = 0; i < render_surface_layer_list_size; ++i) { |
| 833 size_t surface_index = render_surface_layer_list_size - 1 - i; | 835 size_t surface_index = render_surface_layer_list_size - 1 - i; |
| 834 LayerImpl* render_surface_layer = | 836 LayerImpl* render_surface_layer = |
| 835 (*frame->render_surface_layer_list)[surface_index]; | 837 (*frame->render_surface_layer_list)[surface_index]; |
| 836 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); | 838 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 // due to an impl-animation, we drop the frame to avoid flashing due to the | 880 // due to an impl-animation, we drop the frame to avoid flashing due to the |
| 879 // texture suddenly appearing in the future. | 881 // texture suddenly appearing in the future. |
| 880 DrawResult draw_result = DRAW_SUCCESS; | 882 DrawResult draw_result = DRAW_SUCCESS; |
| 881 | 883 |
| 882 int layers_drawn = 0; | 884 int layers_drawn = 0; |
| 883 | 885 |
| 884 const DrawMode draw_mode = GetDrawMode(); | 886 const DrawMode draw_mode = GetDrawMode(); |
| 885 | 887 |
| 886 int num_missing_tiles = 0; | 888 int num_missing_tiles = 0; |
| 887 int num_incomplete_tiles = 0; | 889 int num_incomplete_tiles = 0; |
| 888 int64 checkerboarded_no_recording_content_area = 0; | 890 int64_t checkerboarded_no_recording_content_area = 0; |
| 889 int64 checkerboarded_needs_raster_content_area = 0; | 891 int64_t checkerboarded_needs_raster_content_area = 0; |
| 890 bool have_copy_request = false; | 892 bool have_copy_request = false; |
| 891 bool have_missing_animated_tiles = false; | 893 bool have_missing_animated_tiles = false; |
| 892 | 894 |
| 893 LayerIterator end = LayerIterator::End(frame->render_surface_layer_list); | 895 LayerIterator end = LayerIterator::End(frame->render_surface_layer_list); |
| 894 for (LayerIterator it = | 896 for (LayerIterator it = |
| 895 LayerIterator::Begin(frame->render_surface_layer_list); | 897 LayerIterator::Begin(frame->render_surface_layer_list); |
| 896 it != end; ++it) { | 898 it != end; ++it) { |
| 897 RenderPassId target_render_pass_id = | 899 RenderPassId target_render_pass_id = |
| 898 it.target_render_surface_layer()->render_surface()->GetRenderPassId(); | 900 it.target_render_surface_layer()->render_surface()->GetRenderPassId(); |
| 899 RenderPass* target_render_pass = | 901 RenderPass* target_render_pass = |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 const ManagedMemoryPolicy& policy) { | 1264 const ManagedMemoryPolicy& policy) { |
| 1263 if (!resource_pool_) | 1265 if (!resource_pool_) |
| 1264 return; | 1266 return; |
| 1265 | 1267 |
| 1266 global_tile_state_.hard_memory_limit_in_bytes = 0; | 1268 global_tile_state_.hard_memory_limit_in_bytes = 0; |
| 1267 global_tile_state_.soft_memory_limit_in_bytes = 0; | 1269 global_tile_state_.soft_memory_limit_in_bytes = 0; |
| 1268 if (visible_ && policy.bytes_limit_when_visible > 0) { | 1270 if (visible_ && policy.bytes_limit_when_visible > 0) { |
| 1269 global_tile_state_.hard_memory_limit_in_bytes = | 1271 global_tile_state_.hard_memory_limit_in_bytes = |
| 1270 policy.bytes_limit_when_visible; | 1272 policy.bytes_limit_when_visible; |
| 1271 global_tile_state_.soft_memory_limit_in_bytes = | 1273 global_tile_state_.soft_memory_limit_in_bytes = |
| 1272 (static_cast<int64>(global_tile_state_.hard_memory_limit_in_bytes) * | 1274 (static_cast<int64_t>(global_tile_state_.hard_memory_limit_in_bytes) * |
| 1273 settings_.max_memory_for_prepaint_percentage) / | 1275 settings_.max_memory_for_prepaint_percentage) / |
| 1274 100; | 1276 100; |
| 1275 } | 1277 } |
| 1276 global_tile_state_.memory_limit_policy = | 1278 global_tile_state_.memory_limit_policy = |
| 1277 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( | 1279 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( |
| 1278 visible_ ? | 1280 visible_ ? |
| 1279 policy.priority_cutoff_when_visible : | 1281 policy.priority_cutoff_when_visible : |
| 1280 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); | 1282 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); |
| 1281 global_tile_state_.num_resources_limit = policy.num_resources_limit; | 1283 global_tile_state_.num_resources_limit = policy.num_resources_limit; |
| 1282 | 1284 |
| (...skipping 2492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3775 return task_runner_provider_->HasImplThread(); | 3777 return task_runner_provider_->HasImplThread(); |
| 3776 } | 3778 } |
| 3777 | 3779 |
| 3778 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3780 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3779 // In single threaded mode we skip the pending tree and commit directly to the | 3781 // In single threaded mode we skip the pending tree and commit directly to the |
| 3780 // active tree. | 3782 // active tree. |
| 3781 return !task_runner_provider_->HasImplThread(); | 3783 return !task_runner_provider_->HasImplThread(); |
| 3782 } | 3784 } |
| 3783 | 3785 |
| 3784 } // namespace cc | 3786 } // namespace cc |
| OLD | NEW |