| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 if (!io_surface_image) { | 325 if (!io_surface_image) { |
| 326 DLOG(ERROR) << "Not an IOSurface image."; | 326 DLOG(ERROR) << "Not an IOSurface image."; |
| 327 return false; | 327 return false; |
| 328 } | 328 } |
| 329 return ca_layer_tree_coordinator_->SetPendingGLRendererBackbuffer( | 329 return ca_layer_tree_coordinator_->SetPendingGLRendererBackbuffer( |
| 330 io_surface_image->io_surface()); | 330 io_surface_image->io_surface()); |
| 331 } | 331 } |
| 332 | 332 |
| 333 bool ImageTransportSurfaceOverlayMac::ScheduleCALayer( | 333 bool ImageTransportSurfaceOverlayMac::ScheduleCALayer( |
| 334 const ui::CARendererLayerParams& params) { | 334 const ui::CARendererLayerParams& params) { |
| 335 gl::GLImageIOSurface* io_surface_image = | 335 if (params.image) { |
| 336 gl::GLImageIOSurface::FromGLImage(params.image); | 336 gl::GLImageIOSurface* io_surface_image = |
| 337 if (!io_surface_image) { | 337 gl::GLImageIOSurface::FromGLImage(params.image); |
| 338 DLOG(ERROR) << "Cannot schedule CALayer with non-IOSurface GLImage"; | 338 if (!io_surface_image) { |
| 339 return false; | 339 DLOG(ERROR) << "Cannot schedule CALayer with non-IOSurface GLImage"; |
| 340 return false; |
| 341 } |
| 340 } | 342 } |
| 341 return ca_layer_tree_coordinator_->GetPendingCARendererLayerTree() | 343 return ca_layer_tree_coordinator_->GetPendingCARendererLayerTree() |
| 342 ->ScheduleCALayer(params); | 344 ->ScheduleCALayer(params); |
| 343 } | 345 } |
| 344 | 346 |
| 345 void ImageTransportSurfaceOverlayMac::ScheduleCALayerInUseQuery( | 347 void ImageTransportSurfaceOverlayMac::ScheduleCALayerInUseQuery( |
| 346 std::vector<CALayerInUseQuery> queries) { | 348 std::vector<CALayerInUseQuery> queries) { |
| 347 ca_layer_in_use_queries_.swap(queries); | 349 ca_layer_in_use_queries_.swap(queries); |
| 348 } | 350 } |
| 349 | 351 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 376 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; | 378 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; |
| 377 | 379 |
| 378 // Post a task holding a reference to the new GL context. The reason for | 380 // Post a task holding a reference to the new GL context. The reason for |
| 379 // this is to avoid creating-then-destroying the context for every image | 381 // this is to avoid creating-then-destroying the context for every image |
| 380 // transport surface that is observing the GPU switch. | 382 // transport surface that is observing the GPU switch. |
| 381 base::MessageLoop::current()->PostTask( | 383 base::MessageLoop::current()->PostTask( |
| 382 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); | 384 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); |
| 383 } | 385 } |
| 384 | 386 |
| 385 } // namespace gpu | 387 } // namespace gpu |
| OLD | NEW |