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

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

Issue 2854163003: [cc] Plumb BeginFrameAcks through SurfaceManager to DisplayScheduler. (Closed)
Patch Set: Track state per surface. Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 5 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <unordered_set> 9 #include <unordered_set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "cc/output/compositor_frame.h" 14 #include "cc/output/compositor_frame.h"
15 #include "cc/scheduler/begin_frame_source.h" 15 #include "cc/scheduler/begin_frame_source.h"
16 #include "cc/surfaces/frame_sink_manager.h"
16 #include "cc/surfaces/frame_sink_manager_client.h" 17 #include "cc/surfaces/frame_sink_manager_client.h"
17 #include "cc/surfaces/referenced_surface_tracker.h" 18 #include "cc/surfaces/referenced_surface_tracker.h"
19 #include "cc/surfaces/surface.h"
18 #include "cc/surfaces/surface_id.h" 20 #include "cc/surfaces/surface_id.h"
19 #include "cc/surfaces/surface_resource_holder.h" 21 #include "cc/surfaces/surface_resource_holder.h"
20 #include "cc/surfaces/surface_resource_holder_client.h" 22 #include "cc/surfaces/surface_resource_holder_client.h"
21 #include "cc/surfaces/surfaces_export.h" 23 #include "cc/surfaces/surfaces_export.h"
22 24
23 namespace cc { 25 namespace cc {
24 26
25 class CompositorFrameSinkSupportClient; 27 class CompositorFrameSinkSupportClient;
26 class Surface;
27 class SurfaceManager; 28 class SurfaceManager;
28 29
29 class CC_SURFACES_EXPORT CompositorFrameSinkSupport 30 class CC_SURFACES_EXPORT CompositorFrameSinkSupport
30 : public BeginFrameObserver, 31 : public BeginFrameObserver,
31 public SurfaceResourceHolderClient, 32 public SurfaceResourceHolderClient,
32 public FrameSinkManagerClient { 33 public FrameSinkManagerClient {
33 public: 34 public:
34 static std::unique_ptr<CompositorFrameSinkSupport> Create( 35 static std::unique_ptr<CompositorFrameSinkSupport> Create(
35 CompositorFrameSinkSupportClient* client, 36 CompositorFrameSinkSupportClient* client,
36 SurfaceManager* surface_manager, 37 SurfaceManager* surface_manager,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 void DidReceiveCompositorFrameAck(); 99 void DidReceiveCompositorFrameAck();
99 void WillDrawSurface(const LocalSurfaceId& local_surface_id, 100 void WillDrawSurface(const LocalSurfaceId& local_surface_id,
100 const gfx::Rect& damage_rect); 101 const gfx::Rect& damage_rect);
101 102
102 // BeginFrameObserver implementation. 103 // BeginFrameObserver implementation.
103 void OnBeginFrame(const BeginFrameArgs& args) override; 104 void OnBeginFrame(const BeginFrameArgs& args) override;
104 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; 105 const BeginFrameArgs& LastUsedBeginFrameArgs() const override;
105 void OnBeginFrameSourcePausedChanged(bool paused) override; 106 void OnBeginFrameSourcePausedChanged(bool paused) override;
106 107
108 void SetProducerState(Surface::ProducerState state);
107 void UpdateNeedsBeginFramesInternal(); 109 void UpdateNeedsBeginFramesInternal();
108 std::unique_ptr<Surface> CreateSurface( 110 std::unique_ptr<Surface> CreateSurface(
109 const LocalSurfaceId& local_surface_id); 111 const LocalSurfaceId& local_surface_id);
110 void DestroyCurrentSurface(); 112 void DestroyCurrentSurface();
111 113
112 CompositorFrameSinkSupportClient* const client_; 114 CompositorFrameSinkSupportClient* const client_;
113 115
114 SurfaceManager* surface_manager_ = nullptr; 116 SurfaceManager* surface_manager_ = nullptr;
115 117
116 const FrameSinkId frame_sink_id_; 118 const FrameSinkId frame_sink_id_;
117 119
118 SurfaceResourceHolder surface_resource_holder_; 120 SurfaceResourceHolder surface_resource_holder_;
119 121
120 std::unique_ptr<Surface> current_surface_; 122 std::unique_ptr<Surface> current_surface_;
121 // Counts the number of CompositorFrames that have been submitted and have not 123 // Counts the number of CompositorFrames that have been submitted and have not
122 // yet received an ACK. 124 // yet received an ACK.
123 int ack_pending_count_ = 0; 125 int ack_pending_count_ = 0;
124 ReturnedResourceArray surface_returned_resources_; 126 ReturnedResourceArray surface_returned_resources_;
125 127
126 // The begin frame source being observered. Null if none. 128 // The begin frame source being observered. Null if none.
127 BeginFrameSource* begin_frame_source_ = nullptr; 129 BeginFrameSource* begin_frame_source_ = nullptr;
128 130
129 // The last begin frame args generated by the begin frame source. 131 // The last begin frame args generated by the begin frame source.
130 BeginFrameArgs last_begin_frame_args_; 132 BeginFrameArgs last_begin_frame_args_;
131 133
134 // The last BeginFrameAck sent by the client.
135 BeginFrameAck last_begin_frame_ack_;
136
137 // Our current CompositorFrame producer state. This is also propagated to the
138 // current_surface_, if it exists.
139 Surface::ProducerState producer_state_ = Surface::IDLE;
140
132 // Whether a request for begin frames has been issued. 141 // Whether a request for begin frames has been issued.
133 bool needs_begin_frame_ = false; 142 bool needs_begin_frame_ = false;
134 143
135 // Whether or not a frame observer has been added. 144 // Whether or not a frame observer has been added.
136 bool added_frame_observer_ = false; 145 bool added_frame_observer_ = false;
137 146
138 // Track the surface references for the surface corresponding to this 147 // Track the surface references for the surface corresponding to this
139 // compositor frame sink. 148 // compositor frame sink.
140 ReferencedSurfaceTracker reference_tracker_; 149 ReferencedSurfaceTracker reference_tracker_;
141 150
(...skipping 14 matching lines...) Expand all
156 const bool handles_frame_sink_id_invalidation_; 165 const bool handles_frame_sink_id_invalidation_;
157 166
158 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; 167 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_;
159 168
160 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); 169 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport);
161 }; 170 };
162 171
163 } // namespace cc 172 } // namespace cc
164 173
165 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 174 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/compositor_frame_sink_support.cc » ('j') | cc/surfaces/compositor_frame_sink_support.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698