| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/surface_aggregator.h" | 5 #include "cc/surfaces/surface_aggregator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/containers/adapters.h" | 12 #include "base/containers/adapters.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
| 18 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 19 #include "cc/base/math_util.h" | 19 #include "cc/base/math_util.h" |
| 20 #include "cc/output/compositor_frame.h" | 20 #include "cc/output/compositor_frame.h" |
| 21 #include "cc/quads/draw_quad.h" | 21 #include "cc/quads/draw_quad.h" |
| 22 #include "cc/quads/render_pass_draw_quad.h" | 22 #include "cc/quads/render_pass_draw_quad.h" |
| 23 #include "cc/quads/shared_quad_state.h" | 23 #include "cc/quads/shared_quad_state.h" |
| 24 #include "cc/quads/solid_color_draw_quad.h" | 24 #include "cc/quads/solid_color_draw_quad.h" |
| 25 #include "cc/quads/surface_draw_quad.h" | 25 #include "cc/quads/surface_draw_quad.h" |
| 26 #include "cc/quads/texture_draw_quad.h" | 26 #include "cc/quads/texture_draw_quad.h" |
| 27 #include "cc/resources/resource_provider.h" | 27 #include "cc/resources/resource_provider.h" |
| 28 #include "cc/surfaces/surface.h" | 28 #include "cc/surfaces/surface.h" |
| 29 #include "cc/surfaces/surface_aggregator_client.h" |
| 29 #include "cc/surfaces/surface_factory.h" | 30 #include "cc/surfaces/surface_factory.h" |
| 30 #include "cc/surfaces/surface_manager.h" | 31 #include "cc/surfaces/surface_manager.h" |
| 31 #include "cc/trees/blocking_task_runner.h" | 32 #include "cc/trees/blocking_task_runner.h" |
| 32 | 33 |
| 33 namespace cc { | 34 namespace cc { |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 // Maximum bucket size for the UMA stats. | 37 // Maximum bucket size for the UMA stats. |
| 37 constexpr int kUmaStatMaxSurfaces = 30; | 38 constexpr int kUmaStatMaxSurfaces = 30; |
| 38 | 39 |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 CHECK(debug_weak_this.get()); | 751 CHECK(debug_weak_this.get()); |
| 751 for (const auto& surface_id : frame.metadata.referenced_surfaces) { | 752 for (const auto& surface_id : frame.metadata.referenced_surfaces) { |
| 752 if (!contained_surfaces_.count(surface_id)) { | 753 if (!contained_surfaces_.count(surface_id)) { |
| 753 result->undrawn_surfaces.insert(surface_id); | 754 result->undrawn_surfaces.insert(surface_id); |
| 754 PrewalkTree(surface_id, false, 0, result); | 755 PrewalkTree(surface_id, false, 0, result); |
| 755 } | 756 } |
| 756 } | 757 } |
| 757 | 758 |
| 758 CHECK(debug_weak_this.get()); | 759 CHECK(debug_weak_this.get()); |
| 759 if (surface->factory()) { | 760 if (surface->factory()) { |
| 760 surface->factory()->WillDrawSurface( | 761 surface->factory()->surface_aggregator_client()->WillDrawSurface( |
| 761 surface->surface_id().local_surface_id(), damage_rect); | 762 surface->surface_id().local_surface_id(), damage_rect); |
| 762 } | 763 } |
| 763 | 764 |
| 764 CHECK(debug_weak_this.get()); | 765 CHECK(debug_weak_this.get()); |
| 765 for (const auto& render_pass : frame.render_pass_list) { | 766 for (const auto& render_pass : frame.render_pass_list) { |
| 766 if (!render_pass->copy_requests.empty()) { | 767 if (!render_pass->copy_requests.empty()) { |
| 767 int remapped_pass_id = RemapPassId(render_pass->id, surface_id); | 768 int remapped_pass_id = RemapPassId(render_pass->id, surface_id); |
| 768 copy_request_passes_.insert(remapped_pass_id); | 769 copy_request_passes_.insert(remapped_pass_id); |
| 769 } | 770 } |
| 770 } | 771 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 } | 932 } |
| 932 | 933 |
| 933 void SurfaceAggregator::SetOutputColorSpace( | 934 void SurfaceAggregator::SetOutputColorSpace( |
| 934 const gfx::ColorSpace& blending_color_space, | 935 const gfx::ColorSpace& blending_color_space, |
| 935 const gfx::ColorSpace& output_color_space) { | 936 const gfx::ColorSpace& output_color_space) { |
| 936 blending_color_space_ = blending_color_space; | 937 blending_color_space_ = blending_color_space; |
| 937 output_color_space_ = output_color_space; | 938 output_color_space_ = output_color_space; |
| 938 } | 939 } |
| 939 | 940 |
| 940 } // namespace cc | 941 } // namespace cc |
| OLD | NEW |