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

Unified Diff: ppapi/shared_impl/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/var.cc
diff --git a/ppapi/shared_impl/var.cc b/ppapi/shared_impl/var.cc
index e311b3c4bce7a645185d5e381eeaa18e80085fcc..f173701861ad6a10b92c0943575eb2ea742d6c64 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) {
raymes 2013/09/11 22:52:29 This makes me wonder whether maybe we should have
yzshen1 2013/09/11 22:57:11 Or maybe we could have some boolean method such as
Matt Giuca 2013/09/12 07:08:24 Yeah OK. I think I'll add IsPending (it doesn't se
+ return base::StringPrintf("[Pending resource]");
+ } else {
+ return "[Null resource]";
+ }
+ }
default:
return "[Invalid var]";
}

Powered by Google App Engine
This is Rietveld 408576698