| OLD | NEW |
| 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 "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 : public SandboxedProcessLauncherDelegate { | 146 : public SandboxedProcessLauncherDelegate { |
| 147 public: | 147 public: |
| 148 GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line, | 148 GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line, |
| 149 ChildProcessHost* host) | 149 ChildProcessHost* host) |
| 150 #if defined(OS_WIN) | 150 #if defined(OS_WIN) |
| 151 : cmd_line_(cmd_line) {} | 151 : cmd_line_(cmd_line) {} |
| 152 #elif defined(OS_POSIX) | 152 #elif defined(OS_POSIX) |
| 153 : ipc_fd_(host->TakeClientFileDescriptor()) {} | 153 : ipc_fd_(host->TakeClientFileDescriptor()) {} |
| 154 #endif | 154 #endif |
| 155 | 155 |
| 156 virtual ~GpuSandboxedProcessLauncherDelegate() {} | 156 ~GpuSandboxedProcessLauncherDelegate() override {} |
| 157 | 157 |
| 158 #if defined(OS_WIN) | 158 #if defined(OS_WIN) |
| 159 virtual bool ShouldSandbox() override { | 159 virtual bool ShouldSandbox() override { |
| 160 bool sandbox = !cmd_line_->HasSwitch(switches::kDisableGpuSandbox); | 160 bool sandbox = !cmd_line_->HasSwitch(switches::kDisableGpuSandbox); |
| 161 if(! sandbox) { | 161 if(! sandbox) { |
| 162 DVLOG(1) << "GPU sandbox is disabled"; | 162 DVLOG(1) << "GPU sandbox is disabled"; |
| 163 } | 163 } |
| 164 return sandbox; | 164 return sandbox; |
| 165 } | 165 } |
| 166 | 166 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 log_file_path.c_str()); | 243 log_file_path.c_str()); |
| 244 if (result != sandbox::SBOX_ALL_OK) { | 244 if (result != sandbox::SBOX_ALL_OK) { |
| 245 *success = false; | 245 *success = false; |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 #elif defined(OS_POSIX) | 251 #elif defined(OS_POSIX) |
| 252 | 252 |
| 253 virtual base::ScopedFD TakeIpcFd() override { | 253 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } |
| 254 return ipc_fd_.Pass(); | |
| 255 } | |
| 256 #endif // OS_WIN | 254 #endif // OS_WIN |
| 257 | 255 |
| 258 private: | 256 private: |
| 259 #if defined(OS_WIN) | 257 #if defined(OS_WIN) |
| 260 base::CommandLine* cmd_line_; | 258 base::CommandLine* cmd_line_; |
| 261 #elif defined(OS_POSIX) | 259 #elif defined(OS_POSIX) |
| 262 base::ScopedFD ipc_fd_; | 260 base::ScopedFD ipc_fd_; |
| 263 #endif // OS_WIN | 261 #endif // OS_WIN |
| 264 }; | 262 }; |
| 265 | 263 |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1060 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1063 ClientIdToShaderCacheMap::iterator iter = | 1061 ClientIdToShaderCacheMap::iterator iter = |
| 1064 client_id_to_shader_cache_.find(client_id); | 1062 client_id_to_shader_cache_.find(client_id); |
| 1065 // If the cache doesn't exist then this is an off the record profile. | 1063 // If the cache doesn't exist then this is an off the record profile. |
| 1066 if (iter == client_id_to_shader_cache_.end()) | 1064 if (iter == client_id_to_shader_cache_.end()) |
| 1067 return; | 1065 return; |
| 1068 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1066 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1069 } | 1067 } |
| 1070 | 1068 |
| 1071 } // namespace content | 1069 } // namespace content |
| OLD | NEW |