| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/mach_broker_mac.h" | 5 #include "content/browser/mach_broker_mac.h" |
| 6 | 6 |
| 7 #include <bsm/libbsm.h> | 7 #include <bsm/libbsm.h> |
| 8 #include <servers/bootstrap.h> | 8 #include <servers/bootstrap.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 msg.header.msgh_local_port = server_port_.get(); | 193 msg.header.msgh_local_port = server_port_.get(); |
| 194 | 194 |
| 195 const mach_msg_option_t options = MACH_RCV_MSG | | 195 const mach_msg_option_t options = MACH_RCV_MSG | |
| 196 MACH_RCV_TRAILER_TYPE(MACH_RCV_TRAILER_AUDIT) | | 196 MACH_RCV_TRAILER_TYPE(MACH_RCV_TRAILER_AUDIT) | |
| 197 MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT); | 197 MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT); |
| 198 | 198 |
| 199 kern_return_t kr = mach_msg(&msg.header, | 199 kern_return_t kr = mach_msg(&msg.header, |
| 200 options, | 200 options, |
| 201 0, | 201 0, |
| 202 sizeof(msg), | 202 sizeof(msg), |
| 203 server_port_, | 203 server_port_.get(), |
| 204 MACH_MSG_TIMEOUT_NONE, | 204 MACH_MSG_TIMEOUT_NONE, |
| 205 MACH_PORT_NULL); | 205 MACH_PORT_NULL); |
| 206 if (kr != KERN_SUCCESS) { | 206 if (kr != KERN_SUCCESS) { |
| 207 MACH_LOG(ERROR, kr) << "mach_msg"; | 207 MACH_LOG(ERROR, kr) << "mach_msg"; |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Use the kernel audit information to make sure this message is from | 211 // Use the kernel audit information to make sure this message is from |
| 212 // a task that this process spawned. The kernel audit token contains the | 212 // a task that this process spawned. The kernel audit token contains the |
| 213 // unspoofable pid of the task that sent the message. | 213 // unspoofable pid of the task that sent the message. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 NotificationService::AllBrowserContextsAndSources()); | 262 NotificationService::AllBrowserContextsAndSources()); |
| 263 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 263 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 264 NotificationService::AllBrowserContextsAndSources()); | 264 NotificationService::AllBrowserContextsAndSources()); |
| 265 | 265 |
| 266 // No corresponding StopObservingBrowserChildProcesses, | 266 // No corresponding StopObservingBrowserChildProcesses, |
| 267 // we leak this singleton. | 267 // we leak this singleton. |
| 268 BrowserChildProcessObserver::Add(this); | 268 BrowserChildProcessObserver::Add(this); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace content | 271 } // namespace content |
| OLD | NEW |