OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/aura/gpu_process_transport_factory.h" | 5 #include "content/browser/aura/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 Loading... |
172 #elif defined(USE_X11) | 172 #elif defined(USE_X11) |
173 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceX11( | 173 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceX11( |
174 compositor)); | 174 compositor)); |
175 #endif | 175 #endif |
176 | 176 |
177 NOTREACHED(); | 177 NOTREACHED(); |
178 return scoped_ptr<cc::SoftwareOutputDevice>(); | 178 return scoped_ptr<cc::SoftwareOutputDevice>(); |
179 } | 179 } |
180 | 180 |
181 scoped_ptr<cc::OutputSurface> GpuProcessTransportFactory::CreateOutputSurface( | 181 scoped_ptr<cc::OutputSurface> GpuProcessTransportFactory::CreateOutputSurface( |
182 ui::Compositor* compositor) { | 182 ui::Compositor* compositor, bool software_fallback) { |
183 PerCompositorData* data = per_compositor_data_[compositor]; | 183 PerCompositorData* data = per_compositor_data_[compositor]; |
184 if (!data) | 184 if (!data) |
185 data = CreatePerCompositorData(compositor); | 185 data = CreatePerCompositorData(compositor); |
186 | 186 |
187 scoped_refptr<ContextProviderCommandBuffer> context_provider; | 187 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
188 | 188 |
189 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 189 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
190 if (!command_line->HasSwitch(switches::kUIEnableSoftwareCompositing)) { | 190 if (!command_line->HasSwitch(switches::kUIEnableSoftwareCompositing) && |
| 191 !software_fallback) { |
191 context_provider = ContextProviderCommandBuffer::Create( | 192 context_provider = ContextProviderCommandBuffer::Create( |
192 GpuProcessTransportFactory::CreateContextCommon(data->surface_id), | 193 GpuProcessTransportFactory::CreateContextCommon(data->surface_id), |
193 "Compositor"); | 194 "Compositor"); |
194 } | 195 } |
195 | 196 |
196 UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", !!context_provider); | 197 UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", !!context_provider); |
197 | 198 |
198 if (!context_provider.get()) { | 199 if (!context_provider.get()) { |
199 if (ui::Compositor::WasInitializedWithThread()) { | 200 if (ui::Compositor::WasInitializedWithThread()) { |
200 LOG(FATAL) << "Failed to create UI context, but can't use software" | 201 LOG(FATAL) << "Failed to create UI context, but can't use software" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 observer_list_, | 492 observer_list_, |
492 OnLostResources()); | 493 OnLostResources()); |
493 | 494 |
494 // Kill things that use the shared context before killing the shared context. | 495 // Kill things that use the shared context before killing the shared context. |
495 lost_gl_helper.reset(); | 496 lost_gl_helper.reset(); |
496 lost_offscreen_compositor_contexts = NULL; | 497 lost_offscreen_compositor_contexts = NULL; |
497 lost_shared_main_thread_contexts = NULL; | 498 lost_shared_main_thread_contexts = NULL; |
498 } | 499 } |
499 | 500 |
500 } // namespace content | 501 } // namespace content |
OLD | NEW |