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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2760733002: Check for already existing entry when adding to SiteProcessMap. (Closed)
Patch Set: Restore ordering of test cases in webRequestBlocking. Created 3 years, 9 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 | « content/browser/frame_host/navigator_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index a9c2314efe81b1ec63a27eeed6b3a28f3a458843..67298e50e9cc42b8202596de8d955afc2b42bfd7 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -335,7 +335,13 @@ class SiteProcessMap : public base::SupportsUserData::Data {
SiteProcessMap() {}
void RegisterProcess(const std::string& site, RenderProcessHost* process) {
- map_[site] = process;
+ // There could already exist a site to process mapping due to races between
+ // two WebContents with blank SiteInstances. If that occurs, keeping the
+ // exising entry and not overwriting it is a predictable behavior that is
+ // safe.
+ SiteToProcessMap::iterator i = map_.find(site);
+ if (i == map_.end())
+ map_[site] = process;
}
RenderProcessHost* FindProcess(const std::string& site) {
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698