constants.h 919 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef SANDBOX_CONSTANTS_H_
  5. #define SANDBOX_CONSTANTS_H_
  6. #include <limits>
  7. #include "build/build_config.h"
  8. namespace sandbox {
  9. // kDataSizeLimit is used for RLIMIT_DATA on POSIX and for
  10. // JOBOBJECT_EXTENDED_LIMIT_INFORMATION.JobMemoryLimit on Windows.
  11. //
  12. #if defined(ARCH_CPU_64_BITS)
  13. // Note: On Linux and Windows, the sandbox may set a higher limit for
  14. // renderer and GPU processes if the system has enough physical memory.
  15. constexpr size_t kDataSizeLimit = size_t{1} << 32; // 4 GB
  16. #else
  17. // Limit the data memory to a size that prevents allocations that can't be
  18. // indexed by an int.
  19. constexpr size_t kDataSizeLimit =
  20. static_cast<size_t>(std::numeric_limits<int>::max());
  21. #endif
  22. } // namespace sandbox
  23. #endif // SANDBOX_CONSTANTS_H_