OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_STATE_MATRIX_H_ | 5 #ifndef MEDIA_BASE_STATE_MATRIX_H_ |
6 #define MEDIA_BASE_STATE_MATRIX_H_ | 6 #define MEDIA_BASE_STATE_MATRIX_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "media/base/media_export.h" | |
12 | 11 |
13 namespace media { | 12 namespace media { |
14 | 13 |
15 class MEDIA_EXPORT StateMatrix { | 14 class StateMatrix { |
16 public: | 15 public: |
17 StateMatrix(); | 16 StateMatrix(); |
18 ~StateMatrix(); | 17 ~StateMatrix(); |
19 | 18 |
20 template <typename HandlerType> | 19 template <typename HandlerType> |
21 void AddState(int state, int (HandlerType::* handler)()) { | 20 void AddState(int state, int (HandlerType::* handler)()) { |
22 CHECK(!IsStateDefined(state)); | 21 CHECK(!IsStateDefined(state)); |
23 StateEntryBase* entry = new StateEntry<HandlerType>(handler); | 22 StateEntryBase* entry = new StateEntry<HandlerType>(handler); |
24 states_.insert(std::make_pair(state, entry)); | 23 states_.insert(std::make_pair(state, entry)); |
25 } | 24 } |
(...skipping 27 matching lines...) Expand all Loading... |
53 | 52 |
54 typedef std::map<int, StateEntryBase*> StateMap; | 53 typedef std::map<int, StateEntryBase*> StateMap; |
55 StateMap states_; | 54 StateMap states_; |
56 | 55 |
57 DISALLOW_COPY_AND_ASSIGN(StateMatrix); | 56 DISALLOW_COPY_AND_ASSIGN(StateMatrix); |
58 }; | 57 }; |
59 | 58 |
60 } // namespace media | 59 } // namespace media |
61 | 60 |
62 #endif // MEDIA_BASE_STATE_MATRIX_H_ | 61 #endif // MEDIA_BASE_STATE_MATRIX_H_ |
OLD | NEW |