fixup! Added switch for single renderer process 25/320425/8
authorsidpaswan <s.paswan@samsung.com>
Fri, 7 Mar 2025 11:30:25 +0000 (17:00 +0530)
committerBot Blink <blinkbot@samsung.com>
Fri, 11 Apr 2025 07:50:14 +0000 (07:50 +0000)
A new BrowserContext is created when adding new profile/launching
incognito window, and the new BrowserContext's storage partition
should be the same with render process host, for it to reuse the
existing render process host. If not, we need to create a new render
process host.

Change-Id: I200ddf0aba12679de0ceafb76664c29ece0e1ef5
Signed-off-by: sidpaswan <s.paswan@samsung.com>
Signed-off-by: uzair <uzair.jaleel@samsung.com>
content/browser/renderer_host/render_process_host_impl.cc

index 352cdcf279140e1c6e83d4af55b1d6422016b4f3..5aa8430f5b6c309852e475e28eb575eaef06f47a 100644 (file)
@@ -4835,6 +4835,22 @@ RenderProcessHost* RenderProcessHostImpl::GetProcessHostForSiteInstance(
     }
   }
 
+#if BUILDFLAG(IS_TIZEN)
+  // as long as browser context is same we can re-use existing renderers but
+  // for cases like profile change ,incognito mode new browser context is
+  // created in such cases new browser context and existing render process host
+  // have different storage partition hence for such scenarios we allow the
+  // creation of new render process host to adhere to current chromium design.
+  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kSingleRendererProcess)) {
+    if (render_process_host &&
+        !render_process_host->InSameStoragePartition(
+            browser_context->GetStoragePartition(site_instance, false))) {
+      render_process_host = nullptr;
+    }
+  }
+#endif
+
   // If we found a process to reuse, double-check that it is suitable for
   // |site_instance|. For example, if the SiteInfo for |site_instance| requires
   // a dedicated process, we should never pick a process used by, or locked to,