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

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

Issue 2793623002: android: Limit num renderer to service slots (Closed)
Patch Set: fix remaining unit tests Created 3 years, 8 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
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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 612
613 // static 613 // static
614 size_t RenderProcessHost::GetMaxRendererProcessCount() { 614 size_t RenderProcessHost::GetMaxRendererProcessCount() {
615 if (g_max_renderer_count_override) 615 if (g_max_renderer_count_override)
616 return g_max_renderer_count_override; 616 return g_max_renderer_count_override;
617 617
618 #if defined(OS_ANDROID) 618 #if defined(OS_ANDROID)
619 // On Android we don't maintain a limit of renderer process hosts - we are 619 // On Android we don't maintain a limit of renderer process hosts - we are
620 // happy with keeping a lot of these, as long as the number of live renderer 620 // happy with keeping a lot of these, as long as the number of live renderer
621 // processes remains reasonable, and on Android the OS takes care of that. 621 // processes remains reasonable, and on Android the OS takes care of that.
622 return std::numeric_limits<size_t>::max(); 622 // TODO(boliu): This is a short term workaround before ChildProcessLauncher
623 // can actively kill child processes in LRU order. Bug and process is tracked
624 // in crbug.com/693484. Note this workaround is not perfect and still has
625 // corner case problems.
626 static const size_t kNumRendererSlots =
627 ChildProcessLauncher::GetNumberOfRendererSlots();
628 return kNumRendererSlots;
623 #endif 629 #endif
624 630
625 // On other platforms, we calculate the maximum number of renderer process 631 // On other platforms, we calculate the maximum number of renderer process
626 // hosts according to the amount of installed memory as reported by the OS. 632 // hosts according to the amount of installed memory as reported by the OS.
627 // The calculation assumes that you want the renderers to use half of the 633 // The calculation assumes that you want the renderers to use half of the
628 // installed RAM and assuming that each WebContents uses ~40MB. If you modify 634 // installed RAM and assuming that each WebContents uses ~40MB. If you modify
629 // this assumption, you need to adjust the ThirtyFourTabs test to match the 635 // this assumption, you need to adjust the ThirtyFourTabs test to match the
630 // expected number of processes. 636 // expected number of processes.
631 // 637 //
632 // With the given amounts of installed memory below on a 32-bit CPU, the 638 // With the given amounts of installed memory below on a 32-bit CPU, the
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3077 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3072 3078
3073 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3079 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3074 // Capture the error message in a crash key value. 3080 // Capture the error message in a crash key value.
3075 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3081 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3076 bad_message::ReceivedBadMessage(render_process_id, 3082 bad_message::ReceivedBadMessage(render_process_id,
3077 bad_message::RPH_MOJO_PROCESS_ERROR); 3083 bad_message::RPH_MOJO_PROCESS_ERROR);
3078 } 3084 }
3079 3085
3080 } // namespace content 3086 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698