OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/mach_broker_mac.h" | 5 #include "chrome/browser/mach_broker_mac.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mach_ipc_mac.h" | 9 #include "base/mach_ipc_mac.h" |
10 #include "base/platform_thread.h" | 10 #include "base/platform_thread.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 scoped_ptr<base::ReceivePort> receive_port_; | 114 scoped_ptr<base::ReceivePort> receive_port_; |
115 | 115 |
116 // The MachBroker to use when new child task rights are received. Can be | 116 // The MachBroker to use when new child task rights are received. Can be |
117 // NULL. | 117 // NULL. |
118 MachBroker* broker_; // weak | 118 MachBroker* broker_; // weak |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(MachListenerThreadDelegate); | 120 DISALLOW_COPY_AND_ASSIGN(MachListenerThreadDelegate); |
121 }; | 121 }; |
122 | 122 |
123 // Returns the global MachBroker. | 123 // Returns the global MachBroker. |
124 MachBroker* MachBroker::instance() { | 124 MachBroker* MachBroker::GetInstance() { |
125 return Singleton<MachBroker, LeakySingletonTraits<MachBroker> >::get(); | 125 return Singleton<MachBroker, LeakySingletonTraits<MachBroker> >::get(); |
126 } | 126 } |
127 | 127 |
128 MachBroker::MachBroker() : listener_thread_started_(false) { | 128 MachBroker::MachBroker() : listener_thread_started_(false) { |
129 } | 129 } |
130 | 130 |
131 void MachBroker::PrepareForFork() { | 131 void MachBroker::PrepareForFork() { |
132 if (!listener_thread_started_) { | 132 if (!listener_thread_started_) { |
133 listener_thread_started_ = true; | 133 listener_thread_started_ = true; |
134 | 134 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 #endif | 232 #endif |
233 ".rohitfork.%d"; | 233 ".rohitfork.%d"; |
234 | 234 |
235 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 235 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
236 const bool is_child = command_line.HasSwitch(switches::kProcessType); | 236 const bool is_child = command_line.HasSwitch(switches::kProcessType); |
237 | 237 |
238 // In non-browser (child) processes, use the parent's pid. | 238 // In non-browser (child) processes, use the parent's pid. |
239 const pid_t pid = is_child ? getppid() : getpid(); | 239 const pid_t pid = is_child ? getppid() : getpid(); |
240 return StringPrintf(kFormatString, pid); | 240 return StringPrintf(kFormatString, pid); |
241 } | 241 } |
OLD | NEW |