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

Side by Side Diff: media/audio/audio_device_thread.cc

Issue 12741012: base: Support setting thread priorities generically. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add id to handle. Created 7 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
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 "media/audio/audio_device_thread.h" 5 #include "media/audio/audio_device_thread.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 AudioDeviceThread::Thread::Thread(AudioDeviceThread::Callback* callback, 94 AudioDeviceThread::Thread::Thread(AudioDeviceThread::Callback* callback,
95 base::SyncSocket::Handle socket, 95 base::SyncSocket::Handle socket,
96 const char* thread_name) 96 const char* thread_name)
97 : thread_(base::kNullThreadHandle), 97 : thread_(base::kNullThreadHandle),
98 callback_(callback), 98 callback_(callback),
99 socket_(socket), 99 socket_(socket),
100 thread_name_(thread_name) { 100 thread_name_(thread_name) {
101 } 101 }
102 102
103 AudioDeviceThread::Thread::~Thread() { 103 AudioDeviceThread::Thread::~Thread() {
104 DCHECK_EQ(thread_, base::kNullThreadHandle) << "Stop wasn't called"; 104 DCHECK(thread_ == base::kNullThreadHandle);
105 } 105 }
106 106
107 void AudioDeviceThread::Thread::Start() { 107 void AudioDeviceThread::Thread::Start() {
108 base::AutoLock auto_lock(callback_lock_); 108 base::AutoLock auto_lock(callback_lock_);
109 DCHECK_EQ(thread_, base::kNullThreadHandle); 109 DCHECK(thread_ == base::kNullThreadHandle);
110 // This reference will be released when the thread exists. 110 // This reference will be released when the thread exists.
111 AddRef(); 111 AddRef();
112 112
113 PlatformThread::CreateWithPriority(0, this, &thread_, 113 PlatformThread::CreateWithPriority(0, this, &thread_,
114 base::kThreadPriority_RealtimeAudio); 114 base::kThreadPriority_RealtimeAudio);
115 CHECK(thread_ != base::kNullThreadHandle); 115 CHECK(thread_ != base::kNullThreadHandle);
116 } 116 }
117 117
118 void AudioDeviceThread::Thread::Stop(base::MessageLoop* loop_for_join) { 118 void AudioDeviceThread::Thread::Stop(base::MessageLoop* loop_for_join) {
119 socket_.Shutdown(); 119 socket_.Shutdown();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 AudioDeviceThread::Callback::~Callback() {} 198 AudioDeviceThread::Callback::~Callback() {}
199 199
200 void AudioDeviceThread::Callback::InitializeOnAudioThread() { 200 void AudioDeviceThread::Callback::InitializeOnAudioThread() {
201 MapSharedMemory(); 201 MapSharedMemory();
202 CHECK(shared_memory_.memory()); 202 CHECK(shared_memory_.memory());
203 } 203 }
204 204
205 } // namespace media. 205 } // namespace media.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698