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