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

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: 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..26d25eddbf84172cc59947fdec375ef3f008bb95 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(
@@ -338,9 +344,9 @@ bool ImageTransportSurfaceOverlayMac::ScheduleCALayer(
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);
+ gl::GLImageIOSurface* io_surface_image =
+ gl::GLImageIOSurface::FromGLImage(contents_image);
+ if (io_surface_image) {
io_surface = io_surface_image->io_surface();
cv_pixel_buffer = io_surface_image->cv_pixel_buffer();
}
piman 2016/06/28 17:28:35 else return false? Or is it ok/meaningful to call
erikchen 2016/06/28 17:36:08 Good point. We should return false.
« 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