| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 // Prints a string representation of a Mach error code. | 27 // Prints a string representation of a Mach error code. |
| 28 std::string MachErrorCode(kern_return_t err) { | 28 std::string MachErrorCode(kern_return_t err) { |
| 29 return base::StringPrintf("0x%x %s", err, mach_error_string(err)); | 29 return base::StringPrintf("0x%x %s", err, mach_error_string(err)); |
| 30 } | 30 } |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 class MachListenerThreadDelegate : public base::PlatformThread::Delegate { | 33 class MachListenerThreadDelegate : public base::PlatformThread::Delegate { |
| 34 public: | 34 public: |
| 35 MachListenerThreadDelegate(MachBroker* broker) : broker_(broker) { | 35 explicit MachListenerThreadDelegate(MachBroker* broker) : broker_(broker) { |
| 36 DCHECK(broker_); | 36 DCHECK(broker_); |
| 37 std::string port_name = MachBroker::GetMachPortName(); | 37 std::string port_name = MachBroker::GetMachPortName(); |
| 38 | 38 |
| 39 // Create the receive port in the constructor, not in ThreadMain(). It is | 39 // Create the receive port in the constructor, not in ThreadMain(). It is |
| 40 // important to create and register the receive port before starting the | 40 // important to create and register the receive port before starting the |
| 41 // thread so that child processes will always have someone who's listening. | 41 // thread so that child processes will always have someone who's listening. |
| 42 receive_port_.reset(new base::ReceivePort(port_name.c_str())); | 42 receive_port_.reset(new base::ReceivePort(port_name.c_str())); |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Implement |PlatformThread::Delegate|. | 45 // Implement |PlatformThread::Delegate|. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 NotificationService::AllBrowserContextsAndSources()); | 218 NotificationService::AllBrowserContextsAndSources()); |
| 219 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 219 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 220 NotificationService::AllBrowserContextsAndSources()); | 220 NotificationService::AllBrowserContextsAndSources()); |
| 221 registrar_.Add(this, NOTIFICATION_CHILD_PROCESS_CRASHED, | 221 registrar_.Add(this, NOTIFICATION_CHILD_PROCESS_CRASHED, |
| 222 NotificationService::AllBrowserContextsAndSources()); | 222 NotificationService::AllBrowserContextsAndSources()); |
| 223 registrar_.Add(this, NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, | 223 registrar_.Add(this, NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, |
| 224 NotificationService::AllBrowserContextsAndSources()); | 224 NotificationService::AllBrowserContextsAndSources()); |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace content | 227 } // namespace content |
| OLD | NEW |