Check key via ContainsKey instead of null check
This commit is contained in:
parent
974415f8a1
commit
ffdf2f7fcf
1 changed files with 10 additions and 8 deletions
|
@ -80,16 +80,18 @@ void WebViewManager::AddGuest(int guest_instance_id,
|
|||
}
|
||||
|
||||
void WebViewManager::RemoveGuest(int guest_instance_id) {
|
||||
if (!ContainsKey(web_contents_map_, guest_instance_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto web_contents = web_contents_map_[guest_instance_id].web_contents;
|
||||
|
||||
if (web_contents) {
|
||||
content::BrowserThread::PostTask(
|
||||
content::BrowserThread::IO, FROM_HERE,
|
||||
base::Bind(
|
||||
&WebViewRendererState::RemoveGuest,
|
||||
base::Unretained(WebViewRendererState::GetInstance()),
|
||||
web_contents->GetRenderProcessHost()->GetID()));
|
||||
}
|
||||
content::BrowserThread::PostTask(
|
||||
content::BrowserThread::IO, FROM_HERE,
|
||||
base::Bind(
|
||||
&WebViewRendererState::RemoveGuest,
|
||||
base::Unretained(WebViewRendererState::GetInstance()),
|
||||
web_contents->GetRenderProcessHost()->GetID()));
|
||||
|
||||
web_contents_map_.erase(guest_instance_id);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue