Commit c036f14b authored by Chris Lu's avatar Chris Lu Committed by Chromium LUCI CQ

[ios] Remove delegate reset in OverlayPresenterImpl::OverlayWasDismissed

OverlayPresenterImpl's |detached_presenting_request_queue_| is
used to receive the OverlayRequestRemoved() delegate callback to
extend the lifetime of the request being removed to
OverlayPresenterImpl::OverlayWasDismissed in the instance
of a presenting WebState being detached. However, this pointer
does not guarantee the continued existence of the
|detached_presenting_request_queue_|. In addition, in this callback,
there is no need to reset the delegate since OverlayPresenterImpl
doesn't need to listen for OverlayRequestRemoved() anymore with
|presented_request_| being reset in this callback.

Bug: 1155138
Change-Id: Ie5ec9b3ee1fe85484ab51919e5f9656e3351f41b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2575318Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835313}
parent 165711ee
...@@ -311,11 +311,8 @@ void OverlayPresenterImpl::OverlayWasDismissed( ...@@ -311,11 +311,8 @@ void OverlayPresenterImpl::OverlayWasDismissed(
// The OverlayPresenter remains as the delegate for // The OverlayPresenter remains as the delegate for
// |detached_presenting_request_queue_| to ensure that |presented_request_| is // |detached_presenting_request_queue_| to ensure that |presented_request_| is
// not deleted before the dismissal of its UI is finished. Since the UI is // not deleted before the dismissal of its UI is finished. Since the UI is
// now being dismissed, the delegate can be reset. // now being dismissed, this reference is not needed anymore.
if (detached_presenting_request_queue_) { detached_presenting_request_queue_ = nullptr;
detached_presenting_request_queue_->SetDelegate(nullptr);
detached_presenting_request_queue_ = nullptr;
}
// Notify the observers that the overlay UI was hidden. // Notify the observers that the overlay UI was hidden.
for (auto& observer : observers_) { for (auto& observer : observers_) {
......
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