blob: 05ed92303c787d04bfc71652facfc7edba726379 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// 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_RESOURCE_OBJECT_BASE_H_
#define PPAPI_SHARED_IMPL_RESOURCE_OBJECT_BASE_H_
namespace ppapi {
namespace thunk {
class PPB_Audio_API;
class PPB_AudioConfig_API;
class PPB_AudioTrusted_API;
class PPB_Font_API;
class PPB_Graphics2D_API;
class PPB_ImageData_API;
}
class ResourceObjectBase {
public:
virtual thunk::PPB_Audio_API* AsAudio_API() { return NULL; }
virtual thunk::PPB_AudioConfig_API* AsAudioConfig_API() { return NULL; }
virtual thunk::PPB_AudioTrusted_API* AsAudioTrusted_API() { return NULL; }
virtual thunk::PPB_Font_API* AsFont_API() { return NULL; }
virtual thunk::PPB_Graphics2D_API* AsGraphics2D_API() { return NULL; }
virtual thunk::PPB_ImageData_API* AsImageData_API() { return NULL; }
template <typename T> T* GetAs() { return NULL; }
};
template<>
inline thunk::PPB_Audio_API* ResourceObjectBase::GetAs() {
return AsAudio_API();
}
template<>
inline thunk::PPB_AudioConfig_API* ResourceObjectBase::GetAs() {
return AsAudioConfig_API();
}
template<>
inline thunk::PPB_AudioTrusted_API* ResourceObjectBase::GetAs() {
return AsAudioTrusted_API();
}
template<>
inline thunk::PPB_Font_API* ResourceObjectBase::GetAs() {
return AsFont_API();
}
template<>
inline thunk::PPB_Graphics2D_API* ResourceObjectBase::GetAs() {
return AsGraphics2D_API();
}
template<>
inline thunk::PPB_ImageData_API* ResourceObjectBase::GetAs() {
return AsImageData_API();
}
} // namespace ppapi
#endif // PPAPI_SHARED_IMPL_RESOURCE_OBJECT_BASE_H_
|