| 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/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // Windows and Mac need to explicitly duplicate the handle out to another | 327 // Windows and Mac need to explicitly duplicate the handle out to another |
| 328 // process. | 328 // process. |
| 329 base::SharedMemoryHandle target_handle; | 329 base::SharedMemoryHandle target_handle; |
| 330 base::ProcessId peer_pid; | 330 base::ProcessId peer_pid; |
| 331 { | 331 { |
| 332 AutoLock lock(context_lock_); | 332 AutoLock lock(context_lock_); |
| 333 if (!channel_) | 333 if (!channel_) |
| 334 return base::SharedMemory::NULLHandle(); | 334 return base::SharedMemory::NULLHandle(); |
| 335 peer_pid = channel_->GetPeerPID(); | 335 peer_pid = channel_->GetPeerPID(); |
| 336 } | 336 } |
| 337 #if defined(OS_WIN) | |
| 338 bool success = | |
| 339 BrokerDuplicateHandle(source_handle, peer_pid, &target_handle, | |
| 340 FILE_GENERIC_READ | FILE_GENERIC_WRITE, 0); | |
| 341 #elif defined(OS_MACOSX) | |
| 342 bool success = BrokerDuplicateSharedMemoryHandle(source_handle, peer_pid, | 337 bool success = BrokerDuplicateSharedMemoryHandle(source_handle, peer_pid, |
| 343 &target_handle); | 338 &target_handle); |
| 344 #endif | |
| 345 if (!success) | 339 if (!success) |
| 346 return base::SharedMemory::NULLHandle(); | 340 return base::SharedMemory::NULLHandle(); |
| 347 | 341 |
| 348 return target_handle; | 342 return target_handle; |
| 349 #else | 343 #else |
| 350 return base::SharedMemory::DuplicateHandle(source_handle); | 344 return base::SharedMemory::DuplicateHandle(source_handle); |
| 351 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 345 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 352 } | 346 } |
| 353 | 347 |
| 354 int32 GpuChannelHost::ReserveTransferBufferId() { | 348 int32 GpuChannelHost::ReserveTransferBufferId() { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 455 |
| 462 listeners_.clear(); | 456 listeners_.clear(); |
| 463 } | 457 } |
| 464 | 458 |
| 465 bool GpuChannelHost::MessageFilter::IsLost() const { | 459 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 466 AutoLock lock(lock_); | 460 AutoLock lock(lock_); |
| 467 return lost_; | 461 return lost_; |
| 468 } | 462 } |
| 469 | 463 |
| 470 } // namespace content | 464 } // namespace content |
| OLD | NEW |