summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/function_group_base.h
blob: 6b8976eab930d71565fb79b7f285e19d9f7e4645 (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
// 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 PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_
#define PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_

namespace ppapi {

namespace thunk {
class ResourceCreationAPI;
}

class FunctionGroupBase {
 public:
  // Dynamic casting for this object. Returns the pointer to the given type if
  // it's supported.
  virtual thunk::ResourceCreationAPI* AsResourceCreation() { return NULL; }

  template <typename T> T* GetAs() { return NULL; }
};

template<>
inline ppapi::thunk::ResourceCreationAPI* FunctionGroupBase::GetAs() {
  return AsResourceCreation();
}

}  // namespace ppapi

#endif  // PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_