| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_scheduler.h" | 5 #include "cc/surfaces/display_scheduler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 void DisplayScheduler::DisplayResized() { | 63 void DisplayScheduler::DisplayResized() { |
| 64 expecting_root_surface_damage_because_of_resize_ = true; | 64 expecting_root_surface_damage_because_of_resize_ = true; |
| 65 expect_damage_from_root_surface_ = true; | 65 expect_damage_from_root_surface_ = true; |
| 66 needs_draw_ = true; | 66 needs_draw_ = true; |
| 67 ScheduleBeginFrameDeadline(); | 67 ScheduleBeginFrameDeadline(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Notification that there was a resize or the root surface changed and | 70 // Notification that there was a resize or the root surface changed and |
| 71 // that we should just draw immediately. | 71 // that we should just draw immediately. |
| 72 void DisplayScheduler::SetNewRootSurface(SurfaceId root_surface_id) { | 72 void DisplayScheduler::SetNewRootSurface(const SurfaceId& root_surface_id) { |
| 73 TRACE_EVENT0("cc", "DisplayScheduler::SetNewRootSurface"); | 73 TRACE_EVENT0("cc", "DisplayScheduler::SetNewRootSurface"); |
| 74 root_surface_id_ = root_surface_id; | 74 root_surface_id_ = root_surface_id; |
| 75 SurfaceDamaged(root_surface_id); | 75 SurfaceDamaged(root_surface_id); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Indicates that there was damage to one of the surfaces. | 78 // Indicates that there was damage to one of the surfaces. |
| 79 // Has some logic to wait for multiple active surfaces before | 79 // Has some logic to wait for multiple active surfaces before |
| 80 // triggering the deadline. | 80 // triggering the deadline. |
| 81 void DisplayScheduler::SurfaceDamaged(SurfaceId surface_id) { | 81 void DisplayScheduler::SurfaceDamaged(const SurfaceId& surface_id) { |
| 82 TRACE_EVENT1("cc", "DisplayScheduler::SurfaceDamaged", "surface_id", | 82 TRACE_EVENT1("cc", "DisplayScheduler::SurfaceDamaged", "surface_id", |
| 83 surface_id.ToString()); | 83 surface_id.ToString()); |
| 84 | 84 |
| 85 needs_draw_ = true; | 85 needs_draw_ = true; |
| 86 | 86 |
| 87 if (surface_id == root_surface_id_) { | 87 if (surface_id == root_surface_id_) { |
| 88 root_surface_damaged_ = true; | 88 root_surface_damaged_ = true; |
| 89 expecting_root_surface_damage_because_of_resize_ = false; | 89 expecting_root_surface_damage_because_of_resize_ = false; |
| 90 } else { | 90 } else { |
| 91 child_surface_ids_damaged_.insert(surface_id); | 91 child_surface_ids_damaged_.insert(surface_id); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 301 } |
| 302 | 302 |
| 303 void DisplayScheduler::DidSwapBuffersComplete() { | 303 void DisplayScheduler::DidSwapBuffersComplete() { |
| 304 pending_swaps_--; | 304 pending_swaps_--; |
| 305 TRACE_EVENT_ASYNC_END1("cc", "DisplayScheduler:pending_swaps", this, | 305 TRACE_EVENT_ASYNC_END1("cc", "DisplayScheduler:pending_swaps", this, |
| 306 "pending_frames", pending_swaps_); | 306 "pending_frames", pending_swaps_); |
| 307 ScheduleBeginFrameDeadline(); | 307 ScheduleBeginFrameDeadline(); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace cc | 310 } // namespace cc |
| OLD | NEW |