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

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

Issue 10834033: Move AudioDevice and AudioInputDevice to media. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and fixed a few lint issues Created 8 years, 4 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 | « media/audio/mac/audio_manager_mac.cc ('k') | media/audio/scoped_loop_observer.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 #ifndef CONTENT_RENDERER_MEDIA_SCOPED_LOOP_OBSERVER_H_ 5 #ifndef MEDIA_AUDIO_SCOPED_LOOP_OBSERVER_H_
6 #define CONTENT_RENDERER_MEDIA_SCOPED_LOOP_OBSERVER_H_ 6 #define MEDIA_AUDIO_SCOPED_LOOP_OBSERVER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 11
12 namespace base { 12 namespace base {
13 class WaitableEvent; 13 class WaitableEvent;
14 } 14 }
15 15
16 // A common base class for AudioDevice and AudioInputDevice that manages 16 namespace media {
17
18 // A common base class for AudioOutputDevice and AudioInputDevice that manages
17 // a message loop pointer and monitors it for destruction. If the object goes 19 // a message loop pointer and monitors it for destruction. If the object goes
18 // out of scope before the message loop, the object will automatically remove 20 // out of scope before the message loop, the object will automatically remove
19 // itself from the message loop's list of destruction observers. 21 // itself from the message loop's list of destruction observers.
20 // NOTE: The class that inherits from this class must implement the 22 // NOTE: The class that inherits from this class must implement the
21 // WillDestroyCurrentMessageLoop virtual method from DestructionObserver. 23 // WillDestroyCurrentMessageLoop virtual method from DestructionObserver.
22 class ScopedLoopObserver 24 class ScopedLoopObserver
23 : public MessageLoop::DestructionObserver { 25 : public MessageLoop::DestructionObserver {
24 public: 26 public:
25 explicit ScopedLoopObserver( 27 explicit ScopedLoopObserver(
26 const scoped_refptr<base::MessageLoopProxy>& message_loop); 28 const scoped_refptr<base::MessageLoopProxy>& message_loop);
27 29
28 protected: 30 protected:
29 virtual ~ScopedLoopObserver(); 31 virtual ~ScopedLoopObserver();
30 32
31 // Accessor to the loop that's used by the derived class. 33 // Accessor to the loop that's used by the derived class.
32 const scoped_refptr<base::MessageLoopProxy>& message_loop() { return loop_; } 34 const scoped_refptr<base::MessageLoopProxy>& message_loop() { return loop_; }
33 35
34 private: 36 private:
35 // Call to add or remove ourselves from the list of destruction observers for 37 // Call to add or remove ourselves from the list of destruction observers for
36 // the message loop. 38 // the message loop.
37 void ObserveLoopDestruction(bool enable, base::WaitableEvent* done); 39 void ObserveLoopDestruction(bool enable, base::WaitableEvent* done);
38 40
39 // A pointer to the message loop's proxy. In case the loop gets destroyed 41 // A pointer to the message loop's proxy. In case the loop gets destroyed
40 // before this object goes out of scope, PostTask etc will fail but not crash. 42 // before this object goes out of scope, PostTask etc will fail but not crash.
41 scoped_refptr<base::MessageLoopProxy> loop_; 43 scoped_refptr<base::MessageLoopProxy> loop_;
42 44
43 DISALLOW_COPY_AND_ASSIGN(ScopedLoopObserver); 45 DISALLOW_COPY_AND_ASSIGN(ScopedLoopObserver);
44 }; 46 };
45 47
46 #endif // CONTENT_RENDERER_MEDIA_SCOPED_LOOP_OBSERVER_H_ 48 } // namespace media.
49
50 #endif // MEDIA_AUDIO_SCOPED_LOOP_OBSERVER_H_
OLDNEW
« no previous file with comments | « media/audio/mac/audio_manager_mac.cc ('k') | media/audio/scoped_loop_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698