Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: ppapi/host/ppapi_host.h

Issue 11053003: Migrate Graphics2D to new design. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};

Powered by Google App Engine
This is Rietveld 408576698