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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 LAZY_INSTANCE_INITIALIZER; 328 LAZY_INSTANCE_INITIALIZER;
329 329
330 // Map of site to process, to ensure we only have one RenderProcessHost per 330 // Map of site to process, to ensure we only have one RenderProcessHost per
331 // site in process-per-site mode. Each map is specific to a BrowserContext. 331 // site in process-per-site mode. Each map is specific to a BrowserContext.
332 class SiteProcessMap : public base::SupportsUserData::Data { 332 class SiteProcessMap : public base::SupportsUserData::Data {
333 public: 333 public:
334 typedef base::hash_map<std::string, RenderProcessHost*> SiteToProcessMap; 334 typedef base::hash_map<std::string, RenderProcessHost*> SiteToProcessMap;
335 SiteProcessMap() {} 335 SiteProcessMap() {}
336 336
337 void RegisterProcess(const std::string& site, RenderProcessHost* process) { 337 void RegisterProcess(const std::string& site, RenderProcessHost* process) {
338 map_[site] = process; 338 // There could already exist a site to process mapping due to races between
339 // two WebContents with blank SiteInstances. If that occurs, keeping the
340 // exising entry and not overwriting it is a predictable behavior that is
341 // safe.
342 SiteToProcessMap::iterator i = map_.find(site);
343 if (i == map_.end())
344 map_[site] = process;
339 } 345 }
340 346
341 RenderProcessHost* FindProcess(const std::string& site) { 347 RenderProcessHost* FindProcess(const std::string& site) {
342 SiteToProcessMap::iterator i = map_.find(site); 348 SiteToProcessMap::iterator i = map_.find(site);
343 if (i != map_.end()) 349 if (i != map_.end())
344 return i->second; 350 return i->second;
345 return NULL; 351 return NULL;
346 } 352 }
347 353
348 void RemoveProcess(RenderProcessHost* host) { 354 void RemoveProcess(RenderProcessHost* host) {
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3092 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3087 3093
3088 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3094 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3089 // Capture the error message in a crash key value. 3095 // Capture the error message in a crash key value.
3090 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3096 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3091 bad_message::ReceivedBadMessage(render_process_id, 3097 bad_message::ReceivedBadMessage(render_process_id,
3092 bad_message::RPH_MOJO_PROCESS_ERROR); 3098 bad_message::RPH_MOJO_PROCESS_ERROR);
3093 } 3099 }
3094 3100
3095 } // namespace content 3101 } // namespace content
OLDNEW
« 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