Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: cc/surfaces/display_scheduler.h

Issue 1138563002: Add DisplayScheduler for Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rendererLatencyRecoveryHeuristic
Patch Set: rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/surfaces/display_client.h ('k') | cc/surfaces/display_scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_SURFACES_DISPLAY_SCHEDULER_H_
6 #define CC_SURFACES_DISPLAY_SCHEDULER_H_
7
8 #include "base/cancelable_callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/single_thread_task_runner.h"
12 #include "cc/scheduler/begin_frame_source.h"
13 #include "cc/surfaces/surface_id.h"
14 #include "cc/surfaces/surfaces_export.h"
15
16 namespace cc {
17
18 class OutputSurface;
19 class BeginFrameSource;
20
21 // TODO(brianderson): Reconcile with SurfacesScheduler crbug.com/476676
22 class CC_SURFACES_EXPORT DisplaySchedulerClient {
23 public:
24 virtual ~DisplaySchedulerClient() {}
25
26 virtual bool DrawAndSwap() = 0;
27 };
28
29 class CC_SURFACES_EXPORT DisplayScheduler : public BeginFrameObserverMixIn {
30 public:
31 DisplayScheduler(DisplaySchedulerClient* client,
32 BeginFrameSource* begin_frame_source,
33 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
34 int max_pending_swaps);
35 ~DisplayScheduler() override;
36
37 void SetRootSurfaceResourcesLocked(bool locked);
38 virtual void EntireDisplayDamaged(SurfaceId root_surface_id);
39 virtual void SurfaceDamaged(SurfaceId surface_id);
40
41 virtual void DidSwapBuffers();
42 void DidSwapBuffersComplete();
43
44 void OutputSurfaceLost();
45
46 // BeginFrameObserverMixIn implementation
47 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override;
48
49 protected:
50 base::TimeTicks DesiredBeginFrameDeadlineTime();
51 virtual void ScheduleBeginFrameDeadline();
52 void OnBeginFrameDeadline();
53 void DrawAndSwap();
54
55 DisplaySchedulerClient* client_;
56 BeginFrameSource* begin_frame_source_;
57 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
58
59 BeginFrameArgs current_begin_frame_args_;
60 base::Closure begin_frame_deadline_closure_;
61 base::CancelableClosure begin_frame_deadline_task_;
62 base::TimeTicks begin_frame_deadline_task_time_;
63
64 bool output_surface_lost_;
65 bool root_surface_resources_locked_;
66
67 bool inside_begin_frame_deadline_interval_;
68 bool needs_draw_;
69 bool entire_display_damaged_;
70 bool all_active_child_surfaces_ready_to_draw_;
71
72 int pending_swaps_;
73 int max_pending_swaps_;
74
75 SurfaceId root_surface_id_;
76 bool root_surface_damaged_;
77 bool expect_damage_from_root_surface_;
78
79 std::set<SurfaceId> child_surface_ids_damaged_;
80 std::set<SurfaceId> child_surface_ids_damaged_prev_;
81 std::vector<SurfaceId> child_surface_ids_to_expect_damage_from_;
82
83 base::WeakPtrFactory<DisplayScheduler> weak_ptr_factory_;
84
85 private:
86 DISALLOW_COPY_AND_ASSIGN(DisplayScheduler);
87 };
88
89 } // namespace cc
90
91 #endif // CC_SURFACES_DISPLAY_SCHEDULER_H_
OLDNEW
« no previous file with comments | « cc/surfaces/display_client.h ('k') | cc/surfaces/display_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698