Bug 1644917 - Part 0: Make AddDynamicPathList a static non-member function. r=gcp

Not strictly necessary, but I noticed this while I was making changes:
AddDynamicPathList can be a simple static function instead of a private
static method, and doesn't need to be in the header.

Differential Revision: https://phabricator.services.mozilla.com/D81422
This commit is contained in:
Jed Davis 2020-06-29 22:32:03 +00:00
Родитель c6cbad9a52
Коммит 0808445a13
2 изменённых файлов: 13 добавлений и 15 удалений

Просмотреть файл

@ -277,6 +277,19 @@ static void AddSharedMemoryPaths(SandboxBroker::Policy* aPolicy, pid_t aPid) {
}
}
static void AddDynamicPathList(SandboxBroker::Policy* policy,
const char* aPathListPref, int perms) {
nsAutoCString pathList;
nsresult rv = Preferences::GetCString(aPathListPref, pathList);
if (NS_SUCCEEDED(rv)) {
for (const nsACString& path : pathList.Split(',')) {
nsCString trimPath(path);
trimPath.Trim(" ", true, true);
policy->AddDynamic(perms, trimPath.get());
}
}
}
SandboxBrokerPolicyFactory::SandboxBrokerPolicyFactory() {
// Policy entries that are the same in every process go here, and
// are cached over the lifetime of the factory.
@ -652,19 +665,6 @@ UniquePtr<SandboxBroker::Policy> SandboxBrokerPolicyFactory::GetContentPolicy(
return policy;
}
void SandboxBrokerPolicyFactory::AddDynamicPathList(
SandboxBroker::Policy* policy, const char* aPathListPref, int perms) {
nsAutoCString pathList;
nsresult rv = Preferences::GetCString(aPathListPref, pathList);
if (NS_SUCCEEDED(rv)) {
for (const nsACString& path : pathList.Split(',')) {
nsCString trimPath(path);
trimPath.Trim(" ", true, true);
policy->AddDynamic(perms, trimPath.get());
}
}
}
/* static */ UniquePtr<SandboxBroker::Policy>
SandboxBrokerPolicyFactory::GetUtilityPolicy(int aPid) {
auto policy = MakeUnique<SandboxBroker::Policy>();

Просмотреть файл

@ -23,8 +23,6 @@ class SandboxBrokerPolicyFactory {
private:
UniquePtr<const SandboxBroker::Policy> mCommonContentPolicy;
static void AddDynamicPathList(SandboxBroker::Policy* policy,
const char* aPathListPref, int perms);
};
} // namespace mozilla