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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 9328011: Adding a command line flag to specify renderer process limit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moving function body to the .cc file. Created 8 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/string_number_conversions.h"
14 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
15 #include "content/browser/browser_thread_impl.h" 16 #include "content/browser/browser_thread_impl.h"
16 #include "content/browser/download/download_file_manager.h" 17 #include "content/browser/download/download_file_manager.h"
17 #include "content/browser/download/save_file_manager.h" 18 #include "content/browser/download/save_file_manager.h"
18 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 19 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
19 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 20 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
20 #include "content/browser/in_process_webkit/webkit_thread.h" 21 #include "content/browser/in_process_webkit/webkit_thread.h"
21 #include "content/browser/plugin_service_impl.h" 22 #include "content/browser/plugin_service_impl.h"
22 #include "content/browser/renderer_host/resource_dispatcher_host.h" 23 #include "content/browser/renderer_host/resource_dispatcher_host.h"
23 #include "content/browser/trace_controller.h" 24 #include "content/browser/trace_controller.h"
24 #include "content/common/hi_res_timer_manager.h" 25 #include "content/common/hi_res_timer_manager.h"
25 #include "content/common/sandbox_policy.h" 26 #include "content/common/sandbox_policy.h"
26 #include "content/public/browser/browser_main_parts.h" 27 #include "content/public/browser/browser_main_parts.h"
27 #include "content/public/browser/browser_shutdown.h" 28 #include "content/public/browser/browser_shutdown.h"
28 #include "content/public/browser/content_browser_client.h" 29 #include "content/public/browser/content_browser_client.h"
30 #include "content/public/browser/render_process_host.h"
29 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
30 #include "content/public/common/main_function_params.h" 32 #include "content/public/common/main_function_params.h"
31 #include "content/public/common/result_codes.h" 33 #include "content/public/common/result_codes.h"
32 #include "crypto/nss_util.h" 34 #include "crypto/nss_util.h"
33 #include "net/base/network_change_notifier.h" 35 #include "net/base/network_change_notifier.h"
34 #include "net/base/ssl_config_service.h" 36 #include "net/base/ssl_config_service.h"
35 #include "net/socket/client_socket_factory.h" 37 #include "net/socket/client_socket_factory.h"
36 #include "net/socket/tcp_client_socket.h" 38 #include "net/socket/tcp_client_socket.h"
37 39
38 #if defined(OS_WIN) 40 #if defined(OS_WIN)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 #endif 266 #endif
265 267
266 if (parsed_command_line_.HasSwitch(switches::kEnableSSLCachedInfo)) 268 if (parsed_command_line_.HasSwitch(switches::kEnableSSLCachedInfo))
267 net::SSLConfigService::EnableCachedInfo(); 269 net::SSLConfigService::EnableCachedInfo();
268 270
269 // TODO(abarth): Should this move to InitializeNetworkOptions? This doesn't 271 // TODO(abarth): Should this move to InitializeNetworkOptions? This doesn't
270 // seem dependent on SSL initialization(). 272 // seem dependent on SSL initialization().
271 if (parsed_command_line_.HasSwitch(switches::kEnableTcpFastOpen)) 273 if (parsed_command_line_.HasSwitch(switches::kEnableTcpFastOpen))
272 net::set_tcp_fastopen_enabled(true); 274 net::set_tcp_fastopen_enabled(true);
273 275
276 if (parsed_command_line_.HasSwitch(switches::kRendererProcessLimit)) {
277 std::string limit_string = parsed_command_line_.GetSwitchValueASCII(
278 switches::kRendererProcessLimit);
279 size_t process_limit;
280 if (base::StringToSizeT(limit_string, &process_limit)) {
281 content::RenderProcessHost::SetMaxRendererProcessCount(process_limit);
282 }
283 }
284
274 if (parts_.get()) 285 if (parts_.get())
275 parts_->PostEarlyInitialization(); 286 parts_->PostEarlyInitialization();
276 } 287 }
277 288
278 void BrowserMainLoop::MainMessageLoopStart() { 289 void BrowserMainLoop::MainMessageLoopStart() {
279 if (parts_.get()) 290 if (parts_.get())
280 parts_->PreMainMessageLoopStart(); 291 parts_->PreMainMessageLoopStart();
281 292
282 #if defined(OS_WIN) 293 #if defined(OS_WIN)
283 // If we're running tests (ui_task is non-null), then the ResourceBundle 294 // If we're running tests (ui_task is non-null), then the ResourceBundle
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); 614 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
604 615
605 #if defined(OS_MACOSX) 616 #if defined(OS_MACOSX)
606 MessageLoopForUI::current()->Run(); 617 MessageLoopForUI::current()->Run();
607 #else 618 #else
608 MessageLoopForUI::current()->RunWithDispatcher(NULL); 619 MessageLoopForUI::current()->RunWithDispatcher(NULL);
609 #endif 620 #endif
610 } 621 }
611 622
612 } // namespace content 623 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc ('k') | content/browser/renderer_host/render_process_host_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698