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

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

Issue 356453003: Don't share renderers between unrelated tabs on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address John(me)'s comments. Created 6 years, 5 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 // 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 // Stores the maximum number of renderer processes the content module can 388 // Stores the maximum number of renderer processes the content module can
389 // create. 389 // create.
390 static size_t g_max_renderer_count_override = 0; 390 static size_t g_max_renderer_count_override = 0;
391 391
392 // static 392 // static
393 size_t RenderProcessHost::GetMaxRendererProcessCount() { 393 size_t RenderProcessHost::GetMaxRendererProcessCount() {
394 if (g_max_renderer_count_override) 394 if (g_max_renderer_count_override)
395 return g_max_renderer_count_override; 395 return g_max_renderer_count_override;
396 396
397 // Defines the maximum number of renderer processes according to the 397 #if defined(OS_ANDROID)
398 // amount of installed memory as reported by the OS. The calculation 398 // On Android we don't maintain a limit of renderer process hosts - we are
399 // assumes that you want the renderers to use half of the installed 399 // happy with keeping a lot of these, as long as the number of live renderer
400 // RAM and assuming that each WebContents uses ~40MB. 400 // processes remains reasonable, and on Android the OS takes care of that.
401 // If you modify this assumption, you need to adjust the 401 return std::numeric_limits<size_t>::max();
402 // ThirtyFourTabs test to match the expected number of processes. 402 #endif
403
404 // On other platforms, we calculate the maximum number of renderer process
405 // hosts according to the amount of installed memory as reported by the OS.
406 // The calculation assumes that you want the renderers to use half of the
407 // installed RAM and assuming that each WebContents uses ~40MB. If you modify
408 // this assumption, you need to adjust the ThirtyFourTabs test to match the
409 // expected number of processes.
403 // 410 //
404 // With the given amounts of installed memory below on a 32-bit CPU, 411 // With the given amounts of installed memory below on a 32-bit CPU, the
405 // the maximum renderer count will roughly be as follows: 412 // maximum renderer count will roughly be as follows:
406 // 413 //
407 // 128 MB -> 3 414 // 128 MB -> 3
408 // 512 MB -> 6 415 // 512 MB -> 6
409 // 1024 MB -> 12 416 // 1024 MB -> 12
410 // 4096 MB -> 51 417 // 4096 MB -> 51
411 // 16384 MB -> 82 (kMaxRendererProcessCount) 418 // 16384 MB -> 82 (kMaxRendererProcessCount)
412 419
413 static size_t max_count = 0; 420 static size_t max_count = 0;
414 if (!max_count) { 421 if (!max_count) {
415 const size_t kEstimatedWebContentsMemoryUsage = 422 const size_t kEstimatedWebContentsMemoryUsage =
(...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 void RenderProcessHostImpl::GpuMemoryBufferAllocated( 2334 void RenderProcessHostImpl::GpuMemoryBufferAllocated(
2328 IPC::Message* reply, 2335 IPC::Message* reply,
2329 const gfx::GpuMemoryBufferHandle& handle) { 2336 const gfx::GpuMemoryBufferHandle& handle) {
2330 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2337 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2331 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 2338 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
2332 handle); 2339 handle);
2333 Send(reply); 2340 Send(reply);
2334 } 2341 }
2335 2342
2336 } // namespace content 2343 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_startup_flags.cc ('k') | content/browser/renderer_host/render_process_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698