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) {
|
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;
|
auto web_contents = web_contents_map_[guest_instance_id].web_contents;
|
||||||
|
|
||||||
if (web_contents) {
|
|
||||||
content::BrowserThread::PostTask(
|
content::BrowserThread::PostTask(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
content::BrowserThread::IO, FROM_HERE,
|
||||||
base::Bind(
|
base::Bind(
|
||||||
&WebViewRendererState::RemoveGuest,
|
&WebViewRendererState::RemoveGuest,
|
||||||
base::Unretained(WebViewRendererState::GetInstance()),
|
base::Unretained(WebViewRendererState::GetInstance()),
|
||||||
web_contents->GetRenderProcessHost()->GetID()));
|
web_contents->GetRenderProcessHost()->GetID()));
|
||||||
}
|
|
||||||
|
|
||||||
web_contents_map_.erase(guest_instance_id);
|
web_contents_map_.erase(guest_instance_id);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue