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

Side by Side Diff: services/ui/ws/server_window_compositor_frame_sink.h

Issue 2453013002: Mus: Remove dependency on ServerWindowCompositorFrameSink from FrameGenerator (Closed)
Patch Set: Rebased 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ 5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_
6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ 6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "cc/ipc/compositor_frame.mojom.h" 11 #include "cc/ipc/compositor_frame.mojom.h"
12 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" 12 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
13 #include "cc/surfaces/frame_sink_id.h" 13 #include "cc/surfaces/frame_sink_id.h"
14 #include "cc/surfaces/surface_factory.h" 14 #include "cc/surfaces/surface_factory.h"
15 #include "cc/surfaces/surface_factory_client.h" 15 #include "cc/surfaces/surface_factory_client.h"
16 #include "cc/surfaces/surface_id.h" 16 #include "cc/surfaces/surface_id.h"
17 #include "cc/surfaces/surface_id_allocator.h" 17 #include "cc/surfaces/surface_id_allocator.h"
18 #include "cc/surfaces/surface_sequence_generator.h"
19 #include "mojo/public/cpp/bindings/binding.h" 18 #include "mojo/public/cpp/bindings/binding.h"
20 #include "services/ui/public/interfaces/window_tree.mojom.h" 19 #include "services/ui/public/interfaces/window_tree.mojom.h"
21 #include "services/ui/ws/ids.h" 20 #include "services/ui/ws/ids.h"
22 21
23 namespace ui { 22 namespace ui {
24 23
25 class DisplayCompositor; 24 class DisplayCompositor;
26 25
27 namespace ws { 26 namespace ws {
28 27
29 class ServerWindow; 28 class ServerWindow;
30 class ServerWindowCompositorFrameSinkManager; 29 class ServerWindowCompositorFrameSinkManager;
31 30
32 // Server side representation of a WindowSurface. 31 // Server side representation of a WindowSurface.
33 class ServerWindowCompositorFrameSink 32 class ServerWindowCompositorFrameSink
34 : public cc::mojom::MojoCompositorFrameSink, 33 : public cc::mojom::MojoCompositorFrameSink,
35 public cc::SurfaceFactoryClient { 34 public cc::SurfaceFactoryClient {
36 public: 35 public:
37 ServerWindowCompositorFrameSink( 36 ServerWindowCompositorFrameSink(
38 ServerWindowCompositorFrameSinkManager* manager, 37 ServerWindowCompositorFrameSinkManager* manager,
39 const cc::FrameSinkId& frame_sink_id, 38 const cc::FrameSinkId& frame_sink_id,
40 cc::mojom::MojoCompositorFrameSinkRequest request, 39 cc::mojom::MojoCompositorFrameSinkRequest request,
41 cc::mojom::MojoCompositorFrameSinkClientPtr client); 40 cc::mojom::MojoCompositorFrameSinkClientPtr client);
42 41
43 ~ServerWindowCompositorFrameSink() override; 42 ~ServerWindowCompositorFrameSink() override;
44 43
45 const gfx::Size& last_submitted_frame_size() const {
46 return last_submitted_frame_size_;
47 }
48
49 bool may_contain_video() const { return may_contain_video_; }
50
51 // cc::mojom::MojoCompositorFrameSink: 44 // cc::mojom::MojoCompositorFrameSink:
52 void SetNeedsBeginFrame(bool needs_begin_frame) override; 45 void SetNeedsBeginFrame(bool needs_begin_frame) override;
53 void SubmitCompositorFrame(cc::CompositorFrame frame) override; 46 void SubmitCompositorFrame(cc::CompositorFrame frame) override;
54 47
55 // There is a 1-1 correspondence between FrameSinks and frame sources.
56 // The FrameSinkId uniquely identifies the FrameSink, and since there is
57 // one FrameSink per ServerWindowCompositorFrameSink, it allows the window
58 // server to uniquely identify the window, and the thus the client that
59 // generated the frame.
60 const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; }
61
62 // The LocalFrameId can be thought of as an identifier to a bucket of
63 // sequentially submitted CompositorFrames in the same FrameSink all sharing
64 // the same size and device scale factor.
65 const cc::LocalFrameId& local_frame_id() const { return local_frame_id_; }
66
67 bool has_frame() const { return !local_frame_id_.is_null(); }
68
69 cc::SurfaceId GetSurfaceId() const;
70
71 // Creates a surface dependency token that expires when this
72 // ServerWindowCompositorFrameSink goes away.
73 cc::SurfaceSequence CreateSurfaceSequence();
74
75 ServerWindow* window();
76
77 private: 48 private:
78 void DidReceiveCompositorFrameAck(); 49 void DidReceiveCompositorFrameAck();
79 50
80 // SurfaceFactoryClient implementation. 51 // SurfaceFactoryClient implementation.
81 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 52 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
82 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; 53 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
83 54
84 const cc::FrameSinkId frame_sink_id_; 55 const cc::FrameSinkId frame_sink_id_;
85 cc::SurfaceSequenceGenerator surface_sequence_generator_;
86 56
87 ServerWindowCompositorFrameSinkManager* manager_; // Owns this. 57 ServerWindowCompositorFrameSinkManager* manager_; // Owns this.
88 58
89 gfx::Size last_submitted_frame_size_; 59 gfx::Size last_submitted_frame_size_;
90 60
91 cc::LocalFrameId local_frame_id_; 61 cc::LocalFrameId local_frame_id_;
92 cc::SurfaceIdAllocator surface_id_allocator_; 62 cc::SurfaceIdAllocator surface_id_allocator_;
93 cc::SurfaceFactory surface_factory_; 63 cc::SurfaceFactory surface_factory_;
94 64
95 cc::mojom::MojoCompositorFrameSinkClientPtr client_; 65 cc::mojom::MojoCompositorFrameSinkClientPtr client_;
96 mojo::Binding<MojoCompositorFrameSink> binding_; 66 mojo::Binding<MojoCompositorFrameSink> binding_;
97 67
98 bool may_contain_video_ = false;
99
100 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSink); 68 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSink);
101 }; 69 };
102 70
103 } // namespace ws 71 } // namespace ws
104 72
105 } // namespace ui 73 } // namespace ui
106 74
107 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ 75 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « services/ui/ws/frame_generator_unittest.cc ('k') | services/ui/ws/server_window_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698