| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SURFACES_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ | 6 #define SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ |
| 7 | 7 |
| 8 #include "cc/surfaces/display_client.h" | 8 #include "cc/surfaces/display_client.h" |
| 9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
| 10 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
| 11 #include "cc/surfaces/surface_factory_client.h" | 11 #include "cc/surfaces/surface_factory_client.h" |
| 12 #include "cc/surfaces/surface_id_allocator.h" | 12 #include "cc/surfaces/surface_id_allocator.h" |
| 13 #include "gpu/ipc/common/surface_handle.h" |
| 13 #include "services/ui/surfaces/display_compositor.h" | 14 #include "services/ui/surfaces/display_compositor.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 class Display; | 18 class Display; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace gpu { | 21 namespace gpu { |
| 21 class GpuChannelHost; | 22 class GpuChannelHost; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace ui { | 25 namespace ui { |
| 25 namespace surfaces { | 26 namespace surfaces { |
| 26 | 27 |
| 27 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split. | 28 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split. |
| 28 // TODO(fsamuel): This should not be a SurfaceFactoryClient. | 29 // TODO(fsamuel): This should not be a SurfaceFactoryClient. |
| 29 // The CompositorFrameSink receives CompositorFrames from all sources, | 30 // The CompositorFrameSink receives CompositorFrames from all sources, |
| 30 // creates a top-level CompositorFrame once per tick, and generates graphical | 31 // creates a top-level CompositorFrame once per tick, and generates graphical |
| 31 // output. | 32 // output. |
| 32 class CompositorFrameSink : public cc::SurfaceFactoryClient, | 33 class CompositorFrameSink : public cc::SurfaceFactoryClient, |
| 33 public cc::DisplayClient { | 34 public cc::DisplayClient { |
| 34 public: | 35 public: |
| 35 CompositorFrameSink( | 36 CompositorFrameSink( |
| 36 const cc::FrameSinkId& frame_sink_id, | 37 const cc::FrameSinkId& frame_sink_id, |
| 37 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 38 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 38 gfx::AcceleratedWidget widget, | 39 gpu::SurfaceHandle widget, |
| 39 scoped_refptr<gpu::GpuChannelHost> gpu_channel, | 40 scoped_refptr<gpu::GpuChannelHost> gpu_channel, |
| 40 const scoped_refptr<DisplayCompositor>& display_compositor); | 41 const scoped_refptr<DisplayCompositor>& display_compositor); |
| 41 ~CompositorFrameSink() override; | 42 ~CompositorFrameSink() override; |
| 42 | 43 |
| 43 // CompositorFrameSink embedders submit a CompositorFrame when content on the | 44 // CompositorFrameSink embedders submit a CompositorFrame when content on the |
| 44 // display should be changed. A well-behaving embedder should only submit | 45 // display should be changed. A well-behaving embedder should only submit |
| 45 // a CompositorFrame once per BeginFrame tick. The callback is called the | 46 // a CompositorFrame once per BeginFrame tick. The callback is called the |
| 46 // first time this frame is used to draw, or if the frame is discarded. | 47 // first time this frame is used to draw, or if the frame is discarded. |
| 47 void SubmitCompositorFrame(cc::CompositorFrame frame, | 48 void SubmitCompositorFrame(cc::CompositorFrame frame, |
| 48 const base::Callback<void()>& callback); | 49 const base::Callback<void()>& callback); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 81 |
| 81 gfx::Size display_size_; | 82 gfx::Size display_size_; |
| 82 std::unique_ptr<cc::Display> display_; | 83 std::unique_ptr<cc::Display> display_; |
| 83 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); | 84 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 } // nanmespace surfaces | 87 } // nanmespace surfaces |
| 87 } // namespace ui | 88 } // namespace ui |
| 88 | 89 |
| 89 #endif // SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ | 90 #endif // SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |