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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.h

Issue 2688613002: RenderWidgetHostViewChildFrame should use CompositorFrameSinkSupport (Closed)
Patch Set: c Created 3 years, 9 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 | « no previous file | content/browser/frame_host/render_widget_host_view_child_frame.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <memory> 12 #include <memory>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "cc/resources/returned_resource.h" 18 #include "cc/resources/returned_resource.h"
19 #include "cc/scheduler/begin_frame_source.h" 19 #include "cc/scheduler/begin_frame_source.h"
20 #include "cc/surfaces/compositor_frame_sink_support_client.h"
20 #include "cc/surfaces/local_surface_id_allocator.h" 21 #include "cc/surfaces/local_surface_id_allocator.h"
21 #include "cc/surfaces/surface_factory_client.h"
22 #include "cc/surfaces/surface_info.h" 22 #include "cc/surfaces/surface_info.h"
23 #include "cc/surfaces/surface_sequence.h" 23 #include "cc/surfaces/surface_sequence.h"
24 #include "content/browser/compositor/image_transport_factory.h" 24 #include "content/browser/compositor/image_transport_factory.h"
25 #include "content/browser/renderer_host/event_with_latency_info.h" 25 #include "content/browser/renderer_host/event_with_latency_info.h"
26 #include "content/browser/renderer_host/render_widget_host_view_base.h" 26 #include "content/browser/renderer_host/render_widget_host_view_base.h"
27 #include "content/common/content_export.h" 27 #include "content/common/content_export.h"
28 #include "content/common/input/input_event_ack_state.h" 28 #include "content/common/input/input_event_ack_state.h"
29 #include "content/public/browser/readback_types.h" 29 #include "content/public/browser/readback_types.h"
30 #include "ui/gfx/geometry/rect.h" 30 #include "ui/gfx/geometry/rect.h"
31 #include "ui/gfx/native_widget_types.h" 31 #include "ui/gfx/native_widget_types.h"
32 32
33 namespace cc { 33 namespace cc {
34 class SurfaceFactory; 34 class CompositorFrameSinkSupport;
35 } 35 }
36 36
37
38 namespace content { 37 namespace content {
39 class CrossProcessFrameConnector; 38 class CrossProcessFrameConnector;
40 class RenderWidgetHost; 39 class RenderWidgetHost;
41 class RenderWidgetHostImpl; 40 class RenderWidgetHostImpl;
42 class RenderWidgetHostViewChildFrameTest; 41 class RenderWidgetHostViewChildFrameTest;
43 class RenderWidgetHostViewGuestSurfaceTest; 42 class RenderWidgetHostViewGuestSurfaceTest;
44 43
45 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost 44 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost
46 // associated with content being rendered in a separate process from 45 // associated with content being rendered in a separate process from
47 // content that is embedding it. This is not a platform-specific class; rather, 46 // content that is embedding it. This is not a platform-specific class; rather,
48 // the embedding renderer process implements the platform containing the 47 // the embedding renderer process implements the platform containing the
49 // widget, and the top-level frame's RenderWidgetHostView will ultimately 48 // widget, and the top-level frame's RenderWidgetHostView will ultimately
50 // manage all native widget interaction. 49 // manage all native widget interaction.
51 // 50 //
52 // See comments in render_widget_host_view.h about this class and its members. 51 // See comments in render_widget_host_view.h about this class and its members.
53 class CONTENT_EXPORT RenderWidgetHostViewChildFrame 52 class CONTENT_EXPORT RenderWidgetHostViewChildFrame
54 : public RenderWidgetHostViewBase, 53 : public RenderWidgetHostViewBase,
55 public cc::SurfaceFactoryClient, 54 public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient) {
56 public cc::BeginFrameObserver {
57 public: 55 public:
58 static RenderWidgetHostViewChildFrame* Create(RenderWidgetHost* widget); 56 static RenderWidgetHostViewChildFrame* Create(RenderWidgetHost* widget);
59 ~RenderWidgetHostViewChildFrame() override; 57 ~RenderWidgetHostViewChildFrame() override;
60 58
61 void SetCrossProcessFrameConnector( 59 void SetCrossProcessFrameConnector(
62 CrossProcessFrameConnector* frame_connector); 60 CrossProcessFrameConnector* frame_connector);
63 61
64 // This functions registers single-use callbacks that want to be notified when 62 // This functions registers single-use callbacks that want to be notified when
65 // the next frame is swapped. The callback is triggered by 63 // the next frame is swapped. The callback is triggered by
66 // OnSwapCompositorFrame, which is the appropriate time to request pixel 64 // OnSwapCompositorFrame, which is the appropriate time to request pixel
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void SpeakSelection() override; 152 void SpeakSelection() override;
155 bool IsSpeaking() const override; 153 bool IsSpeaking() const override;
156 void StopSpeaking() override; 154 void StopSpeaking() override;
157 #endif // defined(OS_MACOSX) 155 #endif // defined(OS_MACOSX)
158 156
159 InputEventAckState FilterInputEvent( 157 InputEventAckState FilterInputEvent(
160 const blink::WebInputEvent& input_event) override; 158 const blink::WebInputEvent& input_event) override;
161 BrowserAccessibilityManager* CreateBrowserAccessibilityManager( 159 BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
162 BrowserAccessibilityDelegate* delegate, bool for_root_frame) override; 160 BrowserAccessibilityDelegate* delegate, bool for_root_frame) override;
163 161
164 // cc::SurfaceFactoryClient implementation. 162 // cc::CompositorFrameSinkSupportClient implementation.
165 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 163 void DidReceiveCompositorFrameAck() override;
166 void SetBeginFrameSource(cc::BeginFrameSource* source) override;
167
168 // cc::BeginFrameObserver implementation.
169 void OnBeginFrame(const cc::BeginFrameArgs& args) override; 164 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
170 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; 165 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
171 void OnBeginFrameSourcePausedChanged(bool paused) override; 166 void WillDrawSurface(const cc::LocalSurfaceId& id,
172 167 const gfx::Rect& damage_rect) override {}
173 // Declared 'public' instead of 'protected' here to allow derived classes
174 // to Bind() to it.
175 void SurfaceDrawn(uint32_t compositor_frame_sink_id);
176 168
177 // Exposed for tests. 169 // Exposed for tests.
178 bool IsChildFrameForTesting() const override; 170 bool IsChildFrameForTesting() const override;
179 cc::SurfaceId SurfaceIdForTesting() const override; 171 cc::SurfaceId SurfaceIdForTesting() const override;
180 CrossProcessFrameConnector* FrameConnectorForTesting() const { 172 CrossProcessFrameConnector* FrameConnectorForTesting() const {
181 return frame_connector_; 173 return frame_connector_;
182 } 174 }
183 175
184 // Returns the current surface scale factor. 176 // Returns the current surface scale factor.
185 float current_surface_scale_factor() { return current_surface_scale_factor_; } 177 float current_surface_scale_factor() { return current_surface_scale_factor_; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 212
221 // Members will become private when RenderWidgetHostViewGuest is removed. 213 // Members will become private when RenderWidgetHostViewGuest is removed.
222 // The model object. 214 // The model object.
223 RenderWidgetHostImpl* host_; 215 RenderWidgetHostImpl* host_;
224 216
225 // The ID for FrameSink associated with this view. 217 // The ID for FrameSink associated with this view.
226 cc::FrameSinkId frame_sink_id_; 218 cc::FrameSinkId frame_sink_id_;
227 219
228 // Surface-related state. 220 // Surface-related state.
229 std::unique_ptr<cc::LocalSurfaceIdAllocator> id_allocator_; 221 std::unique_ptr<cc::LocalSurfaceIdAllocator> id_allocator_;
230 std::unique_ptr<cc::SurfaceFactory> surface_factory_; 222 std::unique_ptr<cc::CompositorFrameSinkSupport> support_;
231 cc::LocalSurfaceId local_surface_id_; 223 cc::LocalSurfaceId local_surface_id_;
232 uint32_t next_surface_sequence_; 224 uint32_t next_surface_sequence_;
233 uint32_t last_compositor_frame_sink_id_; 225 uint32_t last_compositor_frame_sink_id_;
234 gfx::Size current_surface_size_; 226 gfx::Size current_surface_size_;
235 float current_surface_scale_factor_; 227 float current_surface_scale_factor_;
236 gfx::Rect last_screen_rect_; 228 gfx::Rect last_screen_rect_;
237 uint32_t ack_pending_count_;
238 cc::ReturnedResourceArray surface_returned_resources_;
239 229
240 // frame_connector_ provides a platform abstraction. Messages 230 // frame_connector_ provides a platform abstraction. Messages
241 // sent through it are routed to the embedding renderer process. 231 // sent through it are routed to the embedding renderer process.
242 CrossProcessFrameConnector* frame_connector_; 232 CrossProcessFrameConnector* frame_connector_;
243 233
244 base::WeakPtr<RenderWidgetHostViewChildFrame> AsWeakPtr() { 234 base::WeakPtr<RenderWidgetHostViewChildFrame> AsWeakPtr() {
245 return weak_factory_.GetWeakPtr(); 235 return weak_factory_.GetWeakPtr();
246 } 236 }
247 237
248 private: 238 private:
249 virtual void SendSurfaceInfoToEmbedderImpl( 239 virtual void SendSurfaceInfoToEmbedderImpl(
250 const cc::SurfaceInfo& surface_info, 240 const cc::SurfaceInfo& surface_info,
251 const cc::SurfaceSequence& sequence); 241 const cc::SurfaceSequence& sequence);
252 242
253 void SubmitSurfaceCopyRequest(const gfx::Rect& src_subrect, 243 void SubmitSurfaceCopyRequest(const gfx::Rect& src_subrect,
254 const gfx::Size& dst_size, 244 const gfx::Size& dst_size,
255 const ReadbackRequestCallback& callback, 245 const ReadbackRequestCallback& callback,
256 const SkColorType preferred_color_type); 246 const SkColorType preferred_color_type);
257 247
248 void CreateCompositorFrameSinkSupport();
249 void ResetCompositorFrameSinkSupport();
250
258 using FrameSwappedCallbackList = std::deque<std::unique_ptr<base::Closure>>; 251 using FrameSwappedCallbackList = std::deque<std::unique_ptr<base::Closure>>;
259 // Since frame-drawn callbacks are "fire once", we use std::deque to make 252 // Since frame-drawn callbacks are "fire once", we use std::deque to make
260 // it convenient to swap() when processing the list. 253 // it convenient to swap() when processing the list.
261 FrameSwappedCallbackList frame_swapped_callbacks_; 254 FrameSwappedCallbackList frame_swapped_callbacks_;
262 255
263 // The begin frame source being observed. Null if none.
264 cc::BeginFrameSource* begin_frame_source_;
265 cc::BeginFrameArgs last_begin_frame_args_;
266 // The surface client ID of the parent RenderWidgetHostView. 0 if none. 256 // The surface client ID of the parent RenderWidgetHostView. 0 if none.
267 cc::FrameSinkId parent_frame_sink_id_; 257 cc::FrameSinkId parent_frame_sink_id_;
268 258
269 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; 259 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_;
270 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); 260 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
271 }; 261 };
272 262
273 } // namespace content 263 } // namespace content
274 264
275 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ 265 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_widget_host_view_child_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698