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

Side by Side Diff: sandbox/mac/bootstrap_sandbox.cc

Issue 303293002: Initialize the bootstrap sandbox in the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge bootstrap-child-proc branch 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sandbox/mac/bootstrap_sandbox.h" 5 #include "sandbox/mac/bootstrap_sandbox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/mach_logging.h" 8 #include "base/mac/mach_logging.h"
9 9
10 #include "sandbox/mac/launchd_interception_server.h" 10 #include "sandbox/mac/launchd_interception_server.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 BootstrapSandbox::~BootstrapSandbox() { 53 BootstrapSandbox::~BootstrapSandbox() {
54 kern_return_t kr = task_set_special_port(mach_task_self(), 54 kern_return_t kr = task_set_special_port(mach_task_self(),
55 TASK_BOOTSTRAP_PORT, real_bootstrap_port_); 55 TASK_BOOTSTRAP_PORT, real_bootstrap_port_);
56 MACH_CHECK(kr == KERN_SUCCESS, kr); 56 MACH_CHECK(kr == KERN_SUCCESS, kr);
57 } 57 }
58 58
59 void BootstrapSandbox::RegisterSandboxPolicy( 59 void BootstrapSandbox::RegisterSandboxPolicy(
60 int sandbox_policy_id, 60 int sandbox_policy_id,
61 const BootstrapSandboxPolicy& policy) { 61 const BootstrapSandboxPolicy& policy) {
62 CHECK(IsPolicyValid(policy)); 62 CHECK(IsPolicyValid(policy));
63 CHECK_GT(sandbox_policy_id, 0); 63 CHECK_GT(sandbox_policy_id, kNotAPolicy);
64 base::AutoLock lock(lock_); 64 base::AutoLock lock(lock_);
65 DCHECK(policies_.find(sandbox_policy_id) == policies_.end()); 65 DCHECK(policies_.find(sandbox_policy_id) == policies_.end());
66 policies_.insert(std::make_pair(sandbox_policy_id, policy)); 66 policies_.insert(std::make_pair(sandbox_policy_id, policy));
67 } 67 }
68 68
69 void BootstrapSandbox::PrepareToForkWithPolicy(int sandbox_policy_id) { 69 void BootstrapSandbox::PrepareToForkWithPolicy(int sandbox_policy_id) {
70 base::AutoLock lock(lock_); 70 base::AutoLock lock(lock_);
71 71
72 CHECK(policies_.find(sandbox_policy_id) != policies_.end()); 72 CHECK(policies_.find(sandbox_policy_id) != policies_.end());
73 CHECK_EQ(kNotAPolicy, effective_policy_id_) 73 CHECK_EQ(kNotAPolicy, effective_policy_id_)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 : real_bootstrap_port_(MACH_PORT_NULL), 128 : real_bootstrap_port_(MACH_PORT_NULL),
129 effective_policy_id_(kNotAPolicy) { 129 effective_policy_id_(kNotAPolicy) {
130 mach_port_t port = MACH_PORT_NULL; 130 mach_port_t port = MACH_PORT_NULL;
131 kern_return_t kr = task_get_special_port( 131 kern_return_t kr = task_get_special_port(
132 mach_task_self(), TASK_BOOTSTRAP_PORT, &port); 132 mach_task_self(), TASK_BOOTSTRAP_PORT, &port);
133 MACH_CHECK(kr == KERN_SUCCESS, kr); 133 MACH_CHECK(kr == KERN_SUCCESS, kr);
134 real_bootstrap_port_.reset(port); 134 real_bootstrap_port_.reset(port);
135 } 135 }
136 136
137 } // namespace sandbox 137 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698