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

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

Issue 2453013002: Mus: Remove dependency on ServerWindowCompositorFrameSink from FrameGenerator (Closed)
Patch Set: Delete may_contain_video 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_SURFACE_MANAGER_H_ 5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
6 #define SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ 6 #define SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
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/surfaces/surface_factory.h" 12 #include "cc/surfaces/surface_factory.h"
13 #include "cc/surfaces/surface_id.h" 13 #include "cc/surfaces/surface_id.h"
14 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "services/ui/public/interfaces/window_tree.mojom.h" 15 #include "services/ui/public/interfaces/window_tree.mojom.h"
16 16
17 namespace ui { 17 namespace ui {
18 namespace ws { 18 namespace ws {
19 19
20 class ServerWindow; 20 class ServerWindow;
21 class ServerWindowCompositorFrameSink; 21 class ServerWindowCompositorFrameSink;
22 class ServerWindowCompositorFrameSinkManagerTestApi; 22 class ServerWindowCompositorFrameSinkManagerTestApi;
23 23
24 struct CompositorFrameSinkData {
25 CompositorFrameSinkData();
26 CompositorFrameSinkData(CompositorFrameSinkData&& other);
27 ~CompositorFrameSinkData();
28
29 CompositorFrameSinkData& operator=(CompositorFrameSinkData&& other);
30
31 cc::SurfaceId last_submitted_surface_id;
32 gfx::Size last_submitted_frame_size;
33 // TODO(fsamuel): This should be a mojo interface.
34 std::unique_ptr<ServerWindowCompositorFrameSink> compositor_frame_sink;
35 };
36
24 // ServerWindowCompositorFrameSinkManager tracks the surfaces associated with a 37 // ServerWindowCompositorFrameSinkManager tracks the surfaces associated with a
25 // ServerWindow. 38 // ServerWindow.
26 class ServerWindowCompositorFrameSinkManager { 39 class ServerWindowCompositorFrameSinkManager {
27 public: 40 public:
28 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); 41 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window);
29 ~ServerWindowCompositorFrameSinkManager(); 42 ~ServerWindowCompositorFrameSinkManager();
30 43
31 // Returns true if the surfaces from this manager should be drawn. 44 // Returns true if the surfaces from this manager should be drawn.
32 bool ShouldDraw(); 45 bool ShouldDraw();
33 46
34 // Creates a new surface of the specified type, replacing the existing one of 47 // Creates a new surface of the specified type, replacing the existing one of
35 // the specified type. 48 // the specified type.
36 void CreateCompositorFrameSink( 49 void CreateCompositorFrameSink(
37 mojom::CompositorFrameSinkType surface_type, 50 mojom::CompositorFrameSinkType surface_type,
38 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> request, 51 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> request,
39 cc::mojom::MojoCompositorFrameSinkClientPtr client); 52 cc::mojom::MojoCompositorFrameSinkClientPtr client);
40 53
41 ServerWindow* window() { return window_; } 54 ServerWindow* window() { return window_; }
42 55
43 ServerWindowCompositorFrameSink* GetDefaultCompositorFrameSink() const; 56 ServerWindowCompositorFrameSink* GetDefaultCompositorFrameSink() const;
44 ServerWindowCompositorFrameSink* GetUnderlayCompositorFrameSink() const; 57 ServerWindowCompositorFrameSink* GetUnderlayCompositorFrameSink() const;
45 ServerWindowCompositorFrameSink* GetCompositorFrameSinkByType( 58 ServerWindowCompositorFrameSink* GetCompositorFrameSinkByType(
46 mojom::CompositorFrameSinkType type) const; 59 mojom::CompositorFrameSinkType type) const;
47 bool HasCompositorFrameSinkOfType(mojom::CompositorFrameSinkType type) const; 60 bool HasCompositorFrameSinkOfType(mojom::CompositorFrameSinkType type) const;
48 bool HasAnyCompositorFrameSink() const; 61 bool HasAnyCompositorFrameSink() const;
49 62
63 gfx::Size GetLastFrameSize(mojom::CompositorFrameSinkType type) const;
64 cc::SurfaceId GetLastSurfaceId(mojom::CompositorFrameSinkType type) const;
65 void SetLastSurfaceId(mojom::CompositorFrameSinkType type,
sadrul 2016/10/27 05:06:30 Since this also sets the size, how about SetLatest
Fady Samuel 2016/10/27 05:46:37 Done.
66 const cc::SurfaceId& surface_id,
67 const gfx::Size& frame_size);
sadrul 2016/10/27 05:06:30 nit: s/Last/Latest/ in these?
Fady Samuel 2016/10/27 05:46:37 Done.
68
50 cc::SurfaceManager* GetCompositorFrameSinkManager(); 69 cc::SurfaceManager* GetCompositorFrameSinkManager();
51 70
52 private: 71 private:
53 friend class ServerWindowCompositorFrameSinkManagerTestApi; 72 friend class ServerWindowCompositorFrameSinkManagerTestApi;
54 friend class ServerWindowCompositorFrameSink; 73 friend class ServerWindowCompositorFrameSink;
55 74
56 // Returns true if a CompositorFrameSink of |type| has been set and has 75 // Returns true if a CompositorFrameSink of |type| has been set and has
57 // received a frame that is greater than the size of the window. 76 // received a frame that is greater than the size of the window.
58 bool IsCompositorFrameSinkReadyAndNonEmpty( 77 bool IsCompositorFrameSinkReadyAndNonEmpty(
59 mojom::CompositorFrameSinkType type) const; 78 mojom::CompositorFrameSinkType type) const;
60 79
61 ServerWindow* window_; 80 ServerWindow* window_;
62 81
63 using TypeToCompositorFrameSinkMap = 82 using TypeToCompositorFrameSinkMap =
64 std::map<mojom::CompositorFrameSinkType, 83 std::map<mojom::CompositorFrameSinkType, CompositorFrameSinkData>;
65 std::unique_ptr<ServerWindowCompositorFrameSink>>;
66 84
67 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_; 85 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_;
68 86
69 // While true the window is not drawn. This is initially true if the window 87 // While true the window is not drawn. This is initially true if the window
70 // has the property |kWaitForUnderlay_Property|. This is set to false once 88 // has the property |kWaitForUnderlay_Property|. This is set to false once
71 // the underlay and default surface have been set *and* their size is at 89 // the underlay and default surface have been set *and* their size is at
72 // least that of the window. Ideally we would wait for sizes to match, but 90 // least that of the window. Ideally we would wait for sizes to match, but
73 // the underlay is not necessarily as big as the window. 91 // the underlay is not necessarily as big as the window.
74 bool waiting_for_initial_frames_; 92 bool waiting_for_initial_frames_;
75 93
76 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); 94 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager);
77 }; 95 };
78 96
79 } // namespace ws 97 } // namespace ws
80 } // namespace ui 98 } // namespace ui
81 99
82 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ 100 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698