From 424bf6b47ba02d4000ea75ff1cb1a0bc4f9e118c Mon Sep 17 00:00:00 2001 From: "mgiuca@chromium.org" Date: Thu, 12 Sep 2013 11:11:20 +0000 Subject: [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 --- ppapi/shared_impl/var.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ppapi/shared_impl/var.cc') diff --git a/ppapi/shared_impl/var.cc b/ppapi/shared_impl/var.cc index e311b3c..f173701 100644 --- a/ppapi/shared_impl/var.cc +++ b/ppapi/shared_impl/var.cc @@ -9,8 +9,10 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" #include "ppapi/c/pp_var.h" #include "ppapi/shared_impl/ppapi_globals.h" +#include "ppapi/shared_impl/resource_var.h" #include "ppapi/shared_impl/var_tracker.h" namespace ppapi { @@ -62,6 +64,19 @@ std::string Var::PPVarToLogString(PP_Var var) { return "[Dictionary]"; case PP_VARTYPE_ARRAY_BUFFER: return "[Array buffer]"; + case PP_VARTYPE_RESOURCE: { + ResourceVar* resource(ResourceVar::FromPPVar(var)); + if (!resource) + return "[Invalid resource]"; + + if (resource->pp_resource()) { + return base::StringPrintf("[Resource %d]", resource->pp_resource()); + } else if (resource->creation_message().type() != 0) { + return base::StringPrintf("[Pending resource]"); + } else { + return "[Null resource]"; + } + } default: return "[Invalid var]"; } -- cgit v1.1