summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/resource_object_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/shared_impl/resource_object_base.h')
-rw-r--r--ppapi/shared_impl/resource_object_base.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/ppapi/shared_impl/resource_object_base.h b/ppapi/shared_impl/resource_object_base.h
new file mode 100644
index 0000000..50ba30d
--- /dev/null
+++ b/ppapi/shared_impl/resource_object_base.h
@@ -0,0 +1,38 @@
+// 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_Graphics2D_API;
+class PPB_ImageData_API;
+}
+
+namespace shared_impl {
+
+class ResourceObjectBase {
+ public:
+
+ 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_Graphics2D_API* ResourceObjectBase::GetAs() {
+ return AsGraphics2D_API();
+}
+template<>
+inline thunk::PPB_ImageData_API* ResourceObjectBase::GetAs() {
+ return AsImageData_API();
+}
+
+} // namespace shared_impl
+} // namespace ppapi
+
+#endif // PPAPI_SHARED_IMPL_RESOURCE_OBJECT_BASE_H_