| OLD | NEW |
| 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 void RenderProcessHostImpl::AddRoute(int32_t routing_id, | 1169 void RenderProcessHostImpl::AddRoute(int32_t routing_id, |
| 1170 IPC::Listener* listener) { | 1170 IPC::Listener* listener) { |
| 1171 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " | 1171 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " |
| 1172 << routing_id; | 1172 << routing_id; |
| 1173 listeners_.AddWithID(listener, routing_id); | 1173 listeners_.AddWithID(listener, routing_id); |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 void RenderProcessHostImpl::RemoveRoute(int32_t routing_id) { | 1176 void RenderProcessHostImpl::RemoveRoute(int32_t routing_id) { |
| 1177 DCHECK(listeners_.Lookup(routing_id) != NULL); | 1177 DCHECK(listeners_.Lookup(routing_id) != NULL); |
| 1178 listeners_.Remove(routing_id); | 1178 listeners_.Remove(routing_id); |
| 1179 | 1179 Cleanup(); |
| 1180 // Keep the one renderer thread around forever in single process mode. | |
| 1181 if (!run_renderer_in_process()) | |
| 1182 Cleanup(); | |
| 1183 } | 1180 } |
| 1184 | 1181 |
| 1185 void RenderProcessHostImpl::AddObserver(RenderProcessHostObserver* observer) { | 1182 void RenderProcessHostImpl::AddObserver(RenderProcessHostObserver* observer) { |
| 1186 observers_.AddObserver(observer); | 1183 observers_.AddObserver(observer); |
| 1187 } | 1184 } |
| 1188 | 1185 |
| 1189 void RenderProcessHostImpl::RemoveObserver( | 1186 void RenderProcessHostImpl::RemoveObserver( |
| 1190 RenderProcessHostObserver* observer) { | 1187 RenderProcessHostObserver* observer) { |
| 1191 observers_.RemoveObserver(observer); | 1188 observers_.RemoveObserver(observer); |
| 1192 } | 1189 } |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 | 1803 |
| 1807 void RenderProcessHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { | 1804 void RenderProcessHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { |
| 1808 ignore_input_events_ = ignore_input_events; | 1805 ignore_input_events_ = ignore_input_events; |
| 1809 } | 1806 } |
| 1810 | 1807 |
| 1811 bool RenderProcessHostImpl::IgnoreInputEvents() const { | 1808 bool RenderProcessHostImpl::IgnoreInputEvents() const { |
| 1812 return ignore_input_events_; | 1809 return ignore_input_events_; |
| 1813 } | 1810 } |
| 1814 | 1811 |
| 1815 void RenderProcessHostImpl::Cleanup() { | 1812 void RenderProcessHostImpl::Cleanup() { |
| 1813 // Keep the one renderer thread around forever in single process mode. |
| 1814 if (run_renderer_in_process()) |
| 1815 return; |
| 1816 |
| 1816 // If within_process_died_observer_ is true, one of our observers performed an | 1817 // If within_process_died_observer_ is true, one of our observers performed an |
| 1817 // action that caused us to die (e.g. http://crbug.com/339504). Therefore, | 1818 // action that caused us to die (e.g. http://crbug.com/339504). Therefore, |
| 1818 // delay the destruction until all of the observer callbacks have been made, | 1819 // delay the destruction until all of the observer callbacks have been made, |
| 1819 // and guarantee that the RenderProcessHostDestroyed observer callback is | 1820 // and guarantee that the RenderProcessHostDestroyed observer callback is |
| 1820 // always the last callback fired. | 1821 // always the last callback fired. |
| 1821 if (within_process_died_observer_) { | 1822 if (within_process_died_observer_) { |
| 1822 delayed_cleanup_needed_ = true; | 1823 delayed_cleanup_needed_ = true; |
| 1823 return; | 1824 return; |
| 1824 } | 1825 } |
| 1825 delayed_cleanup_needed_ = false; | 1826 delayed_cleanup_needed_ = false; |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2780 | 2781 |
| 2781 // Skip widgets in other processes. | 2782 // Skip widgets in other processes. |
| 2782 if (rvh->GetProcess()->GetID() != GetID()) | 2783 if (rvh->GetProcess()->GetID() != GetID()) |
| 2783 continue; | 2784 continue; |
| 2784 | 2785 |
| 2785 rvh->OnWebkitPreferencesChanged(); | 2786 rvh->OnWebkitPreferencesChanged(); |
| 2786 } | 2787 } |
| 2787 } | 2788 } |
| 2788 | 2789 |
| 2789 } // namespace content | 2790 } // namespace content |
| OLD | NEW |