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

Unified Diff: webkit/plugins/ppapi/resource_tracker.cc

Issue 6905088: New thunk system for Pepper proxy and implementation (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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: webkit/plugins/ppapi/resource_tracker.cc
===================================================================
--- webkit/plugins/ppapi/resource_tracker.cc (revision 84344)
+++ webkit/plugins/ppapi/resource_tracker.cc (working copy)
@@ -11,9 +11,11 @@
#include "base/rand_util.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/tracker_base.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/resource.h"
+#include "webkit/plugins/ppapi/resource_creation_impl.h"
#include "webkit/plugins/ppapi/var.h"
enum PPIdType {
@@ -40,9 +42,19 @@
return (id & mask) == type;
}
+namespace shared_impl = ::ppapi::shared_impl;
+
namespace webkit {
namespace ppapi {
+namespace {
+
+shared_impl::TrackerBase* GetTrackerBase() {
+ return ResourceTracker::Get();
+}
+
+} // namespace
+
struct ResourceTracker::InstanceData {
InstanceData() : instance(0) {}
@@ -72,6 +84,8 @@
ResourceTracker::ResourceTracker()
: last_resource_id_(0),
last_var_id_(0) {
+ // Wire up the new shared resource tracker base to use our implementation.
+ shared_impl::TrackerBase::Init(&GetTrackerBase);
}
ResourceTracker::~ResourceTracker() {
@@ -226,6 +240,28 @@
found->second.object_vars.size());
}
+shared_impl::ResourceObjectBase* ResourceTracker::GetResourceAPI(
+ PP_Resource res) {
+ DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE))
+ << res << " is not a PP_Resource.";
+ ResourceMap::const_iterator result = live_resources_.find(res);
+ if (result == live_resources_.end())
+ return NULL;
+ return result->second.first.get();
+}
+
+shared_impl::FunctionGroupBase* ResourceTracker::GetFunctionAPI(
+ PP_Instance inst,
+ pp::proxy::InterfaceID id) {
+ if (function_proxies_[id].get())
+ return function_proxies_[id].get();
+
+ if (id == ::pp::proxy::INTERFACE_ID_RESOURCE_CREATION)
+ function_proxies_[id].reset(new ResourceCreationImpl());
+
+ return function_proxies_[id].get();
+}
+
scoped_refptr<Var> ResourceTracker::GetVar(int32 var_id) const {
DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
<< var_id << " is not a PP_Var ID.";
« webkit/plugins/ppapi/ppb_graphics_2d_impl.h ('K') | « webkit/plugins/ppapi/resource_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698