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

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

Issue 2789753002: Convert offscreen canvas to use FrameSinkManagerHost. (Closed)
Patch Set: Lower similarity. Created 3 years, 8 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "content/public/common/content_switches.h" 44 #include "content/public/common/content_switches.h"
45 #include "gpu/GLES2/gl2extchromium.h" 45 #include "gpu/GLES2/gl2extchromium.h"
46 #include "gpu/command_buffer/client/gles2_interface.h" 46 #include "gpu/command_buffer/client/gles2_interface.h"
47 #include "gpu/command_buffer/client/shared_memory_limits.h" 47 #include "gpu/command_buffer/client/shared_memory_limits.h"
48 #include "gpu/command_buffer/common/mailbox.h" 48 #include "gpu/command_buffer/common/mailbox.h"
49 #include "gpu/ipc/client/gpu_channel_host.h" 49 #include "gpu/ipc/client/gpu_channel_host.h"
50 #include "gpu/ipc/host/gpu_memory_buffer_support.h" 50 #include "gpu/ipc/host/gpu_memory_buffer_support.h"
51 #include "gpu/vulkan/features.h" 51 #include "gpu/vulkan/features.h"
52 #include "services/service_manager/runner/common/client_util.h" 52 #include "services/service_manager/runner/common/client_util.h"
53 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 53 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
54 #include "services/ui/surfaces/display_compositor.h"
54 #include "third_party/khronos/GLES2/gl2.h" 55 #include "third_party/khronos/GLES2/gl2.h"
55 #include "ui/compositor/compositor.h" 56 #include "ui/compositor/compositor.h"
56 #include "ui/compositor/compositor_constants.h" 57 #include "ui/compositor/compositor_constants.h"
57 #include "ui/compositor/compositor_switches.h" 58 #include "ui/compositor/compositor_switches.h"
58 #include "ui/compositor/layer.h" 59 #include "ui/compositor/layer.h"
59 #include "ui/display/types/display_snapshot.h" 60 #include "ui/display/types/display_snapshot.h"
60 #include "ui/gfx/geometry/size.h" 61 #include "ui/gfx/geometry/size.h"
61 #include "ui/gfx/switches.h" 62 #include "ui/gfx/switches.h"
62 #include "ui/gl/gl_switches.h" 63 #include "ui/gl/gl_switches.h"
63 64
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 std::unique_ptr<cc::Display> display; 189 std::unique_ptr<cc::Display> display;
189 bool output_is_secure = false; 190 bool output_is_secure = false;
190 }; 191 };
191 192
192 GpuProcessTransportFactory::GpuProcessTransportFactory() 193 GpuProcessTransportFactory::GpuProcessTransportFactory()
193 : frame_sink_id_allocator_(kDefaultClientId), 194 : frame_sink_id_allocator_(kDefaultClientId),
194 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), 195 task_graph_runner_(new cc::SingleThreadTaskGraphRunner),
195 callback_factory_(this) { 196 callback_factory_(this) {
196 cc::SetClientNameForMetrics("Browser"); 197 cc::SetClientNameForMetrics("Browser");
197 198
198 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); 199 display_compositor_ = base::MakeUnique<ui::DisplayCompositor>(
200 nullptr, MakeRequest(&display_compositor_ptr_), nullptr);
199 201
200 task_graph_runner_->Start("CompositorTileWorker1", 202 task_graph_runner_->Start("CompositorTileWorker1",
201 base::SimpleThread::Options()); 203 base::SimpleThread::Options());
202 #if defined(OS_WIN) 204 #if defined(OS_WIN)
203 software_backing_.reset(new OutputDeviceBacking); 205 software_backing_.reset(new OutputDeviceBacking);
204 #endif 206 #endif
205 } 207 }
206 208
207 GpuProcessTransportFactory::~GpuProcessTransportFactory() { 209 GpuProcessTransportFactory::~GpuProcessTransportFactory() {
208 DCHECK(per_compositor_data_.empty()); 210 DCHECK(per_compositor_data_.empty());
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // until we have reset |data->display|. 592 // until we have reset |data->display|.
591 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); 593 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source);
592 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); 594 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source);
593 595
594 // The |delegated_output_surface| is given back to the compositor, it 596 // The |delegated_output_surface| is given back to the compositor, it
595 // delegates to the Display as its root surface. Importantly, it shares the 597 // delegates to the Display as its root surface. Importantly, it shares the
596 // same ContextProvider as the Display's output surface. 598 // same ContextProvider as the Display's output surface.
597 auto compositor_frame_sink = 599 auto compositor_frame_sink =
598 vulkan_context_provider 600 vulkan_context_provider
599 ? base::MakeUnique<cc::DirectCompositorFrameSink>( 601 ? base::MakeUnique<cc::DirectCompositorFrameSink>(
600 compositor->frame_sink_id(), surface_manager_.get(), 602 compositor->frame_sink_id(), GetSurfaceManager(),
601 data->display.get(), 603 data->display.get(),
602 static_cast<scoped_refptr<cc::VulkanContextProvider>>( 604 static_cast<scoped_refptr<cc::VulkanContextProvider>>(
603 vulkan_context_provider)) 605 vulkan_context_provider))
604 : base::MakeUnique<cc::DirectCompositorFrameSink>( 606 : base::MakeUnique<cc::DirectCompositorFrameSink>(
605 compositor->frame_sink_id(), surface_manager_.get(), 607 compositor->frame_sink_id(), GetSurfaceManager(),
606 data->display.get(), context_provider, 608 data->display.get(), context_provider,
607 shared_worker_context_provider_, GetGpuMemoryBufferManager(), 609 shared_worker_context_provider_, GetGpuMemoryBufferManager(),
608 HostSharedBitmapManager::current()); 610 HostSharedBitmapManager::current());
609 data->display->Resize(compositor->size()); 611 data->display->Resize(compositor->size());
610 data->display->SetOutputIsSecure(data->output_is_secure); 612 data->display->SetOutputIsSecure(data->output_is_secure);
611 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); 613 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink));
612 } 614 }
613 615
614 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( 616 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector(
615 ui::Compositor* source_compositor, 617 ui::Compositor* source_compositor,
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 ui::ContextFactoryObserver* observer) { 787 ui::ContextFactoryObserver* observer) {
786 observer_list_.AddObserver(observer); 788 observer_list_.AddObserver(observer);
787 } 789 }
788 790
789 void GpuProcessTransportFactory::RemoveObserver( 791 void GpuProcessTransportFactory::RemoveObserver(
790 ui::ContextFactoryObserver* observer) { 792 ui::ContextFactoryObserver* observer) {
791 observer_list_.RemoveObserver(observer); 793 observer_list_.RemoveObserver(observer);
792 } 794 }
793 795
794 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { 796 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() {
795 return surface_manager_.get(); 797 return display_compositor_->surface_manager();
798 }
799
800 cc::mojom::DisplayCompositor*
801 GpuProcessTransportFactory::GetDisplayCompositor() {
802 return display_compositor_ptr_.get();
796 } 803 }
797 804
798 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { 805 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() {
799 if (!gl_helper_ && !per_compositor_data_.empty()) { 806 if (!gl_helper_ && !per_compositor_data_.empty()) {
800 scoped_refptr<cc::ContextProvider> provider = 807 scoped_refptr<cc::ContextProvider> provider =
801 SharedMainThreadContextProvider(); 808 SharedMainThreadContextProvider();
802 if (provider.get()) 809 if (provider.get())
803 gl_helper_.reset(new display_compositor::GLHelper( 810 gl_helper_.reset(new display_compositor::GLHelper(
804 provider->ContextGL(), provider->ContextSupport())); 811 provider->ContextGL(), provider->ContextSupport()));
805 } 812 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 shared_vulkan_context_provider_ = 930 shared_vulkan_context_provider_ =
924 cc::VulkanInProcessContextProvider::Create(); 931 cc::VulkanInProcessContextProvider::Create();
925 } 932 }
926 933
927 shared_vulkan_context_provider_initialized_ = true; 934 shared_vulkan_context_provider_initialized_ = true;
928 } 935 }
929 return shared_vulkan_context_provider_; 936 return shared_vulkan_context_provider_;
930 } 937 }
931 938
932 } // namespace content 939 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698