| 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 15 matching lines...) Expand all Loading... |
| 26 expecting_root_surface_damage_because_of_resize_(false), | 26 expecting_root_surface_damage_because_of_resize_(false), |
| 27 all_active_child_surfaces_ready_to_draw_(false), | 27 all_active_child_surfaces_ready_to_draw_(false), |
| 28 pending_swaps_(0), | 28 pending_swaps_(0), |
| 29 max_pending_swaps_(max_pending_swaps), | 29 max_pending_swaps_(max_pending_swaps), |
| 30 root_surface_damaged_(false), | 30 root_surface_damaged_(false), |
| 31 expect_damage_from_root_surface_(false), | 31 expect_damage_from_root_surface_(false), |
| 32 weak_ptr_factory_(this) { | 32 weak_ptr_factory_(this) { |
| 33 begin_frame_source_->AddObserver(this); | 33 begin_frame_source_->AddObserver(this); |
| 34 begin_frame_deadline_closure_ = base::Bind( | 34 begin_frame_deadline_closure_ = base::Bind( |
| 35 &DisplayScheduler::OnBeginFrameDeadline, weak_ptr_factory_.GetWeakPtr()); | 35 &DisplayScheduler::OnBeginFrameDeadline, weak_ptr_factory_.GetWeakPtr()); |
| 36 |
| 37 // TODO(tansell): Set this to something useful. |
| 38 begin_frame_source_for_children_ = SyntheticBeginFrameSource::Create( |
| 39 task_runner, BeginFrameArgs::DefaultInterval()); |
| 36 } | 40 } |
| 37 | 41 |
| 38 DisplayScheduler::~DisplayScheduler() { | 42 DisplayScheduler::~DisplayScheduler() { |
| 39 begin_frame_source_->RemoveObserver(this); | 43 begin_frame_source_->RemoveObserver(this); |
| 40 } | 44 } |
| 41 | 45 |
| 42 // If we try to draw when the root surface resources are locked, the | 46 // If we try to draw when the root surface resources are locked, the |
| 43 // draw will fail. | 47 // draw will fail. |
| 44 void DisplayScheduler::SetRootSurfaceResourcesLocked(bool locked) { | 48 void DisplayScheduler::SetRootSurfaceResourcesLocked(bool locked) { |
| 45 TRACE_EVENT1("cc", "DisplayScheduler::SetRootSurfaceResourcesLocked", | 49 TRACE_EVENT1("cc", "DisplayScheduler::SetRootSurfaceResourcesLocked", |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 289 } |
| 286 | 290 |
| 287 void DisplayScheduler::DidSwapBuffersComplete() { | 291 void DisplayScheduler::DidSwapBuffersComplete() { |
| 288 pending_swaps_--; | 292 pending_swaps_--; |
| 289 TRACE_EVENT1("cc", "DisplayScheduler::DidSwapBuffersComplete", | 293 TRACE_EVENT1("cc", "DisplayScheduler::DidSwapBuffersComplete", |
| 290 "pending_frames", pending_swaps_); | 294 "pending_frames", pending_swaps_); |
| 291 ScheduleBeginFrameDeadline(); | 295 ScheduleBeginFrameDeadline(); |
| 292 } | 296 } |
| 293 | 297 |
| 294 } // namespace cc | 298 } // namespace cc |
| OLD | NEW |