| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "gpu/ipc/service/image_transport_surface_overlay_mac.h" | 5 #include "gpu/ipc/service/image_transport_surface_overlay_mac.h" |
| 6 | 6 |
| 7 #include <CoreGraphics/CoreGraphics.h> | 7 #include <CoreGraphics/CoreGraphics.h> |
| 8 #include <IOSurface/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
| 9 #include <OpenGL/CGLRenderers.h> | 9 #include <OpenGL/CGLRenderers.h> |
| 10 #include <OpenGL/CGLTypes.h> | 10 #include <OpenGL/CGLTypes.h> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 ImageTransportSurfaceOverlayMac::ImageTransportSurfaceOverlayMac( | 69 ImageTransportSurfaceOverlayMac::ImageTransportSurfaceOverlayMac( |
| 70 GpuCommandBufferStub* stub, | 70 GpuCommandBufferStub* stub, |
| 71 SurfaceHandle handle) | 71 SurfaceHandle handle) |
| 72 : stub_(stub->AsWeakPtr()), | 72 : stub_(stub->AsWeakPtr()), |
| 73 handle_(handle), | 73 handle_(handle), |
| 74 use_remote_layer_api_(ui::RemoteLayerAPISupported()), | 74 use_remote_layer_api_(ui::RemoteLayerAPISupported()), |
| 75 scale_factor_(1), | 75 scale_factor_(1), |
| 76 gl_renderer_id_(0) { | 76 gl_renderer_id_(0) { |
| 77 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 77 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
| 78 ca_layer_tree_coordinator_.reset( | 78 |
| 79 new ui::CALayerTreeCoordinator(use_remote_layer_api_)); | 79 bool disable_av_sample_buffer_display_layer = |
| 80 stub_->GetFeatureInfo() |
| 81 ->workarounds() |
| 82 .disable_av_sample_buffer_display_layer; |
| 83 |
| 84 ca_layer_tree_coordinator_.reset(new ui::CALayerTreeCoordinator( |
| 85 use_remote_layer_api_, !disable_av_sample_buffer_display_layer)); |
| 80 } | 86 } |
| 81 | 87 |
| 82 ImageTransportSurfaceOverlayMac::~ImageTransportSurfaceOverlayMac() { | 88 ImageTransportSurfaceOverlayMac::~ImageTransportSurfaceOverlayMac() { |
| 83 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); | 89 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); |
| 84 if (stub_.get()) { | 90 if (stub_.get()) { |
| 85 stub_->SetLatencyInfoCallback( | 91 stub_->SetLatencyInfoCallback( |
| 86 base::Callback<void(const std::vector<ui::LatencyInfo>&)>()); | 92 base::Callback<void(const std::vector<ui::LatencyInfo>&)>()); |
| 87 } | 93 } |
| 88 Destroy(); | 94 Destroy(); |
| 89 } | 95 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; | 396 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; |
| 391 | 397 |
| 392 // Post a task holding a reference to the new GL context. The reason for | 398 // Post a task holding a reference to the new GL context. The reason for |
| 393 // this is to avoid creating-then-destroying the context for every image | 399 // this is to avoid creating-then-destroying the context for every image |
| 394 // transport surface that is observing the GPU switch. | 400 // transport surface that is observing the GPU switch. |
| 395 base::ThreadTaskRunnerHandle::Get()->PostTask( | 401 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 396 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); | 402 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); |
| 397 } | 403 } |
| 398 | 404 |
| 399 } // namespace gpu | 405 } // namespace gpu |
| OLD | NEW |