| 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_DISPLAY_COMPOSITOR_H_ | 5 #ifndef SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
| 6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_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 "services/ui/surfaces/surfaces_state.h" | 13 #include "services/ui/surfaces/surfaces_state.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 class Display; | 17 class Display; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace gpu { |
| 21 class GpuChannelHost; |
| 22 } |
| 23 |
| 20 namespace ui { | 24 namespace ui { |
| 21 | 25 |
| 22 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split. | 26 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split. |
| 23 // TODO(fsamuel): This should not be a SurfaceFactoryClient. | 27 // TODO(fsamuel): This should not be a SurfaceFactoryClient. |
| 24 // The DisplayCompositor receives CompositorFrames from all sources, | 28 // The DisplayCompositor receives CompositorFrames from all sources, |
| 25 // creates a top-level CompositorFrame once per tick, and generates graphical | 29 // creates a top-level CompositorFrame once per tick, and generates graphical |
| 26 // output. | 30 // output. |
| 27 class DisplayCompositor : public cc::SurfaceFactoryClient, | 31 class DisplayCompositor : public cc::SurfaceFactoryClient, |
| 28 public cc::DisplayClient { | 32 public cc::DisplayClient { |
| 29 public: | 33 public: |
| 30 DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 34 DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 31 gfx::AcceleratedWidget widget, | 35 gfx::AcceleratedWidget widget, |
| 36 scoped_refptr<gpu::GpuChannelHost> gpu_channel, |
| 32 const scoped_refptr<SurfacesState>& surfaces_state); | 37 const scoped_refptr<SurfacesState>& surfaces_state); |
| 33 ~DisplayCompositor() override; | 38 ~DisplayCompositor() override; |
| 34 | 39 |
| 35 // DisplayCompositor embedders submit a CompositorFrame when content on the | 40 // DisplayCompositor embedders submit a CompositorFrame when content on the |
| 36 // display should be changed. A well-behaving embedder should only submit | 41 // display should be changed. A well-behaving embedder should only submit |
| 37 // a CompositorFrame once per BeginFrame tick. The callback is called the | 42 // a CompositorFrame once per BeginFrame tick. The callback is called the |
| 38 // first time this frame is used to draw, or if the frame is discarded. | 43 // first time this frame is used to draw, or if the frame is discarded. |
| 39 void SubmitCompositorFrame(cc::CompositorFrame frame, | 44 void SubmitCompositorFrame(cc::CompositorFrame frame, |
| 40 const base::Callback<void()>& callback); | 45 const base::Callback<void()>& callback); |
| 41 | 46 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 71 cc::SurfaceId surface_id_; | 76 cc::SurfaceId surface_id_; |
| 72 | 77 |
| 73 gfx::Size display_size_; | 78 gfx::Size display_size_; |
| 74 std::unique_ptr<cc::Display> display_; | 79 std::unique_ptr<cc::Display> display_; |
| 75 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); | 80 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); |
| 76 }; | 81 }; |
| 77 | 82 |
| 78 } // namespace ui | 83 } // namespace ui |
| 79 | 84 |
| 80 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 85 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
| OLD | NEW |