西西河

主题:【原创】漫谈浏览器大战 -- (构架篇) -- Highway

共:💬46 🌺488
全看分页树展 · 主题 跟帖
家园 source codes, version 5.x.x.

in chrome/browser/renderer_host/render_process_host.cc

size_t GetMaxRendererProcessCount() {

// Defines the maximum number of renderer processes according to the

// amount of installed memory as reported by the OS. The table

// values are calculated by assuming that you want the renderers to

// use half of the installed ram and assuming that each tab uses

// ~40MB, however the curve is not linear but piecewise linear with

// interleaved slopes of 3 and 2.

// If you modify this table you need to adjust browser\browser_uitest.cc

// to match the expected number of processes.

static const size_t kMaxRenderersByRamTier[] = {

3, // less than 256MB

6, // 256MB

9, // 512MB

12, // 768MB

14, // 1024MB

18, // 1280MB

20, // 1536MB

22, // 1792MB

24, // 2048MB

26, // 2304MB

29, // 2560MB

32, // 2816MB

35, // 3072MB

38, // 3328MB

40 // 3584MB

};

static size_t max_count = 0;

if (!max_count) {

size_t memory_tier = base::SysInfo::AmountOfPhysicalMemoryMB() / 256;

if (memory_tier >= arraysize(kMaxRenderersByRamTier))

max_count = chrome::kMaxRendererProcessCount;

else

max_count = kMaxRenderersByRamTier[memory_tier];

}

return max_count;

}

全看分页树展 · 主题 跟帖


有趣有益,互惠互利;开阔视野,博采众长。
虚拟的网络,真实的人。天南地北客,相逢皆朋友

Copyright © cchere 西西河