Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: components/mus/surfaces/display_compositor.h

Issue 1976663003: Pull parts of TopLevelDisplayClient into DisplayCompositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RegisterSurfaceIdNamespace Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/surfaces/BUILD.gn ('k') | components/mus/surfaces/display_compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 rendered and given to the
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_
OLDNEW
« no previous file with comments | « components/mus/surfaces/BUILD.gn ('k') | components/mus/surfaces/display_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698