Commit ed8084c1 authored by Weilun Shi's avatar Weilun Shi Committed by Commit Bot

[NTP] Make sure the renderer belong to that profile

When there are multiply profiles opened at the same time. The renderer
creation process will be called multiple times which might cause
incorrect behavior. Make sure the renderer created only for the
corresponding profile.

Bug: 847606
Change-Id: I4d47d22220cab2197ad59feedacd3e6a5bc0dabb
Reviewed-on: https://chromium-review.googlesource.com/1229193Reviewed-by: default avatarKristi Park <kristipark@chromium.org>
Commit-Queue: Weilun Shi <sweilun@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592140}
parent f32840cf
......@@ -420,14 +420,24 @@ void InstantService::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case content::NOTIFICATION_RENDERER_PROCESS_CREATED:
SendNewTabPageURLToRenderer(
content::Source<content::RenderProcessHost>(source).ptr());
case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
content::RenderProcessHost* rph =
content::Source<content::RenderProcessHost>(source).ptr();
Profile* renderer_profile =
static_cast<Profile*>(rph->GetBrowserContext());
if (profile_ == renderer_profile)
SendNewTabPageURLToRenderer(rph);
break;
case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED:
OnRendererProcessTerminated(
content::Source<content::RenderProcessHost>(source)->GetID());
}
case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
content::RenderProcessHost* rph =
content::Source<content::RenderProcessHost>(source).ptr();
Profile* renderer_profile =
static_cast<Profile*>(rph->GetBrowserContext());
if (profile_ == renderer_profile)
OnRendererProcessTerminated(rph->GetID());
break;
}
case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
BuildThemeInfo();
NotifyAboutThemeInfo();
......
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