From ce6b35f1b91b82e348b2dd944ff59828ca4a6485 Mon Sep 17 00:00:00 2001 From: openharmony_ci <120357966@qq.com> Date: Fri, 24 May 2024 02:54:33 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!980=20:?= =?UTF-8?q?=20=20=E4=BF=AE=E5=A4=8DCVE-2024-4671=20'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frame_sinks/frame_sink_bundle_impl.cc | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/components/viz/service/frame_sinks/frame_sink_bundle_impl.cc b/components/viz/service/frame_sinks/frame_sink_bundle_impl.cc index f01b98ffb5..07262759cc 100644 --- a/components/viz/service/frame_sinks/frame_sink_bundle_impl.cc +++ b/components/viz/service/frame_sinks/frame_sink_bundle_impl.cc @@ -4,15 +4,12 @@ #include "components/viz/service/frame_sinks/frame_sink_bundle_impl.h" -#include #include #include #include "base/check.h" #include "base/functional/bind.h" -#include "base/memory/raw_ptr.h" #include "base/memory/raw_ref.h" -#include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "components/viz/service/frame_sinks/compositor_frame_sink_impl.h" #include "components/viz/service/frame_sinks/frame_sink_manager_impl.h" @@ -48,10 +45,6 @@ class FrameSinkBundleImpl::SinkGroup : public BeginFrameObserver { bool IsEmpty() const { return frame_sinks_.empty(); } - base::WeakPtr GetWeakPtr() { - return weak_ptr_factory_.GetWeakPtr(); - } - void AddFrameSink(uint32_t sink_id) { frame_sinks_.insert(sink_id); @@ -211,8 +204,6 @@ class FrameSinkBundleImpl::SinkGroup : public BeginFrameObserver { std::set unacked_submissions_; BeginFrameArgs last_used_begin_frame_args_; - - base::WeakPtrFactory weak_ptr_factory_{this}; }; FrameSinkBundleImpl::FrameSinkBundleImpl( @@ -283,7 +274,7 @@ void FrameSinkBundleImpl::SetNeedsBeginFrame(uint32_t sink_id, void FrameSinkBundleImpl::Submit( std::vector submissions) { - std::map, base::WeakPtr> affected_groups; + std::set affected_groups; // Count the frame submissions before processing anything. This ensures that // any frames submitted here will be acked together in a batch, and not acked // individually in case they happen to ack synchronously within @@ -296,7 +287,7 @@ void FrameSinkBundleImpl::Submit( if (submission->data->is_frame()) { if (auto* group = GetSinkGroup(submission->sink_id)) { group->WillSubmitFrame(submission->sink_id); - affected_groups.emplace(group, group->GetWeakPtr()); + affected_groups.insert(group); } } } @@ -326,10 +317,8 @@ void FrameSinkBundleImpl::Submit( } } - for (const auto& [unsafe_group, weak_group] : affected_groups) { - if (weak_group) { - weak_group->FlushMessages(); - } + for (auto* group : affected_groups) { + group->FlushMessages(); } } -- Gitee