| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/viz/host/host_frame_sink_manager.h" | 5 #include "components/viz/host/host_frame_sink_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 #include "components/viz/common/surfaces/surface_info.h" | 10 #include "components/viz/common/surfaces/surface_info.h" |
| 11 #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" | 11 #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" |
| 12 #include "components/viz/service/frame_sinks/compositor_frame_sink_support_clien
t.h" | 12 #include "components/viz/service/frame_sinks/compositor_frame_sink_support_clien
t.h" |
| 13 #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" | 13 #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" |
| 14 #include "services/viz/public/interfaces/hit_test/input_hit_test.mojom.h" |
| 14 | 15 |
| 15 namespace viz { | 16 namespace viz { |
| 16 | 17 |
| 17 HostFrameSinkManager::HostFrameSinkManager() | 18 HostFrameSinkManager::HostFrameSinkManager() |
| 18 : binding_(this), weak_ptr_factory_(this) {} | 19 : binding_(this), weak_ptr_factory_(this) {} |
| 19 | 20 |
| 20 HostFrameSinkManager::~HostFrameSinkManager() = default; | 21 HostFrameSinkManager::~HostFrameSinkManager() = default; |
| 21 | 22 |
| 22 void HostFrameSinkManager::SetLocalManager( | 23 void HostFrameSinkManager::SetLocalManager( |
| 23 FrameSinkManagerImpl* frame_sink_manager_impl) { | 24 FrameSinkManagerImpl* frame_sink_manager_impl) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 frame_sink_manager_->UnregisterFrameSinkHierarchy(parent_frame_sink_id, | 107 frame_sink_manager_->UnregisterFrameSinkHierarchy(parent_frame_sink_id, |
| 107 child_frame_sink_id); | 108 child_frame_sink_id); |
| 108 | 109 |
| 109 if (data.IsEmpty()) | 110 if (data.IsEmpty()) |
| 110 frame_sink_data_map_.erase(iter); | 111 frame_sink_data_map_.erase(iter); |
| 111 } | 112 } |
| 112 | 113 |
| 113 std::unique_ptr<CompositorFrameSinkSupport> | 114 std::unique_ptr<CompositorFrameSinkSupport> |
| 114 HostFrameSinkManager::CreateCompositorFrameSinkSupport( | 115 HostFrameSinkManager::CreateCompositorFrameSinkSupport( |
| 115 CompositorFrameSinkSupportClient* client, | 116 CompositorFrameSinkSupportClient* client, |
| 117 mojom::FrameInputHitTest* frame_input_hit_test, |
| 116 const FrameSinkId& frame_sink_id, | 118 const FrameSinkId& frame_sink_id, |
| 117 bool is_root, | 119 bool is_root, |
| 118 bool handles_frame_sink_id_invalidation, | 120 bool handles_frame_sink_id_invalidation, |
| 119 bool needs_sync_points) { | 121 bool needs_sync_points) { |
| 120 DCHECK(frame_sink_manager_impl_); | 122 DCHECK(frame_sink_manager_impl_); |
| 121 | 123 |
| 122 FrameSinkData& data = frame_sink_data_map_[frame_sink_id]; | 124 FrameSinkData& data = frame_sink_data_map_[frame_sink_id]; |
| 123 DCHECK(!data.HasCompositorFrameSinkData()); | 125 DCHECK(!data.HasCompositorFrameSinkData()); |
| 124 | 126 |
| 125 auto support = CompositorFrameSinkSupport::Create( | 127 auto support = CompositorFrameSinkSupport::Create( |
| 126 client, frame_sink_manager_impl_, frame_sink_id, is_root, | 128 client, frame_sink_manager_impl_, frame_sink_id, is_root, |
| 127 handles_frame_sink_id_invalidation, needs_sync_points); | 129 handles_frame_sink_id_invalidation, needs_sync_points); |
| 128 support->SetDestructionCallback( | 130 support->SetDestructionCallback( |
| 129 base::BindOnce(&HostFrameSinkManager::DestroyCompositorFrameSink, | 131 base::BindOnce(&HostFrameSinkManager::DestroyCompositorFrameSink, |
| 130 weak_ptr_factory_.GetWeakPtr(), frame_sink_id)); | 132 weak_ptr_factory_.GetWeakPtr(), frame_sink_id)); |
| 131 | 133 |
| 132 data.support = support.get(); | 134 data.support = support.get(); |
| 133 data.is_root = is_root; | 135 data.is_root = is_root; |
| 136 data.frame_hit_test = frame_input_hit_test; |
| 134 | 137 |
| 135 return support; | 138 return support; |
| 136 } | 139 } |
| 137 | 140 |
| 138 void HostFrameSinkManager::PerformAssignTemporaryReference( | 141 void HostFrameSinkManager::PerformAssignTemporaryReference( |
| 139 const SurfaceId& surface_id) { | 142 const SurfaceId& surface_id) { |
| 140 // Find the expected embedder for the new surface and assign the temporary | 143 // Find the expected embedder for the new surface and assign the temporary |
| 141 // reference to it. | 144 // reference to it. |
| 142 auto iter = frame_sink_data_map_.find(surface_id.frame_sink_id()); | 145 auto iter = frame_sink_data_map_.find(surface_id.frame_sink_id()); |
| 143 if (iter != frame_sink_data_map_.end()) { | 146 if (iter != frame_sink_data_map_.end()) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 181 |
| 179 HostFrameSinkManager::FrameSinkData::FrameSinkData(FrameSinkData&& other) = | 182 HostFrameSinkManager::FrameSinkData::FrameSinkData(FrameSinkData&& other) = |
| 180 default; | 183 default; |
| 181 | 184 |
| 182 HostFrameSinkManager::FrameSinkData::~FrameSinkData() = default; | 185 HostFrameSinkManager::FrameSinkData::~FrameSinkData() = default; |
| 183 | 186 |
| 184 HostFrameSinkManager::FrameSinkData& HostFrameSinkManager::FrameSinkData:: | 187 HostFrameSinkManager::FrameSinkData& HostFrameSinkManager::FrameSinkData:: |
| 185 operator=(FrameSinkData&& other) = default; | 188 operator=(FrameSinkData&& other) = default; |
| 186 | 189 |
| 187 } // namespace viz | 190 } // namespace viz |
| OLD | NEW |