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

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

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Fix build break with chrome embedder Created 4 years, 3 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 | « blimp/client/core/compositor/BUILD.gn ('k') | blimp/client/core/compositor/blimp_compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "blimp/client/core/compositor/blimp_output_surface.h" 13 #include "blimp/client/core/compositor/blimp_output_surface.h"
13 #include "blimp/client/core/input/blimp_input_manager.h" 14 #include "blimp/client/core/input/blimp_input_manager.h"
14 #include "blimp/client/public/compositor/compositor_dependencies.h" 15 #include "blimp/client/public/compositor/compositor_dependencies.h"
15 #include "cc/surfaces/surface_factory_client.h" 16 #include "cc/surfaces/surface_factory_client.h"
16 #include "cc/trees/layer_tree_host.h" 17 #include "cc/trees/layer_tree_host.h"
17 #include "cc/trees/layer_tree_host_client.h" 18 #include "cc/trees/layer_tree_host_client.h"
18 #include "cc/trees/layer_tree_settings.h" 19 #include "cc/trees/layer_tree_settings.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 BlimpCompositorClient* client); 90 BlimpCompositorClient* client);
90 91
91 ~BlimpCompositor() override; 92 ~BlimpCompositor() override;
92 93
93 virtual void SetVisible(bool visible); 94 virtual void SetVisible(bool visible);
94 95
95 // Forwards the touch event to the |input_manager_|. 96 // Forwards the touch event to the |input_manager_|.
96 // virtual for testing. 97 // virtual for testing.
97 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event); 98 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event);
98 99
100 // Notifies |callback| when all pending commits have been drawn to the screen.
101 // If this compositor is destroyed or becomes hidden |callback| will be
102 // notified.
103 void NotifyWhenDonePendingCommits(base::Closure callback);
104
99 // Called to forward the compositor message from the remote server 105 // Called to forward the compositor message from the remote server
100 // LayerTreeHost of the render widget for this compositor. 106 // LayerTreeHost of the render widget for this compositor.
101 // virtual for testing. 107 // virtual for testing.
102 virtual void OnCompositorMessageReceived( 108 virtual void OnCompositorMessageReceived(
103 std::unique_ptr<cc::proto::CompositorMessage> message); 109 std::unique_ptr<cc::proto::CompositorMessage> message);
104 110
105 scoped_refptr<cc::Layer> layer() const { return layer_; } 111 scoped_refptr<cc::Layer> layer() const { return layer_; }
106 112
107 int render_widget_id() const { return render_widget_id_; } 113 int render_widget_id() const { return render_widget_id_; }
108 114
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 void DestroyDelegatedContent(); 170 void DestroyDelegatedContent();
165 171
166 // Helper method to build the internal CC LayerTreeHost instance from 172 // Helper method to build the internal CC LayerTreeHost instance from
167 // |message|. 173 // |message|.
168 void CreateLayerTreeHost(); 174 void CreateLayerTreeHost();
169 175
170 // Helper method to destroy the internal CC LayerTreeHost instance and all its 176 // Helper method to destroy the internal CC LayerTreeHost instance and all its
171 // associated state. 177 // associated state.
172 void DestroyLayerTreeHost(); 178 void DestroyLayerTreeHost();
173 179
180 // Updates |pending_commit_trackers_|, decrementing the count and, if 0,
181 // notifying the callback. If |flush| is true, flushes all entries regardless
182 // of the count.
183 void CheckPendingCommitCounts(bool flush);
184
174 // The unique identifier for the render widget for this compositor. 185 // The unique identifier for the render widget for this compositor.
175 const int render_widget_id_; 186 const int render_widget_id_;
176 187
177 BlimpCompositorClient* client_; 188 BlimpCompositorClient* client_;
178 189
179 BlimpCompositorDependencies* compositor_dependencies_; 190 BlimpCompositorDependencies* compositor_dependencies_;
180 191
181 std::unique_ptr<cc::LayerTreeHostInterface> host_; 192 std::unique_ptr<cc::LayerTreeHostInterface> host_;
182 193
183 // The SurfaceFactory is bound to the lifetime of the BlimpOutputSurface. When 194 // The SurfaceFactory is bound to the lifetime of the BlimpOutputSurface. When
(...skipping 19 matching lines...) Expand all
203 // to |render_widget_id_|. 214 // to |render_widget_id_|.
204 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; 215 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_;
205 216
206 // Handles input events for the current render widget. The lifetime of the 217 // Handles input events for the current render widget. The lifetime of the
207 // input manager is tied to the lifetime of the |host_| which owns the 218 // input manager is tied to the lifetime of the |host_| which owns the
208 // cc::InputHandler. The input events are forwarded to this input handler by 219 // cc::InputHandler. The input events are forwarded to this input handler by
209 // the manager to be handled by the client compositor for the current render 220 // the manager to be handled by the client compositor for the current render
210 // widget. 221 // widget.
211 std::unique_ptr<BlimpInputManager> input_manager_; 222 std::unique_ptr<BlimpInputManager> input_manager_;
212 223
224 // The number of times a START_COMMIT proto has been received but a call to
225 // DidCommitAndDrawFrame hasn't been seen. This should track the number of
226 // outstanding commits.
227 size_t outstanding_commits_;
228
229 // When NotifyWhenDonePendingCommitsis called |outstanding_commits_| is copied
230 // along with the |callback| into this vector. Each time
231 // DidCommitAndDrawFrame is called these entries get decremented. If they hit
232 // 0 the callback is triggered.
233 std::vector<std::pair<size_t, base::Closure>> pending_commit_trackers_;
234
213 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; 235 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_;
214 236
215 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); 237 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
216 }; 238 };
217 239
218 } // namespace client 240 } // namespace client
219 } // namespace blimp 241 } // namespace blimp
220 242
221 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 243 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « blimp/client/core/compositor/BUILD.gn ('k') | blimp/client/core/compositor/blimp_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698