OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/nacl/browser/nacl_process_host.h" | 5 #include "components/nacl/browser/nacl_process_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = | 205 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = |
206 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; | 206 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; |
207 | 207 |
208 // Unfortunately, we cannot use ScopedGeneric directly for IPC::ChannelHandle, | 208 // Unfortunately, we cannot use ScopedGeneric directly for IPC::ChannelHandle, |
209 // because there is neither operator== nor operator != definition for it. | 209 // because there is neither operator== nor operator != definition for it. |
210 // Instead, define a simple wrapper for IPC::ChannelHandle with an assumption | 210 // Instead, define a simple wrapper for IPC::ChannelHandle with an assumption |
211 // that this only takes a transferred IPC::ChannelHandle or one to be | 211 // that this only takes a transferred IPC::ChannelHandle or one to be |
212 // transferred via IPC. | 212 // transferred via IPC. |
213 class NaClProcessHost::ScopedChannelHandle { | 213 class NaClProcessHost::ScopedChannelHandle { |
214 MOVE_ONLY_TYPE_FOR_CPP_03(ScopedChannelHandle, RValue); | 214 MOVE_ONLY_TYPE_FOR_CPP_03(ScopedChannelHandle); |
| 215 |
215 public: | 216 public: |
216 ScopedChannelHandle() { | 217 ScopedChannelHandle() { |
217 } | 218 } |
218 explicit ScopedChannelHandle(const IPC::ChannelHandle& handle) | 219 explicit ScopedChannelHandle(const IPC::ChannelHandle& handle) |
219 : handle_(handle) { | 220 : handle_(handle) { |
220 DCHECK(IsSupportedHandle(handle_)); | 221 DCHECK(IsSupportedHandle(handle_)); |
221 } | 222 } |
222 ScopedChannelHandle(RValue other) : handle_(other.object->handle_) { | 223 ScopedChannelHandle(ScopedChannelHandle&& other) : handle_(other.handle_) { |
223 other.object->handle_ = IPC::ChannelHandle(); | 224 other.handle_ = IPC::ChannelHandle(); |
224 DCHECK(IsSupportedHandle(handle_)); | 225 DCHECK(IsSupportedHandle(handle_)); |
225 } | 226 } |
226 ~ScopedChannelHandle() { | 227 ~ScopedChannelHandle() { |
227 CloseIfNecessary(); | 228 CloseIfNecessary(); |
228 } | 229 } |
229 | 230 |
230 const IPC::ChannelHandle& get() const { return handle_; } | 231 const IPC::ChannelHandle& get() const { return handle_; } |
231 IPC::ChannelHandle release() WARN_UNUSED_RESULT { | 232 IPC::ChannelHandle release() WARN_UNUSED_RESULT { |
232 IPC::ChannelHandle result = handle_; | 233 IPC::ChannelHandle result = handle_; |
233 handle_ = IPC::ChannelHandle(); | 234 handle_ = IPC::ChannelHandle(); |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 NaClStartDebugExceptionHandlerThread( | 1395 NaClStartDebugExceptionHandlerThread( |
1395 process.Pass(), info, base::ThreadTaskRunnerHandle::Get(), | 1396 process.Pass(), info, base::ThreadTaskRunnerHandle::Get(), |
1396 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1397 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
1397 weak_factory_.GetWeakPtr())); | 1398 weak_factory_.GetWeakPtr())); |
1398 return true; | 1399 return true; |
1399 } | 1400 } |
1400 } | 1401 } |
1401 #endif | 1402 #endif |
1402 | 1403 |
1403 } // namespace nacl | 1404 } // namespace nacl |
OLD | NEW |