Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 1232603002: This patch improves the way that GuestViewManager tracks the destruction of GuestView embedders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment by kalman@. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/guest_view/web_view/web_view_guest.cc
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc
index 1ee9252e392997ae23c48fd33d4073ef38bcbff1..841bcc59838394f29ea78333f319099483748338 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest.cc
+++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -197,20 +197,11 @@ static base::LazyInstance<WebViewKeyToIDMap> web_view_key_to_id_map =
} // namespace
// static
-void WebViewGuest::CleanUp(int embedder_process_id, int view_instance_id) {
- GuestViewBase::CleanUp(embedder_process_id, view_instance_id);
-
- auto rph = content::RenderProcessHost::FromID(embedder_process_id);
- // TODO(paulmeyer): It should be impossible for rph to be nullptr here, but
- // this check is needed here for now as there seems to be occasional crashes
- // because of this (http//crbug.com/499438). This should be removed once the
- // cause is discovered and fixed.
- DCHECK(rph != nullptr)
- << "Cannot find RenderProcessHost for embedder process ID# "
- << embedder_process_id;
- if (rph == nullptr)
- return;
- auto browser_context = rph->GetBrowserContext();
+void WebViewGuest::CleanUp(content::BrowserContext* browser_context,
+ int embedder_process_id,
+ int view_instance_id) {
+ GuestViewBase::CleanUp(browser_context, embedder_process_id,
+ view_instance_id);
// Clean up rules registries for the WebView.
WebViewKey key(embedder_process_id, view_instance_id);
@@ -218,8 +209,10 @@ void WebViewGuest::CleanUp(int embedder_process_id, int view_instance_id) {
if (it != web_view_key_to_id_map.Get().end()) {
auto rules_registry_id = it->second;
web_view_key_to_id_map.Get().erase(it);
- RulesRegistryService::Get(browser_context)
- ->RemoveRulesRegistriesByID(rules_registry_id);
+ RulesRegistryService* rrs =
+ RulesRegistryService::GetIfExists(browser_context);
+ if (rrs)
+ rrs->RemoveRulesRegistriesByID(rules_registry_id);
}
// Clean up web request event listeners for the WebView.
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698