| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 }; | 292 }; |
| 293 | 293 |
| 294 } // anonymous namespace | 294 } // anonymous namespace |
| 295 | 295 |
| 296 class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { | 296 class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { |
| 297 public: | 297 public: |
| 298 ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {} | 298 ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {} |
| 299 | 299 |
| 300 private: | 300 private: |
| 301 // ConnectionFilter: | 301 // ConnectionFilter: |
| 302 bool OnConnect(const shell::Identity& remote_identity, | 302 bool OnConnect(const service_manager::Identity& remote_identity, |
| 303 shell::InterfaceRegistry* registry, | 303 service_manager::InterfaceRegistry* registry, |
| 304 shell::Connector* connector) override { | 304 service_manager::Connector* connector) override { |
| 305 if (remote_identity.name() != kGpuServiceName) | 305 if (remote_identity.name() != kGpuServiceName) |
| 306 return false; | 306 return false; |
| 307 | 307 |
| 308 GetContentClient()->browser()->ExposeInterfacesToGpuProcess(registry, | 308 GetContentClient()->browser()->ExposeInterfacesToGpuProcess(registry, |
| 309 host_); | 309 host_); |
| 310 return true; | 310 return true; |
| 311 } | 311 } |
| 312 | 312 |
| 313 GpuProcessHost* host_; | 313 GpuProcessHost* host_; |
| 314 | 314 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 328 !GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()))) { | 328 !GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()))) { |
| 329 return true; | 329 return true; |
| 330 } | 330 } |
| 331 | 331 |
| 332 host->ForceShutdown(); | 332 host->ForceShutdown(); |
| 333 return false; | 333 return false; |
| 334 } | 334 } |
| 335 | 335 |
| 336 // static | 336 // static |
| 337 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, bool force_create) { | 337 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, bool force_create) { |
| 338 DCHECK(!shell::ShellIsRemote()); | 338 DCHECK(!service_manager::ServiceManagerIsRemote()); |
| 339 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 339 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 340 | 340 |
| 341 // Don't grant further access to GPU if it is not allowed. | 341 // Don't grant further access to GPU if it is not allowed. |
| 342 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | 342 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); |
| 343 DCHECK(gpu_data_manager); | 343 DCHECK(gpu_data_manager); |
| 344 if (!gpu_data_manager->GpuAccessAllowed(NULL)) | 344 if (!gpu_data_manager->GpuAccessAllowed(NULL)) |
| 345 return NULL; | 345 return NULL; |
| 346 | 346 |
| 347 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) | 347 if (g_gpu_process_hosts[kind] && ValidateHost(g_gpu_process_hosts[kind])) |
| 348 return g_gpu_process_hosts[kind]; | 348 return g_gpu_process_hosts[kind]; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 GpuProcessHost::EstablishChannelRequest::EstablishChannelRequest( | 408 GpuProcessHost::EstablishChannelRequest::EstablishChannelRequest( |
| 409 const EstablishChannelRequest& other) = default; | 409 const EstablishChannelRequest& other) = default; |
| 410 | 410 |
| 411 GpuProcessHost::EstablishChannelRequest::~EstablishChannelRequest() {} | 411 GpuProcessHost::EstablishChannelRequest::~EstablishChannelRequest() {} |
| 412 | 412 |
| 413 void GpuProcessHost::RegisterGpuMainThreadFactory( | 413 void GpuProcessHost::RegisterGpuMainThreadFactory( |
| 414 GpuMainThreadFactoryFunction create) { | 414 GpuMainThreadFactoryFunction create) { |
| 415 g_gpu_main_thread_factory = create; | 415 g_gpu_main_thread_factory = create; |
| 416 } | 416 } |
| 417 | 417 |
| 418 shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() { | 418 service_manager::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() { |
| 419 return process_->child_connection()->GetRemoteInterfaces(); | 419 return process_->child_connection()->GetRemoteInterfaces(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 // static | 422 // static |
| 423 GpuProcessHost* GpuProcessHost::FromID(int host_id) { | 423 GpuProcessHost* GpuProcessHost::FromID(int host_id) { |
| 424 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 424 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 425 | 425 |
| 426 for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) { | 426 for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) { |
| 427 GpuProcessHost* host = g_gpu_process_hosts[i]; | 427 GpuProcessHost* host = g_gpu_process_hosts[i]; |
| 428 if (host && host->host_id_ == host_id && ValidateHost(host)) | 428 if (host && host->host_id_ == host_id && ValidateHost(host)) |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1165 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1166 ClientIdToShaderCacheMap::iterator iter = | 1166 ClientIdToShaderCacheMap::iterator iter = |
| 1167 client_id_to_shader_cache_.find(client_id); | 1167 client_id_to_shader_cache_.find(client_id); |
| 1168 // If the cache doesn't exist then this is an off the record profile. | 1168 // If the cache doesn't exist then this is an off the record profile. |
| 1169 if (iter == client_id_to_shader_cache_.end()) | 1169 if (iter == client_id_to_shader_cache_.end()) |
| 1170 return; | 1170 return; |
| 1171 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1171 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 } // namespace content | 1174 } // namespace content |
| OLD | NEW |