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

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

Issue 11468033: Vanquish the remnants of media::MessageLoopFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 7 years, 11 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
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | media/base/message_loop_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_
6 #define MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_
7
8 #include <list>
9 #include <string>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop_proxy.h"
14 #include "base/synchronization/lock.h"
15 #include "media/base/media_export.h"
16
17 class MessageLoop;
18
19 namespace base {
20 class Thread;
21 }
22
23 namespace media {
24
25 // Factory object that manages named MessageLoops.
26 //
27 // TODO(scherkus): replace this with something simpler http://crbug.com/116873
28 class MEDIA_EXPORT MessageLoopFactory {
29 public:
30 enum Type {
31 kPipeline
32 };
33
34 MessageLoopFactory();
35
36 // Get the message loop proxy associated with |type|. A new MessageLoopProxy
37 // is created if the factory doesn't have one associated with |type|.
38 scoped_refptr<base::MessageLoopProxy> GetMessageLoop(Type type);
39
40 private:
41 // Restrict who can delete the factory to scoped_ptr<>. scoped_ptr<> uses
42 // base::DefaultDeleter.
43 friend struct base::DefaultDeleter<MessageLoopFactory>;
44 ~MessageLoopFactory();
45
46 // Returns the thread associated with |type| creating a new thread if needed.
47 base::Thread* GetThread(Type type);
48
49 // Lock used to serialize access for the following data members.
50 base::Lock lock_;
51
52 // List of pairs of created threads and their types. We use a list to ensure
53 // threads are stopped & deleted in reverse order of creation.
54 typedef std::list<std::pair<Type, base::Thread*> > ThreadList;
55 ThreadList threads_;
56
57 DISALLOW_COPY_AND_ASSIGN(MessageLoopFactory);
58 };
59
60 } // namespace media
61
62 #endif // MEDIA_BASE_MESSAGE_LOOP_FACTORY_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | media/base/message_loop_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698