| 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 "content/common/gpu/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 base::SharedMemoryHandle GpuChannelHost::ShareToGpuProcess( | 260 base::SharedMemoryHandle GpuChannelHost::ShareToGpuProcess( |
| 261 base::SharedMemoryHandle source_handle) { | 261 base::SharedMemoryHandle source_handle) { |
| 262 if (IsLost()) | 262 if (IsLost()) |
| 263 return base::SharedMemory::NULLHandle(); | 263 return base::SharedMemory::NULLHandle(); |
| 264 | 264 |
| 265 #if defined(OS_WIN) | 265 #if defined(OS_WIN) |
| 266 // Windows needs to explicitly duplicate the handle out to another process. | 266 // Windows needs to explicitly duplicate the handle out to another process. |
| 267 base::SharedMemoryHandle target_handle; | 267 base::SharedMemoryHandle target_handle; |
| 268 if (!BrokerDuplicateHandle(source_handle, | 268 if (!BrokerDuplicateHandle(source_handle, |
| 269 channel_->peer_pid(), | 269 channel_->GetPeerPID(), |
| 270 &target_handle, | 270 &target_handle, |
| 271 FILE_GENERIC_READ | FILE_GENERIC_WRITE, | 271 FILE_GENERIC_READ | FILE_GENERIC_WRITE, |
| 272 0)) { | 272 0)) { |
| 273 return base::SharedMemory::NULLHandle(); | 273 return base::SharedMemory::NULLHandle(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 return target_handle; | 276 return target_handle; |
| 277 #else | 277 #else |
| 278 int duped_handle = HANDLE_EINTR(dup(source_handle.fd)); | 278 int duped_handle = HANDLE_EINTR(dup(source_handle.fd)); |
| 279 if (duped_handle < 0) | 279 if (duped_handle < 0) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 390 |
| 391 listeners_.clear(); | 391 listeners_.clear(); |
| 392 } | 392 } |
| 393 | 393 |
| 394 bool GpuChannelHost::MessageFilter::IsLost() const { | 394 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 395 AutoLock lock(lock_); | 395 AutoLock lock(lock_); |
| 396 return lost_; | 396 return lost_; |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace content | 399 } // namespace content |
| OLD | NEW |