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

Side by Side Diff: media/base/message_loop_factory.h

Issue 9632024: Create video and audio decoder threads on demand. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
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 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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 15 matching lines...) Expand all
26 // 26 //
27 // TODO(scherkus): replace this with something simpler http://crbug.com/116873 27 // TODO(scherkus): replace this with something simpler http://crbug.com/116873
28 class MEDIA_EXPORT MessageLoopFactory { 28 class MEDIA_EXPORT MessageLoopFactory {
29 public: 29 public:
30 MessageLoopFactory(); 30 MessageLoopFactory();
31 31
32 // Get the message loop associated with |name|. A new MessageLoop 32 // Get the message loop associated with |name|. A new MessageLoop
33 // is created if the factory doesn't have one associated with |name|. 33 // is created if the factory doesn't have one associated with |name|.
34 // 34 //
35 // |name| must not be an empty string. 35 // |name| must not be an empty string.
36 MessageLoop* GetMessageLoop(const std::string& name); 36 virtual MessageLoop* GetMessageLoop(const std::string& name);
37 37
38 // Get the message loop proxy associated with |name|. A new MessageLoopProxy 38 // Get the message loop proxy associated with |name|. A new MessageLoopProxy
39 // is created if the factory doesn't have one associated with |name|. 39 // is created if the factory doesn't have one associated with |name|.
40 // 40 //
41 // |name| must not be an empty string. 41 // |name| must not be an empty string.
42 scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxy( 42 scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxy(
43 const std::string& name); 43 const std::string& name);
44 44
45 private: 45 protected:
46 // Only allow scoped_ptr<> to delete factory. 46 // Only allow scoped_ptr<> to delete factory.
47 friend class scoped_ptr<MessageLoopFactory>; 47 friend class scoped_ptr<MessageLoopFactory>;
48 ~MessageLoopFactory(); 48 virtual ~MessageLoopFactory();
49 49
50 private:
50 // Returns the thread associated with |name| creating a new thread if needed. 51 // Returns the thread associated with |name| creating a new thread if needed.
51 base::Thread* GetThread(const std::string& name); 52 base::Thread* GetThread(const std::string& name);
52 53
53 // Lock used to serialize access for the following data members. 54 // Lock used to serialize access for the following data members.
54 base::Lock lock_; 55 base::Lock lock_;
55 56
56 typedef std::map<std::string, base::Thread*> ThreadMap; 57 typedef std::map<std::string, base::Thread*> ThreadMap;
57 ThreadMap thread_map_; 58 ThreadMap thread_map_;
58 59
59 DISALLOW_COPY_AND_ASSIGN(MessageLoopFactory); 60 DISALLOW_COPY_AND_ASSIGN(MessageLoopFactory);
60 }; 61 };
61 62
62 } // namespace media 63 } // namespace media
63 64
64 #endif // MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_ 65 #endif // MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/message_loop_factory_for_test.h » ('j') | media/filters/ffmpeg_audio_decoder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698