| 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_H_ | 5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_SURFACE_H_ |
| 6 #define SERVICES_UI_WS_SERVER_WINDOW_SURFACE_H_ | 6 #define SERVICES_UI_WS_SERVER_WINDOW_SURFACE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 namespace ws { | 25 namespace ws { |
| 26 | 26 |
| 27 class ServerWindow; | 27 class ServerWindow; |
| 28 class ServerWindowSurfaceManager; | 28 class ServerWindowSurfaceManager; |
| 29 | 29 |
| 30 // Server side representation of a WindowSurface. | 30 // Server side representation of a WindowSurface. |
| 31 class ServerWindowSurface : public mojom::Surface, | 31 class ServerWindowSurface : public mojom::Surface, |
| 32 public cc::SurfaceFactoryClient { | 32 public cc::SurfaceFactoryClient { |
| 33 public: | 33 public: |
| 34 ServerWindowSurface(ServerWindowSurfaceManager* manager, | 34 ServerWindowSurface(ServerWindowSurfaceManager* manager, |
| 35 const cc::FrameSinkId& frame_sink_id, |
| 35 mojo::InterfaceRequest<mojom::Surface> request, | 36 mojo::InterfaceRequest<mojom::Surface> request, |
| 36 mojom::SurfaceClientPtr client); | 37 mojom::SurfaceClientPtr client); |
| 37 | 38 |
| 38 ~ServerWindowSurface() override; | 39 ~ServerWindowSurface() override; |
| 39 | 40 |
| 40 const gfx::Size& last_submitted_frame_size() const { | 41 const gfx::Size& last_submitted_frame_size() const { |
| 41 return last_submitted_frame_size_; | 42 return last_submitted_frame_size_; |
| 42 } | 43 } |
| 43 | 44 |
| 44 bool may_contain_video() const { return may_contain_video_; } | 45 bool may_contain_video() const { return may_contain_video_; } |
| 45 | 46 |
| 46 // mojom::Surface: | 47 // mojom::Surface: |
| 47 void SubmitCompositorFrame( | 48 void SubmitCompositorFrame( |
| 48 cc::CompositorFrame frame, | 49 cc::CompositorFrame frame, |
| 49 const SubmitCompositorFrameCallback& callback) override; | 50 const SubmitCompositorFrameCallback& callback) override; |
| 50 | 51 |
| 51 const cc::SurfaceId& id() const { return surface_id_; } | 52 const cc::SurfaceId& id() const { return surface_id_; } |
| 52 | 53 |
| 53 // Destroys old surfaces that have been outdated by a new surface. | 54 // Destroys old surfaces that have been outdated by a new surface. |
| 54 void DestroySurfacesScheduledForDestruction(); | 55 void DestroySurfacesScheduledForDestruction(); |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 ServerWindow* window(); | 58 ServerWindow* window(); |
| 58 | 59 |
| 59 // SurfaceFactoryClient implementation. | 60 // SurfaceFactoryClient implementation. |
| 60 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 61 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 61 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | 62 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 62 | 63 |
| 63 ServerWindowSurfaceManager* manager_; // Owns this. | 64 ServerWindowSurfaceManager* const manager_; // Owns this. |
| 64 | 65 |
| 65 gfx::Size last_submitted_frame_size_; | 66 gfx::Size last_submitted_frame_size_; |
| 66 | 67 |
| 67 cc::SurfaceId surface_id_; | 68 cc::SurfaceId surface_id_; |
| 68 cc::SurfaceIdAllocator surface_id_allocator_; | 69 cc::SurfaceIdAllocator surface_id_allocator_; |
| 69 cc::SurfaceFactory surface_factory_; | 70 cc::SurfaceFactory surface_factory_; |
| 70 | 71 |
| 71 mojom::SurfaceClientPtr client_; | 72 mojom::SurfaceClientPtr client_; |
| 72 mojo::Binding<Surface> binding_; | 73 mojo::Binding<Surface> binding_; |
| 73 | 74 |
| 74 // Set of surface ids that need to be destroyed. | 75 // Set of surface ids that need to be destroyed. |
| 75 std::set<cc::SurfaceId> surfaces_scheduled_for_destruction_; | 76 std::set<cc::SurfaceId> surfaces_scheduled_for_destruction_; |
| 76 | 77 |
| 77 bool may_contain_video_ = false; | 78 bool may_contain_video_ = false; |
| 78 | 79 |
| 79 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurface); | 80 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurface); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 } // namespace ws | 83 } // namespace ws |
| 83 | 84 |
| 84 } // namespace ui | 85 } // namespace ui |
| 85 | 86 |
| 86 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_H_ | 87 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_H_ |
| OLD | NEW |