Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_ | |
| 6 #define COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_ | |
| 7 | |
| 8 #include "cc/surfaces/surface.h" | |
| 9 #include "cc/surfaces/surface_factory.h" | |
| 10 #include "cc/surfaces/surface_factory_client.h" | |
| 11 #include "cc/surfaces/surface_id_allocator.h" | |
| 12 #include "components/mus/gles2/gpu_state.h" | |
| 13 #include "components/mus/surfaces/surfaces_state.h" | |
| 14 #include "ui/gfx/native_widget_types.h" | |
| 15 | |
| 16 namespace mus { | |
| 17 | |
| 18 class TopLevelDisplayClient; | |
| 19 | |
| 20 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split. | |
| 21 // TODO(fsamuel): This should not be a SurfaceFactoryClient. | |
| 22 // The DisplayCompositor receives CompositorFrames from all sources, | |
| 23 // creates a top-level CompositorFrame once per tick, and generates graphical | |
| 24 // output. | |
| 25 class DisplayCompositor : public cc::SurfaceFactoryClient { | |
| 26 public: | |
| 27 DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner, | |
| 28 gfx::AcceleratedWidget widget, | |
| 29 const scoped_refptr<GpuState>& gpu_state, | |
| 30 const scoped_refptr<SurfacesState>& surfaces_state); | |
| 31 ~DisplayCompositor() override; | |
| 32 | |
| 33 // DisplayCompositor embedders submit a CompositorFrame when content on the | |
| 34 // display should be changed. A well-behaving embedder should only submit | |
| 35 // a CompositorFrame once per BeginFrame tick. The callback is called the | |
| 36 // first time this frame is used to draw, or if the frame is discarded. | |
| 37 void SubmitCompositorFrame( | |
| 38 std::unique_ptr<cc::CompositorFrame> frame, | |
| 39 const base::Callback<void(cc::SurfaceDrawStatus)>& callback); | |
| 40 | |
| 41 // TODO(fsamuel): This is used for surface hittesting and should not be | |
| 42 // exposed outside of DisplayCompositor. | |
| 43 const cc::SurfaceId& surface_id() const { return surface_id_; } | |
| 44 | |
| 45 // This requests the display CompositorFrame be renderer and given to the | |
|
rjkroege
2016/05/13 20:39:35
"be renderer"? "be rendered" maybe?
Fady Samuel
2016/05/13 22:45:27
Done.
| |
| 46 // callback within CopyOutputRequest. | |
| 47 void RequestCopyOfOutput( | |
| 48 std::unique_ptr<cc::CopyOutputRequest> output_request); | |
| 49 | |
| 50 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace | |
| 51 // A SurfaceNamespace can create CompositorFrameSinks where the client can | |
| 52 // make up the ID. | |
| 53 | |
| 54 private: | |
| 55 // SurfaceFactoryClient implementation. | |
| 56 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 57 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | |
| 58 | |
| 59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
| 60 scoped_refptr<SurfacesState> surfaces_state_; | |
| 61 cc::SurfaceFactory factory_; | |
| 62 cc::SurfaceIdAllocator allocator_; | |
| 63 cc::SurfaceId surface_id_; | |
| 64 | |
| 65 gfx::Size display_size_; | |
| 66 std::unique_ptr<TopLevelDisplayClient> display_client_; | |
| 67 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); | |
| 68 }; | |
| 69 | |
| 70 } // namespace mus | |
| 71 | |
| 72 #endif // COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_ | |
| OLD | NEW |