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 "content/child/child_io_surface_manager_mac.h" | 5 #include "content/child/child_io_surface_manager_mac.h" |
6 | 6 |
7 #include "base/mac/mach_logging.h" | 7 #include "base/mac/mach_logging.h" |
8 #include "content/common/mac/io_surface_manager_messages.h" | 8 #include "content/common/mac/io_surface_manager_messages.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 data.request.io_surface_id = io_surface_id.id; | 121 data.request.io_surface_id = io_surface_id.id; |
122 memcpy(data.request.token_name, token_.name, sizeof(token_.name)); | 122 memcpy(data.request.token_name, token_.name, sizeof(token_.name)); |
123 | 123 |
124 kr = mach_msg(&data.request.header, MACH_SEND_MSG | MACH_RCV_MSG, | 124 kr = mach_msg(&data.request.header, MACH_SEND_MSG | MACH_RCV_MSG, |
125 sizeof(data.request), sizeof(data.reply), reply_port, | 125 sizeof(data.request), sizeof(data.reply), reply_port, |
126 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); | 126 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
127 if (kr != KERN_SUCCESS) { | 127 if (kr != KERN_SUCCESS) { |
128 MACH_LOG(ERROR, kr) << "mach_msg"; | 128 MACH_LOG(ERROR, kr) << "mach_msg"; |
129 return nullptr; | 129 return nullptr; |
130 } | 130 } |
131 | 131 if (!data.reply.msg.result) { |
132 // Crash the renderer (for now) to see if this was the cause of renderer hangs | 132 DLOG(ERROR) << "Browser refused AcquireIOSurface request"; |
133 // that have recently been noticed. | 133 return nullptr; |
134 // http://crbug.com/532149 | 134 } |
135 CHECK(data.reply.msg.result); | |
136 | 135 |
137 // Deallocate the right after creating an IOSurface reference. | 136 // Deallocate the right after creating an IOSurface reference. |
138 base::mac::ScopedMachSendRight scoped_io_surface_right( | 137 base::mac::ScopedMachSendRight scoped_io_surface_right( |
139 data.reply.msg.io_surface_port.name); | 138 data.reply.msg.io_surface_port.name); |
140 | 139 |
141 return IOSurfaceLookupFromMachPort(scoped_io_surface_right); | 140 return IOSurfaceLookupFromMachPort(scoped_io_surface_right); |
142 } | 141 } |
143 | 142 |
144 ChildIOSurfaceManager::ChildIOSurfaceManager() {} | 143 ChildIOSurfaceManager::ChildIOSurfaceManager() {} |
145 | 144 |
146 ChildIOSurfaceManager::~ChildIOSurfaceManager() {} | 145 ChildIOSurfaceManager::~ChildIOSurfaceManager() {} |
147 | 146 |
148 } // namespace content | 147 } // namespace content |
OLD | NEW |