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

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

Issue 1827123002: Move content/common/gpu/client to gpu/ipc/client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 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 22 matching lines...) Expand all
33 #include "content/browser/compositor/reflector_impl.h" 33 #include "content/browser/compositor/reflector_impl.h"
34 #include "content/browser/compositor/software_browser_compositor_output_surface. h" 34 #include "content/browser/compositor/software_browser_compositor_output_surface. h"
35 #include "content/browser/compositor/software_output_device_mus.h" 35 #include "content/browser/compositor/software_output_device_mus.h"
36 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 36 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
37 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 37 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
38 #include "content/browser/gpu/compositor_util.h" 38 #include "content/browser/gpu/compositor_util.h"
39 #include "content/browser/gpu/gpu_data_manager_impl.h" 39 #include "content/browser/gpu/gpu_data_manager_impl.h"
40 #include "content/browser/gpu/gpu_surface_tracker.h" 40 #include "content/browser/gpu/gpu_surface_tracker.h"
41 #include "content/browser/renderer_host/render_widget_host_impl.h" 41 #include "content/browser/renderer_host/render_widget_host_impl.h"
42 #include "content/common/gpu/client/context_provider_command_buffer.h" 42 #include "content/common/gpu/client/context_provider_command_buffer.h"
43 #include "content/common/gpu/client/gpu_channel_host.h"
44 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 43 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
45 #include "content/common/gpu_process_launch_causes.h" 44 #include "content/common/gpu_process_launch_causes.h"
46 #include "content/common/host_shared_bitmap_manager.h" 45 #include "content/common/host_shared_bitmap_manager.h"
47 #include "content/public/common/content_switches.h" 46 #include "content/public/common/content_switches.h"
48 #include "gpu/GLES2/gl2extchromium.h" 47 #include "gpu/GLES2/gl2extchromium.h"
49 #include "gpu/command_buffer/client/gles2_interface.h" 48 #include "gpu/command_buffer/client/gles2_interface.h"
50 #include "gpu/command_buffer/common/mailbox.h" 49 #include "gpu/command_buffer/common/mailbox.h"
50 #include "gpu/ipc/client/gpu_channel_host.h"
51 #include "third_party/khronos/GLES2/gl2.h" 51 #include "third_party/khronos/GLES2/gl2.h"
52 #include "ui/compositor/compositor.h" 52 #include "ui/compositor/compositor.h"
53 #include "ui/compositor/compositor_constants.h" 53 #include "ui/compositor/compositor_constants.h"
54 #include "ui/compositor/compositor_switches.h" 54 #include "ui/compositor/compositor_switches.h"
55 #include "ui/compositor/layer.h" 55 #include "ui/compositor/layer.h"
56 #include "ui/gfx/geometry/size.h" 56 #include "ui/gfx/geometry/size.h"
57 57
58 #if defined(MOJO_RUNNER_CLIENT) 58 #if defined(MOJO_RUNNER_CLIENT)
59 #include "content/common/mojo/mojo_shell_connection_impl.h" 59 #include "content/common/mojo/mojo_shell_connection_impl.h"
60 #endif 60 #endif
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Make sure the lost context callback doesn't try to run during destruction. 116 // Make sure the lost context callback doesn't try to run during destruction.
117 callback_factory_.InvalidateWeakPtrs(); 117 callback_factory_.InvalidateWeakPtrs();
118 118
119 task_graph_runner_->Shutdown(); 119 task_graph_runner_->Shutdown();
120 } 120 }
121 121
122 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 122 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
123 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() { 123 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
124 CauseForGpuLaunch cause = 124 CauseForGpuLaunch cause =
125 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; 125 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
126 scoped_refptr<GpuChannelHost> gpu_channel_host( 126 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(
127 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); 127 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause));
128 return CreateContextCommon(gpu_channel_host, gpu::kNullSurfaceHandle); 128 return CreateContextCommon(gpu_channel_host, gpu::kNullSurfaceHandle);
129 } 129 }
130 130
131 scoped_ptr<cc::SoftwareOutputDevice> 131 scoped_ptr<cc::SoftwareOutputDevice>
132 GpuProcessTransportFactory::CreateSoftwareOutputDevice( 132 GpuProcessTransportFactory::CreateSoftwareOutputDevice(
133 ui::Compositor* compositor) { 133 ui::Compositor* compositor) {
134 #if defined(MOJO_RUNNER_CLIENT) 134 #if defined(MOJO_RUNNER_CLIENT)
135 if (IsRunningInMojoShell()) { 135 if (IsRunningInMojoShell()) {
136 return scoped_ptr<cc::SoftwareOutputDevice>( 136 return scoped_ptr<cc::SoftwareOutputDevice>(
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // Try to reuse existing worker context provider. 271 // Try to reuse existing worker context provider.
272 bool shared_worker_context_provider_lost = false; 272 bool shared_worker_context_provider_lost = false;
273 if (shared_worker_context_provider_) { 273 if (shared_worker_context_provider_) {
274 // Note: If context is lost, we delete reference after releasing the lock. 274 // Note: If context is lost, we delete reference after releasing the lock.
275 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); 275 base::AutoLock lock(*shared_worker_context_provider_->GetLock());
276 if (shared_worker_context_provider_->ContextGL() 276 if (shared_worker_context_provider_->ContextGL()
277 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { 277 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
278 shared_worker_context_provider_lost = true; 278 shared_worker_context_provider_lost = true;
279 } 279 }
280 } 280 }
281 scoped_refptr<GpuChannelHost> gpu_channel_host = 281 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host =
282 BrowserGpuChannelHostFactory::instance()->GetGpuChannel(); 282 BrowserGpuChannelHostFactory::instance()->GetGpuChannel();
283 if (gpu_channel_host.get()) { 283 if (gpu_channel_host.get()) {
284 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get(); 284 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get();
285 gpu::SurfaceHandle surface_handle = 285 gpu::SurfaceHandle surface_handle =
286 data->surface_id ? tracker->GetSurfaceHandle(data->surface_id) 286 data->surface_id ? tracker->GetSurfaceHandle(data->surface_id)
287 : gpu::kNullSurfaceHandle; 287 : gpu::kNullSurfaceHandle;
288 // This context is used for both the browser compositor and the display 288 // This context is used for both the browser compositor and the display
289 // compositor. 289 // compositor.
290 context_provider = ContextProviderCommandBuffer::Create( 290 context_provider = ContextProviderCommandBuffer::Create(
291 GpuProcessTransportFactory::CreateContextCommon(gpu_channel_host, 291 GpuProcessTransportFactory::CreateContextCommon(gpu_channel_host,
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 data->surface_id = tracker->AddSurfaceForNativeWidget(widget); 602 data->surface_id = tracker->AddSurfaceForNativeWidget(widget);
603 } 603 }
604 604
605 per_compositor_data_[compositor] = data; 605 per_compositor_data_[compositor] = data;
606 606
607 return data; 607 return data;
608 } 608 }
609 609
610 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 610 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
611 GpuProcessTransportFactory::CreateContextCommon( 611 GpuProcessTransportFactory::CreateContextCommon(
612 scoped_refptr<GpuChannelHost> gpu_channel_host, 612 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
613 gpu::SurfaceHandle surface_handle) { 613 gpu::SurfaceHandle surface_handle) {
614 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) 614 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor())
615 return nullptr; 615 return nullptr;
616 if (!gpu_channel_host) { 616 if (!gpu_channel_host) {
617 LOG(ERROR) << "Failed to establish GPU channel."; 617 LOG(ERROR) << "Failed to establish GPU channel.";
618 return nullptr; 618 return nullptr;
619 } 619 }
620 620
621 // This is called from a few places to create different contexts: 621 // This is called from a few places to create different contexts:
622 // - The shared main thread context (offscreen). 622 // - The shared main thread context (offscreen).
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 675 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
676 observer_list_, 676 observer_list_,
677 OnLostResources()); 677 OnLostResources());
678 678
679 // Kill things that use the shared context before killing the shared context. 679 // Kill things that use the shared context before killing the shared context.
680 lost_gl_helper.reset(); 680 lost_gl_helper.reset();
681 lost_shared_main_thread_contexts = NULL; 681 lost_shared_main_thread_contexts = NULL;
682 } 682 }
683 683
684 } // namespace content 684 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.h ('k') | content/browser/gpu/browser_gpu_channel_host_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698