| OLD | NEW |
| 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 SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef SERVICES_UI_WS_GPU_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ | 6 #define SERVICES_UI_WS_GPU_COMPOSITOR_FRAME_SINK_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "cc/ipc/compositor_frame.mojom.h" | 13 #include "cc/ipc/compositor_frame.mojom.h" |
| 14 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" | 14 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
| 15 #include "cc/output/context_provider.h" | 15 #include "cc/output/context_provider.h" |
| 16 #include "cc/scheduler/begin_frame_source.h" | 16 #include "cc/scheduler/begin_frame_source.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 class GpuMemoryBufferManager; | 32 class GpuMemoryBufferManager; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace ui { | 35 namespace ui { |
| 36 | 36 |
| 37 class DisplayCompositor; | 37 class DisplayCompositor; |
| 38 | 38 |
| 39 namespace ws { | 39 namespace ws { |
| 40 | 40 |
| 41 // Server side representation of a WindowSurface. | 41 // Server side representation of a WindowSurface. |
| 42 class ServerWindowCompositorFrameSink | 42 class GpuCompositorFrameSink : public cc::mojom::MojoCompositorFrameSink, |
| 43 : public cc::mojom::MojoCompositorFrameSink, | 43 public cc::DisplayClient, |
| 44 public cc::DisplayClient, | 44 public cc::mojom::MojoCompositorFrameSinkPrivate, |
| 45 public cc::mojom::MojoCompositorFrameSinkPrivate, | 45 public cc::SurfaceFactoryClient, |
| 46 public cc::SurfaceFactoryClient, | 46 public cc::BeginFrameObserver { |
| 47 public cc::BeginFrameObserver { | |
| 48 public: | 47 public: |
| 49 // TODO(fsamuel): DisplayCompositor should own | 48 // TODO(fsamuel): DisplayCompositor should own |
| 50 // ServerWindowCompositorFrameSink. ServerWindowCompositorFrameSink should not | 49 // GpuCompositorFrameSink. GpuCompositorFrameSink should not |
| 51 // refer to ServerWindowCompositorFrameSinkManager. | 50 // refer to GpuCompositorFrameSinkManager. |
| 52 ServerWindowCompositorFrameSink( | 51 GpuCompositorFrameSink( |
| 53 scoped_refptr<DisplayCompositor> display_compositor, | 52 scoped_refptr<DisplayCompositor> display_compositor, |
| 54 const cc::FrameSinkId& frame_sink_id, | 53 const cc::FrameSinkId& frame_sink_id, |
| 55 gfx::AcceleratedWidget widget, | 54 gfx::AcceleratedWidget widget, |
| 56 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 55 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 57 scoped_refptr<SurfacesContextProvider> context_provider, | 56 scoped_refptr<SurfacesContextProvider> context_provider, |
| 58 cc::mojom::MojoCompositorFrameSinkRequest request, | 57 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 59 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 58 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 60 | 59 |
| 61 ~ServerWindowCompositorFrameSink() override; | 60 ~GpuCompositorFrameSink() override; |
| 62 | 61 |
| 63 // cc::mojom::MojoCompositorFrameSink: | 62 // cc::mojom::MojoCompositorFrameSink: |
| 64 void SetNeedsBeginFrame(bool needs_begin_frame) override; | 63 void SetNeedsBeginFrame(bool needs_begin_frame) override; |
| 65 void SubmitCompositorFrame(cc::CompositorFrame frame) override; | 64 void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
| 66 | 65 |
| 67 // cc::mojom::MojoCompositorFrameSinkPrivate: | 66 // cc::mojom::MojoCompositorFrameSinkPrivate: |
| 68 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; | 67 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; |
| 69 void RemoveChildFrameSink( | 68 void RemoveChildFrameSink( |
| 70 const cc::FrameSinkId& child_frame_sink_id) override; | 69 const cc::FrameSinkId& child_frame_sink_id) override; |
| 71 | 70 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 91 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 90 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
| 92 void OnBeginFrameSourcePausedChanged(bool paused) override; | 91 void OnBeginFrameSourcePausedChanged(bool paused) override; |
| 93 | 92 |
| 94 void UpdateNeedsBeginFramesInternal(); | 93 void UpdateNeedsBeginFramesInternal(); |
| 95 | 94 |
| 96 const cc::FrameSinkId frame_sink_id_; | 95 const cc::FrameSinkId frame_sink_id_; |
| 97 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 96 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 98 | 97 |
| 99 // TODO(fsamuel): We hold a reference to DisplayCompositor so we can talk to | 98 // TODO(fsamuel): We hold a reference to DisplayCompositor so we can talk to |
| 100 // SurfaceManager in the destructor. In the future, DisplayCompositor will own | 99 // SurfaceManager in the destructor. In the future, DisplayCompositor will own |
| 101 // ServerWindowCompositorFrameSink. | 100 // GpuCompositorFrameSink. |
| 102 scoped_refptr<DisplayCompositor> display_compositor_; | 101 scoped_refptr<DisplayCompositor> display_compositor_; |
| 103 | 102 |
| 104 gfx::Size last_submitted_frame_size_; | 103 gfx::Size last_submitted_frame_size_; |
| 105 // ServerWindowCompositorFrameSink holds a cc::Display if it created with | 104 // GpuCompositorFrameSink holds a cc::Display if it created with |
| 106 // non-null gfx::AcceleratedWidget. In the window server, the display root | 105 // non-null gfx::AcceleratedWidget. In the window server, the display root |
| 107 // window's CompositorFrameSink will have a valid gfx::AcceleratedWidget. | 106 // window's CompositorFrameSink will have a valid gfx::AcceleratedWidget. |
| 108 std::unique_ptr<cc::Display> display_; | 107 std::unique_ptr<cc::Display> display_; |
| 109 | 108 |
| 110 cc::LocalFrameId local_frame_id_; | 109 cc::LocalFrameId local_frame_id_; |
| 111 cc::SurfaceIdAllocator surface_id_allocator_; | 110 cc::SurfaceIdAllocator surface_id_allocator_; |
| 112 cc::SurfaceFactory surface_factory_; | 111 cc::SurfaceFactory surface_factory_; |
| 113 // Counts the number of CompositorFrames that have been submitted and have not | 112 // Counts the number of CompositorFrames that have been submitted and have not |
| 114 // yet received an ACK. | 113 // yet received an ACK. |
| 115 int ack_pending_count_ = 0; | 114 int ack_pending_count_ = 0; |
| 116 cc::ReturnedResourceArray surface_returned_resources_; | 115 cc::ReturnedResourceArray surface_returned_resources_; |
| 117 | 116 |
| 118 // The begin frame source being observered. Null if none. | 117 // The begin frame source being observered. Null if none. |
| 119 cc::BeginFrameSource* begin_frame_source_ = nullptr; | 118 cc::BeginFrameSource* begin_frame_source_ = nullptr; |
| 120 | 119 |
| 121 // The last begin frame args generated by the begin frame source. | 120 // The last begin frame args generated by the begin frame source. |
| 122 cc::BeginFrameArgs last_begin_frame_args_; | 121 cc::BeginFrameArgs last_begin_frame_args_; |
| 123 | 122 |
| 124 // Whether a request for begin frames has been issued. | 123 // Whether a request for begin frames has been issued. |
| 125 bool needs_begin_frame_ = false; | 124 bool needs_begin_frame_ = false; |
| 126 | 125 |
| 127 // Whether or not a frame observer has been added. | 126 // Whether or not a frame observer has been added. |
| 128 bool added_frame_observer_ = false; | 127 bool added_frame_observer_ = false; |
| 129 | 128 |
| 130 cc::mojom::MojoCompositorFrameSinkClientPtr client_; | 129 cc::mojom::MojoCompositorFrameSinkClientPtr client_; |
| 131 mojo::Binding<cc::mojom::MojoCompositorFrameSink> binding_; | 130 mojo::Binding<cc::mojom::MojoCompositorFrameSink> binding_; |
| 132 | 131 |
| 133 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSink); | 132 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink); |
| 134 }; | 133 }; |
| 135 | 134 |
| 136 } // namespace ws | 135 } // namespace ws |
| 137 | 136 |
| 138 } // namespace ui | 137 } // namespace ui |
| 139 | 138 |
| 140 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ | 139 #endif // SERVICES_UI_WS_GPU_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |