Index: ppapi/host/ppapi_host.h |
diff --git a/ppapi/host/ppapi_host.h b/ppapi/host/ppapi_host.h |
index 748d47a531884c2497b6e985a18a425ff2e9e634..2caf6bca3a2dbe2859e394a4ba89bf87e9ab787a 100644 |
--- a/ppapi/host/ppapi_host.h |
+++ b/ppapi/host/ppapi_host.h |
@@ -6,6 +6,7 @@ |
#define PPAPI_HOST_PPAPI_HOST_H_ |
#include <map> |
+#include <set> |
#include "base/compiler_specific.h" |
#include "base/memory/linked_ptr.h" |
@@ -64,9 +65,18 @@ class PPAPI_HOST_EXPORT PpapiHost : public IPC::Sender, public IPC::Listener { |
// ownership of the pointer. |
void AddInstanceMessageFilter(scoped_ptr<InstanceMessageFilter> filter); |
+ // Returns null if the resource doesn't exist. |
+ host::ResourceHost* GetResourceHost(PP_Resource resource) const; |
+ |
+ // Returns true if the resource is a known Graphics2D resource. |
+ bool IsGraphics2DResource(PP_Resource resource) const; |
+ |
private: |
friend class InstanceMessageFilter; |
+ template <typename Container, typename Element> |
+ static void ReleaseResource(Container container, Element element); |
+ |
// Message handlers. |
void OnHostMsgResourceCall(const proxy::ResourceMessageCallParams& params, |
const IPC::Message& nested_msg); |
@@ -75,9 +85,6 @@ class PPAPI_HOST_EXPORT PpapiHost : public IPC::Sender, public IPC::Listener { |
const IPC::Message& nested_msg); |
void OnHostMsgResourceDestroyed(PP_Resource resource); |
- // Returns null if the resource doesn't exist. |
- host::ResourceHost* GetResourceHost(PP_Resource resource); |
- |
// Non-owning pointer. |
IPC::Sender* sender_; |
@@ -98,6 +105,10 @@ class PPAPI_HOST_EXPORT PpapiHost : public IPC::Sender, public IPC::Listener { |
typedef std::map<PP_Resource, linked_ptr<ResourceHost> > ResourceMap; |
ResourceMap resources_; |
+ // This set is used to identify Graphics2D resource. |
+ typedef std::set<PP_Resource> Graphics2DSet; |
+ Graphics2DSet graphics_2d_set_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PpapiHost); |
}; |