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

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

Issue 2382733007: Add BlimpDocument, pull out functions in BlimpCompositor. (Closed)
Patch Set: Remove Webkit DEPS modification. Created 4 years, 2 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 #include <vector>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // The BlimpCompositorClient provides the BlimpCompositor with the necessary 51 // The BlimpCompositorClient provides the BlimpCompositor with the necessary
52 // dependencies for cc::LayerTreeHost owned by this compositor and for 52 // dependencies for cc::LayerTreeHost owned by this compositor and for
53 // communicating the compositor and input messages to the corresponding 53 // communicating the compositor and input messages to the corresponding
54 // render widget of this compositor on the engine. 54 // render widget of this compositor on the engine.
55 class BlimpCompositorClient { 55 class BlimpCompositorClient {
56 public: 56 public:
57 // Should send web gesture events which could not be handled locally by the 57 // Should send web gesture events which could not be handled locally by the
58 // compositor to the engine. 58 // compositor to the engine.
59 virtual void SendWebGestureEvent( 59 virtual void SendWebGestureEvent(
60 int render_widget_id,
61 const blink::WebGestureEvent& gesture_event) = 0; 60 const blink::WebGestureEvent& gesture_event) = 0;
62 61
63 // Should send the compositor messages from the remote client LayerTreeHost of 62 // Should send the compositor messages from the remote client LayerTreeHost of
64 // this compositor to the corresponding remote server LayerTreeHost. 63 // this compositor to the corresponding remote server LayerTreeHost.
65 virtual void SendCompositorMessage( 64 virtual void SendCompositorMessage(
66 int render_widget_id,
67 const cc::proto::CompositorMessage& message) = 0; 65 const cc::proto::CompositorMessage& message) = 0;
68 66
69 protected: 67 protected:
70 virtual ~BlimpCompositorClient() {} 68 virtual ~BlimpCompositorClient() {}
71 }; 69 };
72 70
73 // BlimpCompositor provides the basic framework and setup to host a 71 // BlimpCompositor provides the basic framework and setup to host a
74 // LayerTreeHost. This class owns the remote client cc::LayerTreeHost, which 72 // LayerTreeHost. This class owns the remote client cc::LayerTreeHost, which
75 // performs the compositing work for the remote server LayerTreeHost. The server 73 // performs the compositing work for the remote server LayerTreeHost. The server
76 // LayerTreeHost for a BlimpCompositor is owned by the 74 // LayerTreeHost for a BlimpCompositor is owned by the
77 // content::RenderWidgetCompositor. Thus, each BlimpCompositor is tied to a 75 // content::RenderWidgetCompositor. Thus, each BlimpCompositor is tied to a
78 // RenderWidget, identified by a custom |render_widget_id| generated on the 76 // RenderWidget, identified by a custom |render_widget_id| generated on the
79 // engine. The lifetime of this compositor is controlled by its corresponding 77 // engine. The lifetime of this compositor is controlled by its corresponding
80 // RenderWidget. 78 // RenderWidget.
81 // This class should only be accessed from the main thread. 79 // This class should only be accessed from the main thread.
82 class BlimpCompositor : public cc::LayerTreeHostClient, 80 class BlimpCompositor : public cc::LayerTreeHostClient,
83 public cc::RemoteProtoChannel, 81 public cc::RemoteProtoChannel,
84 public BlimpInputManagerClient, 82 public BlimpInputManagerClient,
85 public BlimpCompositorFrameSinkProxy, 83 public BlimpCompositorFrameSinkProxy,
86 public cc::SurfaceFactoryClient { 84 public cc::SurfaceFactoryClient {
87 public: 85 public:
88 BlimpCompositor(const int render_widget_id, 86 BlimpCompositor(BlimpCompositorDependencies* compositor_dependencies,
89 BlimpCompositorDependencies* compositor_dependencies,
90 BlimpCompositorClient* client); 87 BlimpCompositorClient* client);
91 88
92 ~BlimpCompositor() override; 89 ~BlimpCompositor() override;
93 90
94 virtual void SetVisible(bool visible); 91 virtual void SetVisible(bool visible);
95 92
96 // Forwards the touch event to the |input_manager_|. 93 // Forwards the touch event to the |input_manager_|.
97 // virtual for testing. 94 // virtual for testing.
98 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event); 95 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event);
99 96
100 // Notifies |callback| when all pending commits have been drawn to the screen. 97 // Notifies |callback| when all pending commits have been drawn to the screen.
101 // If this compositor is destroyed or becomes hidden |callback| will be 98 // If this compositor is destroyed or becomes hidden |callback| will be
102 // notified. 99 // notified.
103 void NotifyWhenDonePendingCommits(base::Closure callback); 100 void NotifyWhenDonePendingCommits(base::Closure callback);
104 101
105 // Called to forward the compositor message from the remote server 102 // Called to forward the compositor message from the remote server
106 // LayerTreeHost of the render widget for this compositor. 103 // LayerTreeHost of the render widget for this compositor.
107 // virtual for testing. 104 // virtual for testing.
108 virtual void OnCompositorMessageReceived( 105 virtual void OnCompositorMessageReceived(
109 std::unique_ptr<cc::proto::CompositorMessage> message); 106 std::unique_ptr<cc::proto::CompositorMessage> message);
110 107
111 scoped_refptr<cc::Layer> layer() const { return layer_; } 108 scoped_refptr<cc::Layer> layer() const { return layer_; }
112 109
113 int render_widget_id() const { return render_widget_id_; }
114
115 private: 110 private:
116 friend class BlimpCompositorForTesting; 111 friend class BlimpCompositorForTesting;
117 112
118 // LayerTreeHostClient implementation. 113 // LayerTreeHostClient implementation.
119 void WillBeginMainFrame() override {} 114 void WillBeginMainFrame() override {}
120 void DidBeginMainFrame() override {} 115 void DidBeginMainFrame() override {}
121 void BeginMainFrame(const cc::BeginFrameArgs& args) override {} 116 void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
122 void BeginMainFrameNotExpectedSoon() override {} 117 void BeginMainFrameNotExpectedSoon() override {}
123 void UpdateLayerTreeHost() override {} 118 void UpdateLayerTreeHost() override {}
124 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 119 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 170
176 // Helper method to destroy the internal CC LayerTreeHost instance and all its 171 // Helper method to destroy the internal CC LayerTreeHost instance and all its
177 // associated state. 172 // associated state.
178 void DestroyLayerTreeHost(); 173 void DestroyLayerTreeHost();
179 174
180 // Updates |pending_commit_trackers_|, decrementing the count and, if 0, 175 // Updates |pending_commit_trackers_|, decrementing the count and, if 0,
181 // notifying the callback. If |flush| is true, flushes all entries regardless 176 // notifying the callback. If |flush| is true, flushes all entries regardless
182 // of the count. 177 // of the count.
183 void CheckPendingCommitCounts(bool flush); 178 void CheckPendingCommitCounts(bool flush);
184 179
185 // The unique identifier for the render widget for this compositor.
186 const int render_widget_id_;
187
188 BlimpCompositorClient* client_; 180 BlimpCompositorClient* client_;
189 181
190 BlimpCompositorDependencies* compositor_dependencies_; 182 BlimpCompositorDependencies* compositor_dependencies_;
191 183
192 cc::FrameSinkId frame_sink_id_; 184 cc::FrameSinkId frame_sink_id_;
193 185
194 std::unique_ptr<cc::LayerTreeHost> host_; 186 std::unique_ptr<cc::LayerTreeHost> host_;
195 187
196 // The SurfaceFactory is bound to the lifetime of the |proxy_client_|. When 188 // The SurfaceFactory is bound to the lifetime of the |proxy_client_|. When
197 // detached, the surface factory will be destroyed. 189 // detached, the surface factory will be destroyed.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 228
237 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; 229 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_;
238 230
239 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); 231 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
240 }; 232 };
241 233
242 } // namespace client 234 } // namespace client
243 } // namespace blimp 235 } // namespace blimp
244 236
245 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 237 #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