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

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

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
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/display_client.h"
9 #include "cc/surfaces/surface.h"
10 #include "cc/surfaces/surface_factory.h"
11 #include "cc/surfaces/surface_factory_client.h"
12 #include "cc/surfaces/surface_id_allocator.h"
13 #include "components/mus/gles2/gpu_state.h"
14 #include "components/mus/surfaces/surfaces_state.h"
15 #include "ui/gfx/native_widget_types.h"
16
17 namespace cc {
18 class Display;
19 }
20
21 namespace mus {
22
23 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split.
24 // TODO(fsamuel): This should not be a SurfaceFactoryClient.
25 // The DisplayCompositor receives CompositorFrames from all sources,
26 // creates a top-level CompositorFrame once per tick, and generates graphical
27 // output.
28 class DisplayCompositor : public cc::SurfaceFactoryClient,
29 public cc::DisplayClient {
30 public:
31 DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
32 gfx::AcceleratedWidget widget,
33 const scoped_refptr<GpuState>& gpu_state,
34 const scoped_refptr<SurfacesState>& surfaces_state);
35 ~DisplayCompositor() override;
36
37 // DisplayCompositor embedders submit a CompositorFrame when content on the
38 // display should be changed. A well-behaving embedder should only submit
39 // 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.
41 void SubmitCompositorFrame(
42 cc::CompositorFrame frame,
43 const base::Callback<void(cc::SurfaceDrawStatus)>& callback);
44
45 // TODO(fsamuel): This is used for surface hittesting and should not be
46 // exposed outside of DisplayCompositor.
47 const cc::SurfaceId& surface_id() const { return surface_id_; }
48
49 // This requests the display CompositorFrame be rendered and given to the
50 // callback within CopyOutputRequest.
51 void RequestCopyOfOutput(
52 std::unique_ptr<cc::CopyOutputRequest> output_request);
53
54 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace
55 // A SurfaceNamespace can create CompositorFrameSinks where the client can
56 // make up the ID.
57
58 private:
59 // SurfaceFactoryClient implementation.
60 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
61 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
62
63 // DisplayClient implementation.
64 void DisplayOutputSurfaceLost() override;
65 void DisplaySetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
66
67 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
68 scoped_refptr<SurfacesState> surfaces_state_;
69 cc::SurfaceFactory factory_;
70 cc::SurfaceIdAllocator allocator_;
71 cc::SurfaceId surface_id_;
72
73 gfx::Size display_size_;
74 std::unique_ptr<cc::Display> display_;
75 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
76 };
77
78 } // namespace mus
79
80 #endif // COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « components/mus/surfaces/direct_output_surface_ozone.cc ('k') | components/mus/surfaces/display_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698