| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 474 } |
| 475 | 475 |
| 476 cc::TaskGraphRunner* GpuProcessTransportFactory::GetTaskGraphRunner() { | 476 cc::TaskGraphRunner* GpuProcessTransportFactory::GetTaskGraphRunner() { |
| 477 return task_graph_runner_.get(); | 477 return task_graph_runner_.get(); |
| 478 } | 478 } |
| 479 | 479 |
| 480 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { | 480 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { |
| 481 return this; | 481 return this; |
| 482 } | 482 } |
| 483 | 483 |
| 484 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { |
| 485 return surface_manager_.get(); |
| 486 } |
| 487 |
| 484 scoped_ptr<cc::SurfaceIdAllocator> | 488 scoped_ptr<cc::SurfaceIdAllocator> |
| 485 GpuProcessTransportFactory::CreateSurfaceIdAllocator() { | 489 GpuProcessTransportFactory::CreateSurfaceIdAllocator() { |
| 486 scoped_ptr<cc::SurfaceIdAllocator> allocator = | 490 scoped_ptr<cc::SurfaceIdAllocator> allocator = |
| 487 make_scoped_ptr(new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); | 491 make_scoped_ptr(new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); |
| 488 if (GetSurfaceManager()) | 492 allocator->RegisterSurfaceIdNamespace(surface_manager_.get()); |
| 489 allocator->RegisterSurfaceIdNamespace(GetSurfaceManager()); | |
| 490 return allocator; | 493 return allocator; |
| 491 } | 494 } |
| 492 | 495 |
| 493 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, | 496 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, |
| 494 const gfx::Size& size) { | 497 const gfx::Size& size) { |
| 495 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 498 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 496 if (it == per_compositor_data_.end()) | 499 if (it == per_compositor_data_.end()) |
| 497 return; | 500 return; |
| 498 PerCompositorData* data = it->second; | 501 PerCompositorData* data = it->second; |
| 499 DCHECK(data); | 502 DCHECK(data); |
| 500 if (data->display_client) | 503 if (data->display_client) |
| 501 data->display_client->display()->Resize(size); | 504 data->display_client->display()->Resize(size); |
| 502 } | 505 } |
| 503 | 506 |
| 504 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { | |
| 505 return surface_manager_.get(); | |
| 506 } | |
| 507 | |
| 508 GLHelper* GpuProcessTransportFactory::GetGLHelper() { | 507 GLHelper* GpuProcessTransportFactory::GetGLHelper() { |
| 509 if (!gl_helper_ && !per_compositor_data_.empty()) { | 508 if (!gl_helper_ && !per_compositor_data_.empty()) { |
| 510 scoped_refptr<cc::ContextProvider> provider = | 509 scoped_refptr<cc::ContextProvider> provider = |
| 511 SharedMainThreadContextProvider(); | 510 SharedMainThreadContextProvider(); |
| 512 if (provider.get()) | 511 if (provider.get()) |
| 513 gl_helper_.reset(new GLHelper(provider->ContextGL(), | 512 gl_helper_.reset(new GLHelper(provider->ContextGL(), |
| 514 provider->ContextSupport())); | 513 provider->ContextSupport())); |
| 515 } | 514 } |
| 516 return gl_helper_.get(); | 515 return gl_helper_.get(); |
| 517 } | 516 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 657 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 659 observer_list_, | 658 observer_list_, |
| 660 OnLostResources()); | 659 OnLostResources()); |
| 661 | 660 |
| 662 // Kill things that use the shared context before killing the shared context. | 661 // Kill things that use the shared context before killing the shared context. |
| 663 lost_gl_helper.reset(); | 662 lost_gl_helper.reset(); |
| 664 lost_shared_main_thread_contexts = NULL; | 663 lost_shared_main_thread_contexts = NULL; |
| 665 } | 664 } |
| 666 | 665 |
| 667 } // namespace content | 666 } // namespace content |
| OLD | NEW |