| 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 <string.h> | 7 #include <string.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = | 210 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = |
| 211 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; | 211 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; |
| 212 | 212 |
| 213 // Unfortunately, we cannot use ScopedGeneric directly for IPC::ChannelHandle, | 213 // Unfortunately, we cannot use ScopedGeneric directly for IPC::ChannelHandle, |
| 214 // because there is neither operator== nor operator != definition for it. | 214 // because there is neither operator== nor operator != definition for it. |
| 215 // Instead, define a simple wrapper for IPC::ChannelHandle with an assumption | 215 // Instead, define a simple wrapper for IPC::ChannelHandle with an assumption |
| 216 // that this only takes a transferred IPC::ChannelHandle or one to be | 216 // that this only takes a transferred IPC::ChannelHandle or one to be |
| 217 // transferred via IPC. | 217 // transferred via IPC. |
| 218 class NaClProcessHost::ScopedChannelHandle { | 218 class NaClProcessHost::ScopedChannelHandle { |
| 219 MOVE_ONLY_TYPE_FOR_CPP_03(ScopedChannelHandle); |
| 220 |
| 219 public: | 221 public: |
| 220 ScopedChannelHandle() { | 222 ScopedChannelHandle() { |
| 221 } | 223 } |
| 222 explicit ScopedChannelHandle(const IPC::ChannelHandle& handle) | 224 explicit ScopedChannelHandle(const IPC::ChannelHandle& handle) |
| 223 : handle_(handle) { | 225 : handle_(handle) { |
| 224 DCHECK(IsSupportedHandle(handle_)); | 226 DCHECK(IsSupportedHandle(handle_)); |
| 225 } | 227 } |
| 226 ScopedChannelHandle(ScopedChannelHandle&& other) : handle_(other.handle_) { | 228 ScopedChannelHandle(ScopedChannelHandle&& other) : handle_(other.handle_) { |
| 227 other.handle_ = IPC::ChannelHandle(); | 229 other.handle_ = IPC::ChannelHandle(); |
| 228 DCHECK(IsSupportedHandle(handle_)); | 230 DCHECK(IsSupportedHandle(handle_)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 void CloseIfNecessary() { | 268 void CloseIfNecessary() { |
| 267 #if defined(OS_POSIX) | 269 #if defined(OS_POSIX) |
| 268 if (handle_.socket.auto_close) { | 270 if (handle_.socket.auto_close) { |
| 269 // Defer closing task to the ScopedFD. | 271 // Defer closing task to the ScopedFD. |
| 270 base::ScopedFD(handle_.socket.fd); | 272 base::ScopedFD(handle_.socket.fd); |
| 271 } | 273 } |
| 272 #endif | 274 #endif |
| 273 } | 275 } |
| 274 | 276 |
| 275 IPC::ChannelHandle handle_; | 277 IPC::ChannelHandle handle_; |
| 276 | |
| 277 DISALLOW_COPY_AND_ASSIGN(ScopedChannelHandle); | |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 NaClProcessHost::NaClProcessHost( | 280 NaClProcessHost::NaClProcessHost( |
| 281 const GURL& manifest_url, | 281 const GURL& manifest_url, |
| 282 base::File nexe_file, | 282 base::File nexe_file, |
| 283 const NaClFileToken& nexe_token, | 283 const NaClFileToken& nexe_token, |
| 284 const std::vector<NaClResourcePrefetchResult>& prefetched_resource_files, | 284 const std::vector<NaClResourcePrefetchResult>& prefetched_resource_files, |
| 285 ppapi::PpapiPermissions permissions, | 285 ppapi::PpapiPermissions permissions, |
| 286 int render_view_id, | 286 int render_view_id, |
| 287 uint32_t permission_bits, | 287 uint32_t permission_bits, |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 NaClStartDebugExceptionHandlerThread( | 1292 NaClStartDebugExceptionHandlerThread( |
| 1293 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), | 1293 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), |
| 1294 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1294 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 1295 weak_factory_.GetWeakPtr())); | 1295 weak_factory_.GetWeakPtr())); |
| 1296 return true; | 1296 return true; |
| 1297 } | 1297 } |
| 1298 } | 1298 } |
| 1299 #endif | 1299 #endif |
| 1300 | 1300 |
| 1301 } // namespace nacl | 1301 } // namespace nacl |
| OLD | NEW |