OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_MESSAGE_LOOP_FACTORY_H_ | 5 #ifndef MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_ |
6 #define MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_ | 6 #define MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/message_loop_proxy.h" | |
11 | 13 |
12 class MessageLoop; | 14 class MessageLoop; |
13 | 15 |
14 namespace media { | 16 namespace media { |
15 | 17 |
16 // Factory object that manages named MessageLoops. | 18 // Factory object that manages named MessageLoops. |
17 class MessageLoopFactory { | 19 class MessageLoopFactory { |
18 public: | 20 public: |
19 // Get the message loop associated with |name|. A new MessageLoop | 21 // Get the message loop associated with |name|. A new MessageLoop |
20 // is created if the factory doesn't have one associated with |name|. | 22 // is created if the factory doesn't have one associated with |name|. |
21 // NULL is returned if |name| is an empty string, or a new | 23 // NULL is returned if |name| is an empty string, or a new |
22 // MessageLoop needs to be created and a failure occurs during the | 24 // MessageLoop needs to be created and a failure occurs during the |
23 // creation process. | 25 // creation process. |
24 virtual MessageLoop* GetMessageLoop(const std::string& name) = 0; | 26 virtual MessageLoop* GetMessageLoop(const std::string& name) = 0; |
25 | 27 |
28 // Get the message loop proxy associated with |name|. A new MessageLoopProxy | |
29 // is created if the factory doesn't have one associated with |name|. | |
30 // NULL is returned if |name| is an empty string, or a new | |
31 // MessageLoop needs to be created and a failure occurs during the | |
32 // creation process. | |
33 virtual scoped_refptr<base::MessageLoopProxy> GetMLProxy( | |
scherkus (not reviewing)
2011/05/06 23:01:45
use the full name
GetMessageLoopProxy
| |
34 const std::string& name) = 0; | |
35 | |
26 protected: | 36 protected: |
27 // Only allow scoped_ptr<> to delete factory. | 37 // Only allow scoped_ptr<> to delete factory. |
28 friend class scoped_ptr<MessageLoopFactory>; | 38 friend class scoped_ptr<MessageLoopFactory>; |
29 virtual ~MessageLoopFactory(); | 39 virtual ~MessageLoopFactory(); |
30 }; | 40 }; |
31 | 41 |
32 } // namespace media | 42 } // namespace media |
33 | 43 |
34 #endif // MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_ | 44 #endif // MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_ |
OLD | NEW |