Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 2873243002: Move components/display_compositor to components/viz/display_compositor (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 #include "cc/output/texture_mailbox_deleter.h" 23 #include "cc/output/texture_mailbox_deleter.h"
24 #include "cc/output/vulkan_in_process_context_provider.h" 24 #include "cc/output/vulkan_in_process_context_provider.h"
25 #include "cc/raster/single_thread_task_graph_runner.h" 25 #include "cc/raster/single_thread_task_graph_runner.h"
26 #include "cc/raster/task_graph_runner.h" 26 #include "cc/raster/task_graph_runner.h"
27 #include "cc/scheduler/begin_frame_source.h" 27 #include "cc/scheduler/begin_frame_source.h"
28 #include "cc/scheduler/delay_based_time_source.h" 28 #include "cc/scheduler/delay_based_time_source.h"
29 #include "cc/surfaces/direct_compositor_frame_sink.h" 29 #include "cc/surfaces/direct_compositor_frame_sink.h"
30 #include "cc/surfaces/display.h" 30 #include "cc/surfaces/display.h"
31 #include "cc/surfaces/display_scheduler.h" 31 #include "cc/surfaces/display_scheduler.h"
32 #include "cc/surfaces/surface_manager.h" 32 #include "cc/surfaces/surface_manager.h"
33 #include "components/display_compositor/compositor_overlay_candidate_validator.h " 33 #include "components/viz/display_compositor/compositor_overlay_candidate_validat or.h"
34 #include "components/display_compositor/gl_helper.h" 34 #include "components/viz/display_compositor/gl_helper.h"
35 #include "components/display_compositor/host_shared_bitmap_manager.h" 35 #include "components/viz/display_compositor/host_shared_bitmap_manager.h"
36 #include "content/browser/compositor/browser_compositor_output_surface.h" 36 #include "content/browser/compositor/browser_compositor_output_surface.h"
37 #include "content/browser/compositor/frame_sink_manager_host.h" 37 #include "content/browser/compositor/frame_sink_manager_host.h"
38 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" 38 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h"
39 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" 39 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h"
40 #include "content/browser/compositor/offscreen_browser_compositor_output_surface .h" 40 #include "content/browser/compositor/offscreen_browser_compositor_output_surface .h"
41 #include "content/browser/compositor/reflector_impl.h" 41 #include "content/browser/compositor/reflector_impl.h"
42 #include "content/browser/compositor/software_browser_compositor_output_surface. h" 42 #include "content/browser/compositor/software_browser_compositor_output_surface. h"
43 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 43 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
44 #include "content/browser/gpu/gpu_data_manager_impl.h" 44 #include "content/browser/gpu/gpu_data_manager_impl.h"
45 #include "content/browser/renderer_host/render_widget_host_impl.h" 45 #include "content/browser/renderer_host/render_widget_host_impl.h"
(...skipping 20 matching lines...) Expand all
66 #include "ui/gfx/switches.h" 66 #include "ui/gfx/switches.h"
67 #include "ui/gl/gl_switches.h" 67 #include "ui/gl/gl_switches.h"
68 68
69 #if defined(USE_AURA) 69 #if defined(USE_AURA)
70 #include "content/public/common/service_manager_connection.h" 70 #include "content/public/common/service_manager_connection.h"
71 #include "ui/aura/window_tree_host.h" 71 #include "ui/aura/window_tree_host.h"
72 #endif 72 #endif
73 73
74 #if defined(OS_WIN) 74 #if defined(OS_WIN)
75 #include "base/win/windows_version.h" 75 #include "base/win/windows_version.h"
76 #include "components/display_compositor/compositor_overlay_candidate_validator_w in.h" 76 #include "components/viz/display_compositor/compositor_overlay_candidate_validat or_win.h"
77 #include "content/browser/compositor/software_output_device_win.h" 77 #include "content/browser/compositor/software_output_device_win.h"
78 #include "ui/gfx/win/rendering_window_manager.h" 78 #include "ui/gfx/win/rendering_window_manager.h"
79 #elif defined(USE_OZONE) 79 #elif defined(USE_OZONE)
80 #include "components/display_compositor/compositor_overlay_candidate_validator_o zone.h" 80 #include "components/viz/display_compositor/compositor_overlay_candidate_validat or_ozone.h"
81 #include "content/browser/compositor/software_output_device_ozone.h" 81 #include "content/browser/compositor/software_output_device_ozone.h"
82 #include "ui/ozone/public/overlay_candidates_ozone.h" 82 #include "ui/ozone/public/overlay_candidates_ozone.h"
83 #include "ui/ozone/public/overlay_manager_ozone.h" 83 #include "ui/ozone/public/overlay_manager_ozone.h"
84 #include "ui/ozone/public/ozone_platform.h" 84 #include "ui/ozone/public/ozone_platform.h"
85 #include "ui/ozone/public/ozone_switches.h" 85 #include "ui/ozone/public/ozone_switches.h"
86 #elif defined(USE_X11) 86 #elif defined(USE_X11)
87 #include "content/browser/compositor/software_output_device_x11.h" 87 #include "content/browser/compositor/software_output_device_x11.h"
88 #elif defined(OS_MACOSX) 88 #elif defined(OS_MACOSX)
89 #include "components/display_compositor/compositor_overlay_candidate_validator_m ac.h" 89 #include "components/viz/display_compositor/compositor_overlay_candidate_validat or_mac.h"
90 #include "content/browser/compositor/gpu_output_surface_mac.h" 90 #include "content/browser/compositor/gpu_output_surface_mac.h"
91 #include "content/browser/compositor/software_output_device_mac.h" 91 #include "content/browser/compositor/software_output_device_mac.h"
92 #include "gpu/config/gpu_driver_bug_workaround_type.h" 92 #include "gpu/config/gpu_driver_bug_workaround_type.h"
93 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" 93 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
94 #include "ui/base/cocoa/remote_layer_api.h" 94 #include "ui/base/cocoa/remote_layer_api.h"
95 #include "ui/base/ui_base_switches.h" 95 #include "ui/base/ui_base_switches.h"
96 #elif defined(OS_ANDROID) 96 #elif defined(OS_ANDROID)
97 #include "components/display_compositor/compositor_overlay_candidate_validator_a ndroid.h" 97 #include "components/viz/display_compositor/compositor_overlay_candidate_validat or_android.h"
98 #endif 98 #endif
99 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) 99 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW)
100 #include "gpu/ipc/common/gpu_surface_tracker.h" 100 #include "gpu/ipc/common/gpu_surface_tracker.h"
101 #endif 101 #endif
102 102
103 #if BUILDFLAG(ENABLE_VULKAN) 103 #if BUILDFLAG(ENABLE_VULKAN)
104 #include "content/browser/compositor/vulkan_browser_compositor_output_surface.h" 104 #include "content/browser/compositor/vulkan_browser_compositor_output_surface.h"
105 #endif 105 #endif
106 106
107 using cc::ContextProvider; 107 using cc::ContextProvider;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 new SoftwareOutputDeviceX11(compositor)); 261 new SoftwareOutputDeviceX11(compositor));
262 #elif defined(OS_MACOSX) 262 #elif defined(OS_MACOSX)
263 return std::unique_ptr<cc::SoftwareOutputDevice>( 263 return std::unique_ptr<cc::SoftwareOutputDevice>(
264 new SoftwareOutputDeviceMac(compositor)); 264 new SoftwareOutputDeviceMac(compositor));
265 #else 265 #else
266 NOTREACHED(); 266 NOTREACHED();
267 return std::unique_ptr<cc::SoftwareOutputDevice>(); 267 return std::unique_ptr<cc::SoftwareOutputDevice>();
268 #endif 268 #endif
269 } 269 }
270 270
271 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 271 std::unique_ptr<viz::CompositorOverlayCandidateValidator>
272 CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) { 272 CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) {
273 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 273 std::unique_ptr<viz::CompositorOverlayCandidateValidator> validator;
274 validator;
275 #if defined(USE_OZONE) 274 #if defined(USE_OZONE)
276 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 275 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
277 if (command_line->HasSwitch(switches::kEnableHardwareOverlays)) { 276 if (command_line->HasSwitch(switches::kEnableHardwareOverlays)) {
278 std::string enable_overlay_flag = 277 std::string enable_overlay_flag =
279 command_line->GetSwitchValueASCII(switches::kEnableHardwareOverlays); 278 command_line->GetSwitchValueASCII(switches::kEnableHardwareOverlays);
280 std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates = 279 std::unique_ptr<ui::OverlayCandidatesOzone> overlay_candidates =
281 ui::OzonePlatform::GetInstance() 280 ui::OzonePlatform::GetInstance()
282 ->GetOverlayManager() 281 ->GetOverlayManager()
283 ->CreateOverlayCandidates(widget); 282 ->CreateOverlayCandidates(widget);
284 validator.reset( 283 validator.reset(new viz::CompositorOverlayCandidateValidatorOzone(
285 new display_compositor::CompositorOverlayCandidateValidatorOzone( 284 std::move(overlay_candidates), enable_overlay_flag));
286 std::move(overlay_candidates), enable_overlay_flag));
287 } 285 }
288 #elif defined(OS_MACOSX) 286 #elif defined(OS_MACOSX)
289 // Overlays are only supported through the remote layer API. 287 // Overlays are only supported through the remote layer API.
290 if (ui::RemoteLayerAPISupported()) { 288 if (ui::RemoteLayerAPISupported()) {
291 static bool overlays_disabled_at_command_line = 289 static bool overlays_disabled_at_command_line =
292 IsCALayersDisabledFromCommandLine(); 290 IsCALayersDisabledFromCommandLine();
293 const bool ca_layers_disabled = 291 const bool ca_layers_disabled =
294 overlays_disabled_at_command_line || 292 overlays_disabled_at_command_line ||
295 GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive( 293 GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive(
296 gpu::DISABLE_OVERLAY_CA_LAYERS); 294 gpu::DISABLE_OVERLAY_CA_LAYERS);
297 validator.reset( 295 validator.reset(
298 new display_compositor::CompositorOverlayCandidateValidatorMac( 296 new viz::CompositorOverlayCandidateValidatorMac(ca_layers_disabled));
299 ca_layers_disabled));
300 } 297 }
301 #elif defined(OS_ANDROID) 298 #elif defined(OS_ANDROID)
302 validator.reset( 299 validator.reset(new viz::CompositorOverlayCandidateValidatorAndroid());
303 new display_compositor::CompositorOverlayCandidateValidatorAndroid());
304 #elif defined(OS_WIN) 300 #elif defined(OS_WIN)
305 validator = base::MakeUnique< 301 validator = base::MakeUnique<viz::CompositorOverlayCandidateValidatorWin>();
306 display_compositor::CompositorOverlayCandidateValidatorWin>();
307 #endif 302 #endif
308 303
309 return validator; 304 return validator;
310 } 305 }
311 306
312 static bool ShouldCreateGpuCompositorFrameSink(ui::Compositor* compositor) { 307 static bool ShouldCreateGpuCompositorFrameSink(ui::Compositor* compositor) {
313 #if defined(OS_CHROMEOS) 308 #if defined(OS_CHROMEOS)
314 // Software fallback does not happen on Chrome OS. 309 // Software fallback does not happen on Chrome OS.
315 return true; 310 return true;
316 #endif 311 #endif
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 base::MakeUnique<SoftwareBrowserCompositorOutputSurface>( 514 base::MakeUnique<SoftwareBrowserCompositorOutputSurface>(
520 CreateSoftwareOutputDevice(compositor.get()), vsync_callback, 515 CreateSoftwareOutputDevice(compositor.get()), vsync_callback,
521 compositor->task_runner()); 516 compositor->task_runner());
522 } else { 517 } else {
523 DCHECK(context_provider); 518 DCHECK(context_provider);
524 const auto& capabilities = context_provider->ContextCapabilities(); 519 const auto& capabilities = context_provider->ContextCapabilities();
525 if (data->surface_handle == gpu::kNullSurfaceHandle) { 520 if (data->surface_handle == gpu::kNullSurfaceHandle) {
526 display_output_surface = 521 display_output_surface =
527 base::MakeUnique<OffscreenBrowserCompositorOutputSurface>( 522 base::MakeUnique<OffscreenBrowserCompositorOutputSurface>(
528 context_provider, vsync_callback, 523 context_provider, vsync_callback,
529 std::unique_ptr< 524 std::unique_ptr<viz::CompositorOverlayCandidateValidator>());
530 display_compositor::CompositorOverlayCandidateValidator>());
531 } else if (capabilities.surfaceless) { 525 } else if (capabilities.surfaceless) {
532 #if defined(OS_MACOSX) 526 #if defined(OS_MACOSX)
533 display_output_surface = base::MakeUnique<GpuOutputSurfaceMac>( 527 display_output_surface = base::MakeUnique<GpuOutputSurfaceMac>(
534 compositor->widget(), context_provider, data->surface_handle, 528 compositor->widget(), context_provider, data->surface_handle,
535 vsync_callback, 529 vsync_callback,
536 CreateOverlayCandidateValidator(compositor->widget()), 530 CreateOverlayCandidateValidator(compositor->widget()),
537 GetGpuMemoryBufferManager()); 531 GetGpuMemoryBufferManager());
538 #else 532 #else
539 auto gpu_output_surface = 533 auto gpu_output_surface =
540 base::MakeUnique<GpuSurfacelessBrowserCompositorOutputSurface>( 534 base::MakeUnique<GpuSurfacelessBrowserCompositorOutputSurface>(
541 context_provider, data->surface_handle, vsync_callback, 535 context_provider, data->surface_handle, vsync_callback,
542 CreateOverlayCandidateValidator(compositor->widget()), 536 CreateOverlayCandidateValidator(compositor->widget()),
543 GL_TEXTURE_2D, GL_RGB, 537 GL_TEXTURE_2D, GL_RGB,
544 display::DisplaySnapshot::PrimaryFormat(), 538 display::DisplaySnapshot::PrimaryFormat(),
545 GetGpuMemoryBufferManager()); 539 GetGpuMemoryBufferManager());
546 gpu_vsync_control = gpu_output_surface.get(); 540 gpu_vsync_control = gpu_output_surface.get();
547 display_output_surface = std::move(gpu_output_surface); 541 display_output_surface = std::move(gpu_output_surface);
548 #endif 542 #endif
549 } else { 543 } else {
550 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 544 std::unique_ptr<viz::CompositorOverlayCandidateValidator> validator;
551 validator;
552 #if defined(OS_WIN) 545 #if defined(OS_WIN)
553 if (capabilities.dc_layers) 546 if (capabilities.dc_layers)
554 validator = CreateOverlayCandidateValidator(compositor->widget()); 547 validator = CreateOverlayCandidateValidator(compositor->widget());
555 #elif !defined(OS_MACOSX) 548 #elif !defined(OS_MACOSX)
556 // Overlays are only supported on surfaceless output surfaces on Mac. 549 // Overlays are only supported on surfaceless output surfaces on Mac.
557 validator = CreateOverlayCandidateValidator(compositor->widget()); 550 validator = CreateOverlayCandidateValidator(compositor->widget());
558 #endif 551 #endif
559 auto gpu_output_surface = 552 auto gpu_output_surface =
560 base::MakeUnique<GpuBrowserCompositorOutputSurface>( 553 base::MakeUnique<GpuBrowserCompositorOutputSurface>(
561 context_provider, vsync_callback, std::move(validator)); 554 context_provider, vsync_callback, std::move(validator));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( 591 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild(
599 compositor->widget()); 592 compositor->widget());
600 #endif 593 #endif
601 594
602 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( 595 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler(
603 compositor->task_runner().get(), 596 compositor->task_runner().get(),
604 display_output_surface->capabilities().max_frames_pending)); 597 display_output_surface->capabilities().max_frames_pending));
605 598
606 // The Display owns and uses the |display_output_surface| created above. 599 // The Display owns and uses the |display_output_surface| created above.
607 data->display = base::MakeUnique<cc::Display>( 600 data->display = base::MakeUnique<cc::Display>(
608 display_compositor::HostSharedBitmapManager::current(), 601 viz::HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(),
609 GetGpuMemoryBufferManager(), renderer_settings_, 602 renderer_settings_, compositor->frame_sink_id(), begin_frame_source,
610 compositor->frame_sink_id(), begin_frame_source,
611 std::move(display_output_surface), std::move(scheduler), 603 std::move(display_output_surface), std::move(scheduler),
612 base::MakeUnique<cc::TextureMailboxDeleter>( 604 base::MakeUnique<cc::TextureMailboxDeleter>(
613 compositor->task_runner().get())); 605 compositor->task_runner().get()));
614 // Note that we are careful not to destroy prior BeginFrameSource objects 606 // Note that we are careful not to destroy prior BeginFrameSource objects
615 // until we have reset |data->display|. 607 // until we have reset |data->display|.
616 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); 608 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source);
617 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); 609 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source);
618 610
619 // The |delegated_output_surface| is given back to the compositor, it 611 // The |delegated_output_surface| is given back to the compositor, it
620 // delegates to the Display as its root surface. Importantly, it shares the 612 // delegates to the Display as its root surface. Importantly, it shares the
621 // same ContextProvider as the Display's output surface. 613 // same ContextProvider as the Display's output surface.
622 auto compositor_frame_sink = 614 auto compositor_frame_sink =
623 vulkan_context_provider 615 vulkan_context_provider
624 ? base::MakeUnique<cc::DirectCompositorFrameSink>( 616 ? base::MakeUnique<cc::DirectCompositorFrameSink>(
625 compositor->frame_sink_id(), GetSurfaceManager(), 617 compositor->frame_sink_id(), GetSurfaceManager(),
626 data->display.get(), 618 data->display.get(),
627 static_cast<scoped_refptr<cc::VulkanContextProvider>>( 619 static_cast<scoped_refptr<cc::VulkanContextProvider>>(
628 vulkan_context_provider)) 620 vulkan_context_provider))
629 : base::MakeUnique<cc::DirectCompositorFrameSink>( 621 : base::MakeUnique<cc::DirectCompositorFrameSink>(
630 compositor->frame_sink_id(), GetSurfaceManager(), 622 compositor->frame_sink_id(), GetSurfaceManager(),
631 data->display.get(), context_provider, 623 data->display.get(), context_provider,
632 shared_worker_context_provider_, GetGpuMemoryBufferManager(), 624 shared_worker_context_provider_, GetGpuMemoryBufferManager(),
633 display_compositor::HostSharedBitmapManager::current()); 625 viz::HostSharedBitmapManager::current());
634 data->display->Resize(compositor->size()); 626 data->display->Resize(compositor->size());
635 data->display->SetOutputIsSecure(data->output_is_secure); 627 data->display->SetOutputIsSecure(data->output_is_secure);
636 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); 628 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink));
637 } 629 }
638 630
639 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( 631 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector(
640 ui::Compositor* source_compositor, 632 ui::Compositor* source_compositor,
641 ui::Layer* target_layer) { 633 ui::Layer* target_layer) {
642 PerCompositorData* source_data = 634 PerCompositorData* source_data =
643 per_compositor_data_[source_compositor].get(); 635 per_compositor_data_[source_compositor].get();
(...skipping 27 matching lines...) Expand all
671 gpu::GpuSurfaceTracker::Get()->RemoveSurface(data->surface_handle); 663 gpu::GpuSurfaceTracker::Get()->RemoveSurface(data->surface_handle);
672 #endif 664 #endif
673 665
674 per_compositor_data_.erase(it); 666 per_compositor_data_.erase(it);
675 if (per_compositor_data_.empty()) { 667 if (per_compositor_data_.empty()) {
676 // Destroying the GLHelper may cause some async actions to be cancelled, 668 // Destroying the GLHelper may cause some async actions to be cancelled,
677 // causing things to request a new GLHelper. Due to crbug.com/176091 the 669 // causing things to request a new GLHelper. Due to crbug.com/176091 the
678 // GLHelper created in this case would be lost/leaked if we just reset() 670 // GLHelper created in this case would be lost/leaked if we just reset()
679 // on the |gl_helper_| variable directly. So instead we call reset() on a 671 // on the |gl_helper_| variable directly. So instead we call reset() on a
680 // local std::unique_ptr. 672 // local std::unique_ptr.
681 std::unique_ptr<display_compositor::GLHelper> helper = 673 std::unique_ptr<viz::GLHelper> helper = std::move(gl_helper_);
682 std::move(gl_helper_);
683 674
684 // If there are any observer left at this point, make sure they clean up 675 // If there are any observer left at this point, make sure they clean up
685 // before we destroy the GLHelper. 676 // before we destroy the GLHelper.
686 for (auto& observer : observer_list_) 677 for (auto& observer : observer_list_)
687 observer.OnLostResources(); 678 observer.OnLostResources();
688 679
689 helper.reset(); 680 helper.reset();
690 DCHECK(!gl_helper_) << "Destroying the GLHelper should not cause a new " 681 DCHECK(!gl_helper_) << "Destroying the GLHelper should not cause a new "
691 "GLHelper to be created."; 682 "GLHelper to be created.";
692 } 683 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 } 809 }
819 810
820 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { 811 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() {
821 return frame_sink_manager_host_->surface_manager(); 812 return frame_sink_manager_host_->surface_manager();
822 } 813 }
823 814
824 FrameSinkManagerHost* GpuProcessTransportFactory::GetFrameSinkManagerHost() { 815 FrameSinkManagerHost* GpuProcessTransportFactory::GetFrameSinkManagerHost() {
825 return frame_sink_manager_host_.get(); 816 return frame_sink_manager_host_.get();
826 } 817 }
827 818
828 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { 819 viz::GLHelper* GpuProcessTransportFactory::GetGLHelper() {
829 if (!gl_helper_ && !per_compositor_data_.empty()) { 820 if (!gl_helper_ && !per_compositor_data_.empty()) {
830 scoped_refptr<cc::ContextProvider> provider = 821 scoped_refptr<cc::ContextProvider> provider =
831 SharedMainThreadContextProvider(); 822 SharedMainThreadContextProvider();
832 if (provider.get()) 823 if (provider.get())
833 gl_helper_.reset(new display_compositor::GLHelper( 824 gl_helper_.reset(
834 provider->ContextGL(), provider->ContextSupport())); 825 new viz::GLHelper(provider->ContextGL(), provider->ContextSupport()));
835 } 826 }
836 return gl_helper_.get(); 827 return gl_helper_.get();
837 } 828 }
838 829
839 void GpuProcessTransportFactory::SetGpuChannelEstablishFactory( 830 void GpuProcessTransportFactory::SetGpuChannelEstablishFactory(
840 gpu::GpuChannelEstablishFactory* factory) { 831 gpu::GpuChannelEstablishFactory* factory) {
841 DCHECK(!gpu_channel_factory_ || !factory); 832 DCHECK(!gpu_channel_factory_ || !factory);
842 gpu_channel_factory_ = factory; 833 gpu_channel_factory_ = factory;
843 } 834 }
844 835
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 LOG(ERROR) << "Lost UI shared context."; 919 LOG(ERROR) << "Lost UI shared context.";
929 920
930 // Keep old resources around while we call the observers, but ensure that 921 // Keep old resources around while we call the observers, but ensure that
931 // new resources are created if needed. 922 // new resources are created if needed.
932 // Kill shared contexts for both threads in tandem so they are always in 923 // Kill shared contexts for both threads in tandem so they are always in
933 // the same share group. 924 // the same share group.
934 scoped_refptr<cc::ContextProvider> lost_shared_main_thread_contexts = 925 scoped_refptr<cc::ContextProvider> lost_shared_main_thread_contexts =
935 shared_main_thread_contexts_; 926 shared_main_thread_contexts_;
936 shared_main_thread_contexts_ = NULL; 927 shared_main_thread_contexts_ = NULL;
937 928
938 std::unique_ptr<display_compositor::GLHelper> lost_gl_helper = 929 std::unique_ptr<viz::GLHelper> lost_gl_helper = std::move(gl_helper_);
939 std::move(gl_helper_);
940 930
941 for (auto& observer : observer_list_) 931 for (auto& observer : observer_list_)
942 observer.OnLostResources(); 932 observer.OnLostResources();
943 933
944 // Kill things that use the shared context before killing the shared context. 934 // Kill things that use the shared context before killing the shared context.
945 lost_gl_helper.reset(); 935 lost_gl_helper.reset();
946 lost_shared_main_thread_contexts = NULL; 936 lost_shared_main_thread_contexts = NULL;
947 } 937 }
948 938
949 scoped_refptr<cc::VulkanInProcessContextProvider> 939 scoped_refptr<cc::VulkanInProcessContextProvider>
950 GpuProcessTransportFactory::SharedVulkanContextProvider() { 940 GpuProcessTransportFactory::SharedVulkanContextProvider() {
951 if (!shared_vulkan_context_provider_initialized_) { 941 if (!shared_vulkan_context_provider_initialized_) {
952 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 942 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
953 switches::kEnableVulkan)) { 943 switches::kEnableVulkan)) {
954 shared_vulkan_context_provider_ = 944 shared_vulkan_context_provider_ =
955 cc::VulkanInProcessContextProvider::Create(); 945 cc::VulkanInProcessContextProvider::Create();
956 } 946 }
957 947
958 shared_vulkan_context_provider_initialized_ = true; 948 shared_vulkan_context_provider_initialized_ = true;
959 } 949 }
960 return shared_vulkan_context_provider_; 950 return shared_vulkan_context_provider_;
961 } 951 }
962 952
963 } // namespace content 953 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698