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

Side by Side Diff: chrome/browser/chromeos/audio/audio_mixer_alsa.cc

Issue 10026013: Update use of TimeDelta in chrome/browser/*, ui/views/*, and other places. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase onto master. Created 8 years, 7 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
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | chrome/browser/chromeos/boot_times_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/chromeos/audio/audio_mixer_alsa.h" 5 #include "chrome/browser/chromeos/audio/audio_mixer_alsa.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 8
9 #include <alsa/asoundlib.h> 9 #include <alsa/asoundlib.h>
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (disconnected_event_.IsSignaled()) 154 if (disconnected_event_.IsSignaled())
155 return; 155 return;
156 156
157 // Do not attempt to connect if we're not on the device. 157 // Do not attempt to connect if we're not on the device.
158 if (!base::chromeos::IsRunningOnChromeOS()) 158 if (!base::chromeos::IsRunningOnChromeOS())
159 return; 159 return;
160 160
161 if (!ConnectInternal()) { 161 if (!ConnectInternal()) {
162 thread_->message_loop()->PostDelayedTask(FROM_HERE, 162 thread_->message_loop()->PostDelayedTask(FROM_HERE,
163 base::Bind(&AudioMixerAlsa::Connect, base::Unretained(this)), 163 base::Bind(&AudioMixerAlsa::Connect, base::Unretained(this)),
164 kConnectionRetrySleepSec * 1000); 164 base::TimeDelta::FromSeconds(kConnectionRetrySleepSec));
165 } 165 }
166 } 166 }
167 167
168 bool AudioMixerAlsa::ConnectInternal() { 168 bool AudioMixerAlsa::ConnectInternal() {
169 DCHECK(MessageLoop::current() == thread_->message_loop()); 169 DCHECK(MessageLoop::current() == thread_->message_loop());
170 num_connection_attempts_++; 170 num_connection_attempts_++;
171 int err; 171 int err;
172 snd_mixer_t* handle = NULL; 172 snd_mixer_t* handle = NULL;
173 173
174 if ((err = snd_mixer_open(&handle, 0)) < 0) { 174 if ((err = snd_mixer_open(&handle, 0)) < 0) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 (max_volume_db_ - min_volume_db_), 1/kVolumeBias); 434 (max_volume_db_ - min_volume_db_), 1/kVolumeBias);
435 } 435 }
436 436
437 double AudioMixerAlsa::PercentToDb(double percent) const { 437 double AudioMixerAlsa::PercentToDb(double percent) const {
438 lock_.AssertAcquired(); 438 lock_.AssertAcquired();
439 return pow(percent / 100.0, kVolumeBias) * 439 return pow(percent / 100.0, kVolumeBias) *
440 (max_volume_db_ - min_volume_db_) + min_volume_db_; 440 (max_volume_db_ - min_volume_db_) + min_volume_db_;
441 } 441 }
442 442
443 } // namespace chromeos 443 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | chrome/browser/chromeos/boot_times_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698