No more need to call setrlimit
Chrome has removed the limiations on fd, this actually became the new limitation.
This commit is contained in:
parent
9efc5fffa2
commit
54997db5f2
3 changed files with 0 additions and 34 deletions
|
@ -137,10 +137,6 @@ BrowserMainParts::~BrowserMainParts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserMainParts::PreEarlyInitialization() {
|
void BrowserMainParts::PreEarlyInitialization() {
|
||||||
#if defined(OS_MACOSX)
|
|
||||||
IncreaseFileDescriptorLimit();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
views::LinuxUI::SetInstance(BuildGtk2UI());
|
views::LinuxUI::SetInstance(BuildGtk2UI());
|
||||||
OverrideLinuxAppDataPath();
|
OverrideLinuxAppDataPath();
|
||||||
|
|
|
@ -49,7 +49,6 @@ class BrowserMainParts : public content::BrowserMainParts {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void IncreaseFileDescriptorLimit();
|
|
||||||
void InitializeMainNib();
|
void InitializeMainNib();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -6,35 +6,6 @@
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// Sets the file descriptor soft limit to |max_descriptors| or the OS hard limit, whichever is
|
|
||||||
// lower.
|
|
||||||
void SetFileDescriptorLimit(rlim_t max_descriptors) {
|
|
||||||
rlimit limits;
|
|
||||||
if (getrlimit(RLIMIT_NOFILE, &limits) != 0) {
|
|
||||||
PLOG(INFO) << "Failed to get file descriptor limit";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto new_limit = max_descriptors;
|
|
||||||
if (limits.rlim_max > 0)
|
|
||||||
new_limit = std::min(new_limit, limits.rlim_max);
|
|
||||||
limits.rlim_cur = new_limit;
|
|
||||||
if (setrlimit(RLIMIT_NOFILE, &limits) != 0)
|
|
||||||
PLOG(INFO) << "Failed to set file descriptor limit";
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
void BrowserMainParts::IncreaseFileDescriptorLimit() {
|
|
||||||
// We use quite a few file descriptors for our IPC, and the default limit on the Mac is low (256),
|
|
||||||
// so bump it up.
|
|
||||||
// See http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/chrome_browser_main_posix.cc?revision=244734#l295
|
|
||||||
// and https://codereview.chromium.org/125151
|
|
||||||
SetFileDescriptorLimit(1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replicates NSApplicationMain, but doesn't start a run loop.
|
// Replicates NSApplicationMain, but doesn't start a run loop.
|
||||||
void BrowserMainParts::InitializeMainNib() {
|
void BrowserMainParts::InitializeMainNib() {
|
||||||
auto infoDictionary = base::mac::OuterBundle().infoDictionary;
|
auto infoDictionary = base::mac::OuterBundle().infoDictionary;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue