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