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

Side by Side Diff: components/mus/ws/server_window_surface_manager.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
6 #define COMPONENTS_MUS_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 "cc/surfaces/surface_id_allocator.h"
15 #include "components/mus/public/interfaces/window_tree.mojom.h"
16 #include "mojo/public/cpp/bindings/binding.h"
17
18 namespace mus {
19 namespace ws {
20
21 class ServerWindow;
22 class ServerWindowSurface;
23 class ServerWindowSurfaceManagerTestApi;
24
25 // ServerWindowSurfaceManager tracks the surfaces associated with a
26 // ServerWindow.
27 class ServerWindowSurfaceManager {
28 public:
29 explicit ServerWindowSurfaceManager(ServerWindow* window);
30 ~ServerWindowSurfaceManager();
31
32 // Returns true if the surfaces from this manager should be drawn.
33 bool ShouldDraw();
34
35 // Creates a new surface of the specified type, replacing the existing one of
36 // the specified type.
37 void CreateSurface(mojom::SurfaceType surface_type,
38 mojo::InterfaceRequest<mojom::Surface> request,
39 mojom::SurfaceClientPtr 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 uint32_t id_namespace() const { return surface_id_allocator_.id_namespace(); }
50 cc::SurfaceManager* GetSurfaceManager();
51
52 private:
53 friend class ServerWindowSurfaceManagerTestApi;
54 friend class ServerWindowSurface;
55
56 // Returns true if a surface of |type| has been set and its size is greater
57 // than the size of the window.
58 bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const;
59
60 cc::SurfaceId GenerateId();
61
62 ServerWindow* window_;
63
64 cc::SurfaceIdAllocator surface_id_allocator_;
65
66 using TypeToSurfaceMap =
67 std::map<mojom::SurfaceType, std::unique_ptr<ServerWindowSurface>>;
68
69 TypeToSurfaceMap type_to_surface_map_;
70
71 // While true the window is not drawn. This is initially true if the window
72 // has the property |kWaitForUnderlay_Property|. This is set to false once
73 // the underlay and default surface have been set *and* their size is at
74 // least that of the window. Ideally we would wait for sizes to match, but
75 // the underlay is not necessarily as big as the window.
76 bool waiting_for_initial_frames_;
77
78 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager);
79 };
80
81 } // namespace ws
82 } // namespace mus
83
84 #endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/server_window_surface.cc ('k') | components/mus/ws/server_window_surface_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698