ContentSettingBubbleModel: ensure destruction on WebContentsDestroyed
ContentSettingBubbleContents owns the underlying bubble model. It is also a WebContentsObserver. This CL destroys the bubble model in WebContentsDestroyed, which allows the model to avoid paranoid null checking throughout the code. In the process, we also remove: 1. Notification observation about profile / web contents destruction. The profile should be alive as long as the web contents. 2. Storing the profile directly and accessing the raw ptr. Instead, just pull it off the web contents. One subtle thing about this patch. On WebContentsDestroyed, we do not synchronously destroy the underlying ContentSettingBubbleContents, instead, we synchronously hide it and post a task which actually deletes it. This means we need to be careful about properly null checking the content_setting_bubble_model_. Thankfully, we can assume that event listeners are not invoked on hidden widgets. Bug: None Change-Id: I0a1ff38a705ace8a9898a4c89f81d51d8474b4da Reviewed-on: https://chromium-review.googlesource.com/c/1334097 Commit-Queue: Charlie Harrison <csharrison@chromium.org> Reviewed-by:Balazs Engedy <engedy@chromium.org> Reviewed-by:
Avi Drissman <avi@chromium.org> Reviewed-by:
Robert Liao <robliao@chromium.org> Cr-Commit-Position: refs/heads/master@{#610852}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment