OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef CONTENT_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_ |
6 #define CONTENT_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_ | 6 #define CONTENT_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
17 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "cc/input/selection.h" | 20 #include "cc/input/selection.h" |
21 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" | 21 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
22 #include "cc/output/begin_frame_args.h" | 22 #include "cc/output/begin_frame_args.h" |
23 #include "cc/output/compositor_frame_sink.h" | 23 #include "cc/output/compositor_frame_sink.h" |
24 #include "cc/scheduler/begin_frame_source.h" | 24 #include "cc/scheduler/begin_frame_source.h" |
25 #include "cc/surfaces/local_surface_id.h" | 25 #include "cc/surfaces/local_surface_id.h" |
26 #include "cc/surfaces/local_surface_id_allocator.h" | 26 #include "cc/surfaces/local_surface_id_allocator.h" |
| 27 #include "content/common/render_widget_surface_properties.h" |
27 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" | 28 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" |
28 #include "ipc/ipc_sync_message_filter.h" | 29 #include "ipc/ipc_sync_message_filter.h" |
29 #include "mojo/public/cpp/bindings/binding.h" | 30 #include "mojo/public/cpp/bindings/binding.h" |
30 #include "ui/gfx/selection_bound.h" | 31 #include "ui/gfx/selection_bound.h" |
31 | 32 |
32 namespace IPC { | 33 namespace IPC { |
33 class Message; | 34 class Message; |
34 } | 35 } |
35 | 36 |
36 namespace cc { | 37 namespace cc { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 friend class base::RefCountedThreadSafe<RendererCompositorFrameSinkProxy>; | 89 friend class base::RefCountedThreadSafe<RendererCompositorFrameSinkProxy>; |
89 ~RendererCompositorFrameSinkProxy() {} | 90 ~RendererCompositorFrameSinkProxy() {} |
90 RendererCompositorFrameSink* compositor_frame_sink_; | 91 RendererCompositorFrameSink* compositor_frame_sink_; |
91 | 92 |
92 DISALLOW_COPY_AND_ASSIGN(RendererCompositorFrameSinkProxy); | 93 DISALLOW_COPY_AND_ASSIGN(RendererCompositorFrameSinkProxy); |
93 }; | 94 }; |
94 | 95 |
95 void OnMessageReceived(const IPC::Message& message); | 96 void OnMessageReceived(const IPC::Message& message); |
96 void OnBeginFrameIPC(const cc::BeginFrameArgs& args); | 97 void OnBeginFrameIPC(const cc::BeginFrameArgs& args); |
97 | 98 |
98 bool ShouldAllocateNewLocalSurfaceId(const cc::CompositorFrame& frame); | |
99 void UpdateFrameData(const cc::CompositorFrame& frame); | |
100 | |
101 // cc::mojom::MojoCompositorFrameSinkClient implementation. | 99 // cc::mojom::MojoCompositorFrameSinkClient implementation. |
102 void DidReceiveCompositorFrameAck( | 100 void DidReceiveCompositorFrameAck( |
103 const cc::ReturnedResourceArray& resources) override; | 101 const cc::ReturnedResourceArray& resources) override; |
104 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 102 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
105 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 103 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
106 | 104 |
107 // cc::ExternalBeginFrameSourceClient implementation. | 105 // cc::ExternalBeginFrameSourceClient implementation. |
108 void OnNeedsBeginFrames(bool need_begin_frames) override; | 106 void OnNeedsBeginFrames(bool need_begin_frames) override; |
109 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; | 107 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; |
110 | 108 |
111 void EstablishMojoConnection(); | 109 void EstablishMojoConnection(); |
112 | 110 |
113 scoped_refptr<CompositorForwardingMessageFilter> | 111 scoped_refptr<CompositorForwardingMessageFilter> |
114 compositor_frame_sink_filter_; | 112 compositor_frame_sink_filter_; |
115 CompositorForwardingMessageFilter::Handler | 113 CompositorForwardingMessageFilter::Handler |
116 compositor_frame_sink_filter_handler_; | 114 compositor_frame_sink_filter_handler_; |
117 scoped_refptr<RendererCompositorFrameSinkProxy> compositor_frame_sink_proxy_; | 115 scoped_refptr<RendererCompositorFrameSinkProxy> compositor_frame_sink_proxy_; |
118 scoped_refptr<IPC::SyncMessageFilter> message_sender_; | 116 scoped_refptr<IPC::SyncMessageFilter> message_sender_; |
119 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 117 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
120 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; | 118 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; |
121 std::unique_ptr<cc::ExternalBeginFrameSource> external_begin_frame_source_; | 119 std::unique_ptr<cc::ExternalBeginFrameSource> external_begin_frame_source_; |
122 int routing_id_; | 120 int routing_id_; |
123 | 121 |
124 cc::LocalSurfaceId local_surface_id_; | 122 cc::LocalSurfaceId local_surface_id_; |
125 cc::LocalSurfaceIdAllocator id_allocator_; | 123 cc::LocalSurfaceIdAllocator id_allocator_; |
126 struct { | 124 RenderWidgetSurfaceProperties current_surface_properties_; |
127 gfx::Size frame_size; | |
128 float device_scale_factor; | |
129 #ifdef OS_ANDROID | |
130 float top_controls_height; | |
131 float top_controls_shown_ratio; | |
132 float bottom_controls_height; | |
133 float bottom_controls_shown_ratio; | |
134 cc::Selection<gfx::SelectionBound> viewport_selection; | |
135 bool has_transparent_background; | |
136 #endif | |
137 } current_frame_data_; | |
138 | 125 |
139 base::ThreadChecker thread_checker_; | 126 base::ThreadChecker thread_checker_; |
140 | 127 |
141 cc::mojom::MojoCompositorFrameSinkPtr sink_; | 128 cc::mojom::MojoCompositorFrameSinkPtr sink_; |
142 cc::mojom::MojoCompositorFrameSinkPtrInfo sink_ptr_info_; | 129 cc::mojom::MojoCompositorFrameSinkPtrInfo sink_ptr_info_; |
143 cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request_; | 130 cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request_; |
144 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> sink_client_binding_; | 131 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> sink_client_binding_; |
145 }; | 132 }; |
146 | 133 |
147 } // namespace content | 134 } // namespace content |
148 | 135 |
149 #endif // CONTENT_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_ | 136 #endif // CONTENT_RENDERER_GPU_RENDERER_COMPOSITOR_FRAME_SINK_H_ |
OLD | NEW |