| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/aura/gpu_process_transport_factory.h" | 5 #include "content/browser/aura/gpu_process_transport_factory.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 if (per_compositor_data_.empty()) | 281 if (per_compositor_data_.empty()) |
| 282 gl_helper_.reset(); | 282 gl_helper_.reset(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 bool GpuProcessTransportFactory::DoesCreateTestContexts() { return false; } | 285 bool GpuProcessTransportFactory::DoesCreateTestContexts() { return false; } |
| 286 | 286 |
| 287 ui::ContextFactory* GpuProcessTransportFactory::AsContextFactory() { | 287 ui::ContextFactory* GpuProcessTransportFactory::AsContextFactory() { |
| 288 return this; | 288 return this; |
| 289 } | 289 } |
| 290 | 290 |
| 291 gfx::GLSurfaceHandle GpuProcessTransportFactory::CreateSharedSurfaceHandle() { | 291 gfx::GLSurfaceHandle GpuProcessTransportFactory::GetSharedSurfaceHandle() { |
| 292 // TODO(sievers): crbug.com/329737 |
| 293 // Creating the context here hurts startup performance. |
| 294 // Remove this once all tests are happy. |
| 292 scoped_refptr<cc::ContextProvider> provider = | 295 scoped_refptr<cc::ContextProvider> provider = |
| 293 SharedMainThreadContextProvider(); | 296 SharedMainThreadContextProvider(); |
| 294 if (!provider.get()) | 297 LOG_IF(ERROR, !provider.get()) |
| 295 return gfx::GLSurfaceHandle(); | 298 << "Could not create shared context. CanUseBrowserCompositor() = " |
| 296 ContextProviderCommandBuffer* provider_command_buffer = | 299 << GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor(); |
| 297 static_cast<ContextProviderCommandBuffer*>(provider.get()); | 300 |
| 298 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( | 301 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( |
| 299 gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); | 302 gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); |
| 300 handle.parent_gpu_process_id = provider_command_buffer->GetGPUProcessID(); | |
| 301 handle.parent_client_id = | 303 handle.parent_client_id = |
| 302 BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); | 304 BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); |
| 303 return handle; | 305 return handle; |
| 304 } | 306 } |
| 305 | 307 |
| 306 void GpuProcessTransportFactory::DestroySharedSurfaceHandle( | |
| 307 gfx::GLSurfaceHandle surface) {} | |
| 308 | |
| 309 scoped_refptr<ui::Texture> GpuProcessTransportFactory::CreateTransportClient( | 308 scoped_refptr<ui::Texture> GpuProcessTransportFactory::CreateTransportClient( |
| 310 float device_scale_factor) { | 309 float device_scale_factor) { |
| 311 scoped_refptr<cc::ContextProvider> provider = | 310 scoped_refptr<cc::ContextProvider> provider = |
| 312 SharedMainThreadContextProvider(); | 311 SharedMainThreadContextProvider(); |
| 313 if (!provider.get()) | 312 if (!provider.get()) |
| 314 return NULL; | 313 return NULL; |
| 315 GLuint texture_id = 0; | 314 GLuint texture_id = 0; |
| 316 provider->ContextGL()->GenTextures(1, &texture_id); | 315 provider->ContextGL()->GenTextures(1, &texture_id); |
| 317 scoped_refptr<ImageTransportClientTexture> image( | 316 scoped_refptr<ImageTransportClientTexture> image( |
| 318 new ImageTransportClientTexture( | 317 new ImageTransportClientTexture( |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 observer_list_, | 480 observer_list_, |
| 482 OnLostResources()); | 481 OnLostResources()); |
| 483 | 482 |
| 484 // Kill things that use the shared context before killing the shared context. | 483 // Kill things that use the shared context before killing the shared context. |
| 485 lost_gl_helper.reset(); | 484 lost_gl_helper.reset(); |
| 486 lost_offscreen_compositor_contexts = NULL; | 485 lost_offscreen_compositor_contexts = NULL; |
| 487 lost_shared_main_thread_contexts = NULL; | 486 lost_shared_main_thread_contexts = NULL; |
| 488 } | 487 } |
| 489 | 488 |
| 490 } // namespace content | 489 } // namespace content |
| OLD | NEW |