Remove the race condition between new process creation and context release (#12342)

* Remove the race condition between new process creation and old process releasing remote context

Previously there was a race condition where the getId() method would return the new context ID even
though the release was for the old context.  This changes it to send the "initial" context ID with
the release message to ensure there is no race.

* fetch context ID from remote in sandbox mode
This commit is contained in:
Samuel Attard 2018-03-20 15:54:47 +11:00 committed by GitHub
parent 9599615b23
commit 0ac883c6d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 6 deletions

View file

@ -1033,13 +1033,17 @@ void WebContents::NavigationEntryCommitted(
details.is_same_document, details.did_replace_entry);
}
int64_t WebContents::GetID() const {
int64_t process_id = web_contents()->GetRenderProcessHost()->GetID();
int64_t routing_id = web_contents()->GetRenderViewHost()->GetRoutingID();
int64_t WebContents::GetIDForContents(content::WebContents* web_contents) {
int64_t process_id = web_contents->GetRenderProcessHost()->GetID();
int64_t routing_id = web_contents->GetMainFrame()->GetRoutingID();
int64_t rv = (process_id << 32) + routing_id;
return rv;
}
int64_t WebContents::GetID() const {
return WebContents::GetIDForContents(web_contents());
}
int WebContents::GetProcessID() const {
return web_contents()->GetRenderProcessHost()->GetID();
}