Thanks for the reply, but to be honest, I am feeling confused about your answer.
I was thinking of the flow like:
1. Both WebContents and GlobalRenderFrameHostId are stored with DownloadItemData::Attach.
2. In case of GetWebContents call, WebContents will be obtained from stored GlobalRenderFrameHostId.
3. Step 2. failed to get the WebContents, GetWebContents returns WebContents stored in Step 1.
If WebContents stored in the Step 1 and WebContents obtained from GlobalRenderFrameHostId always match, why do we need to store RFH id in addition to WC? I may misunderstand what you meant with "In that case, we'd need the download item data to have both the WC and the RFH id.", though.
As far as I understand, the linked crbug might want to prevent people from using GetMainFrame to get the active RFH. To make this CL aligned with the crbug, I wonder if we can keep GetWebContents function itself because it may lead to misuse of WebContents by getting RFH from given WebContents. With the scenario, GetWebContents function will be deprecated and GetGlobalRenderFrameHostId function would be newly made. Callers of GetGlobalRenderFrameHostId can convert returned RFH id to WC if they want. In that case, we break code that relies on the download item outliving the RFH.
Can I ask again what is expected to be stored with DownloadItemData::Attach and why?
Thank you,
Yoshisato.