OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "ui/compositor/compositor_constants.h" | 43 #include "ui/compositor/compositor_constants.h" |
44 #include "ui/compositor/compositor_switches.h" | 44 #include "ui/compositor/compositor_switches.h" |
45 #include "ui/gfx/geometry/size.h" | 45 #include "ui/gfx/geometry/size.h" |
46 #include "ui/gfx/native_widget_types.h" | 46 #include "ui/gfx/native_widget_types.h" |
47 | 47 |
48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
49 #include "content/browser/compositor/software_output_device_win.h" | 49 #include "content/browser/compositor/software_output_device_win.h" |
50 #elif defined(USE_OZONE) | 50 #elif defined(USE_OZONE) |
51 #include "content/browser/compositor/overlay_candidate_validator_ozone.h" | 51 #include "content/browser/compositor/overlay_candidate_validator_ozone.h" |
52 #include "content/browser/compositor/software_output_device_ozone.h" | 52 #include "content/browser/compositor/software_output_device_ozone.h" |
| 53 #include "ui/ozone/public/ozone_switches.h" |
53 #include "ui/ozone/public/surface_factory_ozone.h" | 54 #include "ui/ozone/public/surface_factory_ozone.h" |
54 #elif defined(USE_X11) | 55 #elif defined(USE_X11) |
55 #include "content/browser/compositor/software_output_device_x11.h" | 56 #include "content/browser/compositor/software_output_device_x11.h" |
56 #elif defined(OS_MACOSX) | 57 #elif defined(OS_MACOSX) |
57 #include "content/browser/compositor/software_output_device_mac.h" | 58 #include "content/browser/compositor/software_output_device_mac.h" |
58 #endif | 59 #endif |
59 | 60 |
60 using cc::ContextProvider; | 61 using cc::ContextProvider; |
61 using gpu::gles2::GLES2Interface; | 62 using gpu::gles2::GLES2Interface; |
62 | 63 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 NOTREACHED(); | 115 NOTREACHED(); |
115 return scoped_ptr<cc::SoftwareOutputDevice>(); | 116 return scoped_ptr<cc::SoftwareOutputDevice>(); |
116 #endif | 117 #endif |
117 } | 118 } |
118 | 119 |
119 scoped_ptr<cc::OverlayCandidateValidator> CreateOverlayCandidateValidator( | 120 scoped_ptr<cc::OverlayCandidateValidator> CreateOverlayCandidateValidator( |
120 gfx::AcceleratedWidget widget) { | 121 gfx::AcceleratedWidget widget) { |
121 #if defined(USE_OZONE) | 122 #if defined(USE_OZONE) |
122 ui::OverlayCandidatesOzone* overlay_candidates = | 123 ui::OverlayCandidatesOzone* overlay_candidates = |
123 ui::SurfaceFactoryOzone::GetInstance()->GetOverlayCandidates(widget); | 124 ui::SurfaceFactoryOzone::GetInstance()->GetOverlayCandidates(widget); |
| 125 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
124 if (overlay_candidates && | 126 if (overlay_candidates && |
125 base::CommandLine::ForCurrentProcess()->HasSwitch( | 127 (command_line->HasSwitch(switches::kEnableHardwareOverlays) || |
126 switches::kEnableHardwareOverlays)) { | 128 command_line->HasSwitch(switches::kOzoneTestSingleOverlaySupport))) { |
127 return scoped_ptr<cc::OverlayCandidateValidator>( | 129 return scoped_ptr<cc::OverlayCandidateValidator>( |
128 new OverlayCandidateValidatorOzone(widget, overlay_candidates)); | 130 new OverlayCandidateValidatorOzone(widget, overlay_candidates)); |
129 } | 131 } |
130 #endif | 132 #endif |
131 return scoped_ptr<cc::OverlayCandidateValidator>(); | 133 return scoped_ptr<cc::OverlayCandidateValidator>(); |
132 } | 134 } |
133 | 135 |
134 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { | 136 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { |
135 #if defined(OS_CHROMEOS) | 137 #if defined(OS_CHROMEOS) |
136 // Software fallback does not happen on Chrome OS. | 138 // Software fallback does not happen on Chrome OS. |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 528 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
527 observer_list_, | 529 observer_list_, |
528 OnLostResources()); | 530 OnLostResources()); |
529 | 531 |
530 // Kill things that use the shared context before killing the shared context. | 532 // Kill things that use the shared context before killing the shared context. |
531 lost_gl_helper.reset(); | 533 lost_gl_helper.reset(); |
532 lost_shared_main_thread_contexts = NULL; | 534 lost_shared_main_thread_contexts = NULL; |
533 } | 535 } |
534 | 536 |
535 } // namespace content | 537 } // namespace content |
OLD | NEW |