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

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

Issue 2944603002: Fix nullptr dereference of a RenderProcessHost (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | 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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 const GURL& site_url, 688 const GURL& site_url,
689 std::set<RenderProcessHost*>* foreground_processes, 689 std::set<RenderProcessHost*>* foreground_processes,
690 std::set<RenderProcessHost*>* background_processes) { 690 std::set<RenderProcessHost*>* background_processes) {
691 auto result = map_.find(site_url); 691 auto result = map_.find(site_url);
692 if (result == map_.end()) 692 if (result == map_.end())
693 return; 693 return;
694 694
695 std::map<ProcessID, Count>& counts_per_process = result->second; 695 std::map<ProcessID, Count>& counts_per_process = result->second;
696 for (auto iter : counts_per_process) { 696 for (auto iter : counts_per_process) {
697 RenderProcessHost* host = RenderProcessHost::FromID(iter.first); 697 RenderProcessHost* host = RenderProcessHost::FromID(iter.first);
698 DCHECK(host); 698 if (!host) {
699 // TODO(clamy): This shouldn't happen but we are getting reports from
700 // the field that this is happening. We need to figure out why some
701 // RenderProcessHosts are not taken out of the map when they're
702 // destroyed.
703 NOTREACHED();
704 continue;
705 }
699 if (host->VisibleWidgetCount()) 706 if (host->VisibleWidgetCount())
700 foreground_processes->insert(host); 707 foreground_processes->insert(host);
701 else 708 else
702 background_processes->insert(host); 709 background_processes->insert(host);
703 } 710 }
704 } 711 }
705 712
706 private: 713 private:
707 void RenderProcessHostDestroyed(RenderProcessHost* host) override { 714 void RenderProcessHostDestroyed(RenderProcessHost* host) override {
708 #ifndef NDEBUG 715 #ifndef NDEBUG
(...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after
3629 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3636 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3630 3637
3631 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3638 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3632 // Capture the error message in a crash key value. 3639 // Capture the error message in a crash key value.
3633 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3640 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3634 bad_message::ReceivedBadMessage(render_process_id, 3641 bad_message::ReceivedBadMessage(render_process_id,
3635 bad_message::RPH_MOJO_PROCESS_ERROR); 3642 bad_message::RPH_MOJO_PROCESS_ERROR);
3636 } 3643 }
3637 3644
3638 } // namespace content 3645 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698