OLD | NEW |
---|---|
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 Loading... | |
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 // On Android we don't maintain a limit of renderer process hosts - we are |
jam
2014/07/16 20:22:07
nit: put the comment inside the ifdef to make it c
ppi
2014/07/17 10:14:45
Done.
| |
398 // amount of installed memory as reported by the OS. The calculation | 398 // happy with keeping a lot of these, as long as the number of live renderer |
399 // assumes that you want the renderers to use half of the installed | 399 // processes remains reasonable, and on Android the OS takes care of that. |
400 // RAM and assuming that each WebContents uses ~40MB. | 400 #if defined(OS_ANDROID) |
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 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2362 void RenderProcessHostImpl::GpuMemoryBufferAllocated( | 2369 void RenderProcessHostImpl::GpuMemoryBufferAllocated( |
2363 IPC::Message* reply, | 2370 IPC::Message* reply, |
2364 const gfx::GpuMemoryBufferHandle& handle) { | 2371 const gfx::GpuMemoryBufferHandle& handle) { |
2365 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2372 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2366 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, | 2373 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, |
2367 handle); | 2374 handle); |
2368 Send(reply); | 2375 Send(reply); |
2369 } | 2376 } |
2370 | 2377 |
2371 } // namespace content | 2378 } // namespace content |
OLD | NEW |