| OLD | NEW |
| (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_H_ | |
| 6 #define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_ | |
| 7 | |
| 8 #include <set> | |
| 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_factory_client.h" | |
| 14 #include "cc/surfaces/surface_id.h" | |
| 15 #include "cc/surfaces/surface_id_allocator.h" | |
| 16 #include "components/mus/public/interfaces/surface.mojom.h" | |
| 17 #include "components/mus/public/interfaces/window_tree.mojom.h" | |
| 18 #include "components/mus/ws/ids.h" | |
| 19 #include "mojo/public/cpp/bindings/binding.h" | |
| 20 | |
| 21 namespace mus { | |
| 22 | |
| 23 class SurfacesState; | |
| 24 | |
| 25 namespace ws { | |
| 26 | |
| 27 class ServerWindow; | |
| 28 class ServerWindowSurfaceManager; | |
| 29 | |
| 30 // Server side representation of a WindowSurface. | |
| 31 class ServerWindowSurface : public mojom::Surface, | |
| 32 public cc::SurfaceFactoryClient { | |
| 33 public: | |
| 34 ServerWindowSurface(ServerWindowSurfaceManager* manager, | |
| 35 mojo::InterfaceRequest<mojom::Surface> request, | |
| 36 mojom::SurfaceClientPtr client); | |
| 37 | |
| 38 ~ServerWindowSurface() override; | |
| 39 | |
| 40 const gfx::Size& last_submitted_frame_size() const { | |
| 41 return last_submitted_frame_size_; | |
| 42 } | |
| 43 | |
| 44 // mojom::Surface: | |
| 45 void SubmitCompositorFrame( | |
| 46 cc::CompositorFrame frame, | |
| 47 const SubmitCompositorFrameCallback& callback) override; | |
| 48 | |
| 49 const cc::SurfaceId& id() const { return surface_id_; } | |
| 50 | |
| 51 // Destroys old surfaces that have been outdated by a new surface. | |
| 52 void DestroySurfacesScheduledForDestruction(); | |
| 53 | |
| 54 // Registers this with the SurfaceManager | |
| 55 void RegisterForBeginFrames(); | |
| 56 | |
| 57 private: | |
| 58 ServerWindow* window(); | |
| 59 | |
| 60 // SurfaceFactoryClient implementation. | |
| 61 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 62 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | |
| 63 | |
| 64 ServerWindowSurfaceManager* manager_; // Owns this. | |
| 65 | |
| 66 gfx::Size last_submitted_frame_size_; | |
| 67 | |
| 68 cc::SurfaceId surface_id_; | |
| 69 cc::SurfaceFactory surface_factory_; | |
| 70 | |
| 71 mojom::SurfaceClientPtr client_; | |
| 72 mojo::Binding<Surface> binding_; | |
| 73 | |
| 74 // Set of surface ids that need to be destroyed. | |
| 75 std::set<cc::SurfaceId> surfaces_scheduled_for_destruction_; | |
| 76 | |
| 77 bool registered_surface_factory_client_; | |
| 78 | |
| 79 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurface); | |
| 80 }; | |
| 81 | |
| 82 } // namespace ws | |
| 83 | |
| 84 } // namespace mus | |
| 85 | |
| 86 #endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_ | |
| OLD | NEW |