Chromium Code Reviews| 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_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
| 6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
|
sky
2017/01/09 19:03:00
remove include?
Fady Samuel
2017/01/09 19:27:57
Done.
| |
| 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/ipc/display_compositor.mojom.h" | 12 #include "cc/ipc/display_compositor.mojom.h" |
| 13 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 14 #include "cc/surfaces/surface_id.h" | 14 #include "cc/surfaces/surface_id.h" |
| 15 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 16 #include "services/ui/public/interfaces/window_tree.mojom.h" | 16 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 cc::SurfaceInfo latest_submitted_surface_info; | 32 cc::SurfaceInfo latest_submitted_surface_info; |
| 33 cc::mojom::MojoCompositorFrameSinkPrivatePtr compositor_frame_sink; | 33 cc::mojom::MojoCompositorFrameSinkPrivatePtr compositor_frame_sink; |
| 34 cc::mojom::MojoCompositorFrameSinkPrivateRequest | 34 cc::mojom::MojoCompositorFrameSinkPrivateRequest |
| 35 pending_compositor_frame_sink_request; | 35 pending_compositor_frame_sink_request; |
| 36 cc::FrameSinkId frame_sink_id; | 36 cc::FrameSinkId frame_sink_id; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // ServerWindowCompositorFrameSinkManager tracks the surfaces associated with a | 39 // ServerWindowCompositorFrameSinkManager tracks the surfaces associated with a |
| 40 // ServerWindow. | 40 // ServerWindow. |
| 41 // TODO(fsamuel): Delete this once window decorations are managed in the window | |
| 42 // manager. | |
| 43 class ServerWindowCompositorFrameSinkManager { | 41 class ServerWindowCompositorFrameSinkManager { |
| 44 public: | 42 public: |
| 45 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); | 43 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); |
| 46 ~ServerWindowCompositorFrameSinkManager(); | 44 ~ServerWindowCompositorFrameSinkManager(); |
| 47 | 45 |
| 48 // Returns true if the CompositorFrameSinks from this manager should be drawn. | |
| 49 bool ShouldDraw(); | |
| 50 | |
| 51 // Creates a new CompositorFrameSink of the specified type, replacing the | 46 // Creates a new CompositorFrameSink of the specified type, replacing the |
| 52 // existing one of the specified type. | 47 // existing one of the specified type. |
| 53 void CreateDisplayCompositorFrameSink( | 48 void CreateDisplayCompositorFrameSink( |
| 54 gfx::AcceleratedWidget widget, | 49 gfx::AcceleratedWidget widget, |
| 55 cc::mojom::MojoCompositorFrameSinkRequest request, | 50 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 56 cc::mojom::MojoCompositorFrameSinkClientPtr client, | 51 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
| 57 cc::mojom::DisplayPrivateRequest display_private_request); | 52 cc::mojom::DisplayPrivateRequest display_private_request); |
| 53 | |
| 58 void CreateOffscreenCompositorFrameSink( | 54 void CreateOffscreenCompositorFrameSink( |
| 59 mojom::CompositorFrameSinkType compositor_frame_sink_type, | |
| 60 cc::mojom::MojoCompositorFrameSinkRequest request, | 55 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 61 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 56 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 62 | 57 |
| 63 // Adds the provided |frame_sink_id| to this ServerWindow's associated | 58 // Adds the provided |frame_sink_id| to this ServerWindow's associated |
| 64 // CompositorFrameSink if possible. If this ServerWindow does not have | 59 // CompositorFrameSink if possible. If this ServerWindow does not have |
| 65 // an associated CompositorFrameSink then this method will recursively | 60 // an associated CompositorFrameSink then this method will recursively |
| 66 // walk up the window hierarchy and register itself with the first ancestor | 61 // walk up the window hierarchy and register itself with the first ancestor |
| 67 // that has a CompositorFrameSink of the same type. This method returns | 62 // that has a CompositorFrameSink of the same type. This method returns |
| 68 // the FrameSinkId that is the first composited ancestor of the ServerWindow | 63 // the FrameSinkId that is the first composited ancestor of the ServerWindow |
| 69 // assocaited with the provided |frame_sink_id|. | 64 // assocaited with the provided |frame_sink_id|. |
| 70 void AddChildFrameSinkId( | 65 void AddChildFrameSinkId(const cc::FrameSinkId& frame_sink_id); |
| 71 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 66 void RemoveChildFrameSinkId(const cc::FrameSinkId& frame_sink_id); |
| 72 const cc::FrameSinkId& frame_sink_id); | |
| 73 void RemoveChildFrameSinkId( | |
| 74 mojom::CompositorFrameSinkType compositor_frame_sink_type, | |
| 75 const cc::FrameSinkId& frame_sink_id); | |
| 76 | 67 |
| 77 ServerWindow* window() { return window_; } | 68 ServerWindow* window() { return window_; } |
| 78 | 69 |
| 79 bool HasCompositorFrameSinkOfType(mojom::CompositorFrameSinkType type) const; | 70 bool HasCompositorFrameSink() const; |
| 80 bool HasAnyCompositorFrameSink() const; | |
| 81 | 71 |
| 82 gfx::Size GetLatestFrameSize(mojom::CompositorFrameSinkType type) const; | 72 gfx::Size GetLatestFrameSize() const; |
| 83 cc::SurfaceId GetLatestSurfaceId(mojom::CompositorFrameSinkType type) const; | 73 cc::SurfaceId GetLatestSurfaceId() const; |
| 84 void SetLatestSurfaceInfo(mojom::CompositorFrameSinkType type, | 74 void SetLatestSurfaceInfo(const cc::SurfaceInfo& surface_info); |
| 85 const cc::SurfaceInfo& surface_info); | |
| 86 | 75 |
| 87 void OnRootChanged(ServerWindow* old_root, ServerWindow* new_root); | 76 void OnRootChanged(ServerWindow* old_root, ServerWindow* new_root); |
| 88 | 77 |
| 89 private: | 78 private: |
| 90 friend class ServerWindowCompositorFrameSinkManagerTestApi; | 79 friend class ServerWindowCompositorFrameSinkManagerTestApi; |
| 91 friend class ServerWindowCompositorFrameSink; | 80 friend class ServerWindowCompositorFrameSink; |
| 92 | 81 |
| 93 // Returns true if a CompositorFrameSink of |type| has been set and has | |
| 94 // received a frame that is greater than the size of the window. | |
| 95 bool IsCompositorFrameSinkReadyAndNonEmpty( | |
| 96 mojom::CompositorFrameSinkType type) const; | |
| 97 | |
| 98 void CreateCompositorFrameSinkInternal( | 82 void CreateCompositorFrameSinkInternal( |
| 99 mojom::CompositorFrameSinkType compositor_frame_sink_type, | |
| 100 gfx::AcceleratedWidget widget, | 83 gfx::AcceleratedWidget widget, |
| 101 cc::mojom::MojoCompositorFrameSinkRequest request, | 84 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 102 cc::mojom::MojoCompositorFrameSinkClientPtr client, | 85 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
| 103 cc::mojom::DisplayPrivateRequest display_private_request); | 86 cc::mojom::DisplayPrivateRequest display_private_request); |
| 104 | 87 |
| 105 ServerWindow* window_; | 88 ServerWindow* window_; |
| 106 | 89 |
| 107 using TypeToCompositorFrameSinkMap = | 90 std::unique_ptr<CompositorFrameSinkData> frame_sink_data_; |
| 108 std::map<mojom::CompositorFrameSinkType, CompositorFrameSinkData>; | |
| 109 | |
| 110 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_; | |
| 111 | |
| 112 // TODO(mfomitchev): This is currently always false. Confirm if we still need | |
| 113 // this. | |
| 114 // While true the window is not drawn. This is initially true if the window | |
| 115 // has the property |kWaitForUnderlay_Property|. This is set to false once | |
| 116 // the underlay and default surface have been set *and* their size is at | |
| 117 // least that of the window. Ideally we would wait for sizes to match, but | |
| 118 // the underlay is not necessarily as big as the window. | |
| 119 bool waiting_for_initial_frames_; | |
| 120 | 91 |
| 121 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); | 92 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); |
| 122 }; | 93 }; |
| 123 | 94 |
| 124 } // namespace ws | 95 } // namespace ws |
| 125 } // namespace ui | 96 } // namespace ui |
| 126 | 97 |
| 127 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 98 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
| OLD | NEW |