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/common/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 return false; | 222 return false; |
223 | 223 |
224 cmd_line->AppendSwitchASCII("flash-broker", | 224 cmd_line->AppendSwitchASCII("flash-broker", |
225 base::Int64ToString(::GetProcessId(process))); | 225 base::Int64ToString(::GetProcessId(process))); |
226 | 226 |
227 // The flash broker, unders some circumstances can linger beyond the lifetime | 227 // The flash broker, unders some circumstances can linger beyond the lifetime |
228 // of the flash player, so we put it in a job object, when the browser | 228 // of the flash player, so we put it in a job object, when the browser |
229 // terminates the job object is destroyed (by the OS) and the flash broker | 229 // terminates the job object is destroyed (by the OS) and the flash broker |
230 // is terminated. | 230 // is terminated. |
231 HANDLE job = ::CreateJobObjectW(NULL, NULL); | 231 HANDLE job = ::CreateJobObjectW(NULL, NULL); |
232 JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_limits = {0}; | 232 if (base::SetJobObjectAsKillOnJobClose(job)) { |
233 job_limits.BasicLimitInformation.LimitFlags = | |
234 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; | |
235 if (::SetInformationJobObject(job, JobObjectExtendedLimitInformation, | |
236 &job_limits, sizeof(job_limits))) { | |
237 ::AssignProcessToJobObject(job, process); | 233 ::AssignProcessToJobObject(job, process); |
238 // Yes, we are leaking the object here. Read comment above. | 234 // Yes, we are leaking the object here. Read comment above. |
239 } else { | 235 } else { |
240 ::CloseHandle(job); | 236 ::CloseHandle(job); |
241 return false; | 237 return false; |
242 } | 238 } |
243 | 239 |
244 ::CloseHandle(process); | 240 ::CloseHandle(process); |
245 return true; | 241 return true; |
246 } | 242 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 393 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
398 policy->SetTokenLevel( | 394 policy->SetTokenLevel( |
399 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); | 395 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); |
400 } | 396 } |
401 | 397 |
402 return true; | 398 return true; |
403 } | 399 } |
404 #endif | 400 #endif |
405 | 401 |
406 } // namespace chrome | 402 } // namespace chrome |
OLD | NEW |