| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/browser_main_posix.h" | 5 #include "chrome/browser/browser_main_posix.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 #include <signal.h> | 9 #include <signal.h> |
| 10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 RAW_LOG(WARNING, "Still here, exiting really ungracefully."); | 161 RAW_LOG(WARNING, "Still here, exiting really ungracefully."); |
| 162 _exit(signal | (1 << 7)); | 162 _exit(signal | (1 << 7)); |
| 163 } | 163 } |
| 164 CloseAllBrowsersAndExitPosted(); | 164 CloseAllBrowsersAndExitPosted(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 // Sets the file descriptor soft limit to |max_descriptors| or the OS hard | 167 // Sets the file descriptor soft limit to |max_descriptors| or the OS hard |
| 168 // limit, whichever is lower. | 168 // limit, whichever is lower. |
| 169 void SetFileDescriptorLimit(unsigned int max_descriptors) { | 169 void SetFileDescriptorLimit(unsigned int max_descriptors) { |
| 170 struct rlimit limits; | 170 struct rlimit limits; |
| 171 return; |
| 171 if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { | 172 if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { |
| 172 unsigned int new_limit = max_descriptors; | 173 unsigned int new_limit = max_descriptors; |
| 173 if (limits.rlim_max > 0 && limits.rlim_max < max_descriptors) { | 174 if (limits.rlim_max > 0 && limits.rlim_max < max_descriptors) { |
| 174 new_limit = limits.rlim_max; | 175 new_limit = limits.rlim_max; |
| 175 } | 176 } |
| 176 limits.rlim_cur = new_limit; | 177 limits.rlim_cur = new_limit; |
| 177 if (setrlimit(RLIMIT_NOFILE, &limits) != 0) { | 178 if (setrlimit(RLIMIT_NOFILE, &limits) != 0) { |
| 178 PLOG(INFO) << "Failed to set file descriptor limit"; | 179 PLOG(INFO) << "Failed to set file descriptor limit"; |
| 179 } | 180 } |
| 180 } else { | 181 } else { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 new ShutdownDetector(g_shutdown_pipe_read_fd))) { | 257 new ShutdownDetector(g_shutdown_pipe_read_fd))) { |
| 257 LOG(DFATAL) << "Failed to create shutdown detector task."; | 258 LOG(DFATAL) << "Failed to create shutdown detector task."; |
| 258 } | 259 } |
| 259 } | 260 } |
| 260 | 261 |
| 261 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) | 262 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) |
| 262 printing::PrintingContextCairo::SetCreatePrintDialogFunction( | 263 printing::PrintingContextCairo::SetCreatePrintDialogFunction( |
| 263 &PrintDialogGtk::CreatePrintDialog); | 264 &PrintDialogGtk::CreatePrintDialog); |
| 264 #endif | 265 #endif |
| 265 } | 266 } |
| OLD | NEW |