OLD | NEW |
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 "cc/surfaces/surface_id_allocator.h" | |
15 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
16 #include "services/ui/public/interfaces/window_tree.mojom.h" | 15 #include "services/ui/public/interfaces/window_tree.mojom.h" |
17 | 16 |
18 namespace ui { | 17 namespace ui { |
19 namespace ws { | 18 namespace ws { |
20 | 19 |
21 class ServerWindow; | 20 class ServerWindow; |
22 class ServerWindowSurface; | 21 class ServerWindowSurface; |
23 class ServerWindowSurfaceManagerTestApi; | 22 class ServerWindowSurfaceManagerTestApi; |
24 | 23 |
(...skipping 14 matching lines...) Expand all Loading... |
39 mojom::SurfaceClientPtr client); | 38 mojom::SurfaceClientPtr client); |
40 | 39 |
41 ServerWindow* window() { return window_; } | 40 ServerWindow* window() { return window_; } |
42 | 41 |
43 ServerWindowSurface* GetDefaultSurface() const; | 42 ServerWindowSurface* GetDefaultSurface() const; |
44 ServerWindowSurface* GetUnderlaySurface() const; | 43 ServerWindowSurface* GetUnderlaySurface() const; |
45 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type) const; | 44 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type) const; |
46 bool HasSurfaceOfType(mojom::SurfaceType type) const; | 45 bool HasSurfaceOfType(mojom::SurfaceType type) const; |
47 bool HasAnySurface() const; | 46 bool HasAnySurface() const; |
48 | 47 |
49 uint32_t client_id() const { return surface_id_allocator_.client_id(); } | |
50 cc::SurfaceManager* GetSurfaceManager(); | 48 cc::SurfaceManager* GetSurfaceManager(); |
51 | 49 |
52 private: | 50 private: |
53 friend class ServerWindowSurfaceManagerTestApi; | 51 friend class ServerWindowSurfaceManagerTestApi; |
54 friend class ServerWindowSurface; | 52 friend class ServerWindowSurface; |
55 | 53 |
56 // Returns true if a surface of |type| has been set and its size is greater | 54 // Returns true if a surface of |type| has been set and its size is greater |
57 // than the size of the window. | 55 // than the size of the window. |
58 bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const; | 56 bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const; |
59 | 57 |
60 cc::SurfaceId GenerateId(); | |
61 | |
62 ServerWindow* window_; | 58 ServerWindow* window_; |
63 | 59 |
64 cc::SurfaceIdAllocator surface_id_allocator_; | |
65 | |
66 using TypeToSurfaceMap = | 60 using TypeToSurfaceMap = |
67 std::map<mojom::SurfaceType, std::unique_ptr<ServerWindowSurface>>; | 61 std::map<mojom::SurfaceType, std::unique_ptr<ServerWindowSurface>>; |
68 | 62 |
69 TypeToSurfaceMap type_to_surface_map_; | 63 TypeToSurfaceMap type_to_surface_map_; |
70 | 64 |
71 // While true the window is not drawn. This is initially true if the window | 65 // 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 | 66 // 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 | 67 // 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 | 68 // 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. | 69 // the underlay is not necessarily as big as the window. |
76 bool waiting_for_initial_frames_; | 70 bool waiting_for_initial_frames_; |
77 | 71 |
78 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager); | 72 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager); |
79 }; | 73 }; |
80 | 74 |
81 } // namespace ws | 75 } // namespace ws |
82 } // namespace ui | 76 } // namespace ui |
83 | 77 |
84 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ | 78 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ |
OLD | NEW |