Commit c690c549 authored by Illia Martyniuk's avatar Illia Martyniuk Committed by Commit Bot

Viz: Updating FrameSinkObserver

Avoiding unnecessary complexity in FrameSinkObserver. We are interested
in events like creating and destroying FrameSinks which are handled in
"OnCreated...FrameSink" and "OnDestroyed...FrameSink", so we don't need
to use events "OnRegistered...Support" and "OnUnregistered...Support".
These two just give us the unnecessary overhead of handling more events.

Sorry for missing this in previous CL.

Bug: 816802
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I53eba6a103834cc9d48ced14e013825c3b49027a
Reviewed-on: https://chromium-review.googlesource.com/978374
Commit-Queue: Illia Martyniuk <illiam@google.com>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545776}
parent 5835c1fd
......@@ -70,6 +70,8 @@ class VIZ_SERVICE_EXPORT CompositorFrameSinkSupport
return last_activated_surface_id_.local_surface_id();
}
bool is_root() const { return is_root_; }
FrameSinkManagerImpl* frame_sink_manager() { return frame_sink_manager_; }
// Viz hit-test setup is only called when |is_root_| is true (except on
......
......@@ -166,9 +166,6 @@ void FrameSinkManagerImpl::CreateRootCompositorFrameSink(
std::move(params->compositor_frame_sink_client)),
std::move(params->display_private),
mojom::DisplayClientPtr(std::move(params->display_client)));
for (auto& observer : observer_list_)
observer.OnCreatedRootCompositorFrameSink(params->frame_sink_id);
}
void FrameSinkManagerImpl::CreateCompositorFrameSink(
......@@ -180,17 +177,11 @@ void FrameSinkManagerImpl::CreateCompositorFrameSink(
sink_map_[frame_sink_id] = std::make_unique<CompositorFrameSinkImpl>(
this, frame_sink_id, std::move(request), std::move(client));
for (auto& observer : observer_list_)
observer.OnCreatedCompositorFrameSink(frame_sink_id);
}
void FrameSinkManagerImpl::DestroyCompositorFrameSink(
const FrameSinkId& frame_sink_id,
DestroyCompositorFrameSinkCallback callback) {
for (auto& observer : observer_list_)
observer.OnDestroyedCompositorFrameSink(frame_sink_id);
sink_map_.erase(frame_sink_id);
std::move(callback).Run();
}
......@@ -400,7 +391,7 @@ void FrameSinkManagerImpl::RegisterCompositorFrameSinkSupport(
support->SetBeginFrameSource(it->second.source);
for (auto& observer : observer_list_)
observer.OnRegisteredCompositorFrameSinkSupport(frame_sink_id, support);
observer.OnCreatedCompositorFrameSink(frame_sink_id, support->is_root());
}
void FrameSinkManagerImpl::UnregisterCompositorFrameSinkSupport(
......@@ -408,7 +399,7 @@ void FrameSinkManagerImpl::UnregisterCompositorFrameSinkSupport(
DCHECK(base::ContainsKey(support_map_, frame_sink_id));
for (auto& observer : observer_list_)
observer.OnUnregisteredCompositorFrameSinkSupport(frame_sink_id);
observer.OnDestroyedCompositorFrameSink(frame_sink_id);
for (auto& capturer : video_capturers_) {
if (capturer->requested_target() == frame_sink_id)
......
......@@ -7,7 +7,6 @@
namespace viz {
class CompositorFrameSinkSupport;
class FrameSinkId;
class FrameSinkObserver {
......@@ -18,15 +17,11 @@ class FrameSinkObserver {
// Called when FrameSinkId is being invalidated
virtual void OnInvalidatedFrameSinkId(const FrameSinkId& frame_sink_id) = 0;
// Called when RootCompositorFrameSinkImpl is created
virtual void OnCreatedRootCompositorFrameSink(
const FrameSinkId& frame_sink_id) = 0;
// Called when CompositorFrameSinkImpl is created
virtual void OnCreatedCompositorFrameSink(
const FrameSinkId& frame_sink_id) = 0;
// Called when CompositorFrameSink is created
virtual void OnCreatedCompositorFrameSink(const FrameSinkId& frame_sink_id,
bool is_root) = 0;
// Called when [Root]CompositorFrameSinkImpl is about to be destroyed
// Called when CompositorFrameSink is about to be destroyed
virtual void OnDestroyedCompositorFrameSink(
const FrameSinkId& frame_sink_id) = 0;
......@@ -41,15 +36,6 @@ class FrameSinkObserver {
virtual void OnUnregisteredFrameSinkHierarchy(
const FrameSinkId& parent_frame_sink_id,
const FrameSinkId& child_frame_sink_id) = 0;
// Called on creating of CompositorFrameSinkSupport
virtual void OnRegisteredCompositorFrameSinkSupport(
const FrameSinkId& frame_sink_id,
CompositorFrameSinkSupport* support) = 0;
// Called on destroying CompositorFrameSinkSupport
virtual void OnUnregisteredCompositorFrameSinkSupport(
const FrameSinkId& frame_sink_id) = 0;
};
} // namespace viz
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment