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

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

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

Powered by Google App Engine
This is Rietveld 408576698