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

Side by Side Diff: services/ui/surfaces/compositor_frame_sink.h

Issue 2435193003: Mus: surfaces::CompositorFrameSink => DisplayCompositorFrameSink (Closed)
Patch Set: Created 4 years, 1 month 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 | « services/ui/surfaces/BUILD.gn ('k') | services/ui/surfaces/compositor_frame_sink.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 SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_
6 #define SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_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 "services/ui/surfaces/display_compositor.h"
14 #include "ui/gfx/native_widget_types.h"
15
16 namespace cc {
17 class Display;
18 }
19
20 namespace gpu {
21 class GpuChannelHost;
22 }
23
24 namespace ui {
25 namespace surfaces {
26
27 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split.
28 // TODO(fsamuel): This should not be a SurfaceFactoryClient.
29 // The CompositorFrameSink receives CompositorFrames from all sources,
30 // creates a top-level CompositorFrame once per tick, and generates graphical
31 // output.
32 class CompositorFrameSink : public cc::SurfaceFactoryClient,
33 public cc::DisplayClient {
34 public:
35 CompositorFrameSink(
36 const cc::FrameSinkId& frame_sink_id,
37 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
38 gfx::AcceleratedWidget widget,
39 scoped_refptr<gpu::GpuChannelHost> gpu_channel,
40 const scoped_refptr<DisplayCompositor>& display_compositor);
41 ~CompositorFrameSink() override;
42
43 // CompositorFrameSink embedders submit a CompositorFrame when content on the
44 // display should be changed. A well-behaving embedder should only submit
45 // a CompositorFrame once per BeginFrame tick. The callback is called the
46 // first time this frame is used to draw, or if the frame is discarded.
47 void SubmitCompositorFrame(cc::CompositorFrame frame,
48 const base::Callback<void()>& callback);
49
50 // TODO(fsamuel): This is used for surface hittesting and should not be
51 // exposed outside of CompositorFrameSink.
52 const cc::LocalFrameId& local_frame_id() const { return local_frame_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 // DisplayClient implementation.
60 void DisplayOutputSurfaceLost() override;
61 void DisplayWillDrawAndSwap(bool will_draw_and_swap,
62 const cc::RenderPassList& render_passes) override;
63 void DisplayDidDrawAndSwap() override;
64
65 const cc::FrameSinkId frame_sink_id_;
66 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
67 scoped_refptr<DisplayCompositor> display_compositor_;
68 cc::SurfaceFactory factory_;
69 cc::SurfaceIdAllocator allocator_;
70 cc::LocalFrameId local_frame_id_;
71
72 gfx::Size display_size_;
73 std::unique_ptr<cc::Display> display_;
74 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink);
75 };
76
77 } // nanmespace surfaces
78 } // namespace ui
79
80 #endif // SERVICES_UI_SURFACES_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « services/ui/surfaces/BUILD.gn ('k') | services/ui/surfaces/compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698