| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/audio_sync_reader.h" | 5 #include "chrome/browser/renderer_host/audio_sync_reader.h" |
| 6 | 6 |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
| 9 | 9 |
| 10 AudioSyncReader::AudioSyncReader(base::SharedMemory* shared_memory) | 10 AudioSyncReader::AudioSyncReader(base::SharedMemory* shared_memory) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 44 bool AudioSyncReader::PrepareForeignSocketHandle( | 44 bool AudioSyncReader::PrepareForeignSocketHandle( |
| 45 base::ProcessHandle process_handle, | 45 base::ProcessHandle process_handle, |
| 46 base::SyncSocket::Handle* foreign_handle) { | 46 base::SyncSocket::Handle* foreign_handle) { |
| 47 ::DuplicateHandle(GetCurrentProcess(), foreign_socket_->handle(), | 47 ::DuplicateHandle(GetCurrentProcess(), foreign_socket_->handle(), |
| 48 process_handle, foreign_handle, | 48 process_handle, foreign_handle, |
| 49 0, FALSE, DUPLICATE_SAME_ACCESS); | 49 0, FALSE, DUPLICATE_SAME_ACCESS); |
| 50 if (*foreign_handle != 0) { | 50 if (*foreign_handle != 0) |
| 51 // Note that this is just a way to get away with the unused variable | 51 return true; |
| 52 // warning. We want to return true here. | |
| 53 return foreign_socket_.release() != NULL; | |
| 54 } | |
| 55 return false; | 52 return false; |
| 56 } | 53 } |
| 57 #else | 54 #else |
| 58 bool AudioSyncReader::PrepareForeignSocketHandle( | 55 bool AudioSyncReader::PrepareForeignSocketHandle( |
| 59 base::ProcessHandle process_handle, | 56 base::ProcessHandle process_handle, |
| 60 base::FileDescriptor* foreign_handle) { | 57 base::FileDescriptor* foreign_handle) { |
| 61 foreign_handle->fd = foreign_socket_->handle(); | 58 foreign_handle->fd = foreign_socket_->handle(); |
| 62 foreign_handle->auto_close = false; | 59 foreign_handle->auto_close = false; |
| 63 if (foreign_handle->fd != -1) { | 60 if (foreign_handle->fd != -1) |
| 64 // Note that this is just a way to get away with the unused variable | 61 return true; |
| 65 // warning. We want to return true here. | |
| 66 return foreign_socket_.release() != NULL; | |
| 67 } | |
| 68 return false; | 62 return false; |
| 69 } | 63 } |
| 70 #endif | 64 #endif |
| OLD | NEW |