Chromium Code Reviews| Index: cc/surfaces/display.cc |
| diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc |
| index 846897b21806db19b8c100a9660caa75ee05f441..a7e1e162ca1a59dc699b94cc5dc17479491ad0b2 100644 |
| --- a/cc/surfaces/display.cc |
| +++ b/cc/surfaces/display.cc |
| @@ -383,34 +383,65 @@ void Display::DidReceiveTextureInUseResponses( |
| void Display::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
| aggregator_->SetFullDamageForSurface(current_surface_id_); |
| - if (scheduler_) |
| - scheduler_->SurfaceDamaged(current_surface_id_); |
| + if (scheduler_) { |
| + BeginFrameAck ack; |
| + ack.has_damage = true; |
| + scheduler_->SurfaceDamaged(current_surface_id_, ack, true); |
| + } |
| } |
| -void Display::OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) { |
| - if (aggregator_ && |
| - aggregator_->previous_contained_surfaces().count(surface_id)) { |
| - Surface* surface = surface_manager_->GetSurfaceForId(surface_id); |
| - if (surface) { |
| - if (!surface->HasActiveFrame() || |
| - surface->GetActiveFrame().resource_list.empty()) { |
| - aggregator_->ReleaseResources(surface_id); |
| +void Display::OnSurfaceDamaged(const SurfaceId& surface_id, |
| + const BeginFrameAck& ack, |
| + bool* changed) { |
| + if (ack.has_damage) { |
| + if (aggregator_ && |
| + aggregator_->previous_contained_surfaces().count(surface_id)) { |
| + Surface* surface = surface_manager_->GetSurfaceForId(surface_id); |
| + if (surface) { |
| + if (!surface->HasActiveFrame() || |
|
sunnyps
2017/05/25 20:49:13
nit: Can surface->HasActiveFrame() be false? If no
Eric Seckler
2017/05/26 10:57:52
I think the only place where that may happen is wh
|
| + surface->GetActiveFrame().resource_list.empty()) { |
| + aggregator_->ReleaseResources(surface_id); |
| + } |
| } |
| + *changed = true; |
| + } else if (surface_id == current_surface_id_) { |
| + *changed = true; |
| } |
| - if (scheduler_) |
| - scheduler_->SurfaceDamaged(surface_id); |
| - *changed = true; |
| - } else if (surface_id == current_surface_id_) { |
| - if (scheduler_) |
| - scheduler_->SurfaceDamaged(surface_id); |
| - *changed = true; |
| } |
| + if (scheduler_) |
| + scheduler_->SurfaceDamaged(surface_id, ack, *changed); |
| + |
| if (surface_id == current_surface_id_) |
| UpdateRootSurfaceResourcesLocked(); |
| } |
| -void Display::OnSurfaceCreated(const SurfaceInfo& surface_info) {} |
| +bool Display::SurfaceHasUndrawnFrame(const SurfaceId& surface_id) const { |
| + if (!surface_manager_) |
| + return false; |
| + |
| + Surface* surface = surface_manager_->GetSurfaceForId(surface_id); |
| + if (!surface) |
| + return false; |
| + |
| + return surface->HasUndrawnActiveFrame(); |
| +} |
| + |
| +void Display::OnSurfaceCreated(const SurfaceInfo& surface_info) { |
| + if (scheduler_) |
| + scheduler_->SurfaceCreated(surface_info); |
| +} |
| + |
| +void Display::OnSurfaceDestroyed(const SurfaceId& surface_id) { |
| + if (scheduler_) |
| + scheduler_->SurfaceDestroyed(surface_id); |
| +} |
| + |
| +void Display::OnSurfaceDamageExpected(const SurfaceId& surface_id, |
| + const BeginFrameArgs& args) { |
| + if (scheduler_) |
| + scheduler_->SurfaceDamageExpected(surface_id, args); |
| +} |
| void Display::OnSurfaceDiscarded(const SurfaceId& surface_id) { |
| if (aggregator_) |