| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SHARED_IMPL_FUNCTION_GROUP_BASE_H_ | 5 #ifndef PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_ |
| 6 #define PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_ | 6 #define PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_ |
| 7 | 7 |
| 8 namespace ppapi { | 8 namespace ppapi { |
| 9 | 9 |
| 10 namespace thunk { | 10 namespace thunk { |
| 11 class PPB_Font_FunctionAPI; |
| 11 class ResourceCreationAPI; | 12 class ResourceCreationAPI; |
| 12 } | 13 } |
| 13 | 14 |
| 14 class FunctionGroupBase { | 15 class FunctionGroupBase { |
| 15 public: | 16 public: |
| 16 // Dynamic casting for this object. Returns the pointer to the given type if | 17 // Dynamic casting for this object. Returns the pointer to the given type if |
| 17 // it's supported. | 18 // it's supported. |
| 19 virtual thunk::PPB_Font_FunctionAPI* AsFont_FunctionAPI() { return NULL; } |
| 18 virtual thunk::ResourceCreationAPI* AsResourceCreation() { return NULL; } | 20 virtual thunk::ResourceCreationAPI* AsResourceCreation() { return NULL; } |
| 19 | 21 |
| 20 template <typename T> T* GetAs() { return NULL; } | 22 template <typename T> T* GetAs() { return NULL; } |
| 21 }; | 23 }; |
| 22 | 24 |
| 23 template<> | 25 template<> |
| 26 inline thunk::PPB_Font_FunctionAPI* FunctionGroupBase::GetAs() { |
| 27 return AsFont_FunctionAPI(); |
| 28 } |
| 29 template<> |
| 24 inline ppapi::thunk::ResourceCreationAPI* FunctionGroupBase::GetAs() { | 30 inline ppapi::thunk::ResourceCreationAPI* FunctionGroupBase::GetAs() { |
| 25 return AsResourceCreation(); | 31 return AsResourceCreation(); |
| 26 } | 32 } |
| 27 | 33 |
| 28 } // namespace ppapi | 34 } // namespace ppapi |
| 29 | 35 |
| 30 #endif // PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_ | 36 #endif // PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_ |
| OLD | NEW |