Chromium Code Reviews| Index: cc/surfaces/surface_aggregator.cc |
| diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc |
| index 935b9f7c243217079afe0e7d7ee5b382dd02f22f..1b0e576e9b142fdc25c0c87cf63540f02eb67e93 100644 |
| --- a/cc/surfaces/surface_aggregator.cc |
| +++ b/cc/surfaces/surface_aggregator.cc |
| @@ -25,6 +25,7 @@ |
| #include "cc/quads/surface_draw_quad.h" |
| #include "cc/quads/texture_draw_quad.h" |
| #include "cc/resources/resource_provider.h" |
| +#include "cc/surfaces/compositor_frame_sink_support.h" |
| #include "cc/surfaces/surface.h" |
| #include "cc/surfaces/surface_manager.h" |
| #include "cc/trees/blocking_task_runner.h" |
| @@ -95,6 +96,15 @@ SurfaceAggregator::PrewalkResult::PrewalkResult() {} |
| SurfaceAggregator::PrewalkResult::~PrewalkResult() {} |
| +// static |
| +void SurfaceAggregator::UnrefHelper( |
|
danakj
2017/05/03 16:08:39
Leave this as a file-static function, not a static
Alex Z.
2017/05/03 18:07:37
Done.
|
| + base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support, |
| + const ReturnedResourceArray& resources, |
| + BlockingTaskRunner* main_thread_task_runner) { |
| + if (compositor_frame_sink_support) |
| + compositor_frame_sink_support->UnrefResources(resources); |
| +} |
| + |
| // Create a clip rect for an aggregated quad from the original clip rect and |
| // the clip rect from the surface it's on. |
| SurfaceAggregator::ClipData SurfaceAggregator::CalculateClipRect( |
| @@ -120,13 +130,6 @@ SurfaceAggregator::ClipData SurfaceAggregator::CalculateClipRect( |
| return out_clip; |
| } |
| -static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory, |
| - const ReturnedResourceArray& resources, |
| - BlockingTaskRunner* main_thread_task_runner) { |
| - if (surface_factory) |
| - surface_factory->UnrefResources(resources); |
| -} |
| - |
| int SurfaceAggregator::RemapPassId(int surface_local_pass_id, |
| const SurfaceId& surface_id) { |
| auto key = std::make_pair(surface_id, surface_local_pass_id); |
| @@ -145,11 +148,12 @@ int SurfaceAggregator::RemapPassId(int surface_local_pass_id, |
| int SurfaceAggregator::ChildIdForSurface(Surface* surface) { |
| auto it = surface_id_to_resource_child_id_.find(surface->surface_id()); |
| if (it == surface_id_to_resource_child_id_.end()) { |
| - int child_id = |
| - provider_->CreateChild(base::Bind(&UnrefHelper, surface->factory())); |
| - if (surface->factory()) { |
| + int child_id = provider_->CreateChild( |
| + base::Bind(&UnrefHelper, surface->compositor_frame_sink_support())); |
| + if (surface->compositor_frame_sink_support()) { |
| provider_->SetChildNeedsSyncTokens( |
| - child_id, surface->factory()->needs_sync_points()); |
| + child_id, |
| + surface->compositor_frame_sink_support()->needs_sync_points()); |
| } |
| surface_id_to_resource_child_id_[surface->surface_id()] = child_id; |
| return child_id; |
| @@ -609,8 +613,9 @@ gfx::Rect SurfaceAggregator::PrewalkTree(const SurfaceId& surface_id, |
| // TODO(jbauman): hack for unit tests that don't set up rp |
| if (provider_) { |
| child_id = ChildIdForSurface(surface); |
| - if (surface->factory()) |
| - surface->factory()->RefResources(frame.resource_list); |
| + if (surface->compositor_frame_sink_support()) |
| + surface->compositor_frame_sink_support()->RefResources( |
| + frame.resource_list); |
| provider_->ReceiveFromChild(child_id, frame.resource_list); |
| } |
| CHECK(debug_weak_this.get()); |