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

Unified Diff: content/common/sandbox_win.cc

Issue 1378523002: Use scoped_refptr and RefCountedThreadSafe for TargetPolicy. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated patchset dependency Created 5 years, 1 month 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 | « content/common/sandbox_init_win.cc ('k') | sandbox/win/src/broker_services.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index e131fcf0be8a2ef87950b7e4990667b29534af37..e2992d106a4faa80e64a2c0329fbaf50b1342ccc 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -12,6 +12,7 @@
#include "base/files/file_util.h"
#include "base/hash.h"
#include "base/logging.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/shared_memory.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/sparse_histogram.h"
@@ -691,7 +692,8 @@ base::Process StartSandboxedProcess(
return process.Pass();
}
- sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy();
+ scoped_refptr<sandbox::TargetPolicy> policy =
+ g_broker_services->CreatePolicy();
sandbox::MitigationFlags mitigations = sandbox::MITIGATION_HEAP_TERMINATE |
sandbox::MITIGATION_BOTTOM_UP_ASLR |
@@ -705,7 +707,7 @@ base::Process StartSandboxedProcess(
#if !defined(NACL_WIN64)
if (type_str == switches::kRendererProcess &&
IsWin32kRendererLockdownEnabled()) {
- if (!AddWin32kLockdownPolicy(policy))
+ if (!AddWin32kLockdownPolicy(policy.get()))
return base::Process();
}
#endif
@@ -716,10 +718,10 @@ base::Process StartSandboxedProcess(
if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK)
return base::Process();
- SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy);
+ SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy.get());
if (!delegate->DisableDefaultPolicy()) {
- if (!AddPolicyForSandboxedProcess(policy))
+ if (!AddPolicyForSandboxedProcess(policy.get()))
return base::Process();
}
@@ -731,7 +733,7 @@ base::Process StartSandboxedProcess(
NULL,
true,
sandbox::TargetPolicy::FILES_ALLOW_READONLY,
- policy);
+ policy.get());
// If DirectWrite is enabled for font rendering then open the font cache
// section which is created by the browser and pass the handle to the
@@ -759,7 +761,7 @@ base::Process StartSandboxedProcess(
cmd_line->AppendSwitchASCII("ignored", " --type=renderer ");
}
- if (!AddGenericPolicy(policy)) {
+ if (!AddGenericPolicy(policy.get())) {
NOTREACHED();
return base::Process();
}
@@ -782,7 +784,7 @@ base::Process StartSandboxedProcess(
policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE));
#endif
- if (!delegate->PreSpawnTarget(policy))
+ if (!delegate->PreSpawnTarget(policy.get()))
return base::Process();
TRACE_EVENT_BEGIN0("startup", "StartProcessWithAccess::LAUNCHPROCESS");
« no previous file with comments | « content/common/sandbox_init_win.cc ('k') | sandbox/win/src/broker_services.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698