Commit f140870e authored by Aaron Colwell's avatar Aaron Colwell Committed by Commit Bot

Remove ChildProcessSecurityPolicyImpl::AddWorker() since it has no callers.

It looks like the code that called this was removed over 4 years ago by
https://src.chromium.org/viewvc/chrome?revision=285521&view=revision

Change-Id: Ifd62e5c0750b7de02d0adc8c3fef487cb8a3d0e3
Reviewed-on: https://chromium-review.googlesource.com/c/1356322
Commit-Queue: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613164}
parent 26664074
......@@ -417,17 +417,9 @@ void ChildProcessSecurityPolicyImpl::Add(int child_id) {
AddChild(child_id);
}
void ChildProcessSecurityPolicyImpl::AddWorker(int child_id,
int main_render_process_id) {
base::AutoLock lock(lock_);
AddChild(child_id);
worker_map_[child_id] = main_render_process_id;
}
void ChildProcessSecurityPolicyImpl::Remove(int child_id) {
base::AutoLock lock(lock_);
security_state_.erase(child_id);
worker_map_.erase(child_id);
}
void ChildProcessSecurityPolicyImpl::RegisterWebSafeScheme(
......@@ -985,18 +977,7 @@ bool ChildProcessSecurityPolicyImpl::CanDeleteFromFileSystem(
bool ChildProcessSecurityPolicyImpl::HasPermissionsForFile(
int child_id, const base::FilePath& file, int permissions) {
base::AutoLock lock(lock_);
bool result = ChildProcessHasPermissionsForFile(child_id, file, permissions);
if (!result) {
// If this is a worker thread that has no access to a given file,
// let's check that its renderer process has access to that file instead.
auto iter = worker_map_.find(child_id);
if (iter != worker_map_.end() && iter->second != 0) {
result = ChildProcessHasPermissionsForFile(iter->second,
file,
permissions);
}
}
return result;
return ChildProcessHasPermissionsForFile(child_id, file, permissions);
}
bool ChildProcessSecurityPolicyImpl::HasPermissionsForFileSystemFile(
......
......@@ -137,12 +137,6 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
// this method exactly once.
void Add(int child_id);
// Upon creation, worker thread child processes should register themselves by
// calling this this method exactly once. Workers that are not shared will
// inherit permissions from their parent renderer process identified with
// |main_render_process_id|.
void AddWorker(int worker_child_id, int main_render_process_id);
// Upon destruction, child processess should unregister themselves by caling
// this method exactly once.
void Remove(int child_id);
......@@ -303,7 +297,6 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
typedef std::set<std::string> SchemeSet;
typedef std::map<int, std::unique_ptr<SecurityState>> SecurityStateMap;
typedef std::map<int, int> WorkerToMainProcessMap;
typedef std::map<storage::FileSystemType, int> FileSystemPermissionPolicyMap;
// Obtain an instance of ChildProcessSecurityPolicyImpl via GetInstance().
......@@ -335,9 +328,7 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
int permission);
// Determines if certain permissions were granted for a file. |permissions|
// is an internally defined bit-set. If |child_id| is a worker process,
// this returns true if either the worker process or its parent renderer
// has permissions for the file.
// is an internally defined bit-set.
bool HasPermissionsForFile(int child_id,
const base::FilePath& file,
int permissions);
......@@ -377,10 +368,6 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
// not escape this class.
SecurityStateMap security_state_ GUARDED_BY(lock_);
// This maps keeps the record of which js worker thread child process
// corresponds to which main js thread child process.
WorkerToMainProcessMap worker_map_ GUARDED_BY(lock_);
FileSystemPermissionPolicyMap file_system_policy_map_ GUARDED_BY(lock_);
// Tracks origins for which the entire origin should be treated as a site
......
......@@ -26,7 +26,6 @@ namespace content {
namespace {
const int kRendererID = 42;
const int kWorkerRendererID = kRendererID + 1;
#if defined(FILE_PATH_USES_DRIVE_LETTERS)
#define TEST_PATH(x) FILE_PATH_LITERAL("c:") FILE_PATH_LITERAL(x)
......@@ -830,28 +829,6 @@ TEST_F(ChildProcessSecurityPolicyTest, FilePermissions) {
base::File::FLAG_TEMPORARY));
p->Remove(kRendererID);
// Grant file permissions for the file to main thread renderer process,
// make sure its worker thread renderer process inherits those.
p->Add(kRendererID);
GrantPermissionsForFile(p, kRendererID, granted_file,
base::File::FLAG_OPEN |
base::File::FLAG_READ);
EXPECT_TRUE(p->HasPermissionsForFile(kRendererID, granted_file,
base::File::FLAG_OPEN |
base::File::FLAG_READ));
EXPECT_FALSE(p->HasPermissionsForFile(kRendererID, granted_file,
base::File::FLAG_WRITE));
p->AddWorker(kWorkerRendererID, kRendererID);
EXPECT_TRUE(p->HasPermissionsForFile(kWorkerRendererID, granted_file,
base::File::FLAG_OPEN |
base::File::FLAG_READ));
EXPECT_FALSE(p->HasPermissionsForFile(kWorkerRendererID, granted_file,
base::File::FLAG_WRITE));
p->Remove(kRendererID);
EXPECT_FALSE(p->HasPermissionsForFile(kWorkerRendererID, granted_file,
base::File::FLAG_OPEN |
base::File::FLAG_READ));
p->Remove(kWorkerRendererID);
p->Add(kRendererID);
GrantPermissionsForFile(p, kRendererID, relative_file,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment