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