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

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

Issue 2429173005: Mus+Ash: Replace (Server)WindowSurface with (Server)WindowCompositorFrameSink (Closed)
Patch Set: Rebased 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
6 #define SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
7
8 #include <map>
9
10 #include "base/macros.h"
11 #include "cc/ipc/compositor_frame.mojom.h"
12 #include "cc/surfaces/surface_factory.h"
13 #include "cc/surfaces/surface_id.h"
14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "services/ui/public/interfaces/window_tree.mojom.h"
16
17 namespace ui {
18 namespace ws {
19
20 class ServerWindow;
21 class ServerWindowSurface;
22 class ServerWindowSurfaceManagerTestApi;
23
24 // ServerWindowSurfaceManager tracks the surfaces associated with a
25 // ServerWindow.
26 class ServerWindowSurfaceManager {
27 public:
28 explicit ServerWindowSurfaceManager(ServerWindow* window);
29 ~ServerWindowSurfaceManager();
30
31 // Returns true if the surfaces from this manager should be drawn.
32 bool ShouldDraw();
33
34 // Creates a new surface of the specified type, replacing the existing one of
35 // the specified type.
36 void CreateSurface(
37 mojom::SurfaceType surface_type,
38 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> request,
39 cc::mojom::MojoCompositorFrameSinkClientPtr client);
40
41 ServerWindow* window() { return window_; }
42
43 ServerWindowSurface* GetDefaultSurface() const;
44 ServerWindowSurface* GetUnderlaySurface() const;
45 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type) const;
46 bool HasSurfaceOfType(mojom::SurfaceType type) const;
47 bool HasAnySurface() const;
48
49 cc::SurfaceManager* GetSurfaceManager();
50
51 private:
52 friend class ServerWindowSurfaceManagerTestApi;
53 friend class ServerWindowSurface;
54
55 // Returns true if a surface of |type| has been set and its size is greater
56 // than the size of the window.
57 bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const;
58
59 ServerWindow* window_;
60
61 using TypeToSurfaceMap =
62 std::map<mojom::SurfaceType, std::unique_ptr<ServerWindowSurface>>;
63
64 TypeToSurfaceMap type_to_surface_map_;
65
66 // While true the window is not drawn. This is initially true if the window
67 // has the property |kWaitForUnderlay_Property|. This is set to false once
68 // the underlay and default surface have been set *and* their size is at
69 // least that of the window. Ideally we would wait for sizes to match, but
70 // the underlay is not necessarily as big as the window.
71 bool waiting_for_initial_frames_;
72
73 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager);
74 };
75
76 } // namespace ws
77 } // namespace ui
78
79 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
OLDNEW
« no previous file with comments | « services/ui/ws/server_window_surface.cc ('k') | services/ui/ws/server_window_surface_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698