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

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

Issue 2471503002: Mus+Ash: Unify CompositorFrameSinks (Closed)
Patch Set: Added comment 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
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_DISPLAY_COMPOSITOR_FRAME_SINK_H_
6 #define SERVICES_UI_SURFACES_DISPLAY_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
26 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split.
27 // TODO(fsamuel): This should not be a SurfaceFactoryClient.
28 // The DisplayCompositorFrameSink receives CompositorFrames from all sources,
29 // creates a top-level CompositorFrame once per tick, and generates graphical
30 // output.
31 class DisplayCompositorFrameSink : public cc::SurfaceFactoryClient,
32 public cc::DisplayClient {
33 public:
34 DisplayCompositorFrameSink(
35 const cc::FrameSinkId& frame_sink_id,
36 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
37 gfx::AcceleratedWidget widget,
38 scoped_refptr<gpu::GpuChannelHost> gpu_channel,
39 const scoped_refptr<DisplayCompositor>& display_compositor);
40 ~DisplayCompositorFrameSink() override;
41
42 // DisplayCompositorFrameSink embedders submit a CompositorFrame when content
43 // on the display should be changed. A well-behaving embedder should only
44 // submit a CompositorFrame once per BeginFrame tick. The callback is called
45 // the first time this frame is used to draw, or if the frame is discarded.
46 void SubmitCompositorFrame(cc::CompositorFrame frame,
47 const base::Callback<void()>& callback);
48
49 // TODO(fsamuel): This is used for surface hittesting and should not be
50 // exposed outside of DisplayCompositorFrameSink.
51 const cc::LocalFrameId& local_frame_id() const { return local_frame_id_; }
52
53 private:
54 // SurfaceFactoryClient implementation.
55 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
56 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
57
58 // DisplayClient implementation.
59 void DisplayOutputSurfaceLost() override;
60 void DisplayWillDrawAndSwap(bool will_draw_and_swap,
61 const cc::RenderPassList& render_passes) override;
62 void DisplayDidDrawAndSwap() override;
63
64 const cc::FrameSinkId frame_sink_id_;
65 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
66 scoped_refptr<DisplayCompositor> display_compositor_;
67 cc::SurfaceFactory factory_;
68 cc::SurfaceIdAllocator allocator_;
69 cc::LocalFrameId local_frame_id_;
70
71 gfx::Size display_size_;
72 std::unique_ptr<cc::Display> display_;
73 DISALLOW_COPY_AND_ASSIGN(DisplayCompositorFrameSink);
74 };
75
76 } // namespace ui
77
78 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_FRAME_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698