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

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

Issue 2247183007: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <servers/bootstrap.h> 7 #include <servers/bootstrap.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 DCHECK(policies_.find(sandbox_policy_id) != policies_.end()); 151 DCHECK(policies_.find(sandbox_policy_id) != policies_.end());
152 152
153 uint64_t token; 153 uint64_t token;
154 while (true) { 154 while (true) {
155 token = base::RandUint64(); 155 token = base::RandUint64();
156 if (awaiting_processes_.find(token) == awaiting_processes_.end()) 156 if (awaiting_processes_.find(token) == awaiting_processes_.end())
157 break; 157 break;
158 } 158 }
159 159
160 awaiting_processes_[token] = sandbox_policy_id; 160 awaiting_processes_[token] = sandbox_policy_id;
161 return base::WrapUnique(new PreExecDelegate(server_bootstrap_name_, token)); 161 return base::MakeUnique<PreExecDelegate>(server_bootstrap_name_, token);
162 } 162 }
163 163
164 void BootstrapSandbox::RevokeToken(uint64_t token) { 164 void BootstrapSandbox::RevokeToken(uint64_t token) {
165 base::AutoLock lock(lock_); 165 base::AutoLock lock(lock_);
166 const auto& it = awaiting_processes_.find(token); 166 const auto& it = awaiting_processes_.find(token);
167 if (it != awaiting_processes_.end()) 167 if (it != awaiting_processes_.end())
168 awaiting_processes_.erase(it); 168 awaiting_processes_.erase(it);
169 } 169 }
170 170
171 void BootstrapSandbox::InvalidateClient(base::ProcessHandle handle) { 171 void BootstrapSandbox::InvalidateClient(base::ProcessHandle handle) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } else { 254 } else {
255 { 255 {
256 base::AutoLock lock(lock_); 256 base::AutoLock lock(lock_);
257 sandboxed_processes_.erase(client_pid); 257 sandboxed_processes_.erase(client_pid);
258 } 258 }
259 MACH_LOG(ERROR, kr) << "HandleChildCheckIn mach_msg MACH_SEND_MSG"; 259 MACH_LOG(ERROR, kr) << "HandleChildCheckIn mach_msg MACH_SEND_MSG";
260 } 260 }
261 } 261 }
262 262
263 } // namespace sandbox 263 } // namespace sandbox
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698