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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 ChildProcessHost* host) | 151 ChildProcessHost* host) |
152 #if defined(OS_WIN) | 152 #if defined(OS_WIN) |
153 : cmd_line_(cmd_line) {} | 153 : cmd_line_(cmd_line) {} |
154 #elif defined(OS_POSIX) | 154 #elif defined(OS_POSIX) |
155 : ipc_fd_(host->TakeClientFileDescriptor()) {} | 155 : ipc_fd_(host->TakeClientFileDescriptor()) {} |
156 #endif | 156 #endif |
157 | 157 |
158 ~GpuSandboxedProcessLauncherDelegate() override {} | 158 ~GpuSandboxedProcessLauncherDelegate() override {} |
159 | 159 |
160 #if defined(OS_WIN) | 160 #if defined(OS_WIN) |
161 virtual bool ShouldSandbox() override { | 161 bool ShouldSandbox() override { |
162 bool sandbox = !cmd_line_->HasSwitch(switches::kDisableGpuSandbox); | 162 bool sandbox = !cmd_line_->HasSwitch(switches::kDisableGpuSandbox); |
163 if(! sandbox) { | 163 if(! sandbox) { |
164 DVLOG(1) << "GPU sandbox is disabled"; | 164 DVLOG(1) << "GPU sandbox is disabled"; |
165 } | 165 } |
166 return sandbox; | 166 return sandbox; |
167 } | 167 } |
168 | 168 |
169 virtual void PreSandbox(bool* disable_default_policy, | 169 void PreSandbox(bool* disable_default_policy, |
170 base::FilePath* exposed_dir) override { | 170 base::FilePath* exposed_dir) override { |
171 *disable_default_policy = true; | 171 *disable_default_policy = true; |
172 } | 172 } |
173 | 173 |
174 // For the GPU process we gotten as far as USER_LIMITED. The next level | 174 // For the GPU process we gotten as far as USER_LIMITED. The next level |
175 // which is USER_RESTRICTED breaks both the DirectX backend and the OpenGL | 175 // which is USER_RESTRICTED breaks both the DirectX backend and the OpenGL |
176 // backend. Note that the GPU process is connected to the interactive | 176 // backend. Note that the GPU process is connected to the interactive |
177 // desktop. | 177 // desktop. |
178 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, | 178 void PreSpawnTarget(sandbox::TargetPolicy* policy, bool* success) override { |
179 bool* success) { | |
180 if (base::win::GetVersion() > base::win::VERSION_XP) { | 179 if (base::win::GetVersion() > base::win::VERSION_XP) { |
181 if (cmd_line_->GetSwitchValueASCII(switches::kUseGL) == | 180 if (cmd_line_->GetSwitchValueASCII(switches::kUseGL) == |
182 gfx::kGLImplementationDesktopName) { | 181 gfx::kGLImplementationDesktopName) { |
183 // Open GL path. | 182 // Open GL path. |
184 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, | 183 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, |
185 sandbox::USER_LIMITED); | 184 sandbox::USER_LIMITED); |
186 SetJobLevel(*cmd_line_, sandbox::JOB_UNPROTECTED, 0, policy); | 185 SetJobLevel(*cmd_line_, sandbox::JOB_UNPROTECTED, 0, policy); |
187 policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); | 186 policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW); |
188 } else { | 187 } else { |
189 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, | 188 policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS, |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1090 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1092 ClientIdToShaderCacheMap::iterator iter = | 1091 ClientIdToShaderCacheMap::iterator iter = |
1093 client_id_to_shader_cache_.find(client_id); | 1092 client_id_to_shader_cache_.find(client_id); |
1094 // If the cache doesn't exist then this is an off the record profile. | 1093 // If the cache doesn't exist then this is an off the record profile. |
1095 if (iter == client_id_to_shader_cache_.end()) | 1094 if (iter == client_id_to_shader_cache_.end()) |
1096 return; | 1095 return; |
1097 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1096 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1098 } | 1097 } |
1099 | 1098 |
1100 } // namespace content | 1099 } // namespace content |
OLD | NEW |