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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 vulkan_surface.reset(); | 462 vulkan_surface.reset(); |
463 } else { | 463 } else { |
464 display_output_surface = std::move(vulkan_surface); | 464 display_output_surface = std::move(vulkan_surface); |
465 } | 465 } |
466 } | 466 } |
467 #endif | 467 #endif |
468 | 468 |
469 if (!display_output_surface) { | 469 if (!display_output_surface) { |
470 if (!create_gpu_output_surface) { | 470 if (!create_gpu_output_surface) { |
471 display_output_surface = | 471 display_output_surface = |
472 base::WrapUnique(new SoftwareBrowserCompositorOutputSurface( | 472 base::MakeUnique<SoftwareBrowserCompositorOutputSurface>( |
473 CreateSoftwareOutputDevice(compositor.get()), | 473 CreateSoftwareOutputDevice(compositor.get()), |
474 compositor->vsync_manager(), begin_frame_source.get())); | 474 compositor->vsync_manager(), begin_frame_source.get()); |
475 } else { | 475 } else { |
476 DCHECK(context_provider); | 476 DCHECK(context_provider); |
477 const auto& capabilities = context_provider->ContextCapabilities(); | 477 const auto& capabilities = context_provider->ContextCapabilities(); |
478 if (data->surface_handle == gpu::kNullSurfaceHandle) { | 478 if (data->surface_handle == gpu::kNullSurfaceHandle) { |
479 display_output_surface = | 479 display_output_surface = |
480 base::WrapUnique(new OffscreenBrowserCompositorOutputSurface( | 480 base::MakeUnique<OffscreenBrowserCompositorOutputSurface>( |
481 context_provider, compositor->vsync_manager(), | 481 context_provider, compositor->vsync_manager(), |
482 begin_frame_source.get(), | 482 begin_frame_source.get(), |
483 std::unique_ptr<display_compositor:: | 483 std::unique_ptr< |
484 CompositorOverlayCandidateValidator>())); | 484 display_compositor::CompositorOverlayCandidateValidator>()); |
485 } else if (capabilities.surfaceless) { | 485 } else if (capabilities.surfaceless) { |
486 #if defined(OS_MACOSX) | 486 #if defined(OS_MACOSX) |
487 display_output_surface = base::WrapUnique(new GpuOutputSurfaceMac( | 487 display_output_surface = base::MakeUnique<GpuOutputSurfaceMac>( |
488 context_provider, data->surface_handle, compositor->vsync_manager(), | 488 context_provider, data->surface_handle, compositor->vsync_manager(), |
489 begin_frame_source.get(), | 489 begin_frame_source.get(), |
490 CreateOverlayCandidateValidator(compositor->widget()), | 490 CreateOverlayCandidateValidator(compositor->widget()), |
491 GetGpuMemoryBufferManager())); | 491 GetGpuMemoryBufferManager()); |
492 #else | 492 #else |
493 display_output_surface = | 493 display_output_surface = |
494 base::WrapUnique(new GpuSurfacelessBrowserCompositorOutputSurface( | 494 base::MakeUnique<GpuSurfacelessBrowserCompositorOutputSurface>( |
495 context_provider, data->surface_handle, | 495 context_provider, data->surface_handle, |
496 compositor->vsync_manager(), begin_frame_source.get(), | 496 compositor->vsync_manager(), begin_frame_source.get(), |
497 CreateOverlayCandidateValidator(compositor->widget()), | 497 CreateOverlayCandidateValidator(compositor->widget()), |
498 GL_TEXTURE_2D, GL_RGB, ui::DisplaySnapshot::PrimaryFormat(), | 498 GL_TEXTURE_2D, GL_RGB, ui::DisplaySnapshot::PrimaryFormat(), |
499 GetGpuMemoryBufferManager())); | 499 GetGpuMemoryBufferManager()); |
500 #endif | 500 #endif |
501 } else { | 501 } else { |
502 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 502 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
503 validator; | 503 validator; |
504 const bool use_mus = IsUsingMus(); | 504 const bool use_mus = IsUsingMus(); |
505 #if !defined(OS_MACOSX) | 505 #if !defined(OS_MACOSX) |
506 // Overlays are only supported on surfaceless output surfaces on Mac. | 506 // Overlays are only supported on surfaceless output surfaces on Mac. |
507 if (!use_mus) | 507 if (!use_mus) |
508 validator = CreateOverlayCandidateValidator(compositor->widget()); | 508 validator = CreateOverlayCandidateValidator(compositor->widget()); |
509 #endif | 509 #endif |
510 if (!use_mus) { | 510 if (!use_mus) { |
511 display_output_surface = | 511 display_output_surface = |
512 base::WrapUnique(new GpuBrowserCompositorOutputSurface( | 512 base::MakeUnique<GpuBrowserCompositorOutputSurface>( |
513 context_provider, compositor->vsync_manager(), | 513 context_provider, compositor->vsync_manager(), |
514 begin_frame_source.get(), std::move(validator))); | 514 begin_frame_source.get(), std::move(validator)); |
515 } else { | 515 } else { |
516 #if defined(USE_AURA) | 516 #if defined(USE_AURA) |
517 display_output_surface = | 517 display_output_surface = |
518 base::WrapUnique(new MusBrowserCompositorOutputSurface( | 518 base::MakeUnique<MusBrowserCompositorOutputSurface>( |
519 compositor->window(), context_provider, | 519 compositor->window(), context_provider, |
520 compositor->vsync_manager(), begin_frame_source.get(), | 520 compositor->vsync_manager(), begin_frame_source.get(), |
521 std::move(validator))); | 521 std::move(validator)); |
522 #else | 522 #else |
523 NOTREACHED(); | 523 NOTREACHED(); |
524 #endif | 524 #endif |
525 } | 525 } |
526 } | 526 } |
527 } | 527 } |
528 } | 528 } |
529 | 529 |
530 data->display_output_surface = display_output_surface.get(); | 530 data->display_output_surface = display_output_surface.get(); |
531 data->begin_frame_source = begin_frame_source.get(); | 531 data->begin_frame_source = begin_frame_source.get(); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 shared_vulkan_context_provider_ = | 874 shared_vulkan_context_provider_ = |
875 cc::VulkanInProcessContextProvider::Create(); | 875 cc::VulkanInProcessContextProvider::Create(); |
876 } | 876 } |
877 | 877 |
878 shared_vulkan_context_provider_initialized_ = true; | 878 shared_vulkan_context_provider_initialized_ = true; |
879 } | 879 } |
880 return shared_vulkan_context_provider_; | 880 return shared_vulkan_context_provider_; |
881 } | 881 } |
882 | 882 |
883 } // namespace content | 883 } // namespace content |
OLD | NEW |