Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: content/browser/renderer_host/media/audio_sync_reader.cc

Issue 9317001: Revert 119769 - Switch AudioDevice classes from SyncSocket to CancelableSyncSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_sync_reader.h" 5 #include "content/browser/renderer_host/media/audio_sync_reader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 void AudioSyncReader::Close() { 86 void AudioSyncReader::Close() {
87 base::AutoLock auto_lock(lock_); 87 base::AutoLock auto_lock(lock_);
88 if (socket_.get()) { 88 if (socket_.get()) {
89 socket_->Close(); 89 socket_->Close();
90 socket_.reset(NULL); 90 socket_.reset(NULL);
91 } 91 }
92 } 92 }
93 93
94 bool AudioSyncReader::Init() { 94 bool AudioSyncReader::Init() {
95 socket_.reset(new base::CancelableSyncSocket()); 95 socket_.reset(new base::SyncSocket());
96 foreign_socket_.reset(new base::CancelableSyncSocket()); 96 foreign_socket_.reset(new base::SyncSocket());
97 return base::CancelableSyncSocket::CreatePair(socket_.get(), 97 return base::SyncSocket::CreatePair(socket_.get(), foreign_socket_.get());
98 foreign_socket_.get());
99 } 98 }
100 99
101 #if defined(OS_WIN) 100 #if defined(OS_WIN)
102 bool AudioSyncReader::PrepareForeignSocketHandle( 101 bool AudioSyncReader::PrepareForeignSocketHandle(
103 base::ProcessHandle process_handle, 102 base::ProcessHandle process_handle,
104 base::SyncSocket::Handle* foreign_handle) { 103 base::SyncSocket::Handle* foreign_handle) {
105 ::DuplicateHandle(GetCurrentProcess(), foreign_socket_->handle(), 104 ::DuplicateHandle(GetCurrentProcess(), foreign_socket_->handle(),
106 process_handle, foreign_handle, 105 process_handle, foreign_handle,
107 0, FALSE, DUPLICATE_SAME_ACCESS); 106 0, FALSE, DUPLICATE_SAME_ACCESS);
108 if (*foreign_handle != 0) 107 if (*foreign_handle != 0)
109 return true; 108 return true;
110 return false; 109 return false;
111 } 110 }
112 #else 111 #else
113 bool AudioSyncReader::PrepareForeignSocketHandle( 112 bool AudioSyncReader::PrepareForeignSocketHandle(
114 base::ProcessHandle process_handle, 113 base::ProcessHandle process_handle,
115 base::FileDescriptor* foreign_handle) { 114 base::FileDescriptor* foreign_handle) {
116 foreign_handle->fd = foreign_socket_->handle(); 115 foreign_handle->fd = foreign_socket_->handle();
117 foreign_handle->auto_close = false; 116 foreign_handle->auto_close = false;
118 if (foreign_handle->fd != -1) 117 if (foreign_handle->fd != -1)
119 return true; 118 return true;
120 return false; 119 return false;
121 } 120 }
122 #endif 121 #endif
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.h ('k') | content/renderer/media/audio_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698