Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: gpu/ipc/service/image_transport_surface_overlay_mac.mm

Issue 2106843002: Remove unsafe cast from ImageTransportSurfaceOverlayMac::ScheduleCALayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from piman. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gl/gl_image.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/image_transport_surface_overlay_mac.mm
diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
index f2da74fdc5503df73540cc2cd58b3f29fcbf3a2b..764e45ad44a59b7e5b6c7b6920c92139f51a97eb 100644
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
@@ -163,9 +163,9 @@ void ImageTransportSurfaceOverlayMac::SendAcceleratedSurfaceBuffersSwapped(
gpu::TextureInUseResponse response;
response.texture = query.texture;
bool in_use = false;
- if (query.image) {
- gl::GLImageIOSurface* io_surface_image =
- static_cast<gl::GLImageIOSurface*>(query.image.get());
+ gl::GLImageIOSurface* io_surface_image =
+ gl::GLImageIOSurface::FromGLImage(query.image.get());
+ if (io_surface_image) {
in_use = io_surface_image->CanCheckIOSurfaceIsInUse() &&
IOSurfaceIsInUse(io_surface_image->io_surface());
}
@@ -320,8 +320,14 @@ bool ImageTransportSurfaceOverlayMac::ScheduleOverlayPlane(
DLOG(ERROR) << "Invalid non-zero Z order.";
return false;
}
+ gl::GLImageIOSurface* io_surface_image =
+ gl::GLImageIOSurface::FromGLImage(image);
+ if (!io_surface_image) {
+ DLOG(ERROR) << "Not an IOSurface image.";
+ return false;
+ }
return ca_layer_tree_coordinator_->SetPendingGLRendererBackbuffer(
- static_cast<gl::GLImageIOSurface*>(image)->io_surface());
+ io_surface_image->io_surface());
}
bool ImageTransportSurfaceOverlayMac::ScheduleCALayer(
@@ -336,14 +342,14 @@ bool ImageTransportSurfaceOverlayMac::ScheduleCALayer(
const gfx::Transform& transform,
int sorting_context_id,
unsigned filter) {
- base::ScopedCFTypeRef<IOSurfaceRef> io_surface;
- base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer;
- if (contents_image) {
- gl::GLImageIOSurface* io_surface_image =
- static_cast<gl::GLImageIOSurface*>(contents_image);
- io_surface = io_surface_image->io_surface();
- cv_pixel_buffer = io_surface_image->cv_pixel_buffer();
- }
+ gl::GLImageIOSurface* io_surface_image =
+ gl::GLImageIOSurface::FromGLImage(contents_image);
+ if (!io_surface_image)
+ return false;
ccameron 2016/06/30 02:48:35 |io_surface_image| will be null for solid color la
+ base::ScopedCFTypeRef<IOSurfaceRef> io_surface =
+ io_surface_image->io_surface();
+ base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer =
+ io_surface_image->cv_pixel_buffer();
return ca_layer_tree_coordinator_->GetPendingCARendererLayerTree()
->ScheduleCALayer(is_clipped, gfx::ToEnclosingRect(clip_rect),
sorting_context_id, transform, io_surface,
« no previous file with comments | « no previous file | ui/gl/gl_image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698