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

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

Issue 2289543003: IPC->mojo of audio_renderer_host (Closed)
Patch Set: Some changes. Comments. Created 4 years, 3 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
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 output_bus_->CopyTo(dest); 148 output_bus_->CopyTo(dest);
149 } 149 }
150 150
151 void AudioSyncReader::Close() { 151 void AudioSyncReader::Close() {
152 socket_->Close(); 152 socket_->Close();
153 } 153 }
154 154
155 bool AudioSyncReader::Init() { 155 bool AudioSyncReader::Init() {
156 socket_.reset(new base::CancelableSyncSocket()); 156 socket_.reset(new base::CancelableSyncSocket());
157 foreign_socket_.reset(new base::CancelableSyncSocket()); 157 foreign_socket_.reset(new base::CancelableSyncSocket());
158 return base::CancelableSyncSocket::CreatePair(socket_.get(), 158 bool b = base::CancelableSyncSocket::CreatePair(socket_.get(),
159 foreign_socket_.get()); 159 foreign_socket_.get());
160 return b;
160 } 161 }
161 162
162 bool AudioSyncReader::PrepareForeignSocket( 163 base::SyncSocket::Handle AudioSyncReader::GetSyncSocket() {
163 base::ProcessHandle process_handle, 164 base::SyncSocket::Handle handle = foreign_socket_.get()->handle();
164 base::SyncSocket::TransitDescriptor* descriptor) { 165 foreign_socket_.reset();
165 return foreign_socket_->PrepareTransitDescriptor(process_handle, descriptor); 166 return handle;
166 } 167 }
167 168
168 bool AudioSyncReader::WaitUntilDataIsReady() { 169 bool AudioSyncReader::WaitUntilDataIsReady() {
169 TRACE_EVENT0("audio", "AudioSyncReader::WaitUntilDataIsReady"); 170 TRACE_EVENT0("audio", "AudioSyncReader::WaitUntilDataIsReady");
170 base::TimeDelta timeout = maximum_wait_time_; 171 base::TimeDelta timeout = maximum_wait_time_;
171 const base::TimeTicks start_time = base::TimeTicks::Now(); 172 const base::TimeTicks start_time = base::TimeTicks::Now();
172 const base::TimeTicks finish_time = start_time + timeout; 173 const base::TimeTicks finish_time = start_time + timeout;
173 174
174 // Check if data is ready and if not, wait a reasonable amount of time for it. 175 // Check if data is ready and if not, wait a reasonable amount of time for it.
175 // 176 //
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 base::TimeDelta::FromMilliseconds(1), 214 base::TimeDelta::FromMilliseconds(1),
214 base::TimeDelta::FromMilliseconds(1000), 215 base::TimeDelta::FromMilliseconds(1000),
215 50); 216 50);
216 return false; 217 return false;
217 } 218 }
218 219
219 return true; 220 return true;
220 } 221 }
221 222
222 } // namespace content 223 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698