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

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

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Addressed more comments, added thread restriction bypass for tests. 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
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 BlimpCompositorClient* client); 91 BlimpCompositorClient* client);
91 92
92 ~BlimpCompositor() override; 93 ~BlimpCompositor() override;
93 94
94 virtual void SetVisible(bool visible); 95 virtual void SetVisible(bool visible);
95 96
96 // Forwards the touch event to the |input_manager_|. 97 // Forwards the touch event to the |input_manager_|.
97 // virtual for testing. 98 // virtual for testing.
98 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event); 99 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event);
99 100
101 // Notifies |callback| when all pending commits have been drawn to the screen.
102 // If this compositor is destroyed or becomes hidden |callback| will be
103 // notified.
104 void NotifyWhenDonePendingCommits(base::Closure callback);
Khushal 2016/09/13 23:47:10 May be add, if there are no pending commits, the c
David Trainor- moved to gerrit 2016/09/14 00:31:09 Done.
105
100 // Called to forward the compositor message from the remote server 106 // Called to forward the compositor message from the remote server
101 // LayerTreeHost of the render widget for this compositor. 107 // LayerTreeHost of the render widget for this compositor.
102 // virtual for testing. 108 // virtual for testing.
103 virtual void OnCompositorMessageReceived( 109 virtual void OnCompositorMessageReceived(
104 std::unique_ptr<cc::proto::CompositorMessage> message); 110 std::unique_ptr<cc::proto::CompositorMessage> message);
105 111
106 scoped_refptr<cc::Layer> layer() const { return layer_; } 112 scoped_refptr<cc::Layer> layer() const { return layer_; }
107 113
108 int render_widget_id() const { return render_widget_id_; } 114 int render_widget_id() const { return render_widget_id_; }
109 115
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void DestroyDelegatedContent(); 171 void DestroyDelegatedContent();
166 172
167 // Helper method to build the internal CC LayerTreeHost instance from 173 // Helper method to build the internal CC LayerTreeHost instance from
168 // |message|. 174 // |message|.
169 void CreateLayerTreeHost(const cc::proto::InitializeImpl& initialize_message); 175 void CreateLayerTreeHost(const cc::proto::InitializeImpl& initialize_message);
170 176
171 // Helper method to destroy the internal CC LayerTreeHost instance and all its 177 // Helper method to destroy the internal CC LayerTreeHost instance and all its
172 // associated state. 178 // associated state.
173 void DestroyLayerTreeHost(); 179 void DestroyLayerTreeHost();
174 180
181 // Updates |pending_commit_trackers_|, decrementing the count and, if 0,
182 // notifying the callback. If |flush| is true, flushes all entries regardless
183 // of the count.
184 void CheckPendingCommitCounts(bool flush);
185
175 // The unique identifier for the render widget for this compositor. 186 // The unique identifier for the render widget for this compositor.
176 const int render_widget_id_; 187 const int render_widget_id_;
177 188
178 BlimpCompositorClient* client_; 189 BlimpCompositorClient* client_;
179 190
180 BlimpCompositorDependencies* compositor_dependencies_; 191 BlimpCompositorDependencies* compositor_dependencies_;
181 192
182 std::unique_ptr<cc::LayerTreeHost> host_; 193 std::unique_ptr<cc::LayerTreeHost> host_;
183 194
184 // Whether or not |host_| should be visible. This is stored in case |host_| 195 // Whether or not |host_| should be visible. This is stored in case |host_|
(...skipping 23 matching lines...) Expand all
208 // to |render_widget_id_|. 219 // to |render_widget_id_|.
209 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; 220 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_;
210 221
211 // Handles input events for the current render widget. The lifetime of the 222 // Handles input events for the current render widget. The lifetime of the
212 // input manager is tied to the lifetime of the |host_| which owns the 223 // input manager is tied to the lifetime of the |host_| which owns the
213 // cc::InputHandler. The input events are forwarded to this input handler by 224 // cc::InputHandler. The input events are forwarded to this input handler by
214 // the manager to be handled by the client compositor for the current render 225 // the manager to be handled by the client compositor for the current render
215 // widget. 226 // widget.
216 std::unique_ptr<BlimpInputManager> input_manager_; 227 std::unique_ptr<BlimpInputManager> input_manager_;
217 228
229 // The number of times a START_COMMIT proto has been received but a call to
230 // DidCommitAndDrawFrame hasn't been seen. This should track the number of
231 // outstanding commits.
232 size_t outstanding_commits_;
233
234 // When NotifyWhenDonePendingCommitsis called |outstanding_commits_| is copied
235 // along with the |callback| into this vector. Each time
236 // DidCommitAndDrawFrame is called these entries get decremented. If they hit
237 // 0 the callback is triggered.
238 std::vector<std::pair<size_t, base::Closure>> pending_commit_trackers_;
239
218 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; 240 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_;
219 241
220 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); 242 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
221 }; 243 };
222 244
223 } // namespace client 245 } // namespace client
224 } // namespace blimp 246 } // namespace blimp
225 247
226 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 248 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698