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

Unified Diff: media/base/message_loop_factory.h

Issue 10855051: Use enum instead of string in MessageLoopFactory::GetMessageLoop* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update player_wtl 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 side-by-side diff with in-line comments
Download patch
Index: media/base/message_loop_factory.h
diff --git a/media/base/message_loop_factory.h b/media/base/message_loop_factory.h
index f5ecda2c75af1fe991adfaf56094b53a32525a3a..da15cc30bdb08d085afebfc35bc02866a4eb687a 100644
--- a/media/base/message_loop_factory.h
+++ b/media/base/message_loop_factory.h
@@ -27,35 +27,37 @@ namespace media {
// TODO(scherkus): replace this with something simpler http://crbug.com/116873
class MEDIA_EXPORT MessageLoopFactory {
public:
+ enum MessageLoopType {
scherkus (not reviewing) 2012/08/09 17:13:24 s/MessageLoop/Type/
xhwang 2012/08/10 01:04:28 Done.
+ AUDIO_DECODER,
scherkus (not reviewing) 2012/08/09 17:13:24 we've been using kCamelCase format for constants
xhwang 2012/08/10 01:04:28 Done.
+ VIDEO_DECODER,
+ PIPELINE
+ };
+
MessageLoopFactory();
- // Get the message loop associated with |name|. A new MessageLoop
- // is created if the factory doesn't have one associated with |name|.
- //
- // |name| must not be an empty string.
- MessageLoop* GetMessageLoop(const std::string& name);
+ // Get the message loop associated with |type|. A new MessageLoop
+ // is created if the factory doesn't have one associated with |type|.
+ MessageLoop* GetMessageLoop(MessageLoopType type);
scherkus (not reviewing) 2012/08/09 17:13:24 can we remove this method entirely and rename the
xhwang 2012/08/10 01:04:28 Done.
- // Get the message loop proxy associated with |name|. A new MessageLoopProxy
- // is created if the factory doesn't have one associated with |name|.
- //
- // |name| must not be an empty string.
+ // Get the message loop proxy associated with |type|. A new MessageLoopProxy
+ // is created if the factory doesn't have one associated with |type|.
scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxy(
- const std::string& name);
+ MessageLoopType type);
private:
// Only allow scoped_ptr<> to delete factory.
friend class scoped_ptr<MessageLoopFactory>;
~MessageLoopFactory();
- // Returns the thread associated with |name| creating a new thread if needed.
- base::Thread* GetThread(const std::string& name);
+ // Returns the thread associated with |type| creating a new thread if needed.
+ base::Thread* GetThread(MessageLoopType type);
// Lock used to serialize access for the following data members.
base::Lock lock_;
- // List of pairs of created threads and their names. We use a list to ensure
+ // List of pairs of created threads and their types. We use a list to ensure
// threads are stopped & deleted in reverse order of creation.
- typedef std::list<std::pair<std::string, base::Thread*> > ThreadList;
+ typedef std::list<std::pair<MessageLoopType, base::Thread*> > ThreadList;
ThreadList threads_;
DISALLOW_COPY_AND_ASSIGN(MessageLoopFactory);

Powered by Google App Engine
This is Rietveld 408576698