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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 2164883003: Delete SandboxedProcessLauncherDelegate::TakeIpcFd. Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-ppapi-channel-mojo
Patch Set: Created 4 years, 5 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 | « content/browser/child_process_launcher.cc ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 } 187 }
188 188
189 // NOTE: changes to this class need to be reviewed by the security team. 189 // NOTE: changes to this class need to be reviewed by the security team.
190 class GpuSandboxedProcessLauncherDelegate 190 class GpuSandboxedProcessLauncherDelegate
191 : public SandboxedProcessLauncherDelegate { 191 : public SandboxedProcessLauncherDelegate {
192 public: 192 public:
193 GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line, 193 GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line,
194 ChildProcessHost* host) 194 ChildProcessHost* host)
195 #if defined(OS_WIN) 195 #if defined(OS_WIN)
196 : cmd_line_(cmd_line) {} 196 : cmd_line_(cmd_line)
197 #elif defined(OS_POSIX)
198 : ipc_fd_(host->TakeClientFileDescriptor()) {}
199 #endif 197 #endif
198 {}
200 199
201 ~GpuSandboxedProcessLauncherDelegate() override {} 200 ~GpuSandboxedProcessLauncherDelegate() override {}
202 201
203 #if defined(OS_WIN) 202 #if defined(OS_WIN)
204 bool ShouldSandbox() override { 203 bool ShouldSandbox() override {
205 bool sandbox = !cmd_line_->HasSwitch(switches::kDisableGpuSandbox); 204 bool sandbox = !cmd_line_->HasSwitch(switches::kDisableGpuSandbox);
206 if (!sandbox) { 205 if (!sandbox) {
207 DVLOG(1) << "GPU sandbox is disabled"; 206 DVLOG(1) << "GPU sandbox is disabled";
208 } 207 }
209 return sandbox; 208 return sandbox;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, 269 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
271 sandbox::TargetPolicy::FILES_ALLOW_ANY, 270 sandbox::TargetPolicy::FILES_ALLOW_ANY,
272 log_file_path.c_str()); 271 log_file_path.c_str());
273 if (result != sandbox::SBOX_ALL_OK) 272 if (result != sandbox::SBOX_ALL_OK)
274 return false; 273 return false;
275 } 274 }
276 } 275 }
277 276
278 return true; 277 return true;
279 } 278 }
280 #elif defined(OS_POSIX)
281
282 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
283 #endif // OS_WIN 279 #endif // OS_WIN
284 280
285 SandboxType GetSandboxType() override { 281 SandboxType GetSandboxType() override {
286 return SANDBOX_TYPE_GPU; 282 return SANDBOX_TYPE_GPU;
287 } 283 }
288 284
289 private: 285 private:
290 #if defined(OS_WIN) 286 #if defined(OS_WIN)
291 base::CommandLine* cmd_line_; 287 base::CommandLine* cmd_line_;
292 #elif defined(OS_POSIX)
293 base::ScopedFD ipc_fd_;
294 #endif // OS_WIN 288 #endif // OS_WIN
295 }; 289 };
296 290
297 } // anonymous namespace 291 } // anonymous namespace
298 292
299 // static 293 // static
300 bool GpuProcessHost::ValidateHost(GpuProcessHost* host) { 294 bool GpuProcessHost::ValidateHost(GpuProcessHost* host) {
301 // The Gpu process is invalid if it's not using SwiftShader, the card is 295 // The Gpu process is invalid if it's not using SwiftShader, the card is
302 // blacklisted, and we can kill it and start over. 296 // blacklisted, and we can kill it and start over.
303 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 297 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1182 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1189 ClientIdToShaderCacheMap::iterator iter = 1183 ClientIdToShaderCacheMap::iterator iter =
1190 client_id_to_shader_cache_.find(client_id); 1184 client_id_to_shader_cache_.find(client_id);
1191 // If the cache doesn't exist then this is an off the record profile. 1185 // If the cache doesn't exist then this is an off the record profile.
1192 if (iter == client_id_to_shader_cache_.end()) 1186 if (iter == client_id_to_shader_cache_.end())
1193 return; 1187 return;
1194 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1188 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1195 } 1189 }
1196 1190
1197 } // namespace content 1191 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_launcher.cc ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698