| 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 COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ | 5 #ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ |
| 6 #define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ | 6 #define COMPONENTS_MUS_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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // the specified type. | 36 // the specified type. |
| 37 void CreateSurface(mojom::SurfaceType surface_type, | 37 void CreateSurface(mojom::SurfaceType surface_type, |
| 38 mojo::InterfaceRequest<mojom::Surface> request, | 38 mojo::InterfaceRequest<mojom::Surface> request, |
| 39 mojom::SurfaceClientPtr client); | 39 mojom::SurfaceClientPtr client); |
| 40 | 40 |
| 41 ServerWindow* window() { return window_; } | 41 ServerWindow* window() { return window_; } |
| 42 | 42 |
| 43 ServerWindowSurface* GetDefaultSurface(); | 43 ServerWindowSurface* GetDefaultSurface(); |
| 44 ServerWindowSurface* GetUnderlaySurface(); | 44 ServerWindowSurface* GetUnderlaySurface(); |
| 45 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type); | 45 ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type); |
| 46 bool HasSurfaceOfType(mojom::SurfaceType type); | 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 SurfaceManager* GetSurfaceManager(); |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 friend class ServerWindowSurfaceManagerTestApi; | 53 friend class ServerWindowSurfaceManagerTestApi; |
| 50 friend class ServerWindowSurface; | 54 friend class ServerWindowSurface; |
| 51 | 55 |
| 52 // Returns true if a surface of |type| has been set and it's size is greater | 56 // Returns true if a surface of |type| has been set and its size is greater |
| 53 // than the size of the window. | 57 // than the size of the window. |
| 54 bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const; | 58 bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const; |
| 55 | 59 |
| 56 cc::SurfaceId GenerateId(); | 60 cc::SurfaceId GenerateId(); |
| 57 | 61 |
| 58 ServerWindow* window_; | 62 ServerWindow* window_; |
| 59 | 63 |
| 60 cc::SurfaceIdAllocator surface_id_allocator_; | 64 cc::SurfaceIdAllocator surface_id_allocator_; |
| 61 | 65 |
| 62 using TypeToSurfaceMap = | 66 using TypeToSurfaceMap = |
| 63 std::map<mojom::SurfaceType, scoped_ptr<ServerWindowSurface>>; | 67 std::map<mojom::SurfaceType, scoped_ptr<ServerWindowSurface>>; |
| 64 | 68 |
| 65 TypeToSurfaceMap type_to_surface_map_; | 69 TypeToSurfaceMap type_to_surface_map_; |
| 66 | 70 |
| 67 // While true the window is not drawn. This is initially true if the window | 71 // While true the window is not drawn. This is initially true if the window |
| 68 // has the property |kWaitForUnderlay_Property|. This is set to false once | 72 // has the property |kWaitForUnderlay_Property|. This is set to false once |
| 69 // the underlay and default surface have been set *and* their size is at | 73 // the underlay and default surface have been set *and* their size is at |
| 70 // least that of the window. Ideally we would wait for sizes to match, but | 74 // least that of the window. Ideally we would wait for sizes to match, but |
| 71 // the underlay is not necessarily as big as the window. | 75 // the underlay is not necessarily as big as the window. |
| 72 bool waiting_for_initial_frames_; | 76 bool waiting_for_initial_frames_; |
| 73 | 77 |
| 74 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager); | 78 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager); |
| 75 }; | 79 }; |
| 76 | 80 |
| 77 } // namespace ws | 81 } // namespace ws |
| 78 } // namespace mus | 82 } // namespace mus |
| 79 | 83 |
| 80 #endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ | 84 #endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ |
| OLD | NEW |