| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "content/browser/compositor/software_output_device_ozone.h" | 59 #include "content/browser/compositor/software_output_device_ozone.h" |
| 60 #include "ui/ozone/public/overlay_candidates_ozone.h" | 60 #include "ui/ozone/public/overlay_candidates_ozone.h" |
| 61 #include "ui/ozone/public/overlay_manager_ozone.h" | 61 #include "ui/ozone/public/overlay_manager_ozone.h" |
| 62 #include "ui/ozone/public/ozone_platform.h" | 62 #include "ui/ozone/public/ozone_platform.h" |
| 63 #include "ui/ozone/public/ozone_switches.h" | 63 #include "ui/ozone/public/ozone_switches.h" |
| 64 #elif defined(USE_X11) | 64 #elif defined(USE_X11) |
| 65 #include "content/browser/compositor/software_output_device_x11.h" | 65 #include "content/browser/compositor/software_output_device_x11.h" |
| 66 #elif defined(OS_MACOSX) | 66 #elif defined(OS_MACOSX) |
| 67 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_mac.h" | 67 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_mac.h" |
| 68 #include "content/browser/compositor/software_output_device_mac.h" | 68 #include "content/browser/compositor/software_output_device_mac.h" |
| 69 #include "ui/base/cocoa/remote_layer_api.h" |
| 69 #endif | 70 #endif |
| 70 | 71 |
| 71 using cc::ContextProvider; | 72 using cc::ContextProvider; |
| 72 using gpu::gles2::GLES2Interface; | 73 using gpu::gles2::GLES2Interface; |
| 73 | 74 |
| 74 static const int kNumRetriesBeforeSoftwareFallback = 4; | 75 static const int kNumRetriesBeforeSoftwareFallback = 4; |
| 75 | 76 |
| 76 namespace content { | 77 namespace content { |
| 77 namespace { | 78 namespace { |
| 78 | 79 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 ->CreateOverlayCandidates(widget); | 170 ->CreateOverlayCandidates(widget); |
| 170 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 171 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 171 if (overlay_candidates && | 172 if (overlay_candidates && |
| 172 (command_line->HasSwitch(switches::kEnableHardwareOverlays) || | 173 (command_line->HasSwitch(switches::kEnableHardwareOverlays) || |
| 173 command_line->HasSwitch(switches::kOzoneTestSingleOverlaySupport))) { | 174 command_line->HasSwitch(switches::kOzoneTestSingleOverlaySupport))) { |
| 174 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( | 175 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( |
| 175 new BrowserCompositorOverlayCandidateValidatorOzone( | 176 new BrowserCompositorOverlayCandidateValidatorOzone( |
| 176 widget, overlay_candidates.Pass())); | 177 widget, overlay_candidates.Pass())); |
| 177 } | 178 } |
| 178 #elif defined(OS_MACOSX) | 179 #elif defined(OS_MACOSX) |
| 179 return make_scoped_ptr( | 180 // Overlays are only supported through the remote layer API. |
| 180 new BrowserCompositorOverlayCandidateValidatorMac(widget)); | 181 if (ui::RemoteLayerAPISupported()) { |
| 182 return make_scoped_ptr( |
| 183 new BrowserCompositorOverlayCandidateValidatorMac(widget)); |
| 184 } |
| 181 #endif | 185 #endif |
| 182 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); | 186 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); |
| 183 } | 187 } |
| 184 | 188 |
| 185 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { | 189 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { |
| 186 #if defined(OS_CHROMEOS) | 190 #if defined(OS_CHROMEOS) |
| 187 // Software fallback does not happen on Chrome OS. | 191 // Software fallback does not happen on Chrome OS. |
| 188 return true; | 192 return true; |
| 189 #endif | 193 #endif |
| 190 | 194 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 644 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 641 observer_list_, | 645 observer_list_, |
| 642 OnLostResources()); | 646 OnLostResources()); |
| 643 | 647 |
| 644 // Kill things that use the shared context before killing the shared context. | 648 // Kill things that use the shared context before killing the shared context. |
| 645 lost_gl_helper.reset(); | 649 lost_gl_helper.reset(); |
| 646 lost_shared_main_thread_contexts = NULL; | 650 lost_shared_main_thread_contexts = NULL; |
| 647 } | 651 } |
| 648 | 652 |
| 649 } // namespace content | 653 } // namespace content |
| OLD | NEW |