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

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

Issue 2150533004: cc: Send all begin frames using a PostTask. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler_unittest_no_deadline
Patch Set: Created 4 years, 5 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 #else 470 #else
471 NOTREACHED(); 471 NOTREACHED();
472 #endif 472 #endif
473 } 473 }
474 return; 474 return;
475 } 475 }
476 } 476 }
477 477
478 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source; 478 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source;
479 if (!compositor->GetRendererSettings().disable_display_vsync) { 479 if (!compositor->GetRendererSettings().disable_display_vsync) {
480 begin_frame_source.reset(new cc::DelayBasedBeginFrameSource( 480 begin_frame_source.reset(
481 base::MakeUnique<cc::DelayBasedTimeSource>( 481 new cc::DelayBasedBeginFrameSource(compositor->task_runner().get()));
482 compositor->task_runner().get())));
483 } else { 482 } else {
484 begin_frame_source.reset(new cc::BackToBackBeginFrameSource( 483 begin_frame_source.reset(
485 base::MakeUnique<cc::DelayBasedTimeSource>( 484 new cc::BackToBackBeginFrameSource(compositor->task_runner().get()));
486 compositor->task_runner().get())));
487 } 485 }
488 486
489 std::unique_ptr<BrowserCompositorOutputSurface> display_output_surface; 487 std::unique_ptr<BrowserCompositorOutputSurface> display_output_surface;
490 #if defined(ENABLE_VULKAN) 488 #if defined(ENABLE_VULKAN)
491 std::unique_ptr<VulkanBrowserCompositorOutputSurface> vulkan_surface; 489 std::unique_ptr<VulkanBrowserCompositorOutputSurface> vulkan_surface;
492 if (vulkan_context_provider) { 490 if (vulkan_context_provider) {
493 vulkan_surface.reset(new VulkanBrowserCompositorOutputSurface( 491 vulkan_surface.reset(new VulkanBrowserCompositorOutputSurface(
494 vulkan_context_provider, compositor->vsync_manager(), 492 vulkan_context_provider, compositor->vsync_manager(),
495 compositor->task_runner().get())); 493 compositor->task_runner().get()));
496 if (!vulkan_surface->Initialize(compositor.get()->widget())) { 494 if (!vulkan_surface->Initialize(compositor.get()->widget())) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 helper.reset(); 656 helper.reset();
659 DCHECK(!gl_helper_) << "Destroying the GLHelper should not cause a new " 657 DCHECK(!gl_helper_) << "Destroying the GLHelper should not cause a new "
660 "GLHelper to be created."; 658 "GLHelper to be created.";
661 } 659 }
662 #if defined(OS_WIN) 660 #if defined(OS_WIN)
663 gfx::RenderingWindowManager::GetInstance()->UnregisterParent( 661 gfx::RenderingWindowManager::GetInstance()->UnregisterParent(
664 compositor->widget()); 662 compositor->widget());
665 #endif 663 #endif
666 } 664 }
667 665
668 bool GpuProcessTransportFactory::DoesCreateTestContexts() { return false; } 666 bool GpuProcessTransportFactory::DoesCreateTestContexts() {
667 return false;
668 }
669 669
670 uint32_t GpuProcessTransportFactory::GetImageTextureTarget( 670 uint32_t GpuProcessTransportFactory::GetImageTextureTarget(
671 gfx::BufferFormat format, 671 gfx::BufferFormat format,
672 gfx::BufferUsage usage) { 672 gfx::BufferUsage usage) {
673 return BrowserGpuMemoryBufferManager::GetImageTextureTarget(format, usage); 673 return BrowserGpuMemoryBufferManager::GetImageTextureTarget(format, usage);
674 } 674 }
675 675
676 cc::SharedBitmapManager* GpuProcessTransportFactory::GetSharedBitmapManager() { 676 cc::SharedBitmapManager* GpuProcessTransportFactory::GetSharedBitmapManager() {
677 return HostSharedBitmapManager::current(); 677 return HostSharedBitmapManager::current();
678 } 678 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 866
867 void GpuProcessTransportFactory::OnLostMainThreadSharedContext() { 867 void GpuProcessTransportFactory::OnLostMainThreadSharedContext() {
868 LOG(ERROR) << "Lost UI shared context."; 868 LOG(ERROR) << "Lost UI shared context.";
869 869
870 // Keep old resources around while we call the observers, but ensure that 870 // Keep old resources around while we call the observers, but ensure that
871 // new resources are created if needed. 871 // new resources are created if needed.
872 // Kill shared contexts for both threads in tandem so they are always in 872 // Kill shared contexts for both threads in tandem so they are always in
873 // the same share group. 873 // the same share group.
874 scoped_refptr<cc::ContextProvider> lost_shared_main_thread_contexts = 874 scoped_refptr<cc::ContextProvider> lost_shared_main_thread_contexts =
875 shared_main_thread_contexts_; 875 shared_main_thread_contexts_;
876 shared_main_thread_contexts_ = NULL; 876 shared_main_thread_contexts_ = NULL;
877 877
878 std::unique_ptr<display_compositor::GLHelper> lost_gl_helper = 878 std::unique_ptr<display_compositor::GLHelper> lost_gl_helper =
879 std::move(gl_helper_); 879 std::move(gl_helper_);
880 880
881 FOR_EACH_OBSERVER(ui::ContextFactoryObserver, observer_list_, 881 FOR_EACH_OBSERVER(ui::ContextFactoryObserver, observer_list_,
882 OnLostResources()); 882 OnLostResources());
883 883
884 // Kill things that use the shared context before killing the shared context. 884 // Kill things that use the shared context before killing the shared context.
885 lost_gl_helper.reset(); 885 lost_gl_helper.reset();
886 lost_shared_main_thread_contexts = NULL; 886 lost_shared_main_thread_contexts = NULL;
887 } 887 }
888 888
889 scoped_refptr<cc::VulkanInProcessContextProvider> 889 scoped_refptr<cc::VulkanInProcessContextProvider>
890 GpuProcessTransportFactory::SharedVulkanContextProvider() { 890 GpuProcessTransportFactory::SharedVulkanContextProvider() {
891 if (!shared_vulkan_context_provider_initialized_) { 891 if (!shared_vulkan_context_provider_initialized_) {
892 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 892 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
893 switches::kEnableVulkan)) { 893 switches::kEnableVulkan)) {
894 shared_vulkan_context_provider_ = 894 shared_vulkan_context_provider_ =
895 cc::VulkanInProcessContextProvider::Create(); 895 cc::VulkanInProcessContextProvider::Create();
896 } 896 }
897 897
898 shared_vulkan_context_provider_initialized_ = true; 898 shared_vulkan_context_provider_initialized_ = true;
899 } 899 }
900 return shared_vulkan_context_provider_; 900 return shared_vulkan_context_provider_;
901 } 901 }
902 902
903 } // namespace content 903 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698