Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Unified Diff: sandbox/win/src/job.cc

Issue 319573006: Add sandbox support for process memory limits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/win/src/job.h ('k') | sandbox/win/src/job_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/job.cc
diff --git a/sandbox/win/src/job.cc b/sandbox/win/src/job.cc
index 62b8d5c3c4b294844970f84cad94b207fc9cb38e..8852ab0c7205f97dac97d886a87769d6d33f10e6 100644
--- a/sandbox/win/src/job.cc
+++ b/sandbox/win/src/job.cc
@@ -16,7 +16,8 @@ Job::~Job() {
DWORD Job::Init(JobLevel security_level,
const wchar_t* job_name,
- DWORD ui_exceptions) {
+ DWORD ui_exceptions,
+ size_t memory_limit) {
if (job_handle_)
return ERROR_ALREADY_INITIALIZED;
@@ -52,11 +53,11 @@ DWORD Job::Init(JobLevel security_level,
jbur.UIRestrictionsClass |= JOB_OBJECT_UILIMIT_EXITWINDOWS;
}
case JOB_UNPROTECTED: {
- // The JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag is not supported on
- // Windows 2000. We need a mechanism on Windows 2000 to ensure
- // that processes in the job are terminated when the job is closed
- if (base::win::GetVersion() == base::win::VERSION_PRE_XP)
- break;
+ if (memory_limit) {
+ jeli.BasicLimitInformation.LimitFlags |=
+ JOB_OBJECT_LIMIT_PROCESS_MEMORY;
+ jeli.ProcessMemoryLimit = memory_limit;
+ }
jeli.BasicLimitInformation.LimitFlags |=
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
« no previous file with comments | « sandbox/win/src/job.h ('k') | sandbox/win/src/job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698