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

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

Issue 1464663003: Use IsRunningInMojoShell in GpuProcessTransportFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "gpu/command_buffer/client/gles2_interface.h" 46 #include "gpu/command_buffer/client/gles2_interface.h"
47 #include "gpu/command_buffer/common/mailbox.h" 47 #include "gpu/command_buffer/common/mailbox.h"
48 #include "third_party/khronos/GLES2/gl2.h" 48 #include "third_party/khronos/GLES2/gl2.h"
49 #include "ui/compositor/compositor.h" 49 #include "ui/compositor/compositor.h"
50 #include "ui/compositor/compositor_constants.h" 50 #include "ui/compositor/compositor_constants.h"
51 #include "ui/compositor/compositor_switches.h" 51 #include "ui/compositor/compositor_switches.h"
52 #include "ui/compositor/layer.h" 52 #include "ui/compositor/layer.h"
53 #include "ui/gfx/geometry/size.h" 53 #include "ui/gfx/geometry/size.h"
54 #include "ui/gfx/native_widget_types.h" 54 #include "ui/gfx/native_widget_types.h"
55 55
56 #if defined(MOJO_RUNNER_CLIENT)
57 #include "content/common/mojo/mojo_shell_connection_impl.h"
58 #endif
59
56 #if defined(OS_WIN) 60 #if defined(OS_WIN)
57 #include "content/browser/compositor/software_output_device_win.h" 61 #include "content/browser/compositor/software_output_device_win.h"
58 #elif defined(USE_OZONE) 62 #elif defined(USE_OZONE)
59 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor_ozone.h" 63 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor_ozone.h"
60 #include "content/browser/compositor/software_output_device_ozone.h" 64 #include "content/browser/compositor/software_output_device_ozone.h"
61 #include "ui/ozone/public/overlay_candidates_ozone.h" 65 #include "ui/ozone/public/overlay_candidates_ozone.h"
62 #include "ui/ozone/public/overlay_manager_ozone.h" 66 #include "ui/ozone/public/overlay_manager_ozone.h"
63 #include "ui/ozone/public/ozone_platform.h" 67 #include "ui/ozone/public/ozone_platform.h"
64 #include "ui/ozone/public/ozone_switches.h" 68 #include "ui/ozone/public/ozone_switches.h"
65 #elif defined(USE_X11) 69 #elif defined(USE_X11)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 scoped_refptr<GpuChannelHost> gpu_channel_host( 147 scoped_refptr<GpuChannelHost> gpu_channel_host(
144 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); 148 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause));
145 return CreateContextCommon(gpu_channel_host, 0); 149 return CreateContextCommon(gpu_channel_host, 0);
146 #endif // OS_ANDROID 150 #endif // OS_ANDROID
147 } 151 }
148 152
149 scoped_ptr<cc::SoftwareOutputDevice> 153 scoped_ptr<cc::SoftwareOutputDevice>
150 GpuProcessTransportFactory::CreateSoftwareOutputDevice( 154 GpuProcessTransportFactory::CreateSoftwareOutputDevice(
151 ui::Compositor* compositor) { 155 ui::Compositor* compositor) {
152 #if defined(MOJO_RUNNER_CLIENT) 156 #if defined(MOJO_RUNNER_CLIENT)
153 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 157 if (IsRunningInMojoShell()) {
154 "mojo-platform-channel-handle")) {
155 return scoped_ptr<cc::SoftwareOutputDevice>( 158 return scoped_ptr<cc::SoftwareOutputDevice>(
156 new SoftwareOutputDeviceMus(compositor)); 159 new SoftwareOutputDeviceMus(compositor));
157 } 160 }
158 #endif 161 #endif
159 162
160 #if defined(OS_WIN) 163 #if defined(OS_WIN)
161 return scoped_ptr<cc::SoftwareOutputDevice>( 164 return scoped_ptr<cc::SoftwareOutputDevice>(
162 new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); 165 new SoftwareOutputDeviceWin(software_backing_.get(), compositor));
163 #elif defined(USE_OZONE) 166 #elif defined(USE_OZONE)
164 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceOzone( 167 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceOzone(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 new BrowserCompositorOverlayCandidateValidatorMac(widget)); 200 new BrowserCompositorOverlayCandidateValidatorMac(widget));
198 } 201 }
199 #endif 202 #endif
200 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); 203 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>();
201 } 204 }
202 205
203 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { 206 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) {
204 #if defined(MOJO_RUNNER_CLIENT) 207 #if defined(MOJO_RUNNER_CLIENT)
205 // Chrome running as a mojo app currently can only use software compositing. 208 // Chrome running as a mojo app currently can only use software compositing.
206 // TODO(rjkroege): http://crbug.com/548451 209 // TODO(rjkroege): http://crbug.com/548451
207 // TODO(rjkroege): Make IsRunningInMojoRunner callable from content. 210 if (IsRunningInMojoShell()) {
208 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
209 "mojo-platform-channel-handle")) {
210 return false; 211 return false;
211 } 212 }
212 #endif 213 #endif
213 214
214 #if defined(OS_CHROMEOS) 215 #if defined(OS_CHROMEOS)
215 // Software fallback does not happen on Chrome OS. 216 // Software fallback does not happen on Chrome OS.
216 return true; 217 return true;
217 #endif 218 #endif
218 219
219 #if defined(OS_WIN) 220 #if defined(OS_WIN)
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 672 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
672 observer_list_, 673 observer_list_,
673 OnLostResources()); 674 OnLostResources());
674 675
675 // Kill things that use the shared context before killing the shared context. 676 // Kill things that use the shared context before killing the shared context.
676 lost_gl_helper.reset(); 677 lost_gl_helper.reset();
677 lost_shared_main_thread_contexts = NULL; 678 lost_shared_main_thread_contexts = NULL;
678 } 679 }
679 680
680 } // namespace content 681 } // 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