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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/threading/simple_thread.h" | 16 #include "base/threading/simple_thread.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "cc/base/histograms.h" | 20 #include "cc/base/histograms.h" |
21 #include "cc/output/compositor_frame.h" | 21 #include "cc/output/compositor_frame.h" |
22 #include "cc/output/output_surface.h" | 22 #include "cc/output/output_surface.h" |
23 #include "cc/output/vulkan_in_process_context_provider.h" | 23 #include "cc/output/vulkan_in_process_context_provider.h" |
24 #include "cc/raster/single_thread_task_graph_runner.h" | 24 #include "cc/raster/single_thread_task_graph_runner.h" |
25 #include "cc/raster/task_graph_runner.h" | 25 #include "cc/raster/task_graph_runner.h" |
26 #include "cc/surfaces/onscreen_display_client.h" | 26 #include "cc/surfaces/display.h" |
27 #include "cc/surfaces/surface_display_output_surface.h" | 27 #include "cc/surfaces/surface_display_output_surface.h" |
28 #include "cc/surfaces/surface_manager.h" | 28 #include "cc/surfaces/surface_manager.h" |
29 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 29 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
30 #include "components/display_compositor/gl_helper.h" | 30 #include "components/display_compositor/gl_helper.h" |
31 #include "content/browser/compositor/browser_compositor_output_surface.h" | 31 #include "content/browser/compositor/browser_compositor_output_surface.h" |
32 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 32 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
33 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 33 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
34 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" | 34 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" |
35 #include "content/browser/compositor/reflector_impl.h" | 35 #include "content/browser/compositor/reflector_impl.h" |
36 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" | 36 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 143 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
144 return command_line->HasSwitch(switches::kDisableMacOverlays); | 144 return command_line->HasSwitch(switches::kDisableMacOverlays); |
145 } | 145 } |
146 #endif | 146 #endif |
147 | 147 |
148 } // namespace | 148 } // namespace |
149 | 149 |
150 namespace content { | 150 namespace content { |
151 | 151 |
152 struct GpuProcessTransportFactory::PerCompositorData { | 152 struct GpuProcessTransportFactory::PerCompositorData { |
153 gpu::SurfaceHandle surface_handle; | 153 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; |
154 BrowserCompositorOutputSurface* surface; | 154 BrowserCompositorOutputSurface* display_output_surface = nullptr; |
155 ReflectorImpl* reflector; | 155 ReflectorImpl* reflector = nullptr; |
156 std::unique_ptr<cc::OnscreenDisplayClient> display_client; | 156 std::unique_ptr<cc::Display> display; |
157 bool output_is_secure = false; | 157 bool output_is_secure = false; |
158 | |
159 PerCompositorData() | |
160 : surface_handle(gpu::kNullSurfaceHandle), | |
161 surface(nullptr), | |
162 reflector(nullptr) {} | |
163 }; | 158 }; |
164 | 159 |
165 GpuProcessTransportFactory::GpuProcessTransportFactory() | 160 GpuProcessTransportFactory::GpuProcessTransportFactory() |
166 : next_surface_id_namespace_(1u), | 161 : next_surface_id_namespace_(1u), |
167 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 162 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
168 callback_factory_(this) { | 163 callback_factory_(this) { |
169 cc::SetClientNameForMetrics("Browser"); | 164 cc::SetClientNameForMetrics("Browser"); |
170 | 165 |
171 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 166 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); |
172 | 167 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 return GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor(); | 269 return GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor(); |
275 } | 270 } |
276 | 271 |
277 void GpuProcessTransportFactory::CreateOutputSurface( | 272 void GpuProcessTransportFactory::CreateOutputSurface( |
278 base::WeakPtr<ui::Compositor> compositor) { | 273 base::WeakPtr<ui::Compositor> compositor) { |
279 DCHECK(!!compositor); | 274 DCHECK(!!compositor); |
280 PerCompositorData* data = per_compositor_data_[compositor.get()]; | 275 PerCompositorData* data = per_compositor_data_[compositor.get()]; |
281 if (!data) { | 276 if (!data) { |
282 data = CreatePerCompositorData(compositor.get()); | 277 data = CreatePerCompositorData(compositor.get()); |
283 } else { | 278 } else { |
284 data->surface = nullptr; | 279 // TODO(danakj): We can destroy the |data->display| here when the compositor |
| 280 // destroys its OutputSurface before calling back here. |
| 281 data->display_output_surface = nullptr; |
285 } | 282 } |
286 | 283 |
287 #if defined(OS_WIN) | 284 #if defined(OS_WIN) |
288 gfx::RenderingWindowManager::GetInstance()->UnregisterParent( | 285 gfx::RenderingWindowManager::GetInstance()->UnregisterParent( |
289 compositor->widget()); | 286 compositor->widget()); |
290 #endif | 287 #endif |
291 | 288 |
292 const bool use_vulkan = static_cast<bool>(SharedVulkanContextProvider()); | 289 const bool use_vulkan = static_cast<bool>(SharedVulkanContextProvider()); |
293 | 290 |
294 const bool create_gpu_output_surface = | 291 const bool create_gpu_output_surface = |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 // Try again. | 413 // Try again. |
417 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( | 414 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( |
418 CAUSE_FOR_GPU_LAUNCH_SHARED_WORKER_THREAD_CONTEXT, | 415 CAUSE_FOR_GPU_LAUNCH_SHARED_WORKER_THREAD_CONTEXT, |
419 base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, | 416 base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, |
420 callback_factory_.GetWeakPtr(), compositor, | 417 callback_factory_.GetWeakPtr(), compositor, |
421 create_gpu_output_surface, num_attempts + 1)); | 418 create_gpu_output_surface, num_attempts + 1)); |
422 return; | 419 return; |
423 } | 420 } |
424 } | 421 } |
425 | 422 |
426 std::unique_ptr<BrowserCompositorOutputSurface> surface; | 423 std::unique_ptr<BrowserCompositorOutputSurface> display_output_surface; |
427 #if defined(ENABLE_VULKAN) | 424 #if defined(ENABLE_VULKAN) |
428 std::unique_ptr<VulkanBrowserCompositorOutputSurface> vulkan_surface; | 425 std::unique_ptr<VulkanBrowserCompositorOutputSurface> vulkan_surface; |
429 if (vulkan_context_provider) { | 426 if (vulkan_context_provider) { |
430 vulkan_surface.reset(new VulkanBrowserCompositorOutputSurface( | 427 vulkan_surface.reset(new VulkanBrowserCompositorOutputSurface( |
431 vulkan_context_provider, compositor->vsync_manager(), | 428 vulkan_context_provider, compositor->vsync_manager(), |
432 compositor->task_runner().get())); | 429 compositor->task_runner().get())); |
433 if (!vulkan_surface->Initialize(compositor.get()->widget())) { | 430 if (!vulkan_surface->Initialize(compositor.get()->widget())) { |
434 vulkan_surface->Destroy(); | 431 vulkan_surface->Destroy(); |
435 vulkan_surface.reset(); | 432 vulkan_surface.reset(); |
436 } else { | 433 } else { |
437 surface = std::move(vulkan_surface); | 434 display_output_surface = std::move(vulkan_surface); |
438 } | 435 } |
439 } | 436 } |
440 #endif | 437 #endif |
441 | 438 |
442 if (!surface) { | 439 if (!display_output_surface) { |
443 if (!create_gpu_output_surface) { | 440 if (!create_gpu_output_surface) { |
444 surface = base::WrapUnique(new SoftwareBrowserCompositorOutputSurface( | 441 display_output_surface = |
445 CreateSoftwareOutputDevice(compositor.get()), | 442 base::WrapUnique(new SoftwareBrowserCompositorOutputSurface( |
446 compositor->vsync_manager(), compositor->task_runner().get())); | 443 CreateSoftwareOutputDevice(compositor.get()), |
| 444 compositor->vsync_manager(), compositor->task_runner().get())); |
447 } else { | 445 } else { |
448 DCHECK(context_provider); | 446 DCHECK(context_provider); |
449 const auto& capabilities = context_provider->ContextCapabilities(); | 447 const auto& capabilities = context_provider->ContextCapabilities(); |
450 if (data->surface_handle == gpu::kNullSurfaceHandle) { | 448 if (data->surface_handle == gpu::kNullSurfaceHandle) { |
451 surface = base::WrapUnique(new OffscreenBrowserCompositorOutputSurface( | 449 display_output_surface = |
452 context_provider, compositor->vsync_manager(), | 450 base::WrapUnique(new OffscreenBrowserCompositorOutputSurface( |
453 compositor->task_runner().get(), | 451 context_provider, compositor->vsync_manager(), |
454 std::unique_ptr< | 452 compositor->task_runner().get(), |
455 display_compositor::CompositorOverlayCandidateValidator>())); | 453 std::unique_ptr<display_compositor:: |
| 454 CompositorOverlayCandidateValidator>())); |
456 } else if (capabilities.surfaceless) { | 455 } else if (capabilities.surfaceless) { |
457 #if defined(OS_MACOSX) | 456 #if defined(OS_MACOSX) |
458 surface = base::WrapUnique(new GpuOutputSurfaceMac( | 457 display_output_surface = base::WrapUnique(new GpuOutputSurfaceMac( |
459 context_provider, data->surface_handle, compositor->vsync_manager(), | 458 context_provider, data->surface_handle, compositor->vsync_manager(), |
460 compositor->task_runner().get(), | 459 compositor->task_runner().get(), |
461 CreateOverlayCandidateValidator(compositor->widget()), | 460 CreateOverlayCandidateValidator(compositor->widget()), |
462 BrowserGpuMemoryBufferManager::current())); | 461 BrowserGpuMemoryBufferManager::current())); |
463 #else | 462 #else |
464 surface = | 463 display_output_surface = |
465 base::WrapUnique(new GpuSurfacelessBrowserCompositorOutputSurface( | 464 base::WrapUnique(new GpuSurfacelessBrowserCompositorOutputSurface( |
466 context_provider, data->surface_handle, | 465 context_provider, data->surface_handle, |
467 compositor->vsync_manager(), compositor->task_runner().get(), | 466 compositor->vsync_manager(), compositor->task_runner().get(), |
468 CreateOverlayCandidateValidator(compositor->widget()), | 467 CreateOverlayCandidateValidator(compositor->widget()), |
469 GL_TEXTURE_2D, GL_RGB, | 468 GL_TEXTURE_2D, GL_RGB, |
470 BrowserGpuMemoryBufferManager::current())); | 469 BrowserGpuMemoryBufferManager::current())); |
471 #endif | 470 #endif |
472 } else { | 471 } else { |
473 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 472 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
474 validator; | 473 validator; |
475 #if !defined(OS_MACOSX) | 474 #if !defined(OS_MACOSX) |
476 // Overlays are only supported on surfaceless output surfaces on Mac. | 475 // Overlays are only supported on surfaceless output surfaces on Mac. |
477 validator = CreateOverlayCandidateValidator(compositor->widget()); | 476 validator = CreateOverlayCandidateValidator(compositor->widget()); |
478 #endif | 477 #endif |
479 surface = base::WrapUnique(new GpuBrowserCompositorOutputSurface( | 478 display_output_surface = |
480 context_provider, compositor->vsync_manager(), | 479 base::WrapUnique(new GpuBrowserCompositorOutputSurface( |
481 compositor->task_runner().get(), std::move(validator))); | 480 context_provider, compositor->vsync_manager(), |
| 481 compositor->task_runner().get(), std::move(validator))); |
482 } | 482 } |
483 } | 483 } |
484 } | 484 } |
485 | 485 |
486 data->surface = surface.get(); | 486 data->display_output_surface = display_output_surface.get(); |
487 if (data->reflector) | 487 if (data->reflector) |
488 data->reflector->OnSourceSurfaceReady(data->surface); | 488 data->reflector->OnSourceSurfaceReady(data->display_output_surface); |
489 | 489 |
490 #if defined(OS_WIN) | 490 #if defined(OS_WIN) |
491 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( | 491 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( |
492 compositor->widget()); | 492 compositor->widget()); |
493 #endif | 493 #endif |
494 | 494 |
495 // This gets a bit confusing. Here we have a ContextProvider in the |surface| | 495 // The Display owns and uses the |display_output_surface| created above. |
496 // configured to render directly to this widget. We need to make an | 496 data->display = base::MakeUnique<cc::Display>( |
497 // OnscreenDisplayClient associated with that context, then return a | 497 surface_manager_.get(), HostSharedBitmapManager::current(), |
498 // SurfaceDisplayOutputSurface set up to draw to the display's surface. | 498 BrowserGpuMemoryBufferManager::current(), |
499 cc::SurfaceManager* manager = surface_manager_.get(); | 499 compositor->GetRendererSettings(), |
500 std::unique_ptr<cc::OnscreenDisplayClient> display_client( | 500 compositor->surface_id_allocator()->id_namespace(), |
501 new cc::OnscreenDisplayClient( | 501 compositor->task_runner().get(), std::move(display_output_surface)); |
502 std::move(surface), manager, HostSharedBitmapManager::current(), | |
503 BrowserGpuMemoryBufferManager::current(), | |
504 compositor->GetRendererSettings(), compositor->task_runner(), | |
505 compositor->surface_id_allocator()->id_namespace())); | |
506 | 502 |
507 std::unique_ptr<cc::SurfaceDisplayOutputSurface> output_surface( | 503 // The |delegated_output_surface| is given back to the compositor, it |
| 504 // delegates to the Display as its root surface. Importantly, it shares the |
| 505 // same ContextProvider as the Display's output surface. |
| 506 std::unique_ptr<cc::SurfaceDisplayOutputSurface> delegated_output_surface( |
508 vulkan_context_provider | 507 vulkan_context_provider |
509 ? new cc::SurfaceDisplayOutputSurface( | 508 ? new cc::SurfaceDisplayOutputSurface( |
510 manager, compositor->surface_id_allocator(), | 509 surface_manager_.get(), compositor->surface_id_allocator(), |
| 510 data->display.get(), |
511 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 511 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
512 vulkan_context_provider)) | 512 vulkan_context_provider)) |
513 : new cc::SurfaceDisplayOutputSurface( | 513 : new cc::SurfaceDisplayOutputSurface( |
514 manager, compositor->surface_id_allocator(), context_provider, | 514 surface_manager_.get(), compositor->surface_id_allocator(), |
| 515 data->display.get(), context_provider, |
515 shared_worker_context_provider_)); | 516 shared_worker_context_provider_)); |
516 display_client->set_surface_output_surface(output_surface.get()); | 517 data->display->Resize(compositor->size()); |
517 output_surface->set_display_client(display_client.get()); | 518 data->display->SetOutputIsSecure(data->output_is_secure); |
518 display_client->display()->Resize(compositor->size()); | 519 compositor->SetOutputSurface(std::move(delegated_output_surface)); |
519 display_client->display()->SetOutputIsSecure(data->output_is_secure); | |
520 data->display_client = std::move(display_client); | |
521 compositor->SetOutputSurface(std::move(output_surface)); | |
522 } | 520 } |
523 | 521 |
524 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 522 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
525 ui::Compositor* source_compositor, | 523 ui::Compositor* source_compositor, |
526 ui::Layer* target_layer) { | 524 ui::Layer* target_layer) { |
527 PerCompositorData* source_data = per_compositor_data_[source_compositor]; | 525 PerCompositorData* source_data = per_compositor_data_[source_compositor]; |
528 DCHECK(source_data); | 526 DCHECK(source_data); |
529 | 527 |
530 std::unique_ptr<ReflectorImpl> reflector( | 528 std::unique_ptr<ReflectorImpl> reflector( |
531 new ReflectorImpl(source_compositor, target_layer)); | 529 new ReflectorImpl(source_compositor, target_layer)); |
532 source_data->reflector = reflector.get(); | 530 source_data->reflector = reflector.get(); |
533 if (BrowserCompositorOutputSurface* source_surface = source_data->surface) | 531 if (auto* source_surface = source_data->display_output_surface) |
534 reflector->OnSourceSurfaceReady(source_surface); | 532 reflector->OnSourceSurfaceReady(source_surface); |
535 return std::move(reflector); | 533 return std::move(reflector); |
536 } | 534 } |
537 | 535 |
538 void GpuProcessTransportFactory::RemoveReflector(ui::Reflector* reflector) { | 536 void GpuProcessTransportFactory::RemoveReflector(ui::Reflector* reflector) { |
539 ReflectorImpl* reflector_impl = static_cast<ReflectorImpl*>(reflector); | 537 ReflectorImpl* reflector_impl = static_cast<ReflectorImpl*>(reflector); |
540 PerCompositorData* data = | 538 PerCompositorData* data = |
541 per_compositor_data_[reflector_impl->mirrored_compositor()]; | 539 per_compositor_data_[reflector_impl->mirrored_compositor()]; |
542 DCHECK(data); | 540 DCHECK(data); |
543 data->reflector->Shutdown(); | 541 data->reflector->Shutdown(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 return allocator; | 612 return allocator; |
615 } | 613 } |
616 | 614 |
617 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, | 615 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, |
618 const gfx::Size& size) { | 616 const gfx::Size& size) { |
619 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 617 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
620 if (it == per_compositor_data_.end()) | 618 if (it == per_compositor_data_.end()) |
621 return; | 619 return; |
622 PerCompositorData* data = it->second; | 620 PerCompositorData* data = it->second; |
623 DCHECK(data); | 621 DCHECK(data); |
624 if (data->display_client) | 622 if (data->display) |
625 data->display_client->display()->Resize(size); | 623 data->display->Resize(size); |
626 } | 624 } |
627 | 625 |
628 void GpuProcessTransportFactory::SetAuthoritativeVSyncInterval( | 626 void GpuProcessTransportFactory::SetAuthoritativeVSyncInterval( |
629 ui::Compositor* compositor, | 627 ui::Compositor* compositor, |
630 base::TimeDelta interval) { | 628 base::TimeDelta interval) { |
631 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 629 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
632 if (it == per_compositor_data_.end()) | 630 if (it == per_compositor_data_.end()) |
633 return; | 631 return; |
634 PerCompositorData* data = it->second; | 632 PerCompositorData* data = it->second; |
635 DCHECK(data); | 633 DCHECK(data); |
636 if (data->surface) { | 634 if (data->display_output_surface) { |
637 data->surface->begin_frame_source()->SetAuthoritativeVSyncInterval( | 635 data->display_output_surface->begin_frame_source() |
638 interval); | 636 ->SetAuthoritativeVSyncInterval(interval); |
639 } | 637 } |
640 } | 638 } |
641 | 639 |
642 void GpuProcessTransportFactory::SetOutputIsSecure(ui::Compositor* compositor, | 640 void GpuProcessTransportFactory::SetOutputIsSecure(ui::Compositor* compositor, |
643 bool secure) { | 641 bool secure) { |
644 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 642 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
645 if (it == per_compositor_data_.end()) | 643 if (it == per_compositor_data_.end()) |
646 return; | 644 return; |
647 PerCompositorData* data = it->second; | 645 PerCompositorData* data = it->second; |
648 DCHECK(data); | 646 DCHECK(data); |
649 data->output_is_secure = secure; | 647 data->output_is_secure = secure; |
650 if (data->display_client) | 648 if (data->display) |
651 data->display_client->display()->SetOutputIsSecure(secure); | 649 data->display->SetOutputIsSecure(secure); |
652 } | 650 } |
653 | 651 |
654 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { | 652 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { |
655 return surface_manager_.get(); | 653 return surface_manager_.get(); |
656 } | 654 } |
657 | 655 |
658 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { | 656 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { |
659 if (!gl_helper_ && !per_compositor_data_.empty()) { | 657 if (!gl_helper_ && !per_compositor_data_.empty()) { |
660 scoped_refptr<cc::ContextProvider> provider = | 658 scoped_refptr<cc::ContextProvider> provider = |
661 SharedMainThreadContextProvider(); | 659 SharedMainThreadContextProvider(); |
(...skipping 16 matching lines...) Expand all Loading... |
678 | 676 |
679 #if defined(OS_MACOSX) | 677 #if defined(OS_MACOSX) |
680 void GpuProcessTransportFactory::SetCompositorSuspendedForRecycle( | 678 void GpuProcessTransportFactory::SetCompositorSuspendedForRecycle( |
681 ui::Compositor* compositor, | 679 ui::Compositor* compositor, |
682 bool suspended) { | 680 bool suspended) { |
683 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 681 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
684 if (it == per_compositor_data_.end()) | 682 if (it == per_compositor_data_.end()) |
685 return; | 683 return; |
686 PerCompositorData* data = it->second; | 684 PerCompositorData* data = it->second; |
687 DCHECK(data); | 685 DCHECK(data); |
688 if (data->surface) | 686 if (data->display_output_surface) |
689 data->surface->SetSurfaceSuspendedForRecycle(suspended); | 687 data->display_output_surface->SetSurfaceSuspendedForRecycle(suspended); |
690 } | 688 } |
691 #endif | 689 #endif |
692 | 690 |
693 scoped_refptr<cc::ContextProvider> | 691 scoped_refptr<cc::ContextProvider> |
694 GpuProcessTransportFactory::SharedMainThreadContextProvider() { | 692 GpuProcessTransportFactory::SharedMainThreadContextProvider() { |
695 if (shared_main_thread_contexts_) | 693 if (shared_main_thread_contexts_) |
696 return shared_main_thread_contexts_; | 694 return shared_main_thread_contexts_; |
697 | 695 |
698 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) | 696 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) |
699 return nullptr; | 697 return nullptr; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 shared_vulkan_context_provider_ = | 783 shared_vulkan_context_provider_ = |
786 cc::VulkanInProcessContextProvider::Create(); | 784 cc::VulkanInProcessContextProvider::Create(); |
787 } | 785 } |
788 | 786 |
789 shared_vulkan_context_provider_initialized_ = true; | 787 shared_vulkan_context_provider_initialized_ = true; |
790 } | 788 } |
791 return shared_vulkan_context_provider_; | 789 return shared_vulkan_context_provider_; |
792 } | 790 } |
793 | 791 |
794 } // namespace content | 792 } // namespace content |
OLD | NEW |