OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ipc/mojo/ipc_mojo_bootstrap.h" | 5 #include "ipc/mojo/ipc_mojo_bootstrap.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 Delegate* delegate) { | 147 Delegate* delegate) { |
148 handle_ = std::move(handle); | 148 handle_ = std::move(handle); |
149 delegate_ = delegate; | 149 delegate_ = delegate; |
150 } | 150 } |
151 | 151 |
152 base::ProcessId MojoBootstrap::GetSelfPID() const { | 152 base::ProcessId MojoBootstrap::GetSelfPID() const { |
153 #if defined(OS_LINUX) | 153 #if defined(OS_LINUX) |
154 if (int global_pid = Channel::GetGlobalPid()) | 154 if (int global_pid = Channel::GetGlobalPid()) |
155 return global_pid; | 155 return global_pid; |
156 #endif // OS_LINUX | 156 #endif // OS_LINUX |
| 157 #if defined(OS_NACL) |
| 158 return -1; |
| 159 #else |
157 return base::GetCurrentProcId(); | 160 return base::GetCurrentProcId(); |
| 161 #endif // defined(OS_NACL) |
158 } | 162 } |
159 | 163 |
160 void MojoBootstrap::Fail() { | 164 void MojoBootstrap::Fail() { |
161 set_state(STATE_ERROR); | 165 set_state(STATE_ERROR); |
162 delegate()->OnBootstrapError(); | 166 delegate()->OnBootstrapError(); |
163 } | 167 } |
164 | 168 |
165 bool MojoBootstrap::HasFailed() const { | 169 bool MojoBootstrap::HasFailed() const { |
166 return state() == STATE_ERROR; | 170 return state() == STATE_ERROR; |
167 } | 171 } |
168 | 172 |
169 mojo::ScopedMessagePipeHandle MojoBootstrap::TakeHandle() { | 173 mojo::ScopedMessagePipeHandle MojoBootstrap::TakeHandle() { |
170 return std::move(handle_); | 174 return std::move(handle_); |
171 } | 175 } |
172 | 176 |
173 } // namespace IPC | 177 } // namespace IPC |
OLD | NEW |