Commit 18a9915d authored by jochen@chromium.org's avatar jochen@chromium.org

[content shell] protect against the case when a RPH dies before the process launched

e.g.
http/tests/xmlhttprequest/access-control-repeated-failed-preflight-crash.html
quickly opens and closes the devtools. If a new RPH is then created and happens
to be at the same location, we'll register twice for the process created
notification.

BUG=111316
R=marja@chromium.org

Review URL: https://chromiumcodereview.appspot.com/16023012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202465 0039d316-1c4b-4281-b951-d872f2087c98
parent 0627dc69
...@@ -91,6 +91,9 @@ void ShellContentBrowserClient::RenderProcessHostCreated( ...@@ -91,6 +91,9 @@ void ShellContentBrowserClient::RenderProcessHostCreated(
registrar_.Add(this, registrar_.Add(this,
NOTIFICATION_RENDERER_PROCESS_CREATED, NOTIFICATION_RENDERER_PROCESS_CREATED,
Source<RenderProcessHost>(host)); Source<RenderProcessHost>(host));
registrar_.Add(this,
NOTIFICATION_RENDERER_PROCESS_TERMINATED,
Source<RenderProcessHost>(host));
} }
net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext(
...@@ -212,6 +215,9 @@ void ShellContentBrowserClient::Observe(int type, ...@@ -212,6 +215,9 @@ void ShellContentBrowserClient::Observe(int type,
registrar_.Remove(this, registrar_.Remove(this,
NOTIFICATION_RENDERER_PROCESS_CREATED, NOTIFICATION_RENDERER_PROCESS_CREATED,
source); source);
registrar_.Remove(this,
NOTIFICATION_RENDERER_PROCESS_TERMINATED,
source);
if (hyphen_dictionary_file_ != base::kInvalidPlatformFileValue) { if (hyphen_dictionary_file_ != base::kInvalidPlatformFileValue) {
RenderProcessHost* host = Source<RenderProcessHost>(source).ptr(); RenderProcessHost* host = Source<RenderProcessHost>(source).ptr();
IPC::PlatformFileForTransit file = IPC::GetFileHandleForProcess( IPC::PlatformFileForTransit file = IPC::GetFileHandleForProcess(
...@@ -221,6 +227,16 @@ void ShellContentBrowserClient::Observe(int type, ...@@ -221,6 +227,16 @@ void ShellContentBrowserClient::Observe(int type,
break; break;
} }
case NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
registrar_.Remove(this,
NOTIFICATION_RENDERER_PROCESS_CREATED,
source);
registrar_.Remove(this,
NOTIFICATION_RENDERER_PROCESS_TERMINATED,
source);
break;
}
default: default:
NOTREACHED(); NOTREACHED();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment