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

Unified Diff: chrome/browser/ui/search/search_ipc_router.cc

Issue 2677013004: SearchIPCRouter: Invalidate cached connection ID on renderer crash (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_ipc_router.cc
diff --git a/chrome/browser/ui/search/search_ipc_router.cc b/chrome/browser/ui/search/search_ipc_router.cc
index 2dcba5b33f323cc35d6a805463fd113e78a82cdc..f3b2e238dee25672b6225e899667d6d04b8377e4 100644
--- a/chrome/browser/ui/search/search_ipc_router.cc
+++ b/chrome/browser/ui/search/search_ipc_router.cc
@@ -41,6 +41,8 @@ class SearchBoxClientFactoryImpl
chrome::mojom::SearchBox* GetSearchBox() override;
private:
+ void OnConnectionError();
+
content::WebContents* web_contents_;
chrome::mojom::SearchBoxAssociatedPtr search_box_;
@@ -60,6 +62,9 @@ chrome::mojom::SearchBox* SearchBoxClientFactoryImpl::GetSearchBox() {
if (id != last_connected_rfh_) {
if (IsRenderedInInstantProcess(web_contents_)) {
frame->GetRemoteAssociatedInterfaces()->GetInterface(&search_box_);
+ search_box_.set_connection_error_handler(
+ base::Bind(&SearchBoxClientFactoryImpl::OnConnectionError,
+ base::Unretained(this)));
} else {
// Renderer is not an instant process. We'll create a connection that
// drops all messages.
@@ -70,6 +75,13 @@ chrome::mojom::SearchBox* SearchBoxClientFactoryImpl::GetSearchBox() {
return search_box_.get();
}
+void SearchBoxClientFactoryImpl::OnConnectionError() {
+ search_box_.reset();
+ last_connected_rfh_ = std::make_pair(
+ content::ChildProcessHost::kInvalidUniqueID,
+ MSG_ROUTING_NONE);
+}
+
} // namespace
SearchIPCRouter::SearchIPCRouter(content::WebContents* web_contents,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698