summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/resource_var.cc
diff options
context:
space:
mode:
authormgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-12 11:11:20 +0000
committermgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-12 11:11:20 +0000
commit424bf6b47ba02d4000ea75ff1cb1a0bc4f9e118c (patch)
treeb0082e3c27d47ac7efb831798ad60d62d7b1177a /ppapi/shared_impl/resource_var.cc
parentcb1e98ad27d7a51a8eff148872767795305453cf (diff)
downloadchromium_src-424bf6b47ba02d4000ea75ff1cb1a0bc4f9e118c.zip
chromium_src-424bf6b47ba02d4000ea75ff1cb1a0bc4f9e118c.tar.gz
chromium_src-424bf6b47ba02d4000ea75ff1cb1a0bc4f9e118c.tar.bz2
[PPAPI] Added PP_VARTYPE_RESOURCE as a PP_VarType enum value.
This type is not yet useful. There is currently no way to generate one of these. If the plugin manually builds one and sends it in a message, it will currently check-fail, crashing the plugin. BUG=177017 Review URL: https://chromiumcodereview.appspot.com/18599005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/resource_var.cc')
-rw-r--r--ppapi/shared_impl/resource_var.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/ppapi/shared_impl/resource_var.cc b/ppapi/shared_impl/resource_var.cc
index 61709119..7936e70 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