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

Unified 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: Remove static initializers. 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_device_thread.cc
diff --git a/media/audio/audio_device_thread.cc b/media/audio/audio_device_thread.cc
index 7583c9ed91218d73a21c920ee2463e7fbe421858..f68c0456bfa036318e5bc3298b7a0a487be305f1 100644
--- a/media/audio/audio_device_thread.cc
+++ b/media/audio/audio_device_thread.cc
@@ -94,31 +94,31 @@ bool AudioDeviceThread::IsStopped() {
AudioDeviceThread::Thread::Thread(AudioDeviceThread::Callback* callback,
base::SyncSocket::Handle socket,
const char* thread_name)
- : thread_(base::kNullThreadHandle),
+ : thread_(),
callback_(callback),
socket_(socket),
thread_name_(thread_name) {
}
AudioDeviceThread::Thread::~Thread() {
- DCHECK_EQ(thread_, base::kNullThreadHandle) << "Stop wasn't called";
+ DCHECK(thread_.is_null());
}
void AudioDeviceThread::Thread::Start() {
base::AutoLock auto_lock(callback_lock_);
- DCHECK_EQ(thread_, base::kNullThreadHandle);
+ DCHECK(thread_.is_null());
// This reference will be released when the thread exists.
AddRef();
PlatformThread::CreateWithPriority(0, this, &thread_,
base::kThreadPriority_RealtimeAudio);
- CHECK(thread_ != base::kNullThreadHandle);
+ CHECK(!thread_.is_null());
}
void AudioDeviceThread::Thread::Stop(base::MessageLoop* loop_for_join) {
socket_.Shutdown();
- base::PlatformThreadHandle thread = base::kNullThreadHandle;
+ base::PlatformThreadHandle thread = base::PlatformThreadHandle();
{ // NOLINT
base::AutoLock auto_lock(callback_lock_);
@@ -126,7 +126,7 @@ void AudioDeviceThread::Thread::Stop(base::MessageLoop* loop_for_join) {
std::swap(thread, thread_);
}
- if (thread != base::kNullThreadHandle) {
+ if (!thread.is_null()) {
if (loop_for_join) {
loop_for_join->PostTask(FROM_HERE,
base::Bind(&base::PlatformThread::Join, thread));
« no previous file with comments | « content/renderer/media/webrtc_local_audio_track_unittest.cc ('k') | media/audio/cross_process_notification_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698