summaryrefslogtreecommitdiffstats
path: root/media/base/message_loop_factory_impl.h
blob: e7576ba668222b2c5d18d23e3211e8e0b6315021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_BASE_MESSAGE_LOOP_FACTORY_IMPL_H_
#define MEDIA_BASE_MESSAGE_LOOP_FACTORY_IMPL_H_

#include <map>
#include <string>

#include "base/threading/thread.h"
#include "media/base/message_loop_factory.h"

namespace media {

class MessageLoopFactoryImpl : public MessageLoopFactory {
 public:
  MessageLoopFactoryImpl();

  // MessageLoopFactory methods.
  virtual MessageLoop* GetMessageLoop(const std::string& name);

 protected:
  virtual ~MessageLoopFactoryImpl();

 private:
  // Lock used to serialize access for the following data members.
  base::Lock lock_;

  typedef std::map<std::string, base::Thread*> ThreadMap;
  ThreadMap thread_map_;

  DISALLOW_COPY_AND_ASSIGN(MessageLoopFactoryImpl);
};

}  // namespace media

#endif  // MEDIA_BASE_MESSAGE_LOOP_FACTORY_IMPL_H_