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/display.h" | 5 #include "cc/surfaces/display.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 void Display::CommitVSyncParameters(base::TimeTicks timebase, | 162 void Display::CommitVSyncParameters(base::TimeTicks timebase, |
163 base::TimeDelta interval) { | 163 base::TimeDelta interval) { |
164 client_->CommitVSyncParameters(timebase, interval); | 164 client_->CommitVSyncParameters(timebase, interval); |
165 } | 165 } |
166 | 166 |
167 void Display::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 167 void Display::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
168 client_->SetMemoryPolicy(policy); | 168 client_->SetMemoryPolicy(policy); |
169 } | 169 } |
170 | 170 |
171 void Display::OnSurfaceDamaged(SurfaceId surface) { | 171 void Display::OnSurfaceDamaged(SurfaceId surface_id) { |
172 if (aggregator_ && | 172 if (aggregator_ && |
173 aggregator_->previous_contained_surfaces().count(surface)) { | 173 aggregator_->previous_contained_surfaces().count(surface_id)) { |
174 aggregator_->ReleaseResources(surface); | 174 Surface* surface = manager_->GetSurfaceForId(surface_id); |
| 175 if (surface) { |
| 176 const CompositorFrame* current_frame = surface->GetEligibleFrame(); |
| 177 if (!current_frame || !current_frame->delegated_frame_data || |
| 178 !current_frame->delegated_frame_data->resource_list.size()) |
| 179 aggregator_->ReleaseResources(surface_id); |
| 180 } |
175 client_->DisplayDamaged(); | 181 client_->DisplayDamaged(); |
176 } | 182 } |
177 } | 183 } |
178 | 184 |
179 SurfaceId Display::CurrentSurfaceId() { | 185 SurfaceId Display::CurrentSurfaceId() { |
180 return current_surface_id_; | 186 return current_surface_id_; |
181 } | 187 } |
182 | 188 |
183 int Display::GetMaxFramesPending() { | 189 int Display::GetMaxFramesPending() { |
184 if (!output_surface_) | 190 if (!output_surface_) |
185 return OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 191 return OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
186 return output_surface_->capabilities().max_frames_pending; | 192 return output_surface_->capabilities().max_frames_pending; |
187 } | 193 } |
188 | 194 |
189 } // namespace cc | 195 } // namespace cc |
OLD | NEW |