| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_dependency_tracker.h" | 5 #include "cc/surfaces/surface_dependency_tracker.h" |
| 6 | 6 |
| 7 #include "cc/surfaces/surface.h" | 7 #include "cc/surfaces/surface.h" |
| 8 #include "cc/surfaces/surface_info.h" | 8 #include "cc/surfaces/surface_info.h" |
| 9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 constexpr uint32_t kMaxBeginFrameCount = 4; | 14 constexpr uint32_t kMaxBeginFrameCount = 4; |
| 15 } | 15 } |
| 16 | 16 |
| 17 SurfaceDependencyTracker::SurfaceDependencyTracker( | 17 SurfaceDependencyTracker::SurfaceDependencyTracker( |
| 18 SurfaceManager* surface_manager, | 18 SurfaceManager* surface_manager, |
| 19 BeginFrameSource* begin_frame_source) | 19 BeginFrameSource* begin_frame_source) |
| 20 : surface_manager_(surface_manager), | 20 : surface_manager_(surface_manager), |
| 21 begin_frame_source_(begin_frame_source) { | 21 begin_frame_source_(begin_frame_source) { |
| 22 surface_manager_->AddObserver(this); | 22 surface_manager_->AddObserver(this); |
| 23 begin_frame_source_->AddObserver(this); | 23 begin_frame_source_->AddObserver(this); |
| 24 } | 24 } |
| 25 | 25 |
| 26 SurfaceDependencyTracker::~SurfaceDependencyTracker() { | 26 SurfaceDependencyTracker::~SurfaceDependencyTracker() { |
| 27 surface_manager_->RemoveObserver(this); | 27 surface_manager_->RemoveObserver(this); |
| 28 begin_frame_source_->RemoveObserver(this); | 28 begin_frame_source_->RemoveObserver(this); |
| 29 for (Surface* pending_surface : pending_surfaces_) |
| 30 pending_surface->RemoveObserver(this); |
| 31 pending_surfaces_.clear(); |
| 29 } | 32 } |
| 30 | 33 |
| 31 void SurfaceDependencyTracker::RequestSurfaceResolution(Surface* surface) { | 34 void SurfaceDependencyTracker::RequestSurfaceResolution(Surface* surface) { |
| 32 DCHECK(surface->HasPendingFrame()); | 35 DCHECK(surface->HasPendingFrame()); |
| 33 | 36 |
| 34 const CompositorFrame& pending_frame = surface->GetPendingFrame(); | 37 const CompositorFrame& pending_frame = surface->GetPendingFrame(); |
| 35 bool needs_begin_frame = | 38 bool needs_begin_frame = |
| 36 pending_frame.metadata.can_activate_before_dependencies; | 39 pending_frame.metadata.can_activate_before_dependencies; |
| 37 | 40 |
| 38 // Referenced surface IDs that aren't currently known to the surface manager | 41 // Referenced surface IDs that aren't currently known to the surface manager |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // have a deadline. | 174 // have a deadline. |
| 172 if (blocked_surfaces_.empty()) | 175 if (blocked_surfaces_.empty()) |
| 173 frames_since_deadline_set_.reset(); | 176 frames_since_deadline_set_.reset(); |
| 174 | 177 |
| 175 // Tell each surface about the availability of its blocker. | 178 // Tell each surface about the availability of its blocker. |
| 176 for (Surface* blocked_pending_surface : blocked_pending_surface_set) | 179 for (Surface* blocked_pending_surface : blocked_pending_surface_set) |
| 177 blocked_pending_surface->NotifySurfaceIdAvailable(surface_id); | 180 blocked_pending_surface->NotifySurfaceIdAvailable(surface_id); |
| 178 } | 181 } |
| 179 | 182 |
| 180 } // namespace cc | 183 } // namespace cc |
| OLD | NEW |