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

Side by Side Diff: content/browser/audio_device_thread.cc

Issue 2558303004: Cleanup AudioDeviceThread to avoid accidental misuse. (Closed)
Patch Set: Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/audio_device_thread.h"
6
5 #include "base/threading/thread_task_runner_handle.h" 7 #include "base/threading/thread_task_runner_handle.h"
6 #include "build/build_config.h" 8 #include "build/build_config.h"
7 #include "content/browser/audio_device_thread.h"
8 9
9 namespace content { 10 namespace content {
10 11
11 scoped_refptr<base::SingleThreadTaskRunner> AudioDeviceThread::GetTaskRunner() {
12 #if defined(OS_MACOSX)
13 // On Mac audio task runner must belong to the main thread.
14 // See http://crbug.com/158170.
15 return base::ThreadTaskRunnerHandle::Get();
16 #else
17 return thread_.task_runner();
18 #endif // defined(OS_MACOSX)
19 }
20
21 AudioDeviceThread::AudioDeviceThread() : thread_("AudioThread") { 12 AudioDeviceThread::AudioDeviceThread() : thread_("AudioThread") {
22 #if defined(OS_WIN) 13 #if defined(OS_WIN)
23 thread_.init_com_with_mta(true); 14 thread_.init_com_with_mta(true);
24 #endif 15 #endif
25 CHECK(thread_.Start()); 16 CHECK(thread_.Start());
17
18 #if defined(OS_MACOSX)
19 // On Mac audio task runner must belong to the main thread.
Avi (use Gerrit) 2016/12/13 01:36:11 Grammar? "On the Mac, the audio ..."
20 // See http://crbug.com/158170.
21 task_runner_ = base::ThreadTaskRunnerHandle::Get();
22 #else
23 task_runner_ = thread_.task_runner();
24 #endif
26 } 25 }
27 26
27 AudioDeviceThread::~AudioDeviceThread() {}
28
28 } // namespace content 29 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698