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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2749543004: Revert of Check for already existing entry when adding to SiteProcessMap. (Closed)
Patch Set: 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 LAZY_INSTANCE_INITIALIZER; 326 LAZY_INSTANCE_INITIALIZER;
327 327
328 // Map of site to process, to ensure we only have one RenderProcessHost per 328 // Map of site to process, to ensure we only have one RenderProcessHost per
329 // site in process-per-site mode. Each map is specific to a BrowserContext. 329 // site in process-per-site mode. Each map is specific to a BrowserContext.
330 class SiteProcessMap : public base::SupportsUserData::Data { 330 class SiteProcessMap : public base::SupportsUserData::Data {
331 public: 331 public:
332 typedef base::hash_map<std::string, RenderProcessHost*> SiteToProcessMap; 332 typedef base::hash_map<std::string, RenderProcessHost*> SiteToProcessMap;
333 SiteProcessMap() {} 333 SiteProcessMap() {}
334 334
335 void RegisterProcess(const std::string& site, RenderProcessHost* process) { 335 void RegisterProcess(const std::string& site, RenderProcessHost* process) {
336 // There could already exist a site to process mapping due to races between 336 map_[site] = process;
337 // two WebContents with blank SiteInstances. If that occurs, keeping the
338 // exising entry and not overwriting it is a predictable behavior that is
339 // safe.
340 SiteToProcessMap::iterator i = map_.find(site);
341 if (i == map_.end())
342 map_[site] = process;
343 } 337 }
344 338
345 RenderProcessHost* FindProcess(const std::string& site) { 339 RenderProcessHost* FindProcess(const std::string& site) {
346 SiteToProcessMap::iterator i = map_.find(site); 340 SiteToProcessMap::iterator i = map_.find(site);
347 if (i != map_.end()) 341 if (i != map_.end())
348 return i->second; 342 return i->second;
349 return NULL; 343 return NULL;
350 } 344 }
351 345
352 void RemoveProcess(RenderProcessHost* host) { 346 void RemoveProcess(RenderProcessHost* host) {
(...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3066 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3073 3067
3074 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3068 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3075 // Capture the error message in a crash key value. 3069 // Capture the error message in a crash key value.
3076 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3070 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3077 bad_message::ReceivedBadMessage(render_process_id, 3071 bad_message::ReceivedBadMessage(render_process_id,
3078 bad_message::RPH_MOJO_PROCESS_ERROR); 3072 bad_message::RPH_MOJO_PROCESS_ERROR);
3079 } 3073 }
3080 3074
3081 } // namespace content 3075 } // 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