summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/var.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 04:27:47 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 04:27:47 +0000
commit9b6db26fcc22a7a4ec0510a93733b2e190d9e649 (patch)
treefff3f2610cab083b3093ab1052cad6202335ff59 /ppapi/cpp/var.cc
parentb648e91bd6c911ed26d6c65048c4a597040359ed (diff)
downloadchromium_src-9b6db26fcc22a7a4ec0510a93733b2e190d9e649.zip
chromium_src-9b6db26fcc22a7a4ec0510a93733b2e190d9e649.tar.gz
chromium_src-9b6db26fcc22a7a4ec0510a93733b2e190d9e649.tar.bz2
Create a VarPrivate interface to contain the scripting helper functions of Var.
Currently, the old functions are left in Var. When people have a chance to move to this new API, we can delete them from Var. This also adds new enums for ARRAY and DICTIONARY vars, and makes the var C++ wrapper forward-compatible with them by refcounting any enums that it doesn't know about. Review URL: http://codereview.chromium.org/6823016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81068 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/var.cc')
-rw-r--r--ppapi/cpp/var.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/ppapi/cpp/var.cc b/ppapi/cpp/var.cc
index 09a91d8..00ef401 100644
--- a/ppapi/cpp/var.cc
+++ b/ppapi/cpp/var.cc
@@ -35,7 +35,7 @@ template <> const char* interface_name<PPB_Var_Deprecated>() {
// cross-process calls depending on the plugin. This is an optimization so we
// only do refcounting on the necessary objects.
inline bool NeedsRefcounting(const PP_Var& var) {
- return var.type == PP_VARTYPE_STRING || var.type == PP_VARTYPE_OBJECT;
+ return var.type > PP_VARTYPE_DOUBLE;
}
} // namespace
@@ -167,11 +167,8 @@ bool Var::operator==(const Var& other) const {
if (var_.value.as_id == other.var_.value.as_id)
return true;
return AsString() == other.AsString();
- // TODO(neb): Document that this is === and not ==, unlike strings.
- case PP_VARTYPE_OBJECT:
+ default: // Objects, arrays, dictionaries.
return var_.value.as_id == other.var_.value.as_id;
- default:
- return false;
}
}