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

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

Issue 16297002: Update media/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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
« no previous file with comments | « no previous file | media/audio/audio_input_controller.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 "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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const char* thread_name_; 57 const char* thread_name_;
58 58
59 DISALLOW_COPY_AND_ASSIGN(Thread); 59 DISALLOW_COPY_AND_ASSIGN(Thread);
60 }; 60 };
61 61
62 // AudioDeviceThread implementation 62 // AudioDeviceThread implementation
63 63
64 AudioDeviceThread::AudioDeviceThread() { 64 AudioDeviceThread::AudioDeviceThread() {
65 } 65 }
66 66
67 AudioDeviceThread::~AudioDeviceThread() { 67 AudioDeviceThread::~AudioDeviceThread() { DCHECK(!thread_.get()); }
68 DCHECK(!thread_);
69 }
70 68
71 void AudioDeviceThread::Start(AudioDeviceThread::Callback* callback, 69 void AudioDeviceThread::Start(AudioDeviceThread::Callback* callback,
72 base::SyncSocket::Handle socket, 70 base::SyncSocket::Handle socket,
73 const char* thread_name) { 71 const char* thread_name) {
74 base::AutoLock auto_lock(thread_lock_); 72 base::AutoLock auto_lock(thread_lock_);
75 CHECK(thread_ == NULL); 73 CHECK(thread_.get() == NULL);
76 thread_ = new AudioDeviceThread::Thread(callback, socket, thread_name); 74 thread_ = new AudioDeviceThread::Thread(callback, socket, thread_name);
77 thread_->Start(); 75 thread_->Start();
78 } 76 }
79 77
80 void AudioDeviceThread::Stop(base::MessageLoop* loop_for_join) { 78 void AudioDeviceThread::Stop(base::MessageLoop* loop_for_join) {
81 base::AutoLock auto_lock(thread_lock_); 79 base::AutoLock auto_lock(thread_lock_);
82 if (thread_) { 80 if (thread_.get()) {
83 thread_->Stop(loop_for_join); 81 thread_->Stop(loop_for_join);
84 thread_ = NULL; 82 thread_ = NULL;
85 } 83 }
86 } 84 }
87 85
88 bool AudioDeviceThread::IsStopped() { 86 bool AudioDeviceThread::IsStopped() {
89 base::AutoLock auto_lock(thread_lock_); 87 base::AutoLock auto_lock(thread_lock_);
90 return thread_ == NULL; 88 return thread_.get() == NULL;
91 } 89 }
92 90
93 // AudioDeviceThread::Thread implementation 91 // AudioDeviceThread::Thread implementation
94 AudioDeviceThread::Thread::Thread(AudioDeviceThread::Callback* callback, 92 AudioDeviceThread::Thread::Thread(AudioDeviceThread::Callback* callback,
95 base::SyncSocket::Handle socket, 93 base::SyncSocket::Handle socket,
96 const char* thread_name) 94 const char* thread_name)
97 : thread_(), 95 : thread_(),
98 callback_(callback), 96 callback_(callback),
99 socket_(socket), 97 socket_(socket),
100 thread_name_(thread_name) { 98 thread_name_(thread_name) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 194 }
197 195
198 AudioDeviceThread::Callback::~Callback() {} 196 AudioDeviceThread::Callback::~Callback() {}
199 197
200 void AudioDeviceThread::Callback::InitializeOnAudioThread() { 198 void AudioDeviceThread::Callback::InitializeOnAudioThread() {
201 MapSharedMemory(); 199 MapSharedMemory();
202 CHECK(shared_memory_.memory()); 200 CHECK(shared_memory_.memory());
203 } 201 }
204 202
205 } // namespace media. 203 } // namespace media.
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698