Chromium Code Reviews| 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/browser/renderer_host/media/audio_input_sync_writer.h" | 5 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 10 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 socket_->Close(); | 100 socket_->Close(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool AudioInputSyncWriter::Init() { | 103 bool AudioInputSyncWriter::Init() { |
| 104 socket_.reset(new base::CancelableSyncSocket()); | 104 socket_.reset(new base::CancelableSyncSocket()); |
| 105 foreign_socket_.reset(new base::CancelableSyncSocket()); | 105 foreign_socket_.reset(new base::CancelableSyncSocket()); |
| 106 return base::CancelableSyncSocket::CreatePair(socket_.get(), | 106 return base::CancelableSyncSocket::CreatePair(socket_.get(), |
| 107 foreign_socket_.get()); | 107 foreign_socket_.get()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 #if defined(OS_WIN) | 110 bool AudioInputSyncWriter::PrepareForeignSocket( |
| 111 | |
| 112 bool AudioInputSyncWriter::PrepareForeignSocketHandle( | |
| 113 base::ProcessHandle process_handle, | 111 base::ProcessHandle process_handle, |
| 114 base::SyncSocket::Handle* foreign_handle) { | 112 base::SyncSocket::TransitDescriptor * descriptor) { |
|
burnik
2014/09/01 14:59:34
Nit done.
| |
| 115 ::DuplicateHandle(GetCurrentProcess(), foreign_socket_->handle(), | 113 return foreign_socket_->PrepareTransitDescriptor(process_handle, descriptor); |
| 116 process_handle, foreign_handle, | |
| 117 0, FALSE, DUPLICATE_SAME_ACCESS); | |
| 118 return (*foreign_handle != 0); | |
| 119 } | 114 } |
| 120 | 115 |
| 121 #else | |
| 122 | |
| 123 bool AudioInputSyncWriter::PrepareForeignSocketHandle( | |
| 124 base::ProcessHandle process_handle, | |
| 125 base::FileDescriptor* foreign_handle) { | |
| 126 foreign_handle->fd = foreign_socket_->handle(); | |
| 127 foreign_handle->auto_close = false; | |
| 128 return (foreign_handle->fd != -1); | |
| 129 } | |
| 130 | |
| 131 #endif | |
| 132 | 116 |
| 133 } // namespace content | 117 } // namespace content |
| OLD | NEW |