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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "ui/compositor/compositor_switches.h" | 49 #include "ui/compositor/compositor_switches.h" |
50 #include "ui/compositor/layer.h" | 50 #include "ui/compositor/layer.h" |
51 #include "ui/gfx/geometry/size.h" | 51 #include "ui/gfx/geometry/size.h" |
52 #include "ui/gfx/native_widget_types.h" | 52 #include "ui/gfx/native_widget_types.h" |
53 | 53 |
54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
55 #include "content/browser/compositor/software_output_device_win.h" | 55 #include "content/browser/compositor/software_output_device_win.h" |
56 #elif defined(USE_OZONE) | 56 #elif defined(USE_OZONE) |
57 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_ozone.h" | 57 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_ozone.h" |
58 #include "content/browser/compositor/software_output_device_ozone.h" | 58 #include "content/browser/compositor/software_output_device_ozone.h" |
| 59 #include "ui/ozone/public/overlay_candidates_ozone.h" |
59 #include "ui/ozone/public/overlay_manager_ozone.h" | 60 #include "ui/ozone/public/overlay_manager_ozone.h" |
60 #include "ui/ozone/public/ozone_platform.h" | 61 #include "ui/ozone/public/ozone_platform.h" |
61 #include "ui/ozone/public/ozone_switches.h" | 62 #include "ui/ozone/public/ozone_switches.h" |
62 #elif defined(USE_X11) | 63 #elif defined(USE_X11) |
63 #include "content/browser/compositor/software_output_device_x11.h" | 64 #include "content/browser/compositor/software_output_device_x11.h" |
64 #elif defined(OS_MACOSX) | 65 #elif defined(OS_MACOSX) |
65 #include "content/browser/compositor/software_output_device_mac.h" | 66 #include "content/browser/compositor/software_output_device_mac.h" |
66 #endif | 67 #endif |
67 | 68 |
68 using cc::ContextProvider; | 69 using cc::ContextProvider; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 new SoftwareOutputDeviceMac(compositor)); | 155 new SoftwareOutputDeviceMac(compositor)); |
155 #else | 156 #else |
156 NOTREACHED(); | 157 NOTREACHED(); |
157 return scoped_ptr<cc::SoftwareOutputDevice>(); | 158 return scoped_ptr<cc::SoftwareOutputDevice>(); |
158 #endif | 159 #endif |
159 } | 160 } |
160 | 161 |
161 scoped_ptr<BrowserCompositorOverlayCandidateValidator> | 162 scoped_ptr<BrowserCompositorOverlayCandidateValidator> |
162 CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) { | 163 CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) { |
163 #if defined(USE_OZONE) | 164 #if defined(USE_OZONE) |
164 ui::OverlayCandidatesOzone* overlay_candidates = | 165 scoped_ptr<ui::OverlayCandidatesOzone> overlay_candidates = |
165 ui::OzonePlatform::GetInstance() | 166 ui::OzonePlatform::GetInstance() |
166 ->GetOverlayManager() | 167 ->GetOverlayManager() |
167 ->GetOverlayCandidates(widget); | 168 ->GetOverlayCandidates(widget); |
168 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 169 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
169 if (overlay_candidates && | 170 if (overlay_candidates && |
170 (command_line->HasSwitch(switches::kEnableHardwareOverlays) || | 171 (command_line->HasSwitch(switches::kEnableHardwareOverlays) || |
171 command_line->HasSwitch(switches::kOzoneTestSingleOverlaySupport))) { | 172 command_line->HasSwitch(switches::kOzoneTestSingleOverlaySupport))) { |
172 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( | 173 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( |
173 new BrowserCompositorOverlayCandidateValidatorOzone( | 174 new BrowserCompositorOverlayCandidateValidatorOzone( |
174 widget, overlay_candidates)); | 175 widget, overlay_candidates.Pass())); |
175 } | 176 } |
176 #endif | 177 #endif |
177 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); | 178 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); |
178 } | 179 } |
179 | 180 |
180 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { | 181 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { |
181 #if defined(OS_CHROMEOS) | 182 #if defined(OS_CHROMEOS) |
182 // Software fallback does not happen on Chrome OS. | 183 // Software fallback does not happen on Chrome OS. |
183 return true; | 184 return true; |
184 #endif | 185 #endif |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 616 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
616 observer_list_, | 617 observer_list_, |
617 OnLostResources()); | 618 OnLostResources()); |
618 | 619 |
619 // Kill things that use the shared context before killing the shared context. | 620 // Kill things that use the shared context before killing the shared context. |
620 lost_gl_helper.reset(); | 621 lost_gl_helper.reset(); |
621 lost_shared_main_thread_contexts = NULL; | 622 lost_shared_main_thread_contexts = NULL; |
622 } | 623 } |
623 | 624 |
624 } // namespace content | 625 } // namespace content |
OLD | NEW |