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

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

Issue 9546013: Move IsRunningOnChromeOS to base/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chromeos_version,sync,cleanup Created 8 years, 9 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 "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
11 #include <algorithm> 11 #include <algorithm>
12 #include <cmath> 12 #include <cmath>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/chromeos/chromeos_version.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/message_loop.h" 18 #include "base/message_loop.h"
18 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
19 #include "base/threading/thread_restrictions.h" 20 #include "base/threading/thread_restrictions.h"
20 #include "chrome/browser/chromeos/system/runtime_environment.h"
21 #include "chrome/browser/extensions/extension_tts_api_chromeos.h" 21 #include "chrome/browser/extensions/extension_tts_api_chromeos.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 23
24 typedef long alsa_long_t; // 'long' is required for ALSA API calls. 24 typedef long alsa_long_t; // 'long' is required for ALSA API calls.
25 25
26 using content::BrowserThread; 26 using content::BrowserThread;
27 using std::string; 27 using std::string;
28 28
29 namespace chromeos { 29 namespace chromeos {
30 30
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 void AudioMixerAlsa::Connect() { 146 void AudioMixerAlsa::Connect() {
147 DCHECK(MessageLoop::current() == thread_->message_loop()); 147 DCHECK(MessageLoop::current() == thread_->message_loop());
148 DCHECK(!alsa_mixer_); 148 DCHECK(!alsa_mixer_);
149 149
150 if (disconnected_event_.IsSignaled()) 150 if (disconnected_event_.IsSignaled())
151 return; 151 return;
152 152
153 // Do not attempt to connect if we're not on the device. 153 // Do not attempt to connect if we're not on the device.
154 if (!system::runtime_environment::IsRunningOnChromeOS()) 154 if (!base::chromeos::IsRunningOnChromeOS())
155 return; 155 return;
156 156
157 if (!ConnectInternal()) { 157 if (!ConnectInternal()) {
158 thread_->message_loop()->PostDelayedTask(FROM_HERE, 158 thread_->message_loop()->PostDelayedTask(FROM_HERE,
159 base::Bind(&AudioMixerAlsa::Connect, base::Unretained(this)), 159 base::Bind(&AudioMixerAlsa::Connect, base::Unretained(this)),
160 kConnectionRetrySleepSec * 1000); 160 kConnectionRetrySleepSec * 1000);
161 } 161 }
162 } 162 }
163 163
164 bool AudioMixerAlsa::ConnectInternal() { 164 bool AudioMixerAlsa::ConnectInternal() {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 (max_volume_db_ - min_volume_db_), 1/kVolumeBias); 430 (max_volume_db_ - min_volume_db_), 1/kVolumeBias);
431 } 431 }
432 432
433 double AudioMixerAlsa::PercentToDb(double percent) const { 433 double AudioMixerAlsa::PercentToDb(double percent) const {
434 lock_.AssertAcquired(); 434 lock_.AssertAcquired();
435 return pow(percent / 100.0, kVolumeBias) * 435 return pow(percent / 100.0, kVolumeBias) *
436 (max_volume_db_ - min_volume_db_) + min_volume_db_; 436 (max_volume_db_ - min_volume_db_) + min_volume_db_;
437 } 437 }
438 438
439 } // namespace chromeos 439 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_extra_parts_ash.cc ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698