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

Side by Side Diff: blimp/client/core/compositor/blimp_compositor.h

Issue 2445093002: cc/blimp: Add synchronization for scroll/scale state. (Closed)
Patch Set: Addressed comments Created 4 years, 1 month 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 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 BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 5 #ifndef BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_
6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "blimp/client/core/compositor/blimp_compositor_frame_sink_proxy.h" 14 #include "blimp/client/core/compositor/blimp_compositor_frame_sink_proxy.h"
15 #include "blimp/client/public/compositor/compositor_dependencies.h" 15 #include "blimp/client/public/compositor/compositor_dependencies.h"
16 #include "cc/blimp/compositor_state_deserializer_client.h" 16 #include "cc/blimp/compositor_state_deserializer.h"
17 #include "cc/surfaces/surface_factory_client.h" 17 #include "cc/surfaces/surface_factory_client.h"
18 #include "cc/trees/layer_tree_host.h" 18 #include "cc/trees/layer_tree_host.h"
19 #include "cc/trees/layer_tree_host_client.h" 19 #include "cc/trees/layer_tree_host_client.h"
20 #include "cc/trees/layer_tree_settings.h" 20 #include "cc/trees/layer_tree_settings.h"
21 #include "cc/trees/remote_proto_channel.h" 21 #include "cc/trees/remote_proto_channel.h"
22 #include "ui/gfx/geometry/size.h" 22 #include "ui/gfx/geometry/size.h"
23 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
24 24
25 namespace base { 25 namespace base {
26 class SingleThreadTaskRunner; 26 class SingleThreadTaskRunner;
27 class Thread; 27 class Thread;
28 } // namespace base 28 } // namespace base
29 29
30 namespace cc { 30 namespace cc {
31 class InputHandler; 31 class InputHandler;
32 32
33 namespace proto { 33 namespace proto {
34 class CompositorMessage; 34 class CompositorMessage;
35 } // namespace proto 35 } // namespace proto
36 36
37 class CompositorStateDeserializer;
38 class ContextProvider; 37 class ContextProvider;
39 class Layer; 38 class Layer;
40 class LayerTreeHost; 39 class LayerTreeHost;
41 class LayerTreeSettings; 40 class LayerTreeSettings;
42 class LocalFrameid; 41 class LocalFrameid;
43 class Surface; 42 class Surface;
44 class SurfaceFactory; 43 class SurfaceFactory;
45 class SurfaceIdAllocator; 44 class SurfaceIdAllocator;
46 } // namespace cc 45 } // namespace cc
47 46
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // LayerTreeHostClient implementation. 112 // LayerTreeHostClient implementation.
114 void WillBeginMainFrame() override {} 113 void WillBeginMainFrame() override {}
115 void DidBeginMainFrame() override {} 114 void DidBeginMainFrame() override {}
116 void BeginMainFrame(const cc::BeginFrameArgs& args) override {} 115 void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
117 void BeginMainFrameNotExpectedSoon() override {} 116 void BeginMainFrameNotExpectedSoon() override {}
118 void UpdateLayerTreeHost() override; 117 void UpdateLayerTreeHost() override;
119 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 118 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
120 const gfx::Vector2dF& outer_delta, 119 const gfx::Vector2dF& outer_delta,
121 const gfx::Vector2dF& elastic_overscroll_delta, 120 const gfx::Vector2dF& elastic_overscroll_delta,
122 float page_scale, 121 float page_scale,
123 float top_controls_delta) override {} 122 float top_controls_delta) override;
124 void RequestNewCompositorFrameSink() override; 123 void RequestNewCompositorFrameSink() override;
125 void DidInitializeCompositorFrameSink() override; 124 void DidInitializeCompositorFrameSink() override;
126 // TODO(khushalsagar): Need to handle context initialization failures. 125 // TODO(khushalsagar): Need to handle context initialization failures.
127 void DidFailToInitializeCompositorFrameSink() override {} 126 void DidFailToInitializeCompositorFrameSink() override {}
128 void WillCommit() override {} 127 void WillCommit() override {}
129 void DidCommit() override {} 128 void DidCommit() override {}
130 void DidCommitAndDrawFrame() override; 129 void DidCommitAndDrawFrame() override;
131 void DidReceiveCompositorFrameAck() override {} 130 void DidReceiveCompositorFrameAck() override {}
132 void DidCompletePageScaleAnimation() override {} 131 void DidCompletePageScaleAnimation() override {}
133 132
134 // RemoteProtoChannel implementation. 133 // RemoteProtoChannel implementation.
135 void SetProtoReceiver(ProtoReceiver* receiver) override; 134 void SetProtoReceiver(ProtoReceiver* receiver) override;
136 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override; 135 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override;
137 136
138 // BlimpCompositorFrameSinkProxy implementation. 137 // BlimpCompositorFrameSinkProxy implementation.
139 void BindToProxyClient( 138 void BindToProxyClient(
140 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) override; 139 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) override;
141 void SubmitCompositorFrame(cc::CompositorFrame frame) override; 140 void SubmitCompositorFrame(cc::CompositorFrame frame) override;
142 void UnbindProxyClient() override; 141 void UnbindProxyClient() override;
143 142
144 // SurfaceFactoryClient implementation. 143 // SurfaceFactoryClient implementation.
145 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 144 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
146 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override {} 145 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override {}
147 146
148 // CompositorStateDeserializerClient implementation. 147 // CompositorStateDeserializerClient implementation.
149 bool ShouldRetainClientScroll(int engine_layer_id, 148 void DidUpdateLocalState() override;
150 const gfx::ScrollOffset& new_offset) override;
151 bool ShouldRetainClientPageScale(float new_page_scale) override;
152 149
153 void HandleCompositorMessageToImpl( 150 void HandleCompositorMessageToImpl(
154 std::unique_ptr<cc::proto::CompositorMessage> message); 151 std::unique_ptr<cc::proto::CompositorMessage> message);
155 152
156 // Called when the a ContextProvider has been created by the 153 // Called when the a ContextProvider has been created by the
157 // CompositorDependencies class. If |host_| is waiting on an 154 // CompositorDependencies class. If |host_| is waiting on an
158 // CompositorFrameSink this will build one for it. 155 // CompositorFrameSink this will build one for it.
159 void OnContextProvidersCreated( 156 void OnContextProvidersCreated(
160 const scoped_refptr<cc::ContextProvider>& compositor_context_provider, 157 const scoped_refptr<cc::ContextProvider>& compositor_context_provider,
161 const scoped_refptr<cc::ContextProvider>& worker_context_provider); 158 const scoped_refptr<cc::ContextProvider>& worker_context_provider);
(...skipping 16 matching lines...) Expand all
178 175
179 // Updates |pending_commit_trackers_|, decrementing the count and, if 0, 176 // Updates |pending_commit_trackers_|, decrementing the count and, if 0,
180 // notifying the callback. If |flush| is true, flushes all entries regardless 177 // notifying the callback. If |flush| is true, flushes all entries regardless
181 // of the count. 178 // of the count.
182 void CheckPendingCommitCounts(bool flush); 179 void CheckPendingCommitCounts(bool flush);
183 180
184 // Acks a submitted CompositorFrame when it has been processed and another 181 // Acks a submitted CompositorFrame when it has been processed and another
185 // frame should be started. 182 // frame should be started.
186 void SubmitCompositorFrameAck(); 183 void SubmitCompositorFrameAck();
187 184
188 // Called when the local copy of the layer with |engine_layer_id| on the 185 // Sends an update to the engine if the state on the client was modified and
189 // engine was scrolled on the compositor thread. 186 // an ack for a previous update sent is not pending.
190 void LayerScrolled(int engine_layer_id); 187 void SendClientStateUpdateIfPossible();
191 188
192 // Set to true if we are using a LayerTreeHostInProcess to process frame 189 // Set to true if we are using a LayerTreeHostInProcess to process frame
193 // updates from the engine. 190 // updates from the engine.
194 const bool use_threaded_layer_tree_host_; 191 const bool use_threaded_layer_tree_host_;
195 192
196 BlimpCompositorClient* client_; 193 BlimpCompositorClient* client_;
197 194
198 BlimpCompositorDependencies* compositor_dependencies_; 195 BlimpCompositorDependencies* compositor_dependencies_;
199 196
200 cc::FrameSinkId frame_sink_id_; 197 cc::FrameSinkId frame_sink_id_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Stores a frame update received from the engine, when a threaded 235 // Stores a frame update received from the engine, when a threaded
239 // LayerTreeHost is used. There can only be a single frame in flight at any 236 // LayerTreeHost is used. There can only be a single frame in flight at any
240 // point. 237 // point.
241 std::unique_ptr<cc::proto::CompositorMessage> pending_frame_update_; 238 std::unique_ptr<cc::proto::CompositorMessage> pending_frame_update_;
242 239
243 // Used with a threaded LayerTreeHost to deserialize proto updates from the 240 // Used with a threaded LayerTreeHost to deserialize proto updates from the
244 // engine into the LayerTree. 241 // engine into the LayerTree.
245 std::unique_ptr<cc::CompositorStateDeserializer> 242 std::unique_ptr<cc::CompositorStateDeserializer>
246 compositor_state_deserializer_; 243 compositor_state_deserializer_;
247 244
245 // Set to true if the compositor state on the client was modified on the impl
246 // thread and an update needs to be sent to the engine.
247 bool client_state_modified_ = false;
aelias_OOO_until_Jul13 2016/10/26 04:04:12 "dirty" is the jargon for this, so I suggest "clie
Khushal 2016/10/26 19:02:35 Done.
248
249 // Set to true if a client state update was sent to the engine and an ack for
250 // this update from the engine is pending.
251 bool client_state_update_ack_pending_ = false;
252
248 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; 253 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_;
249 254
250 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); 255 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
251 }; 256 };
252 257
253 } // namespace client 258 } // namespace client
254 } // namespace blimp 259 } // namespace blimp
255 260
256 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 261 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « no previous file | blimp/client/core/compositor/blimp_compositor.cc » ('j') | blimp/client/core/compositor/blimp_compositor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698