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

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

Issue 1216303004: content: Allow software compositing on Chrome OS if requested (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( 172 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(
173 new BrowserCompositorOverlayCandidateValidatorOzone( 173 new BrowserCompositorOverlayCandidateValidatorOzone(
174 widget, overlay_candidates.Pass())); 174 widget, overlay_candidates.Pass()));
175 } 175 }
176 #endif 176 #endif
177 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); 177 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>();
178 } 178 }
179 179
180 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { 180 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) {
181 #if defined(OS_CHROMEOS) 181 #if defined(OS_CHROMEOS)
182 // Software fallback does not happen on Chrome OS. 182 // Software fallback does not happen on Chrome OS.
danakj 2015/07/01 18:34:02 I think you want to change here instead. There's n
183 return true; 183 return true;
184 #endif 184 #endif
185 185
186 #if defined(OS_WIN) 186 #if defined(OS_WIN)
187 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && 187 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) &&
188 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) 188 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor))
189 return false; 189 return false;
190 #endif 190 #endif
191 191
192 return GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor(); 192 return GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 base::WeakPtr<ui::Compositor> compositor, 246 base::WeakPtr<ui::Compositor> compositor,
247 bool create_gpu_output_surface, 247 bool create_gpu_output_surface,
248 int num_attempts) { 248 int num_attempts) {
249 if (!compositor) 249 if (!compositor)
250 return; 250 return;
251 PerCompositorData* data = per_compositor_data_[compositor.get()]; 251 PerCompositorData* data = per_compositor_data_[compositor.get()];
252 DCHECK(data); 252 DCHECK(data);
253 253
254 if (num_attempts > kNumRetriesBeforeSoftwareFallback) { 254 if (num_attempts > kNumRetriesBeforeSoftwareFallback) {
255 #if defined(OS_CHROMEOS) 255 #if defined(OS_CHROMEOS)
256 LOG(FATAL) << "Unable to create a UI graphics context, and cannot use " 256 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
257 << "software compositing on ChromeOS."; 257 switches::kDisableGpu)) {
258 LOG(FATAL) << "Unable to create a UI graphics context, and cannot use "
259 << "software compositing on ChromeOS.";
260 }
258 #endif 261 #endif
259 create_gpu_output_surface = false; 262 create_gpu_output_surface = false;
260 } 263 }
261 264
262 scoped_refptr<ContextProviderCommandBuffer> context_provider; 265 scoped_refptr<ContextProviderCommandBuffer> context_provider;
263 if (create_gpu_output_surface) { 266 if (create_gpu_output_surface) {
264 scoped_refptr<GpuChannelHost> gpu_channel_host = 267 scoped_refptr<GpuChannelHost> gpu_channel_host =
265 BrowserGpuChannelHostFactory::instance()->GetGpuChannel(); 268 BrowserGpuChannelHostFactory::instance()->GetGpuChannel();
266 if (gpu_channel_host.get()) { 269 if (gpu_channel_host.get()) {
267 context_provider = ContextProviderCommandBuffer::Create( 270 context_provider = ContextProviderCommandBuffer::Create(
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 618 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
616 observer_list_, 619 observer_list_,
617 OnLostResources()); 620 OnLostResources());
618 621
619 // Kill things that use the shared context before killing the shared context. 622 // Kill things that use the shared context before killing the shared context.
620 lost_gl_helper.reset(); 623 lost_gl_helper.reset();
621 lost_shared_main_thread_contexts = NULL; 624 lost_shared_main_thread_contexts = NULL;
622 } 625 }
623 626
624 } // namespace content 627 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698