| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 struct CompositorFrameSinkData { | 31 struct CompositorFrameSinkData { |
| 32 CompositorFrameSinkData(); | 32 CompositorFrameSinkData(); |
| 33 CompositorFrameSinkData(CompositorFrameSinkData&& other); | 33 CompositorFrameSinkData(CompositorFrameSinkData&& other); |
| 34 ~CompositorFrameSinkData(); | 34 ~CompositorFrameSinkData(); |
| 35 | 35 |
| 36 CompositorFrameSinkData& operator=(CompositorFrameSinkData&& other); | 36 CompositorFrameSinkData& operator=(CompositorFrameSinkData&& other); |
| 37 | 37 |
| 38 cc::SurfaceId latest_submitted_surface_id; | 38 cc::SurfaceId latest_submitted_surface_id; |
| 39 gfx::Size latest_submitted_frame_size; | 39 gfx::Size latest_submitted_frame_size; |
| 40 cc::SurfaceSequenceGenerator surface_sequence_generator; | 40 cc::SurfaceSequenceGenerator surface_sequence_generator; |
| 41 // TODO(fsamuel): This should be a mojo interface. | 41 cc::mojom::MojoCompositorFrameSinkPrivatePtr compositor_frame_sink; |
| 42 std::unique_ptr<ServerWindowCompositorFrameSink> compositor_frame_sink; | 42 cc::mojom::MojoCompositorFrameSinkPrivateRequest |
| 43 pending_compositor_frame_sink_request; |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 // ServerWindowCompositorFrameSinkManager tracks the surfaces associated with a | 46 // ServerWindowCompositorFrameSinkManager tracks the surfaces associated with a |
| 46 // ServerWindow. | 47 // ServerWindow. |
| 48 // TODO(fsamuel): Delete this once window decorations are managed in the window |
| 49 // manager. |
| 47 class ServerWindowCompositorFrameSinkManager { | 50 class ServerWindowCompositorFrameSinkManager { |
| 48 public: | 51 public: |
| 49 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); | 52 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); |
| 50 ~ServerWindowCompositorFrameSinkManager(); | 53 ~ServerWindowCompositorFrameSinkManager(); |
| 51 | 54 |
| 52 // Returns true if the surfaces from this manager should be drawn. | 55 // Returns true if the CompositorFrameSinks from this manager should be drawn. |
| 53 bool ShouldDraw(); | 56 bool ShouldDraw(); |
| 54 | 57 |
| 55 // Creates a new surface of the specified type, replacing the existing one of | 58 // Creates a new CompositorFrameSink of the specified type, replacing the |
| 56 // the specified type. | 59 // existing one of the specified type. |
| 57 void CreateCompositorFrameSink( | 60 void CreateCompositorFrameSink( |
| 58 mojom::CompositorFrameSinkType surface_type, | 61 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 59 gfx::AcceleratedWidget widget, | 62 gfx::AcceleratedWidget widget, |
| 60 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 63 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 61 scoped_refptr<SurfacesContextProvider> context_provider, | 64 scoped_refptr<SurfacesContextProvider> context_provider, |
| 62 cc::mojom::MojoCompositorFrameSinkRequest request, | 65 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 63 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 66 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 64 | 67 |
| 68 // Adds the provided |frame_sink_id| to this ServerWindow's associated |
| 69 // CompositorFrameSink if possible. If this ServerWindow does not have |
| 70 // an associated CompositorFrameSink then this method will recursively |
| 71 // walk up the window hierarchy and register itself with the first ancestor |
| 72 // that has a CompositorFrameSink of the same type. This method returns |
| 73 // the FrameSinkId that is the first composited ancestor of the ServerWindow |
| 74 // assocaited with the provided |frame_sink_id|. |
| 75 void AddChildFrameSinkId( |
| 76 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 77 const cc::FrameSinkId& frame_sink_id); |
| 78 void RemoveChildFrameSinkId( |
| 79 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 80 const cc::FrameSinkId& frame_sink_id); |
| 81 |
| 65 ServerWindow* window() { return window_; } | 82 ServerWindow* window() { return window_; } |
| 66 | 83 |
| 67 bool HasCompositorFrameSinkOfType(mojom::CompositorFrameSinkType type) const; | 84 bool HasCompositorFrameSinkOfType(mojom::CompositorFrameSinkType type) const; |
| 68 bool HasAnyCompositorFrameSink() const; | 85 bool HasAnyCompositorFrameSink() const; |
| 69 | 86 |
| 70 // Creates a surface dependency token that expires when the | 87 // Creates a surface dependency token that expires when the |
| 71 // CompositorFrameSink of type |type| goes away associated with this window. | 88 // CompositorFrameSink of type |type| goes away associated with this window. |
| 72 cc::SurfaceSequence CreateSurfaceSequence( | 89 cc::SurfaceSequence CreateSurfaceSequence( |
| 73 mojom::CompositorFrameSinkType type); | 90 mojom::CompositorFrameSinkType type); |
| 74 gfx::Size GetLatestFrameSize(mojom::CompositorFrameSinkType type) const; | 91 gfx::Size GetLatestFrameSize(mojom::CompositorFrameSinkType type) const; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 102 // the underlay is not necessarily as big as the window. | 119 // the underlay is not necessarily as big as the window. |
| 103 bool waiting_for_initial_frames_; | 120 bool waiting_for_initial_frames_; |
| 104 | 121 |
| 105 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); | 122 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); |
| 106 }; | 123 }; |
| 107 | 124 |
| 108 } // namespace ws | 125 } // namespace ws |
| 109 } // namespace ui | 126 } // namespace ui |
| 110 | 127 |
| 111 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ | 128 #endif // SERVICES_UI_WS_SERVER_WINDOW_SURFACE_MANAGER_H_ |
| OLD | NEW |