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

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

Issue 2038053002: Change audio render thread checking to use new AudioRendererSink::BelongsToRendererThread() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fixes (dalecurtis@). Created 4 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
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 #ifndef MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_
6 #define MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ 6 #define MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // be made (IOW after Stop() returns, it is safe to delete the callback). 90 // be made (IOW after Stop() returns, it is safe to delete the callback).
91 // The |loop_for_join| parameter is required for asynchronous operation 91 // The |loop_for_join| parameter is required for asynchronous operation
92 // in order to join the worker thread and close the thread handle later via a 92 // in order to join the worker thread and close the thread handle later via a
93 // posted task. 93 // posted task.
94 // If set to NULL, function will wait for the thread to exit before returning. 94 // If set to NULL, function will wait for the thread to exit before returning.
95 void Stop(base::MessageLoop* loop_for_join); 95 void Stop(base::MessageLoop* loop_for_join);
96 96
97 // Returns true if the thread is stopped or stopping. 97 // Returns true if the thread is stopped or stopping.
98 bool IsStopped(); 98 bool IsStopped();
99 99
100 // Returns true if called on the device thread, otherwise false.
101 bool BelongsToRenderingThread();
tommi (sloooow) - chröme 2016/06/13 14:15:21 similarly, CurrentThreadIsDeviceThread()
Henrik Grunell 2016/06/14 11:30:01 Removed.
102
100 private: 103 private:
101 // Our own private SimpleThread override. We implement this in a 104 // Our own private SimpleThread override. We implement this in a
102 // private class so that we get the following benefits: 105 // private class so that we get the following benefits:
103 // 1) AudioDeviceThread doesn't expose SimpleThread methods. 106 // 1) AudioDeviceThread doesn't expose SimpleThread methods.
104 // I.e. the caller can't call Start()/Stop() - which would be bad. 107 // I.e. the caller can't call Start()/Stop() - which would be bad.
105 // 2) We override ThreadMain to add additional on-thread initialization 108 // 2) We override ThreadMain to add additional on-thread initialization
106 // while still synchronized with SimpleThread::Start() to provide 109 // while still synchronized with SimpleThread::Start() to provide
107 // reliable initialization. 110 // reliable initialization.
108 class Thread; 111 class Thread;
109 112
110 base::Lock thread_lock_; 113 base::Lock thread_lock_;
111 scoped_refptr<AudioDeviceThread::Thread> thread_; 114 scoped_refptr<AudioDeviceThread::Thread> thread_;
112 115
113 DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread); 116 DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread);
114 }; 117 };
115 118
116 } // namespace media. 119 } // namespace media.
117 120
118 #endif // MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ 121 #endif // MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698