| 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 #ifndef CC_SURFACES_DISPLAY_SCHEDULER_H_ | 5 #ifndef CC_SURFACES_DISPLAY_SCHEDULER_H_ |
| 6 #define CC_SURFACES_DISPLAY_SCHEDULER_H_ | 6 #define CC_SURFACES_DISPLAY_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // BeginFrameObserverBase implementation | 48 // BeginFrameObserverBase implementation |
| 49 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; | 49 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 base::TimeTicks DesiredBeginFrameDeadlineTime(); | 52 base::TimeTicks DesiredBeginFrameDeadlineTime(); |
| 53 virtual void ScheduleBeginFrameDeadline(); | 53 virtual void ScheduleBeginFrameDeadline(); |
| 54 void AttemptDrawAndSwap(); | 54 void AttemptDrawAndSwap(); |
| 55 void OnBeginFrameDeadline(); | 55 void OnBeginFrameDeadline(); |
| 56 void DrawAndSwap(); | 56 void DrawAndSwap(); |
| 57 void UpdateActiveSurfaces(); | |
| 58 | 57 |
| 59 DisplaySchedulerClient* client_; | 58 DisplaySchedulerClient* client_; |
| 60 BeginFrameSource* begin_frame_source_; | 59 BeginFrameSource* begin_frame_source_; |
| 61 base::SingleThreadTaskRunner* task_runner_; | 60 base::SingleThreadTaskRunner* task_runner_; |
| 62 | 61 |
| 63 BeginFrameArgs current_begin_frame_args_; | 62 BeginFrameArgs current_begin_frame_args_; |
| 64 base::Closure begin_frame_deadline_closure_; | 63 base::Closure begin_frame_deadline_closure_; |
| 65 base::CancelableClosure begin_frame_deadline_task_; | 64 base::CancelableClosure begin_frame_deadline_task_; |
| 66 base::TimeTicks begin_frame_deadline_task_time_; | 65 base::TimeTicks begin_frame_deadline_task_time_; |
| 67 | 66 |
| 68 bool output_surface_lost_; | 67 bool output_surface_lost_; |
| 69 bool root_surface_resources_locked_; | 68 bool root_surface_resources_locked_; |
| 70 | 69 |
| 71 bool inside_begin_frame_deadline_interval_; | 70 bool inside_begin_frame_deadline_interval_; |
| 72 bool needs_draw_; | 71 bool needs_draw_; |
| 73 bool child_surfaces_ready_to_draw_; | 72 bool expecting_root_surface_damage_because_of_resize_; |
| 73 bool all_active_child_surfaces_ready_to_draw_; |
| 74 | 74 |
| 75 int pending_swaps_; | 75 int pending_swaps_; |
| 76 int max_pending_swaps_; | 76 int max_pending_swaps_; |
| 77 | 77 |
| 78 SurfaceId root_surface_id_; | 78 SurfaceId root_surface_id_; |
| 79 bool root_surface_damaged_; | 79 bool root_surface_damaged_; |
| 80 bool root_surface_active_; | 80 bool expect_damage_from_root_surface_; |
| 81 bool expecting_root_surface_damage_because_of_resize_; | |
| 82 | 81 |
| 83 // We currently use a heuristic that considers a child surface | |
| 84 // active if it has submitted a frame anytime within the last 3 | |
| 85 // vsyncs. | |
| 86 static const int kNumFramesSurfaceIsActive = 3; | |
| 87 std::set<SurfaceId> child_surface_ids_damaged_; | 82 std::set<SurfaceId> child_surface_ids_damaged_; |
| 88 std::set<SurfaceId> active_child_surface_ids_[kNumFramesSurfaceIsActive]; | 83 std::set<SurfaceId> child_surface_ids_damaged_prev_; |
| 89 int active_child_surface_ids_index_; | 84 std::vector<SurfaceId> child_surface_ids_to_expect_damage_from_; |
| 90 | 85 |
| 91 base::WeakPtrFactory<DisplayScheduler> weak_ptr_factory_; | 86 base::WeakPtrFactory<DisplayScheduler> weak_ptr_factory_; |
| 92 | 87 |
| 93 private: | 88 private: |
| 94 DISALLOW_COPY_AND_ASSIGN(DisplayScheduler); | 89 DISALLOW_COPY_AND_ASSIGN(DisplayScheduler); |
| 95 }; | 90 }; |
| 96 | 91 |
| 97 } // namespace cc | 92 } // namespace cc |
| 98 | 93 |
| 99 #endif // CC_SURFACES_DISPLAY_SCHEDULER_H_ | 94 #endif // CC_SURFACES_DISPLAY_SCHEDULER_H_ |
| OLD | NEW |