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

Unified Diff: content/child/child_io_surface_manager_mac.cc

Issue 1503393006: GpuMemoryBuffers: Tighten AcquireIOSurface's error checking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 5 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_io_surface_manager_mac.cc
diff --git a/content/child/child_io_surface_manager_mac.cc b/content/child/child_io_surface_manager_mac.cc
index ebad42ad5b42c1d54322c2f59d5f340235848837..af49b7a96b9eb73f4a798112bd1aaea6eca7590d 100644
--- a/content/child/child_io_surface_manager_mac.cc
+++ b/content/child/child_io_surface_manager_mac.cc
@@ -99,10 +99,7 @@ IOSurfaceRef ChildIOSurfaceManager::AcquireIOSurface(
mach_port_t reply_port;
kern_return_t kr = mach_port_allocate(mach_task_self(),
MACH_PORT_RIGHT_RECEIVE, &reply_port);
- if (kr != KERN_SUCCESS) {
- MACH_LOG(ERROR, kr) << "mach_port_allocate";
- return nullptr;
- }
+ CHECK_EQ(KERN_SUCCESS, kr);
base::mac::ScopedMachReceiveRight scoped_receive_right(reply_port);
union {
@@ -128,16 +125,21 @@ IOSurfaceRef ChildIOSurfaceManager::AcquireIOSurface(
MACH_LOG(ERROR, kr) << "mach_msg";
return nullptr;
}
- if (!data.reply.msg.result) {
- DLOG(ERROR) << "Browser refused AcquireIOSurface request";
- return nullptr;
- }
+ // TODO(crbug.com/554541): Remove this check. This error should be fatal for
+ // renderer processes, but not for the GPU process.
+ CHECK(data.reply.msg.result);
// Deallocate the right after creating an IOSurface reference.
base::mac::ScopedMachSendRight scoped_io_surface_right(
data.reply.msg.io_surface_port.name);
- return IOSurfaceLookupFromMachPort(scoped_io_surface_right.get());
+ // If a port was successfully received, it should be valid, and opening it
+ // should not fail.
+ CHECK(scoped_io_surface_right.is_valid());
+ IOSurfaceRef io_surface = IOSurfaceLookupFromMachPort(
+ scoped_io_surface_right.get());
+ CHECK(io_surface);
+ return io_surface;
}
ChildIOSurfaceManager::ChildIOSurfaceManager() {}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698