Chromium Code Reviews| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 } | 435 } |
| 436 | 436 |
| 437 cc::TaskGraphRunner* GpuProcessTransportFactory::GetTaskGraphRunner() { | 437 cc::TaskGraphRunner* GpuProcessTransportFactory::GetTaskGraphRunner() { |
| 438 return task_graph_runner_.get(); | 438 return task_graph_runner_.get(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { | 441 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { |
| 442 return this; | 442 return this; |
| 443 } | 443 } |
| 444 | 444 |
| 445 gfx::GLSurfaceHandle GpuProcessTransportFactory::GetSharedSurfaceHandle() { | |
| 446 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( | |
| 447 gfx::kNullPluginWindow, gfx::NULL_TRANSPORT); | |
| 448 handle.parent_client_id = | |
| 449 BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); | |
| 450 return handle; | |
| 451 } | |
| 452 | |
| 453 scoped_ptr<cc::SurfaceIdAllocator> | 445 scoped_ptr<cc::SurfaceIdAllocator> |
| 454 GpuProcessTransportFactory::CreateSurfaceIdAllocator() { | 446 GpuProcessTransportFactory::CreateSurfaceIdAllocator() { |
| 455 scoped_ptr<cc::SurfaceIdAllocator> allocator = | 447 scoped_ptr<cc::SurfaceIdAllocator> allocator = |
| 456 make_scoped_ptr(new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); | 448 make_scoped_ptr(new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); |
| 457 if (GetSurfaceManager()) | 449 if (GetSurfaceManager()) |
| 458 allocator->RegisterSurfaceIdNamespace(GetSurfaceManager()); | 450 allocator->RegisterSurfaceIdNamespace(GetSurfaceManager()); |
| 459 return allocator; | 451 return allocator; |
| 460 } | 452 } |
| 461 | 453 |
| 462 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, | 454 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 DCHECK(!per_compositor_data_[compositor]); | 549 DCHECK(!per_compositor_data_[compositor]); |
| 558 | 550 |
| 559 gfx::AcceleratedWidget widget = compositor->widget(); | 551 gfx::AcceleratedWidget widget = compositor->widget(); |
| 560 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get(); | 552 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get(); |
| 561 | 553 |
| 562 PerCompositorData* data = new PerCompositorData; | 554 PerCompositorData* data = new PerCompositorData; |
| 563 if (compositor->widget() == gfx::kNullAcceleratedWidget) { | 555 if (compositor->widget() == gfx::kNullAcceleratedWidget) { |
| 564 data->surface_id = 0; | 556 data->surface_id = 0; |
| 565 } else { | 557 } else { |
| 566 data->surface_id = tracker->AddSurfaceForNativeWidget(widget); | 558 data->surface_id = tracker->AddSurfaceForNativeWidget(widget); |
| 559 #if defined(OS_MACOSX) | |
|
no sievers
2015/09/23 21:53:21
While you're at it and are cleaning up the types,
piman
2015/09/23 23:33:37
Yes, good point, done.
| |
| 560 // On Mac, we can't pass the AcceleratedWidget, which is process-local, so | |
| 561 // instead we pass the surface_id, so that we can look up the | |
| 562 // AcceleratedWidget when we receive | |
| 563 // GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params. | |
| 564 gfx::PluginWindowHandle handle = data->surface_id; | |
| 565 #else | |
| 566 gfx::PluginWindowHandle handle = widget; | |
| 567 #endif | |
| 567 tracker->SetSurfaceHandle(data->surface_id, | 568 tracker->SetSurfaceHandle(data->surface_id, |
| 568 gfx::GLSurfaceHandle(widget, gfx::NATIVE_DIRECT)); | 569 gfx::GLSurfaceHandle(handle, gfx::NATIVE_DIRECT)); |
| 569 } | 570 } |
| 570 | 571 |
| 571 per_compositor_data_[compositor] = data; | 572 per_compositor_data_[compositor] = data; |
| 572 | 573 |
| 573 return data; | 574 return data; |
| 574 } | 575 } |
| 575 | 576 |
| 576 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 577 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 577 GpuProcessTransportFactory::CreateContextCommon( | 578 GpuProcessTransportFactory::CreateContextCommon( |
| 578 scoped_refptr<GpuChannelHost> gpu_channel_host, | 579 scoped_refptr<GpuChannelHost> gpu_channel_host, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 626 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 627 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 627 observer_list_, | 628 observer_list_, |
| 628 OnLostResources()); | 629 OnLostResources()); |
| 629 | 630 |
| 630 // Kill things that use the shared context before killing the shared context. | 631 // Kill things that use the shared context before killing the shared context. |
| 631 lost_gl_helper.reset(); | 632 lost_gl_helper.reset(); |
| 632 lost_shared_main_thread_contexts = NULL; | 633 lost_shared_main_thread_contexts = NULL; |
| 633 } | 634 } |
| 634 | 635 |
| 635 } // namespace content | 636 } // namespace content |
| OLD | NEW |