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

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

Issue 1132133004: Share backing canvases between browser compositors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 : next_surface_id_namespace_(1u), 101 : next_surface_id_namespace_(1u),
102 task_graph_runner_(new cc::TaskGraphRunner), 102 task_graph_runner_(new cc::TaskGraphRunner),
103 callback_factory_(this) { 103 callback_factory_(this) {
104 if (UseSurfacesEnabled()) 104 if (UseSurfacesEnabled())
105 surface_manager_ = make_scoped_ptr(new cc::SurfaceManager); 105 surface_manager_ = make_scoped_ptr(new cc::SurfaceManager);
106 106
107 if (ui::IsUIImplSidePaintingEnabled()) { 107 if (ui::IsUIImplSidePaintingEnabled()) {
108 raster_thread_.reset(new RasterThread(task_graph_runner_.get())); 108 raster_thread_.reset(new RasterThread(task_graph_runner_.get()));
109 raster_thread_->Start(); 109 raster_thread_->Start();
110 } 110 }
111 #if defined(OS_WIN)
112 software_backing_.reset(new OutputDeviceBacking);
113 #endif
111 } 114 }
112 115
113 GpuProcessTransportFactory::~GpuProcessTransportFactory() { 116 GpuProcessTransportFactory::~GpuProcessTransportFactory() {
114 DCHECK(per_compositor_data_.empty()); 117 DCHECK(per_compositor_data_.empty());
115 118
116 // Make sure the lost context callback doesn't try to run during destruction. 119 // Make sure the lost context callback doesn't try to run during destruction.
117 callback_factory_.InvalidateWeakPtrs(); 120 callback_factory_.InvalidateWeakPtrs();
118 121
119 task_graph_runner_->Shutdown(); 122 task_graph_runner_->Shutdown();
120 if (raster_thread_) 123 if (raster_thread_)
121 raster_thread_->Join(); 124 raster_thread_->Join();
122 } 125 }
123 126
124 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 127 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
125 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() { 128 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
126 CauseForGpuLaunch cause = 129 CauseForGpuLaunch cause =
127 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; 130 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
128 scoped_refptr<GpuChannelHost> gpu_channel_host( 131 scoped_refptr<GpuChannelHost> gpu_channel_host(
129 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); 132 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause));
130 return CreateContextCommon(gpu_channel_host, 0); 133 return CreateContextCommon(gpu_channel_host, 0);
131 } 134 }
132 135
133 scoped_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice( 136 scoped_ptr<cc::SoftwareOutputDevice>
137 GpuProcessTransportFactory::CreateSoftwareOutputDevice(
134 ui::Compositor* compositor) { 138 ui::Compositor* compositor) {
135 #if defined(OS_WIN) 139 #if defined(OS_WIN)
136 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceWin( 140 return scoped_ptr<cc::SoftwareOutputDevice>(
137 compositor)); 141 new SoftwareOutputDeviceWin(software_backing_.get(), compositor));
138 #elif defined(USE_OZONE) 142 #elif defined(USE_OZONE)
139 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceOzone( 143 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceOzone(
140 compositor)); 144 compositor));
141 #elif defined(USE_X11) 145 #elif defined(USE_X11)
142 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceX11( 146 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceX11(
143 compositor)); 147 compositor));
144 #elif defined(OS_MACOSX) 148 #elif defined(OS_MACOSX)
145 return scoped_ptr<cc::SoftwareOutputDevice>( 149 return scoped_ptr<cc::SoftwareOutputDevice>(
146 new SoftwareOutputDeviceMac(compositor)); 150 new SoftwareOutputDeviceMac(compositor));
147 #else 151 #else
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 603 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
600 observer_list_, 604 observer_list_,
601 OnLostResources()); 605 OnLostResources());
602 606
603 // Kill things that use the shared context before killing the shared context. 607 // Kill things that use the shared context before killing the shared context.
604 lost_gl_helper.reset(); 608 lost_gl_helper.reset();
605 lost_shared_main_thread_contexts = NULL; 609 lost_shared_main_thread_contexts = NULL;
606 } 610 }
607 611
608 } // namespace content 612 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.h ('k') | content/browser/compositor/software_output_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698