| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/browser/renderer_host/render_process_host.h" | 5 #include "content/browser/renderer_host/render_process_host.h" |
| 6 | 6 |
| 7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
| 8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
| 9 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
| 10 #include "content/browser/child_process_security_policy.h" | 10 #include "content/browser/child_process_security_policy.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 << listener_id; | 123 << listener_id; |
| 124 DCHECK(listeners_.Lookup(listener_id) != NULL); | 124 DCHECK(listeners_.Lookup(listener_id) != NULL); |
| 125 listeners_.Remove(listener_id); | 125 listeners_.Remove(listener_id); |
| 126 | 126 |
| 127 // Make sure that all associated resource requests are stopped. | 127 // Make sure that all associated resource requests are stopped. |
| 128 CancelResourceRequests(listener_id); | 128 CancelResourceRequests(listener_id); |
| 129 | 129 |
| 130 // When no other owners of this object, we can delete ourselves | 130 // When no other owners of this object, we can delete ourselves |
| 131 if (listeners_.IsEmpty()) { | 131 if (listeners_.IsEmpty()) { |
| 132 NotificationService::current()->Notify( | 132 NotificationService::current()->Notify( |
| 133 NotificationType::RENDERER_PROCESS_TERMINATED, | 133 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 134 Source<RenderProcessHost>(this), NotificationService::NoDetails()); | 134 Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
| 135 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 135 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 136 deleting_soon_ = true; | 136 deleting_soon_ = true; |
| 137 | 137 |
| 138 // Remove ourself from the list of renderer processes so that we can't be | 138 // Remove ourself from the list of renderer processes so that we can't be |
| 139 // reused in between now and when the Delete task runs. | 139 // reused in between now and when the Delete task runs. |
| 140 all_hosts.Remove(id()); | 140 all_hosts.Remove(id()); |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 // Now pick a random suitable renderer, if we have any. | 210 // Now pick a random suitable renderer, if we have any. |
| 211 if (!suitable_renderers.empty()) { | 211 if (!suitable_renderers.empty()) { |
| 212 int suitable_count = static_cast<int>(suitable_renderers.size()); | 212 int suitable_count = static_cast<int>(suitable_renderers.size()); |
| 213 int random_index = base::RandInt(0, suitable_count - 1); | 213 int random_index = base::RandInt(0, suitable_count - 1); |
| 214 return suitable_renderers[random_index]; | 214 return suitable_renderers[random_index]; |
| 215 } | 215 } |
| 216 | 216 |
| 217 return NULL; | 217 return NULL; |
| 218 } | 218 } |
| OLD | NEW |