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

Unified Diff: ppapi/shared_impl/resource_var.cc

Issue 18599005: [PPAPI] Added PP_VARTYPE_RESOURCE as a PP_VarType enum value. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix unittest_utils comparison of resource vars. Created 7 years, 3 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/shared_impl/resource_var.cc
diff --git a/ppapi/shared_impl/resource_var.cc b/ppapi/shared_impl/resource_var.cc
index 6170911905adaa50874b6d53d25ce6dd834804e4..7936e70636d7d5e2765dc126f3ae8991bfb125d7 100644
--- a/ppapi/shared_impl/resource_var.cc
+++ b/ppapi/shared_impl/resource_var.cc
@@ -4,6 +4,9 @@
#include "ppapi/shared_impl/resource_var.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/var_tracker.h"
+
namespace ppapi {
ResourceVar::ResourceVar() : pp_resource_(0) {}
@@ -21,16 +24,18 @@ ResourceVar* ResourceVar::AsResourceVar() {
}
PP_VarType ResourceVar::GetType() const {
- // TODO(mgiuca): Return PP_VARTYPE_RESOURCE, once that is a valid enum value.
- NOTREACHED();
- return PP_VARTYPE_UNDEFINED;
+ return PP_VARTYPE_RESOURCE;
}
// static
ResourceVar* ResourceVar::FromPPVar(PP_Var var) {
- // TODO(mgiuca): Implement this function, once PP_VARTYPE_RESOURCE is
- // introduced.
- return NULL;
+ if (var.type != PP_VARTYPE_RESOURCE)
+ return NULL;
+ scoped_refptr<Var> var_object(
+ PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
+ if (!var_object.get())
+ return NULL;
+ return var_object->AsResourceVar();
}
} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698