| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~GpuSandboxedProcessLauncherDelegate() {} |
| 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 |
| 167 virtual void PreSandbox(bool* disable_default_policy, | 167 virtual void PreSandbox(bool* disable_default_policy, |
| 168 base::FilePath* exposed_dir) OVERRIDE { | 168 base::FilePath* exposed_dir) override { |
| 169 *disable_default_policy = true; | 169 *disable_default_policy = true; |
| 170 } | 170 } |
| 171 | 171 |
| 172 // For the GPU process we gotten as far as USER_LIMITED. The next level | 172 // For the GPU process we gotten as far as USER_LIMITED. The next level |
| 173 // which is USER_RESTRICTED breaks both the DirectX backend and the OpenGL | 173 // which is USER_RESTRICTED breaks both the DirectX backend and the OpenGL |
| 174 // backend. Note that the GPU process is connected to the interactive | 174 // backend. Note that the GPU process is connected to the interactive |
| 175 // desktop. | 175 // desktop. |
| 176 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, | 176 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, |
| 177 bool* success) { | 177 bool* success) { |
| 178 if (base::win::GetVersion() > base::win::VERSION_XP) { | 178 if (base::win::GetVersion() > base::win::VERSION_XP) { |
| (...skipping 64 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 int GetIpcFd() OVERRIDE { | 253 virtual int GetIpcFd() override { |
| 254 return ipc_fd_; | 254 return ipc_fd_; |
| 255 } | 255 } |
| 256 #endif // OS_WIN | 256 #endif // OS_WIN |
| 257 | 257 |
| 258 private: | 258 private: |
| 259 #if defined(OS_WIN) | 259 #if defined(OS_WIN) |
| 260 base::CommandLine* cmd_line_; | 260 base::CommandLine* cmd_line_; |
| 261 #elif defined(OS_POSIX) | 261 #elif defined(OS_POSIX) |
| 262 int ipc_fd_; | 262 int ipc_fd_; |
| 263 #endif // OS_WIN | 263 #endif // OS_WIN |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1058 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1059 ClientIdToShaderCacheMap::iterator iter = | 1059 ClientIdToShaderCacheMap::iterator iter = |
| 1060 client_id_to_shader_cache_.find(client_id); | 1060 client_id_to_shader_cache_.find(client_id); |
| 1061 // If the cache doesn't exist then this is an off the record profile. | 1061 // If the cache doesn't exist then this is an off the record profile. |
| 1062 if (iter == client_id_to_shader_cache_.end()) | 1062 if (iter == client_id_to_shader_cache_.end()) |
| 1063 return; | 1063 return; |
| 1064 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1064 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 } // namespace content | 1067 } // namespace content |
| OLD | NEW |