| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_ | 5 #ifndef PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_ |
| 6 #define PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_ | 6 #define PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
| 11 #include "ppapi/cpp/dev/var_array_dev.h" | |
| 12 #include "ppapi/cpp/dev/var_dictionary_dev.h" | |
| 13 #include "ppapi/cpp/extensions/optional.h" | 11 #include "ppapi/cpp/extensions/optional.h" |
| 14 #include "ppapi/cpp/logging.h" | 12 #include "ppapi/cpp/logging.h" |
| 15 #include "ppapi/cpp/var.h" | 13 #include "ppapi/cpp/var.h" |
| 14 #include "ppapi/cpp/var_array.h" |
| 16 #include "ppapi/cpp/var_array_buffer.h" | 15 #include "ppapi/cpp/var_array_buffer.h" |
| 16 #include "ppapi/cpp/var_dictionary.h" |
| 17 | 17 |
| 18 namespace pp { | 18 namespace pp { |
| 19 namespace ext { | 19 namespace ext { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| 22 template <class T> | 22 template <class T> |
| 23 class FromVarConverterBase { | 23 class FromVarConverterBase { |
| 24 public: | 24 public: |
| 25 T& value() { return value_; } | 25 T& value() { return value_; } |
| 26 | 26 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 ~FromVarConverter() { | 167 ~FromVarConverter() { |
| 168 } | 168 } |
| 169 | 169 |
| 170 void Set(const PP_Var& var) { | 170 void Set(const PP_Var& var) { |
| 171 FromVarConverterBase<Var>::value_ = Var(var); | 171 FromVarConverterBase<Var>::value_ = Var(var); |
| 172 } | 172 } |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 template <> | 175 template <> |
| 176 class FromVarConverter<VarArray_Dev> | 176 class FromVarConverter<VarArray> |
| 177 : public FromVarConverterBase<VarArray_Dev> { | 177 : public FromVarConverterBase<VarArray> { |
| 178 public: | 178 public: |
| 179 FromVarConverter() { | 179 FromVarConverter() { |
| 180 } | 180 } |
| 181 | 181 |
| 182 explicit FromVarConverter(const PP_Var& var) { | 182 explicit FromVarConverter(const PP_Var& var) { |
| 183 Set(var); | 183 Set(var); |
| 184 } | 184 } |
| 185 | 185 |
| 186 ~FromVarConverter() { | 186 ~FromVarConverter() { |
| 187 } | 187 } |
| 188 | 188 |
| 189 void Set(const PP_Var& var) { | 189 void Set(const PP_Var& var) { |
| 190 FromVarConverterBase<VarArray_Dev>::value_ = Var(var); | 190 FromVarConverterBase<VarArray>::value_ = Var(var); |
| 191 } | 191 } |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 template <> | 194 template <> |
| 195 class FromVarConverter<VarDictionary_Dev> | 195 class FromVarConverter<VarDictionary> |
| 196 : public FromVarConverterBase<VarDictionary_Dev> { | 196 : public FromVarConverterBase<VarDictionary> { |
| 197 public: | 197 public: |
| 198 FromVarConverter() { | 198 FromVarConverter() { |
| 199 } | 199 } |
| 200 | 200 |
| 201 explicit FromVarConverter(const PP_Var& var) { | 201 explicit FromVarConverter(const PP_Var& var) { |
| 202 Set(var); | 202 Set(var); |
| 203 } | 203 } |
| 204 | 204 |
| 205 ~FromVarConverter() { | 205 ~FromVarConverter() { |
| 206 } | 206 } |
| 207 | 207 |
| 208 void Set(const PP_Var& var) { | 208 void Set(const PP_Var& var) { |
| 209 FromVarConverterBase<VarDictionary_Dev>::value_ = Var(var); | 209 FromVarConverterBase<VarDictionary>::value_ = Var(var); |
| 210 } | 210 } |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 template <> | 213 template <> |
| 214 class FromVarConverter<VarArrayBuffer> | 214 class FromVarConverter<VarArrayBuffer> |
| 215 : public FromVarConverterBase<VarArrayBuffer> { | 215 : public FromVarConverterBase<VarArrayBuffer> { |
| 216 public: | 216 public: |
| 217 FromVarConverter() { | 217 FromVarConverter() { |
| 218 } | 218 } |
| 219 | 219 |
| 220 explicit FromVarConverter(const PP_Var& var) { | 220 explicit FromVarConverter(const PP_Var& var) { |
| 221 Set(var); | 221 Set(var); |
| 222 } | 222 } |
| 223 | 223 |
| 224 ~FromVarConverter() { | 224 ~FromVarConverter() { |
| 225 } | 225 } |
| 226 | 226 |
| 227 void Set(const PP_Var& var) { | 227 void Set(const PP_Var& var) { |
| 228 FromVarConverterBase<VarArrayBuffer>::value_ = Var(var); | 228 FromVarConverterBase<VarArrayBuffer>::value_ = Var(var); |
| 229 } | 229 } |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 } // namespace internal | 232 } // namespace internal |
| 233 } // namespace ext | 233 } // namespace ext |
| 234 } // namespace pp | 234 } // namespace pp |
| 235 | 235 |
| 236 #endif // PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_ | 236 #endif // PPAPI_CPP_EXTENSIONS_FROM_VAR_CONVERTOR_H_ |
| OLD | NEW |