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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "content/browser/browser_main.h" 10 #include "content/browser/browser_main.h"
11 #include "content/browser/browser_thread.h" 11 #include "content/browser/browser_thread.h"
12 #include "content/browser/child_process_security_policy.h" 12 #include "content/browser/child_process_security_policy.h"
13 #include "content/browser/webui/web_ui_factory.h" 13 #include "content/browser/webui/web_ui_factory.h"
14 #include "content/common/child_process_info.h" 14 #include "content/common/child_process_info.h"
15 #include "content/common/content_constants.h" 15 #include "content/common/content_constants.h"
16 #include "content/common/notification_service.h"
17 #include "content/public/browser/content_browser_client.h" 16 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
19 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
20 20
21 namespace { 21 namespace {
22 22
23 size_t max_renderer_count_override = 0; 23 size_t max_renderer_count_override = 0;
24 24
25 size_t GetMaxRendererProcessCount() { 25 size_t GetMaxRendererProcessCount() {
26 if (max_renderer_count_override) 26 if (max_renderer_count_override)
27 return max_renderer_count_override; 27 return max_renderer_count_override;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // dumping handles and sends us ChildProcessHostMsg_DumpHandlesDone. 142 // dumping handles and sends us ChildProcessHostMsg_DumpHandlesDone.
143 return; 143 return;
144 } 144 }
145 #endif 145 #endif
146 Cleanup(); 146 Cleanup();
147 } 147 }
148 148
149 void RenderProcessHost::Cleanup() { 149 void RenderProcessHost::Cleanup() {
150 // When no other owners of this object, we can delete ourselves 150 // When no other owners of this object, we can delete ourselves
151 if (listeners_.IsEmpty()) { 151 if (listeners_.IsEmpty()) {
152 NotificationService::current()->Notify( 152 content::NotificationService::current()->Notify(
153 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 153 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
154 content::Source<RenderProcessHost>(this), 154 content::Source<RenderProcessHost>(this),
155 NotificationService::NoDetails()); 155 content::NotificationService::NoDetails());
156 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 156 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
157 deleting_soon_ = true; 157 deleting_soon_ = true;
158 // It's important not to wait for the DeleteTask to delete the channel 158 // It's important not to wait for the DeleteTask to delete the channel
159 // proxy. Kill it off now. That way, in case the profile is going away, the 159 // proxy. Kill it off now. That way, in case the profile is going away, the
160 // rest of the objects attached to this RenderProcessHost start going 160 // rest of the objects attached to this RenderProcessHost start going
161 // away first, since deleting the channel proxy will post a 161 // away first, since deleting the channel proxy will post a
162 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 162 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
163 channel_.reset(); 163 channel_.reset();
164 164
165 // Remove ourself from the list of renderer processes so that we can't be 165 // Remove ourself from the list of renderer processes so that we can't be
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 // Now pick a random suitable renderer, if we have any. 238 // Now pick a random suitable renderer, if we have any.
239 if (!suitable_renderers.empty()) { 239 if (!suitable_renderers.empty()) {
240 int suitable_count = static_cast<int>(suitable_renderers.size()); 240 int suitable_count = static_cast<int>(suitable_renderers.size());
241 int random_index = base::RandInt(0, suitable_count - 1); 241 int random_index = base::RandInt(0, suitable_count - 1);
242 return suitable_renderers[random_index]; 242 return suitable_renderers[random_index];
243 } 243 }
244 244
245 return NULL; 245 return NULL;
246 } 246 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/browser/renderer_host/render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698