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

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

Issue 2036743002: [Merge M52] Avoid deleting RenderProcessHostImpl for in-process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 void RenderProcessHostImpl::AddRoute(int32_t routing_id, 1128 void RenderProcessHostImpl::AddRoute(int32_t routing_id,
1129 IPC::Listener* listener) { 1129 IPC::Listener* listener) {
1130 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " 1130 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: "
1131 << routing_id; 1131 << routing_id;
1132 listeners_.AddWithID(listener, routing_id); 1132 listeners_.AddWithID(listener, routing_id);
1133 } 1133 }
1134 1134
1135 void RenderProcessHostImpl::RemoveRoute(int32_t routing_id) { 1135 void RenderProcessHostImpl::RemoveRoute(int32_t routing_id) {
1136 DCHECK(listeners_.Lookup(routing_id) != NULL); 1136 DCHECK(listeners_.Lookup(routing_id) != NULL);
1137 listeners_.Remove(routing_id); 1137 listeners_.Remove(routing_id);
1138 1138 Cleanup();
1139 // Keep the one renderer thread around forever in single process mode.
1140 if (!run_renderer_in_process())
1141 Cleanup();
1142 } 1139 }
1143 1140
1144 void RenderProcessHostImpl::AddObserver(RenderProcessHostObserver* observer) { 1141 void RenderProcessHostImpl::AddObserver(RenderProcessHostObserver* observer) {
1145 observers_.AddObserver(observer); 1142 observers_.AddObserver(observer);
1146 } 1143 }
1147 1144
1148 void RenderProcessHostImpl::RemoveObserver( 1145 void RenderProcessHostImpl::RemoveObserver(
1149 RenderProcessHostObserver* observer) { 1146 RenderProcessHostObserver* observer) {
1150 observers_.RemoveObserver(observer); 1147 observers_.RemoveObserver(observer);
1151 } 1148 }
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 1793
1797 void RenderProcessHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { 1794 void RenderProcessHostImpl::SetIgnoreInputEvents(bool ignore_input_events) {
1798 ignore_input_events_ = ignore_input_events; 1795 ignore_input_events_ = ignore_input_events;
1799 } 1796 }
1800 1797
1801 bool RenderProcessHostImpl::IgnoreInputEvents() const { 1798 bool RenderProcessHostImpl::IgnoreInputEvents() const {
1802 return ignore_input_events_; 1799 return ignore_input_events_;
1803 } 1800 }
1804 1801
1805 void RenderProcessHostImpl::Cleanup() { 1802 void RenderProcessHostImpl::Cleanup() {
1803 // Keep the one renderer thread around forever in single process mode.
1804 if (run_renderer_in_process())
1805 return;
1806
1806 // If within_process_died_observer_ is true, one of our observers performed an 1807 // If within_process_died_observer_ is true, one of our observers performed an
1807 // action that caused us to die (e.g. http://crbug.com/339504). Therefore, 1808 // action that caused us to die (e.g. http://crbug.com/339504). Therefore,
1808 // delay the destruction until all of the observer callbacks have been made, 1809 // delay the destruction until all of the observer callbacks have been made,
1809 // and guarantee that the RenderProcessHostDestroyed observer callback is 1810 // and guarantee that the RenderProcessHostDestroyed observer callback is
1810 // always the last callback fired. 1811 // always the last callback fired.
1811 if (within_process_died_observer_) { 1812 if (within_process_died_observer_) {
1812 delayed_cleanup_needed_ = true; 1813 delayed_cleanup_needed_ = true;
1813 return; 1814 return;
1814 } 1815 }
1815 delayed_cleanup_needed_ = false; 1816 delayed_cleanup_needed_ = false;
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 2764
2764 // Skip widgets in other processes. 2765 // Skip widgets in other processes.
2765 if (rvh->GetProcess()->GetID() != GetID()) 2766 if (rvh->GetProcess()->GetID() != GetID())
2766 continue; 2767 continue;
2767 2768
2768 rvh->OnWebkitPreferencesChanged(); 2769 rvh->OnWebkitPreferencesChanged();
2769 } 2770 }
2770 } 2771 }
2771 2772
2772 } // namespace content 2773 } // 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