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

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

Issue 2739193004: Check for already existing entry when adding to SiteProcessMap. (Closed)
Patch Set: Add extra comment. 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 2c48d780f0fd99df89d492dc61abe6e947cd9d78..2440b60ad6c5b91fe1fa50f61035ad01514021b6 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -333,7 +333,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