| 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 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" | 5 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" |
| 6 | 6 |
| 7 #include "cc/ipc/display_compositor.mojom.h" | 7 #include "cc/ipc/display_compositor.mojom.h" |
| 8 #include "mojo/public/cpp/bindings/strong_binding.h" | 8 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 9 #include "services/ui/ws/ids.h" | 9 #include "services/ui/ws/ids.h" |
| 10 #include "services/ui/ws/server_window.h" | 10 #include "services/ui/ws/server_window.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 mojo::MakeRequest(&frame_sink_data_->compositor_frame_sink); | 102 mojo::MakeRequest(&frame_sink_data_->compositor_frame_sink); |
| 103 frame_sink_data_->compositor_frame_sink->AddChildFrameSink(frame_sink_id); | 103 frame_sink_data_->compositor_frame_sink->AddChildFrameSink(frame_sink_id); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ServerWindowCompositorFrameSinkManager::RemoveChildFrameSinkId( | 106 void ServerWindowCompositorFrameSinkManager::RemoveChildFrameSinkId( |
| 107 const cc::FrameSinkId& frame_sink_id) { | 107 const cc::FrameSinkId& frame_sink_id) { |
| 108 DCHECK(frame_sink_data_); | 108 DCHECK(frame_sink_data_); |
| 109 frame_sink_data_->compositor_frame_sink->RemoveChildFrameSink(frame_sink_id); | 109 frame_sink_data_->compositor_frame_sink->RemoveChildFrameSink(frame_sink_id); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool ServerWindowCompositorFrameSinkManager::HasCompositorFrameSink() const { | |
| 113 return !!frame_sink_data_; | |
| 114 } | |
| 115 | |
| 116 gfx::Size ServerWindowCompositorFrameSinkManager::GetLatestFrameSize() const { | 112 gfx::Size ServerWindowCompositorFrameSinkManager::GetLatestFrameSize() const { |
| 117 if (!frame_sink_data_) | 113 if (!frame_sink_data_) |
| 118 return gfx::Size(); | 114 return gfx::Size(); |
| 119 | 115 |
| 120 return frame_sink_data_->latest_submitted_surface_info.size_in_pixels(); | 116 return frame_sink_data_->latest_submitted_surface_info.size_in_pixels(); |
| 121 } | 117 } |
| 122 | 118 |
| 123 cc::SurfaceId ServerWindowCompositorFrameSinkManager::GetLatestSurfaceId() | |
| 124 const { | |
| 125 if (!frame_sink_data_) | |
| 126 return cc::SurfaceId(); | |
| 127 | |
| 128 return frame_sink_data_->latest_submitted_surface_info.id(); | |
| 129 } | |
| 130 | |
| 131 void ServerWindowCompositorFrameSinkManager::SetLatestSurfaceInfo( | 119 void ServerWindowCompositorFrameSinkManager::SetLatestSurfaceInfo( |
| 132 const cc::SurfaceInfo& surface_info) { | 120 const cc::SurfaceInfo& surface_info) { |
| 133 if (!frame_sink_data_) | 121 if (!frame_sink_data_) |
| 134 frame_sink_data_ = base::MakeUnique<CompositorFrameSinkData>(); | 122 frame_sink_data_ = base::MakeUnique<CompositorFrameSinkData>(); |
| 135 | 123 |
| 136 frame_sink_data_->latest_submitted_surface_info = surface_info; | 124 frame_sink_data_->latest_submitted_surface_info = surface_info; |
| 137 } | 125 } |
| 138 | 126 |
| 139 void ServerWindowCompositorFrameSinkManager::OnRootChanged( | 127 void ServerWindowCompositorFrameSinkManager::OnRootChanged( |
| 140 ServerWindow* old_root, | 128 ServerWindow* old_root, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 163 | 151 |
| 164 CompositorFrameSinkData& CompositorFrameSinkData::operator=( | 152 CompositorFrameSinkData& CompositorFrameSinkData::operator=( |
| 165 CompositorFrameSinkData&& other) { | 153 CompositorFrameSinkData&& other) { |
| 166 latest_submitted_surface_info = other.latest_submitted_surface_info; | 154 latest_submitted_surface_info = other.latest_submitted_surface_info; |
| 167 compositor_frame_sink = std::move(other.compositor_frame_sink); | 155 compositor_frame_sink = std::move(other.compositor_frame_sink); |
| 168 return *this; | 156 return *this; |
| 169 } | 157 } |
| 170 | 158 |
| 171 } // namespace ws | 159 } // namespace ws |
| 172 } // namespace ui | 160 } // namespace ui |
| OLD | NEW |